Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
xuliangzhan committed Jan 6, 2025
1 parent ff9e020 commit 8883d73
Showing 1 changed file with 17 additions and 12 deletions.
29 changes: 17 additions & 12 deletions packages/table/src/table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2439,25 +2439,28 @@ export default defineComponent({
const { loadMethod } = expandOpts
if (loadMethod) {
const { fullAllDataRowIdData } = internalData
const { rowExpandLazyLoadedMaps } = reactData
const rExpandLazyLoadedMaps = { ...reactData.rowExpandLazyLoadedMaps }
const rowid = getRowid($xeTable, row)
const rowRest = fullAllDataRowIdData[rowid]
rowExpandLazyLoadedMaps[rowid] = row
rExpandLazyLoadedMaps[rowid] = row
reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps
loadMethod({ $table: $xeTable, row, rowIndex: tableMethods.getRowIndex(row), $rowIndex: tableMethods.getVMRowIndex(row) }).then(() => {
const { rowExpandedMaps } = reactData
const rExpandedMaps = { ...reactData.rowExpandedMaps }
if (rowRest) {
rowRest.expandLoaded = true
}
rowExpandedMaps[rowid] = row
rExpandedMaps[rowid] = row
reactData.rowExpandedMaps = rExpandedMaps
}).catch(() => {
if (rowRest) {
rowRest.expandLoaded = false
}
}).finally(() => {
const { rowExpandLazyLoadedMaps } = reactData
if (rowExpandLazyLoadedMaps[rowid]) {
delete rowExpandLazyLoadedMaps[rowid]
const rExpandLazyLoadedMaps = { ...reactData.rowExpandLazyLoadedMaps }
if (rExpandLazyLoadedMaps[rowid]) {
delete rExpandLazyLoadedMaps[rowid]
}
reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps
nextTick().then(() => tableMethods.recalculate()).then(() => resolve())
})
} else {
Expand Down Expand Up @@ -4796,16 +4799,17 @@ export default defineComponent({
return rowRest && !!rowRest.expandLoaded
},
clearRowExpandLoaded (row) {
const { rowExpandLazyLoadedMaps } = reactData
const rExpandLazyLoadedMaps = { ...reactData.rowExpandLazyLoadedMaps }
const { fullAllDataRowIdData } = internalData
const expandOpts = computeExpandOpts.value
const { lazy } = expandOpts
const rowid = getRowid($xeTable, row)
const rowRest = fullAllDataRowIdData[rowid]
if (lazy && rowRest) {
rowRest.expandLoaded = false
delete rowExpandLazyLoadedMaps[rowid]
delete rExpandLazyLoadedMaps[rowid]
}
reactData.rowExpandLazyLoadedMaps = rExpandLazyLoadedMaps
return nextTick()
},
/**
Expand Down Expand Up @@ -4974,7 +4978,7 @@ export default defineComponent({
return rowRest && !!rowRest.treeLoaded
},
clearTreeExpandLoaded (rows: any) {
const { treeExpandedMaps } = reactData
const tExpandedMaps = { ...reactData.treeExpandedMaps }
const { fullAllDataRowIdData } = internalData
const treeOpts = computeTreeOpts.value
const { transform } = treeOpts
Expand All @@ -4987,12 +4991,13 @@ export default defineComponent({
const rowRest = fullAllDataRowIdData[rowid]
if (rowRest) {
rowRest.treeLoaded = false
if (treeExpandedMaps[rowid]) {
delete treeExpandedMaps[rowid]
if (tExpandedMaps[rowid]) {
delete tExpandedMaps[rowid]
}
}
})
}
reactData.treeExpandedMaps = tExpandedMaps
if (transform) {
handleVirtualTreeToList()
return tablePrivateMethods.handleTableData()
Expand Down

0 comments on commit 8883d73

Please sign in to comment.