vxe-table 3.14.5 → 3.15.0-beta.0
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/module/edit/mixin.js +10 -9
- package/es/table/module/export/mixin.js +14 -11
- package/es/table/src/body.js +11 -13
- package/es/table/src/footer.js +3 -16
- package/es/table/src/methods.js +202 -67
- package/es/table/src/table.js +40 -23
- package/es/table/src/util.js +0 -13
- package/es/ui/index.js +2 -2
- package/es/ui/src/log.js +1 -1
- package/lib/index.umd.js +318 -183
- package/lib/index.umd.min.js +1 -1
- package/lib/style.css +1 -1
- package/lib/table/module/edit/mixin.js +9 -9
- package/lib/table/module/edit/mixin.min.js +1 -1
- package/lib/table/module/export/mixin.js +15 -11
- package/lib/table/module/export/mixin.min.js +1 -1
- package/lib/table/src/body.js +14 -15
- package/lib/table/src/body.min.js +1 -1
- package/lib/table/src/footer.js +4 -27
- package/lib/table/src/footer.min.js +1 -1
- package/lib/table/src/methods.js +231 -71
- package/lib/table/src/methods.min.js +1 -1
- package/lib/table/src/table.js +42 -23
- package/lib/table/src/table.min.js +1 -1
- package/lib/table/src/util.js +0 -25
- package/lib/table/src/util.min.js +1 -1
- package/lib/ui/index.js +2 -2
- 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 +2 -2
- package/packages/table/module/edit/mixin.ts +10 -9
- package/packages/table/module/export/mixin.ts +14 -11
- package/packages/table/src/body.ts +11 -13
- package/packages/table/src/footer.ts +3 -17
- package/packages/table/src/methods.ts +218 -78
- package/packages/table/src/table.ts +40 -23
- package/packages/table/src/util.ts +0 -14
- package/packages/ui/index.ts +1 -1
- /package/es/{iconfont.1743479120369.ttf → iconfont.1743578536739.ttf} +0 -0
- /package/es/{iconfont.1743479120369.woff → iconfont.1743578536739.woff} +0 -0
- /package/es/{iconfont.1743479120369.woff2 → iconfont.1743578536739.woff2} +0 -0
- /package/lib/{iconfont.1743479120369.ttf → iconfont.1743578536739.ttf} +0 -0
- /package/lib/{iconfont.1743479120369.woff → iconfont.1743578536739.woff} +0 -0
- /package/lib/{iconfont.1743479120369.woff2 → iconfont.1743578536739.woff2} +0 -0
|
@@ -1321,51 +1321,85 @@ function calculateMergerOffsetIndex (list: any, offsetItem: any, type: any) {
|
|
|
1321
1321
|
}
|
|
1322
1322
|
}
|
|
1323
1323
|
|
|
1324
|
-
function
|
|
1325
|
-
|
|
1324
|
+
function buildMergeData (mergeConfigs: VxeTableDefines.MergeItem[]) {
|
|
1325
|
+
const mergeMaps: Record<string, VxeTableDefines.MergeCacheItem> = {}
|
|
1326
|
+
if (mergeConfigs && mergeConfigs.length) {
|
|
1327
|
+
for (let mIndex = 0; mIndex < mergeConfigs.length; mIndex++) {
|
|
1328
|
+
const { row: _rowIndex, col: _columnIndex, rowspan: mergeRowspan, colspan: mergeColspan } = mergeConfigs[mIndex]
|
|
1329
|
+
for (let i = 0; i < mergeRowspan; i++) {
|
|
1330
|
+
for (let j = 0; j < mergeColspan; j++) {
|
|
1331
|
+
mergeMaps[`${_rowIndex + i}:${_columnIndex + j}`] = !i && !j
|
|
1332
|
+
? {
|
|
1333
|
+
rowspan: mergeRowspan,
|
|
1334
|
+
colspan: mergeColspan
|
|
1335
|
+
}
|
|
1336
|
+
: {
|
|
1337
|
+
rowspan: 0,
|
|
1338
|
+
colspan: 0
|
|
1339
|
+
}
|
|
1340
|
+
}
|
|
1341
|
+
}
|
|
1342
|
+
}
|
|
1343
|
+
}
|
|
1344
|
+
return mergeMaps
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
const handleBodyMerge = ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, merges: VxeTableDefines.MergeOptions | VxeTableDefines.MergeOptions[]) => {
|
|
1326
1348
|
const internalData = $xeTable as unknown as TableInternalData
|
|
1327
1349
|
|
|
1350
|
+
const { fullAllDataRowIdData, fullColumnIdData, visibleColumn, afterFullData, mergeBodyList, mergeBodyMaps } = internalData
|
|
1328
1351
|
if (merges) {
|
|
1329
|
-
|
|
1330
|
-
const { visibleColumn } = internalData
|
|
1352
|
+
const { handleGetRowId } = createHandleGetRowId($xeTable)
|
|
1331
1353
|
if (!XEUtils.isArray(merges)) {
|
|
1332
1354
|
merges = [merges]
|
|
1333
1355
|
}
|
|
1334
|
-
// if (treeConfig && merges.length) {
|
|
1335
|
-
// errLog('vxe.error.noTree', ['merge-cells | merge-footer-items'])
|
|
1336
|
-
// }
|
|
1337
1356
|
merges.forEach((item) => {
|
|
1338
1357
|
let { row, col, rowspan, colspan } = item
|
|
1339
|
-
|
|
1340
|
-
|
|
1358
|
+
let mergeRowIndex = -1
|
|
1359
|
+
let mergeColumnIndex = -1
|
|
1360
|
+
if (XEUtils.isNumber(row)) {
|
|
1361
|
+
mergeRowIndex = row
|
|
1362
|
+
} else {
|
|
1363
|
+
const rowid = row ? handleGetRowId(row) : null
|
|
1364
|
+
const rowRest = rowid ? fullAllDataRowIdData[rowid] : null
|
|
1365
|
+
if (rowRest) {
|
|
1366
|
+
mergeRowIndex = rowRest._index
|
|
1367
|
+
}
|
|
1341
1368
|
}
|
|
1342
1369
|
if (XEUtils.isNumber(col)) {
|
|
1343
|
-
|
|
1370
|
+
mergeColumnIndex = col
|
|
1371
|
+
} else {
|
|
1372
|
+
const colid = col ? col.id : null
|
|
1373
|
+
const colRest = colid ? fullColumnIdData[colid] : null
|
|
1374
|
+
if (colRest) {
|
|
1375
|
+
mergeColumnIndex = colRest._index
|
|
1376
|
+
}
|
|
1344
1377
|
}
|
|
1345
|
-
if (
|
|
1378
|
+
if (mergeRowIndex > -1 && mergeColumnIndex > -1 && (rowspan || colspan)) {
|
|
1346
1379
|
rowspan = XEUtils.toNumber(rowspan) || 1
|
|
1347
1380
|
colspan = XEUtils.toNumber(colspan) || 1
|
|
1348
1381
|
if (rowspan > 1 || colspan > 1) {
|
|
1349
|
-
const
|
|
1350
|
-
const
|
|
1382
|
+
const row = afterFullData[mergeRowIndex]
|
|
1383
|
+
const column = visibleColumn[mergeColumnIndex]
|
|
1384
|
+
let mergeItem = mergeBodyMaps[`${mergeRowIndex}:${mergeColumnIndex}`]
|
|
1351
1385
|
if (mergeItem) {
|
|
1352
1386
|
mergeItem.rowspan = rowspan
|
|
1353
1387
|
mergeItem.colspan = colspan
|
|
1354
1388
|
mergeItem._rowspan = rowspan
|
|
1355
1389
|
mergeItem._colspan = colspan
|
|
1356
1390
|
} else {
|
|
1357
|
-
|
|
1358
|
-
const mergeColIndex = visibleColumn.indexOf(col)
|
|
1359
|
-
mList.push({
|
|
1391
|
+
mergeItem = {
|
|
1360
1392
|
row: mergeRowIndex,
|
|
1361
|
-
col:
|
|
1393
|
+
col: mergeColumnIndex,
|
|
1362
1394
|
rowspan,
|
|
1363
1395
|
colspan,
|
|
1364
1396
|
_row: row,
|
|
1365
|
-
_col:
|
|
1397
|
+
_col: column,
|
|
1366
1398
|
_rowspan: rowspan,
|
|
1367
1399
|
_colspan: colspan
|
|
1368
|
-
}
|
|
1400
|
+
}
|
|
1401
|
+
mergeBodyMaps[`${mergeRowIndex}:${mergeColumnIndex}`] = mergeItem
|
|
1402
|
+
mergeBodyList.push(mergeItem)
|
|
1369
1403
|
}
|
|
1370
1404
|
}
|
|
1371
1405
|
}
|
|
@@ -1373,7 +1407,57 @@ function setMerges ($xeTable: VxeTableConstructor, merges: VxeTableDefines.Merge
|
|
|
1373
1407
|
}
|
|
1374
1408
|
}
|
|
1375
1409
|
|
|
1376
|
-
|
|
1410
|
+
const handleFooterMerge = ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, merges: VxeTableDefines.MergeOptions | VxeTableDefines.MergeOptions[]) => {
|
|
1411
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
1412
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
1413
|
+
|
|
1414
|
+
const { footerTableData } = reactData
|
|
1415
|
+
const { mergeFooterList, mergeFooterMaps } = internalData
|
|
1416
|
+
if (merges) {
|
|
1417
|
+
const { visibleColumn } = internalData
|
|
1418
|
+
if (!XEUtils.isArray(merges)) {
|
|
1419
|
+
merges = [merges]
|
|
1420
|
+
}
|
|
1421
|
+
merges.forEach((item) => {
|
|
1422
|
+
let { row: margeRow, col: margeCol, rowspan, colspan } = item
|
|
1423
|
+
const mergeRowIndex = XEUtils.isNumber(margeRow) ? margeRow : -1
|
|
1424
|
+
let mergeColumnIndex = -1
|
|
1425
|
+
if (XEUtils.isNumber(margeCol)) {
|
|
1426
|
+
mergeColumnIndex = margeCol
|
|
1427
|
+
}
|
|
1428
|
+
if (mergeRowIndex > -1 && mergeColumnIndex > -1 && (rowspan || colspan)) {
|
|
1429
|
+
rowspan = XEUtils.toNumber(rowspan) || 1
|
|
1430
|
+
colspan = XEUtils.toNumber(colspan) || 1
|
|
1431
|
+
if (rowspan > 1 || colspan > 1) {
|
|
1432
|
+
const row = footerTableData[mergeRowIndex]
|
|
1433
|
+
const column = visibleColumn[mergeColumnIndex]
|
|
1434
|
+
let mergeItem = mergeFooterMaps[`${mergeRowIndex}:${mergeColumnIndex}`]
|
|
1435
|
+
if (mergeItem) {
|
|
1436
|
+
mergeItem.rowspan = rowspan
|
|
1437
|
+
mergeItem.colspan = colspan
|
|
1438
|
+
mergeItem._rowspan = rowspan
|
|
1439
|
+
mergeItem._colspan = colspan
|
|
1440
|
+
} else {
|
|
1441
|
+
mergeItem = {
|
|
1442
|
+
row: mergeRowIndex,
|
|
1443
|
+
col: mergeColumnIndex,
|
|
1444
|
+
rowspan,
|
|
1445
|
+
colspan,
|
|
1446
|
+
_row: row,
|
|
1447
|
+
_col: column,
|
|
1448
|
+
_rowspan: rowspan,
|
|
1449
|
+
_colspan: colspan
|
|
1450
|
+
}
|
|
1451
|
+
mergeFooterMaps[`${mergeRowIndex}:${mergeColumnIndex}`] = mergeItem
|
|
1452
|
+
mergeFooterList.push(mergeItem)
|
|
1453
|
+
}
|
|
1454
|
+
}
|
|
1455
|
+
}
|
|
1456
|
+
})
|
|
1457
|
+
}
|
|
1458
|
+
}
|
|
1459
|
+
|
|
1460
|
+
function removeMerges ($xeTable: VxeTableConstructor & VxeTablePrivateMethods, merges: VxeTableDefines.MergeOptions | VxeTableDefines.MergeOptions[], mList: VxeTableDefines.MergeItem[], rowList?: any) {
|
|
1377
1461
|
// const props = $xeTable
|
|
1378
1462
|
const internalData = $xeTable as unknown as TableInternalData
|
|
1379
1463
|
|
|
@@ -2063,8 +2147,8 @@ function loadScrollXData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
2063
2147
|
const reactData = $xeTable as unknown as TableReactData
|
|
2064
2148
|
const internalData = $xeTable as unknown as TableInternalData
|
|
2065
2149
|
|
|
2066
|
-
const {
|
|
2067
|
-
const { scrollXStore } = internalData
|
|
2150
|
+
const { isScrollXBig } = reactData
|
|
2151
|
+
const { mergeBodyList, mergeFooterList, scrollXStore } = internalData
|
|
2068
2152
|
const { preloadSize, startIndex, endIndex, offsetSize } = scrollXStore
|
|
2069
2153
|
const { toVisibleIndex, visibleSize } = handleVirtualXVisible($xeTable)
|
|
2070
2154
|
const offsetItem = {
|
|
@@ -2073,7 +2157,7 @@ function loadScrollXData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
2073
2157
|
}
|
|
2074
2158
|
scrollXStore.visibleStartIndex = toVisibleIndex - 1
|
|
2075
2159
|
scrollXStore.visibleEndIndex = toVisibleIndex + visibleSize + 1
|
|
2076
|
-
calculateMergerOffsetIndex(
|
|
2160
|
+
calculateMergerOffsetIndex(mergeBodyList.concat(mergeFooterList), offsetItem, 'col')
|
|
2077
2161
|
const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem
|
|
2078
2162
|
if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
|
|
2079
2163
|
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
@@ -2287,8 +2371,8 @@ function loadScrollYData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
2287
2371
|
const reactData = $xeTable as unknown as TableReactData
|
|
2288
2372
|
const internalData = $xeTable as unknown as TableInternalData
|
|
2289
2373
|
|
|
2290
|
-
const {
|
|
2291
|
-
const { scrollYStore } = internalData
|
|
2374
|
+
const { isAllOverflow, isScrollYBig } = reactData
|
|
2375
|
+
const { mergeBodyList, scrollYStore } = internalData
|
|
2292
2376
|
const { preloadSize, startIndex, endIndex, offsetSize } = scrollYStore
|
|
2293
2377
|
const autoOffsetYSize = isAllOverflow ? offsetSize : offsetSize + 1
|
|
2294
2378
|
const { toVisibleIndex, visibleSize } = handleVirtualYVisible($xeTable)
|
|
@@ -2298,7 +2382,7 @@ function loadScrollYData ($xeTable: VxeTableConstructor & VxeTablePrivateMethods
|
|
|
2298
2382
|
}
|
|
2299
2383
|
scrollYStore.visibleStartIndex = toVisibleIndex - 1
|
|
2300
2384
|
scrollYStore.visibleEndIndex = toVisibleIndex + visibleSize + 1
|
|
2301
|
-
calculateMergerOffsetIndex(
|
|
2385
|
+
calculateMergerOffsetIndex(mergeBodyList, offsetItem, 'row')
|
|
2302
2386
|
const { startIndex: offsetStartIndex, endIndex: offsetEndIndex } = offsetItem
|
|
2303
2387
|
if (toVisibleIndex <= startIndex || toVisibleIndex >= endIndex - visibleSize - 1) {
|
|
2304
2388
|
if (startIndex !== offsetStartIndex || endIndex !== offsetEndIndex) {
|
|
@@ -2715,7 +2799,7 @@ const Methods = {
|
|
|
2715
2799
|
* 对于某些特殊的场景,比如深层树节点元素发生变动时可能会用到
|
|
2716
2800
|
*/
|
|
2717
2801
|
syncData () {
|
|
2718
|
-
|
|
2802
|
+
errLog('vxe.error.delFunc', ['syncData', 'getData'])
|
|
2719
2803
|
return this.$nextTick().then(() => {
|
|
2720
2804
|
this.tableData = []
|
|
2721
2805
|
return this.$nextTick().then(() => this.loadTableData(this.tableFullData, true))
|
|
@@ -2726,31 +2810,37 @@ const Methods = {
|
|
|
2726
2810
|
* 对于手动更改了排序、筛选...等条件后需要重新处理数据时可能会用到
|
|
2727
2811
|
*/
|
|
2728
2812
|
updateData () {
|
|
2729
|
-
const
|
|
2730
|
-
|
|
2731
|
-
|
|
2813
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
2814
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
2815
|
+
|
|
2816
|
+
const { scrollXLoad, scrollYLoad } = reactData
|
|
2817
|
+
return $xeTable.handleTableData(true).then(() => {
|
|
2818
|
+
$xeTable.updateFooter()
|
|
2732
2819
|
if (scrollXLoad || scrollYLoad) {
|
|
2733
2820
|
if (scrollXLoad) {
|
|
2734
|
-
|
|
2821
|
+
$xeTable.updateScrollXSpace()
|
|
2735
2822
|
}
|
|
2736
2823
|
if (scrollYLoad) {
|
|
2737
|
-
|
|
2824
|
+
$xeTable.updateScrollYSpace()
|
|
2738
2825
|
}
|
|
2739
|
-
return
|
|
2826
|
+
return $xeTable.refreshScroll()
|
|
2740
2827
|
}
|
|
2741
2828
|
}).then(() => {
|
|
2742
|
-
|
|
2743
|
-
return
|
|
2829
|
+
$xeTable.updateCellAreas()
|
|
2830
|
+
return $xeTable.recalculate(true)
|
|
2744
2831
|
}).then(() => {
|
|
2745
2832
|
// 存在滚动行为未结束情况
|
|
2746
|
-
setTimeout(() =>
|
|
2833
|
+
setTimeout(() => $xeTable.recalculate(), 50)
|
|
2747
2834
|
})
|
|
2748
2835
|
},
|
|
2749
2836
|
handleTableData (force: any) {
|
|
2750
|
-
const $xeTable = this
|
|
2837
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
2838
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
2839
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
2751
2840
|
|
|
2752
|
-
const { scrollYLoad
|
|
2753
|
-
|
|
2841
|
+
const { scrollYLoad } = reactData
|
|
2842
|
+
const { scrollYStore, fullDataRowIdData } = internalData
|
|
2843
|
+
let fullList: any[] = internalData.afterFullData
|
|
2754
2844
|
// 是否进行数据处理
|
|
2755
2845
|
if (force) {
|
|
2756
2846
|
// 更新数据,处理筛选和排序
|
|
@@ -2759,14 +2849,17 @@ const Methods = {
|
|
|
2759
2849
|
fullList = handleVirtualTreeToList($xeTable)
|
|
2760
2850
|
}
|
|
2761
2851
|
const tableData = scrollYLoad ? fullList.slice(scrollYStore.startIndex, scrollYStore.endIndex) : fullList.slice(0)
|
|
2852
|
+
const visibleDataRowIdMaps: Record<string, any> = {}
|
|
2762
2853
|
tableData.forEach((row: any, $index: any) => {
|
|
2763
2854
|
const rowid = getRowid(this, row)
|
|
2764
2855
|
const rest = fullDataRowIdData[rowid]
|
|
2765
2856
|
if (rest) {
|
|
2766
2857
|
rest.$index = $index
|
|
2767
2858
|
}
|
|
2859
|
+
visibleDataRowIdMaps[rowid] = row
|
|
2768
2860
|
})
|
|
2769
2861
|
this.tableData = tableData
|
|
2862
|
+
internalData.visibleDataRowIdData = visibleDataRowIdMaps
|
|
2770
2863
|
return this.$nextTick()
|
|
2771
2864
|
},
|
|
2772
2865
|
/**
|
|
@@ -2840,7 +2933,7 @@ const Methods = {
|
|
|
2840
2933
|
internalData.tableFullData = fullData
|
|
2841
2934
|
internalData.tableFullTreeData = treeData
|
|
2842
2935
|
// 缓存数据
|
|
2843
|
-
$xeTable.cacheRowMap(
|
|
2936
|
+
$xeTable.cacheRowMap(isReset)
|
|
2844
2937
|
// 原始数据
|
|
2845
2938
|
internalData.tableSynchData = datas
|
|
2846
2939
|
if (isReset) {
|
|
@@ -2858,6 +2951,7 @@ const Methods = {
|
|
|
2858
2951
|
$xeTable.clearMergeFooterItems()
|
|
2859
2952
|
$xeTable.handleTableData(true)
|
|
2860
2953
|
$xeTable.updateFooter()
|
|
2954
|
+
$xeTable.handleUpdateBodyMerge()
|
|
2861
2955
|
return $xeTable.$nextTick().then(() => {
|
|
2862
2956
|
updateHeight($xeTable)
|
|
2863
2957
|
updateStyle($xeTable)
|
|
@@ -3037,7 +3131,7 @@ const Methods = {
|
|
|
3037
3131
|
/**
|
|
3038
3132
|
* 更新数据行的 Map
|
|
3039
3133
|
*/
|
|
3040
|
-
cacheRowMap () {
|
|
3134
|
+
cacheRowMap (isReset: boolean) {
|
|
3041
3135
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
3042
3136
|
const props = $xeTable
|
|
3043
3137
|
const reactData = $xeTable as unknown as TableReactData
|
|
@@ -3049,7 +3143,7 @@ const Methods = {
|
|
|
3049
3143
|
const childrenField = treeOpts.children || treeOpts.childrenField
|
|
3050
3144
|
const hasChildField = treeOpts.hasChild || treeOpts.hasChildField
|
|
3051
3145
|
const { lazy } = treeOpts
|
|
3052
|
-
const fullAllDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = { ...fullAllDataRowIdData } // 存在已删除数据
|
|
3146
|
+
const fullAllDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = isReset ? {} : { ...fullAllDataRowIdData } // 存在已删除数据
|
|
3053
3147
|
const fullDataRowIdMaps: Record<string, VxeTableDefines.RowCacheItem> = {}
|
|
3054
3148
|
|
|
3055
3149
|
const { handleUpdateRowId } = createHandleUpdateRowId($xeTable)
|
|
@@ -5686,6 +5780,27 @@ const Methods = {
|
|
|
5686
5780
|
this.updateCellAreas()
|
|
5687
5781
|
this.recalculate(true)
|
|
5688
5782
|
},
|
|
5783
|
+
/**
|
|
5784
|
+
* 处理合并
|
|
5785
|
+
*/
|
|
5786
|
+
handleUpdateBodyMerge () {
|
|
5787
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
5788
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
5789
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
5790
|
+
|
|
5791
|
+
const { mergeBodyList } = internalData
|
|
5792
|
+
internalData.mergeBodyCellMaps = buildMergeData(mergeBodyList)
|
|
5793
|
+
reactData.mergeBodyFlag++
|
|
5794
|
+
},
|
|
5795
|
+
handleUpdateFooterMerge () {
|
|
5796
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
5797
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
5798
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
5799
|
+
|
|
5800
|
+
const { mergeFooterList } = internalData
|
|
5801
|
+
internalData.mergeFooterCellMaps = buildMergeData(mergeFooterList)
|
|
5802
|
+
reactData.mergeFootFlag++
|
|
5803
|
+
},
|
|
5689
5804
|
handleTargetLeaveEvent () {
|
|
5690
5805
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
5691
5806
|
const internalData = $xeTable as unknown as TableInternalData
|
|
@@ -9272,7 +9387,7 @@ const Methods = {
|
|
|
9272
9387
|
* @param {ColumnInfo} column 列配置
|
|
9273
9388
|
*/
|
|
9274
9389
|
scrollToColumn (fieldOrColumn: any) {
|
|
9275
|
-
const $xeTable = this
|
|
9390
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9276
9391
|
|
|
9277
9392
|
return handleScrollToRowColumn($xeTable, fieldOrColumn)
|
|
9278
9393
|
},
|
|
@@ -9302,8 +9417,8 @@ const Methods = {
|
|
|
9302
9417
|
* 手动清除滚动相关信息,还原到初始状态
|
|
9303
9418
|
*/
|
|
9304
9419
|
clearScroll () {
|
|
9305
|
-
const $xeTable = this
|
|
9306
|
-
const internalData = $xeTable
|
|
9420
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9421
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
9307
9422
|
|
|
9308
9423
|
const { elemStore, scrollXStore, scrollYStore } = internalData
|
|
9309
9424
|
const headerScrollElem = getRefElem(elemStore['main-header-scroll'])
|
|
@@ -9343,17 +9458,22 @@ const Methods = {
|
|
|
9343
9458
|
*/
|
|
9344
9459
|
updateFooter () {
|
|
9345
9460
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9461
|
+
const props = $xeTable
|
|
9462
|
+
const reactData = $xeTable as unknown as TableReactData
|
|
9463
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
9346
9464
|
const $xeGrid = $xeTable.$xeGrid as VxeGridConstructor & GridPrivateMethods
|
|
9347
9465
|
|
|
9348
|
-
const { showFooter,
|
|
9466
|
+
const { showFooter, footerData, footerMethod } = props
|
|
9467
|
+
const { visibleColumn, afterFullData } = internalData
|
|
9349
9468
|
let footData = []
|
|
9350
9469
|
if (showFooter && footerData && footerData.length) {
|
|
9351
9470
|
footData = footerData.slice(0)
|
|
9352
9471
|
} else if (showFooter && footerMethod) {
|
|
9353
|
-
footData = visibleColumn.length ? footerMethod({ columns: visibleColumn, data:
|
|
9472
|
+
footData = visibleColumn.length ? footerMethod({ columns: visibleColumn, data: afterFullData, $table: $xeTable, $grid: $xeGrid }) : []
|
|
9354
9473
|
}
|
|
9355
|
-
|
|
9356
|
-
|
|
9474
|
+
reactData.footerTableData = footData
|
|
9475
|
+
$xeTable.handleUpdateFooterMerge()
|
|
9476
|
+
return $xeTable.$nextTick()
|
|
9357
9477
|
},
|
|
9358
9478
|
/**
|
|
9359
9479
|
* 更新列状态 updateStatus({ row, column }, cellValue)
|
|
@@ -9361,7 +9481,7 @@ const Methods = {
|
|
|
9361
9481
|
* 如果单元格配置了校验规则,则会进行校验
|
|
9362
9482
|
*/
|
|
9363
9483
|
updateStatus (slotParams: any, cellValue: any) {
|
|
9364
|
-
const $xeTable = this
|
|
9484
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9365
9485
|
const props = $xeTable
|
|
9366
9486
|
|
|
9367
9487
|
return this.$nextTick().then(() => {
|
|
@@ -9376,14 +9496,16 @@ const Methods = {
|
|
|
9376
9496
|
* @param {TableMergeConfig[]} merges { row: Row|number, column: ColumnInfo|number, rowspan: number, colspan: number }
|
|
9377
9497
|
*/
|
|
9378
9498
|
setMergeCells (merges: any) {
|
|
9379
|
-
const $xeTable = this
|
|
9499
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9500
|
+
const props = $xeTable
|
|
9380
9501
|
|
|
9381
|
-
if (
|
|
9502
|
+
if (props.spanMethod) {
|
|
9382
9503
|
errLog('vxe.error.errConflicts', ['merge-cells', 'span-method'])
|
|
9383
9504
|
}
|
|
9384
|
-
|
|
9385
|
-
|
|
9386
|
-
|
|
9505
|
+
handleBodyMerge($xeTable, merges)
|
|
9506
|
+
$xeTable.handleUpdateBodyMerge()
|
|
9507
|
+
return $xeTable.$nextTick().then(() => {
|
|
9508
|
+
$xeTable.updateCellAreas()
|
|
9387
9509
|
return updateStyle($xeTable)
|
|
9388
9510
|
})
|
|
9389
9511
|
},
|
|
@@ -9392,14 +9514,16 @@ const Methods = {
|
|
|
9392
9514
|
* @param {TableMergeConfig[]} merges 多个或数组 [{row:Row|number, col:ColumnInfo|number}]
|
|
9393
9515
|
*/
|
|
9394
9516
|
removeMergeCells (merges: any) {
|
|
9395
|
-
const $xeTable = this
|
|
9517
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9518
|
+
const props = $xeTable
|
|
9519
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
9396
9520
|
|
|
9397
|
-
if (
|
|
9521
|
+
if (props.spanMethod) {
|
|
9398
9522
|
errLog('vxe.error.errConflicts', ['merge-cells', 'span-method'])
|
|
9399
9523
|
}
|
|
9400
|
-
const rest = removeMerges(
|
|
9401
|
-
return
|
|
9402
|
-
|
|
9524
|
+
const rest = removeMerges($xeTable, merges, internalData.mergeBodyList, internalData.afterFullData)
|
|
9525
|
+
return $xeTable.$nextTick().then(() => {
|
|
9526
|
+
$xeTable.updateCellAreas()
|
|
9403
9527
|
updateStyle($xeTable)
|
|
9404
9528
|
return rest
|
|
9405
9529
|
})
|
|
@@ -9408,40 +9532,50 @@ const Methods = {
|
|
|
9408
9532
|
* 获取所有被合并的单元格
|
|
9409
9533
|
*/
|
|
9410
9534
|
getMergeCells () {
|
|
9411
|
-
|
|
9535
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9536
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
9537
|
+
|
|
9538
|
+
return internalData.mergeBodyList.slice(0)
|
|
9412
9539
|
},
|
|
9413
9540
|
/**
|
|
9414
9541
|
* 清除所有单元格合并
|
|
9415
9542
|
*/
|
|
9416
9543
|
clearMergeCells () {
|
|
9417
|
-
const $xeTable = this
|
|
9544
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9545
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
9418
9546
|
|
|
9419
|
-
|
|
9420
|
-
|
|
9547
|
+
internalData.mergeBodyList = []
|
|
9548
|
+
internalData.mergeBodyMaps = {}
|
|
9549
|
+
internalData.mergeBodyCellMaps = {}
|
|
9550
|
+
return $xeTable.$nextTick().then(() => {
|
|
9421
9551
|
return updateStyle($xeTable)
|
|
9422
9552
|
})
|
|
9423
9553
|
},
|
|
9424
9554
|
setMergeFooterItems (merges: any) {
|
|
9425
|
-
const $xeTable = this
|
|
9555
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9556
|
+
const props = $xeTable
|
|
9426
9557
|
|
|
9427
|
-
if (
|
|
9558
|
+
if (props.footerSpanMethod) {
|
|
9428
9559
|
errLog('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method'])
|
|
9429
9560
|
}
|
|
9430
|
-
|
|
9431
|
-
|
|
9432
|
-
|
|
9561
|
+
handleFooterMerge($xeTable, merges)
|
|
9562
|
+
$xeTable.handleUpdateFooterMerge()
|
|
9563
|
+
return $xeTable.$nextTick().then(() => {
|
|
9564
|
+
$xeTable.updateCellAreas()
|
|
9433
9565
|
return updateStyle($xeTable)
|
|
9434
9566
|
})
|
|
9435
9567
|
},
|
|
9436
9568
|
removeMergeFooterItems (merges: any) {
|
|
9437
|
-
const $xeTable = this
|
|
9569
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9570
|
+
const props = $xeTable
|
|
9571
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
9438
9572
|
|
|
9439
|
-
if (
|
|
9573
|
+
if (props.footerSpanMethod) {
|
|
9440
9574
|
errLog('vxe.error.errConflicts', ['merge-footer-items', 'footer-span-method'])
|
|
9441
9575
|
}
|
|
9442
|
-
const rest = removeMerges(
|
|
9443
|
-
return
|
|
9444
|
-
|
|
9576
|
+
const rest = removeMerges($xeTable, merges, internalData.mergeFooterList)
|
|
9577
|
+
return $xeTable.$nextTick().then(() => {
|
|
9578
|
+
$xeTable.updateCellAreas()
|
|
9445
9579
|
updateStyle($xeTable)
|
|
9446
9580
|
return rest
|
|
9447
9581
|
})
|
|
@@ -9450,16 +9584,22 @@ const Methods = {
|
|
|
9450
9584
|
* 获取所有被合并的表尾
|
|
9451
9585
|
*/
|
|
9452
9586
|
getMergeFooterItems () {
|
|
9453
|
-
|
|
9587
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9588
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
9589
|
+
|
|
9590
|
+
return internalData.mergeFooterList.slice(0)
|
|
9454
9591
|
},
|
|
9455
9592
|
/**
|
|
9456
9593
|
* 清除所有表尾合并
|
|
9457
9594
|
*/
|
|
9458
9595
|
clearMergeFooterItems () {
|
|
9459
|
-
const $xeTable = this
|
|
9596
|
+
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
9597
|
+
const internalData = $xeTable as unknown as TableInternalData
|
|
9460
9598
|
|
|
9461
|
-
|
|
9462
|
-
|
|
9599
|
+
internalData.mergeFooterList = []
|
|
9600
|
+
internalData.mergeFooterMaps = {}
|
|
9601
|
+
internalData.mergeFooterCellMaps = {}
|
|
9602
|
+
return $xeTable.$nextTick().then(() => {
|
|
9463
9603
|
return updateStyle($xeTable)
|
|
9464
9604
|
})
|
|
9465
9605
|
},
|
|
@@ -216,20 +216,22 @@ function renderRowExpandedVNs (h: CreateElement, $xeTable: VxeTableConstructor &
|
|
|
216
216
|
const { transform, seqMode } = treeOpts
|
|
217
217
|
const cellStyle: Record<string, string> = {}
|
|
218
218
|
const rowid = handleGetRowId(row)
|
|
219
|
-
const
|
|
219
|
+
const rowRest = fullAllDataRowIdData[rowid]
|
|
220
220
|
let rowLevel = 0
|
|
221
221
|
let seq: string | number = -1
|
|
222
|
-
let _rowIndex =
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
if (
|
|
226
|
-
rowLevel =
|
|
222
|
+
let _rowIndex = -1
|
|
223
|
+
let rowIndex = -1
|
|
224
|
+
let $rowIndex = -1
|
|
225
|
+
if (rowRest) {
|
|
226
|
+
rowLevel = rowRest.level
|
|
227
227
|
if (treeConfig && transform && seqMode === 'increasing') {
|
|
228
|
-
seq =
|
|
228
|
+
seq = rowRest._index + 1
|
|
229
229
|
} else {
|
|
230
|
-
seq =
|
|
230
|
+
seq = rowRest.seq
|
|
231
231
|
}
|
|
232
|
-
|
|
232
|
+
rowIndex = rowRest.index
|
|
233
|
+
$rowIndex = rowRest.$index
|
|
234
|
+
_rowIndex = rowRest._index
|
|
233
235
|
}
|
|
234
236
|
if (expandHeight) {
|
|
235
237
|
cellStyle.height = `${expandHeight}px`
|
|
@@ -479,10 +481,6 @@ export default {
|
|
|
479
481
|
hasFixedColumn: false,
|
|
480
482
|
// 树节点列信息
|
|
481
483
|
treeNodeColumn: null,
|
|
482
|
-
// 合并单元格的对象集
|
|
483
|
-
mergeList: [],
|
|
484
|
-
// 合并表尾数据的对象集
|
|
485
|
-
mergeFooterList: [],
|
|
486
484
|
// 初始化标识
|
|
487
485
|
initStore: {
|
|
488
486
|
filter: false,
|
|
@@ -633,6 +631,10 @@ export default {
|
|
|
633
631
|
treeExpandedFlag: 1,
|
|
634
632
|
updateCheckboxFlag: 1,
|
|
635
633
|
pendingRowFlag: 1,
|
|
634
|
+
insertRowFlag: 1,
|
|
635
|
+
removeRowFlag: 1,
|
|
636
|
+
mergeBodyFlag: 1,
|
|
637
|
+
mergeFootFlag: 1,
|
|
636
638
|
|
|
637
639
|
rowHeightStore: {
|
|
638
640
|
default: 48,
|
|
@@ -1098,20 +1100,22 @@ export default {
|
|
|
1098
1100
|
},
|
|
1099
1101
|
computeTableRowExpandedList () {
|
|
1100
1102
|
const $xeTable = this as VxeTableConstructor & VxeTablePrivateMethods
|
|
1103
|
+
const props = $xeTable
|
|
1101
1104
|
const reactData = $xeTable as unknown as TableReactData
|
|
1102
1105
|
const internalData = $xeTable as unknown as TableInternalData
|
|
1103
1106
|
|
|
1104
|
-
const {
|
|
1105
|
-
const {
|
|
1106
|
-
const {
|
|
1107
|
+
const { treeConfig } = props
|
|
1108
|
+
const { rowExpandedFlag, expandColumn } = reactData
|
|
1109
|
+
const { visibleDataRowIdData, rowExpandedMaps } = internalData
|
|
1110
|
+
const treeOpts = $xeTable.computeTreeOpts
|
|
1111
|
+
const { transform } = treeOpts
|
|
1107
1112
|
const expandList: any[] = []
|
|
1108
1113
|
if (expandColumn && rowExpandedFlag) {
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
})
|
|
1114
|
+
if (treeConfig && !transform) {
|
|
1115
|
+
return XEUtils.values(rowExpandedMaps)
|
|
1116
|
+
}
|
|
1113
1117
|
XEUtils.each(rowExpandedMaps, (row, rowid) => {
|
|
1114
|
-
if (
|
|
1118
|
+
if (visibleDataRowIdData[rowid]) {
|
|
1115
1119
|
expandList.push(row)
|
|
1116
1120
|
}
|
|
1117
1121
|
})
|
|
@@ -1386,14 +1390,27 @@ export default {
|
|
|
1386
1390
|
tableFullColumn: [],
|
|
1387
1391
|
// 渲染所有列
|
|
1388
1392
|
visibleColumn: [],
|
|
1389
|
-
//
|
|
1393
|
+
// 全量数据集(包括当前和已删除)
|
|
1390
1394
|
fullAllDataRowIdData: {},
|
|
1395
|
+
// 数据集(仅当前)
|
|
1396
|
+
fullDataRowIdData: {},
|
|
1397
|
+
// 数据集(仅可视)
|
|
1398
|
+
visibleDataRowIdData: {},
|
|
1391
1399
|
// 渲染中缓存数据
|
|
1392
1400
|
sourceDataRowIdData: {},
|
|
1393
|
-
fullDataRowIdData: {},
|
|
1394
1401
|
fullColumnIdData: {},
|
|
1395
1402
|
fullColumnFieldData: {},
|
|
1396
1403
|
|
|
1404
|
+
// 合并单元格的数据
|
|
1405
|
+
mergeBodyList: [],
|
|
1406
|
+
mergeBodyMaps: {},
|
|
1407
|
+
// 合并表尾的数据
|
|
1408
|
+
mergeFooterList: [],
|
|
1409
|
+
mergeFooterMaps: {},
|
|
1410
|
+
// 已合并单元格数据集合
|
|
1411
|
+
mergeBodyCellMaps: {},
|
|
1412
|
+
// 已合并表尾数据集合
|
|
1413
|
+
mergeFooterCellMaps: {},
|
|
1397
1414
|
// 已展开的行集合
|
|
1398
1415
|
rowExpandedMaps: {},
|
|
1399
1416
|
// 懒加载中的展开行的集合
|
|
@@ -390,20 +390,6 @@ export function calcTreeLine (params: VxeTableDefines.CellRenderBodyParams, prev
|
|
|
390
390
|
return cellHeight * expandSize - (prevRow ? 1 : (12 - getOffsetSize($table)))
|
|
391
391
|
}
|
|
392
392
|
|
|
393
|
-
export function mergeBodyMethod (mergeList: any, _rowIndex: any, _columnIndex: any) {
|
|
394
|
-
for (let mIndex = 0; mIndex < mergeList.length; mIndex++) {
|
|
395
|
-
const { row: mergeRowIndex, col: mergeColIndex, rowspan: mergeRowspan, colspan: mergeColspan } = mergeList[mIndex]
|
|
396
|
-
if (mergeColIndex > -1 && mergeRowIndex > -1 && mergeRowspan && mergeColspan) {
|
|
397
|
-
if (mergeRowIndex === _rowIndex && mergeColIndex === _columnIndex) {
|
|
398
|
-
return { rowspan: mergeRowspan, colspan: mergeColspan }
|
|
399
|
-
}
|
|
400
|
-
if (_rowIndex >= mergeRowIndex && _rowIndex < mergeRowIndex + mergeRowspan && _columnIndex >= mergeColIndex && _columnIndex < mergeColIndex + mergeColspan) {
|
|
401
|
-
return { rowspan: 0, colspan: 0 }
|
|
402
|
-
}
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
}
|
|
406
|
-
|
|
407
393
|
export function getCellValue (row: any, column: any) {
|
|
408
394
|
return XEUtils.get(row, column.field)
|
|
409
395
|
}
|
package/packages/ui/index.ts
CHANGED
|
File without changes
|