mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-06 18:18:53 +08:00
#115 unselect on paging
This commit is contained in:
@@ -163,10 +163,15 @@ export default {
|
|||||||
this.moveFocusInTable(this.selectedCellElement, keyCodeMap[e.keyCode])
|
this.moveFocusInTable(this.selectedCellElement, keyCodeMap[e.keyCode])
|
||||||
},
|
},
|
||||||
onCellClick (e) {
|
onCellClick (e) {
|
||||||
this.selectCell(e.target.closest('td'))
|
this.selectCell(e.target.closest('td'), false)
|
||||||
},
|
},
|
||||||
selectCell (cell) {
|
selectCell (cell, scrollTo = true) {
|
||||||
if (!cell.ariaSelected || cell.ariaSelected === 'false') {
|
if (!cell) {
|
||||||
|
if (this.selectedCellElement) {
|
||||||
|
this.selectedCellElement.ariaSelected = 'false'
|
||||||
|
}
|
||||||
|
this.selectedCellElement = cell
|
||||||
|
} else if (!cell.ariaSelected || cell.ariaSelected === 'false') {
|
||||||
if (this.selectedCellElement) {
|
if (this.selectedCellElement) {
|
||||||
this.selectedCellElement.ariaSelected = 'false'
|
this.selectedCellElement.ariaSelected = 'false'
|
||||||
}
|
}
|
||||||
@@ -177,6 +182,10 @@ export default {
|
|||||||
this.selectedCellElement = null
|
this.selectedCellElement = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.selectedCellElement && scrollTo) {
|
||||||
|
this.selectedCellElement.scrollIntoView()
|
||||||
|
}
|
||||||
|
|
||||||
this.$emit('updateSelectedCell', this.selectedCellElement)
|
this.$emit('updateSelectedCell', this.selectedCellElement)
|
||||||
},
|
},
|
||||||
moveFocusInTable (initialCell, direction) {
|
moveFocusInTable (initialCell, direction) {
|
||||||
@@ -219,7 +228,10 @@ export default {
|
|||||||
this.resizeObserver.unobserve(this.$refs.table)
|
this.resizeObserver.unobserve(this.$refs.table)
|
||||||
},
|
},
|
||||||
watch: {
|
watch: {
|
||||||
currentPageData: 'calculateHeadersWidth',
|
currentPageData () {
|
||||||
|
this.calculateHeadersWidth()
|
||||||
|
this.selectCell(null)
|
||||||
|
},
|
||||||
dataSet () {
|
dataSet () {
|
||||||
this.currentPage = 1
|
this.currentPage = 1
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -96,10 +96,15 @@ export default {
|
|||||||
this.moveFocusInTable(this.selectedCellElement, keyCodeMap[e.keyCode])
|
this.moveFocusInTable(this.selectedCellElement, keyCodeMap[e.keyCode])
|
||||||
},
|
},
|
||||||
onCellClick (e) {
|
onCellClick (e) {
|
||||||
this.selectCell(e.target.closest('td'))
|
this.selectCell(e.target.closest('td'), false)
|
||||||
},
|
},
|
||||||
selectCell (cell) {
|
selectCell (cell, scrollTo = true) {
|
||||||
if (!cell.ariaSelected || cell.ariaSelected === 'false') {
|
if (!cell) {
|
||||||
|
if (this.selectedCellElement) {
|
||||||
|
this.selectedCellElement.ariaSelected = 'false'
|
||||||
|
}
|
||||||
|
this.selectedCellElement = cell
|
||||||
|
} else if (!cell.ariaSelected || cell.ariaSelected === 'false') {
|
||||||
if (this.selectedCellElement) {
|
if (this.selectedCellElement) {
|
||||||
this.selectedCellElement.ariaSelected = 'false'
|
this.selectedCellElement.ariaSelected = 'false'
|
||||||
}
|
}
|
||||||
@@ -110,6 +115,10 @@ export default {
|
|||||||
this.selectedCellElement = null
|
this.selectedCellElement = null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.selectedCellElement && scrollTo) {
|
||||||
|
this.selectedCellElement.scrollIntoView()
|
||||||
|
}
|
||||||
|
|
||||||
this.$emit('updateSelectedCell', this.selectedCellElement)
|
this.$emit('updateSelectedCell', this.selectedCellElement)
|
||||||
},
|
},
|
||||||
moveFocusInTable (initialCell, direction) {
|
moveFocusInTable (initialCell, direction) {
|
||||||
|
|||||||
@@ -185,6 +185,13 @@ export default {
|
|||||||
beforeDestroy () {
|
beforeDestroy () {
|
||||||
this.resizeObserver.unobserve(this.$refs.runResultPanel)
|
this.resizeObserver.unobserve(this.$refs.runResultPanel)
|
||||||
},
|
},
|
||||||
|
watch: {
|
||||||
|
result () {
|
||||||
|
this.defaultSelectedCell = null
|
||||||
|
this.selectedCell = null
|
||||||
|
this.selectedCellValue = ''
|
||||||
|
}
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
handleResize () {
|
handleResize () {
|
||||||
this.calculatePageSize()
|
this.calculatePageSize()
|
||||||
|
|||||||
Reference in New Issue
Block a user