1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-07 02:28:54 +08:00

#115 unselect on paging

This commit is contained in:
lana-k
2023-10-31 22:27:47 +01:00
parent 6ecbde7fd3
commit 1e982a1196
3 changed files with 35 additions and 7 deletions

View File

@@ -96,10 +96,15 @@ export default {
this.moveFocusInTable(this.selectedCellElement, keyCodeMap[e.keyCode])
},
onCellClick (e) {
this.selectCell(e.target.closest('td'))
this.selectCell(e.target.closest('td'), false)
},
selectCell (cell) {
if (!cell.ariaSelected || cell.ariaSelected === 'false') {
selectCell (cell, scrollTo = true) {
if (!cell) {
if (this.selectedCellElement) {
this.selectedCellElement.ariaSelected = 'false'
}
this.selectedCellElement = cell
} else if (!cell.ariaSelected || cell.ariaSelected === 'false') {
if (this.selectedCellElement) {
this.selectedCellElement.ariaSelected = 'false'
}
@@ -110,6 +115,10 @@ export default {
this.selectedCellElement = null
}
if (this.selectedCellElement && scrollTo) {
this.selectedCellElement.scrollIntoView()
}
this.$emit('updateSelectedCell', this.selectedCellElement)
},
moveFocusInTable (initialCell, direction) {

View File

@@ -185,6 +185,13 @@ export default {
beforeDestroy () {
this.resizeObserver.unobserve(this.$refs.runResultPanel)
},
watch: {
result () {
this.defaultSelectedCell = null
this.selectedCell = null
this.selectedCellValue = ''
}
},
methods: {
handleResize () {
this.calculatePageSize()