mirror of
https://github.com/lana-k/sqliteviz.git
synced 2025-12-06 18:18:53 +08:00
#115 unselect
This commit is contained in:
@@ -39,7 +39,7 @@
|
|||||||
:data-row="rowIndex - 1"
|
:data-row="rowIndex - 1"
|
||||||
:key="colIndex"
|
:key="colIndex"
|
||||||
:aria-selected="false"
|
:aria-selected="false"
|
||||||
@click="selectCell($event.target)"
|
@click="onCellClick"
|
||||||
>
|
>
|
||||||
<div class="cell-data" :style="cellStyle">
|
<div class="cell-data" :style="cellStyle">
|
||||||
{{ dataSet.values[col][rowIndex - 1 + currentPageData.start] }}
|
{{ dataSet.values[col][rowIndex - 1 + currentPageData.start] }}
|
||||||
@@ -135,16 +135,26 @@ export default {
|
|||||||
if (!Object.keys(keyCodeMap).includes(e.keyCode.toString())) {
|
if (!Object.keys(keyCodeMap).includes(e.keyCode.toString())) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
e.preventDefault()
|
||||||
|
|
||||||
this.moveFocusInTable(this.selectedCellElement, keyCodeMap[e.keyCode])
|
this.moveFocusInTable(this.selectedCellElement, keyCodeMap[e.keyCode])
|
||||||
},
|
},
|
||||||
|
onCellClick (e) {
|
||||||
|
this.selectCell(e.target.closest('td'))
|
||||||
|
},
|
||||||
selectCell (cell) {
|
selectCell (cell) {
|
||||||
|
if (!cell.ariaSelected || cell.ariaSelected === 'false') {
|
||||||
if (this.selectedCellElement) {
|
if (this.selectedCellElement) {
|
||||||
this.selectedCellElement.ariaSelected = false
|
this.selectedCellElement.ariaSelected = 'false'
|
||||||
}
|
}
|
||||||
cell.ariaSelected = true
|
cell.ariaSelected = 'true'
|
||||||
this.selectedCellElement = cell
|
this.selectedCellElement = cell
|
||||||
this.$emit('updateSelectedCell', cell)
|
} else {
|
||||||
|
cell.ariaSelected = 'false'
|
||||||
|
this.selectedCellElement = null
|
||||||
|
}
|
||||||
|
|
||||||
|
this.$emit('updateSelectedCell', this.selectedCellElement)
|
||||||
},
|
},
|
||||||
moveFocusInTable (initialCell, direction) {
|
moveFocusInTable (initialCell, direction) {
|
||||||
const currentRowIndex = +initialCell.dataset.row
|
const currentRowIndex = +initialCell.dataset.row
|
||||||
|
|||||||
Reference in New Issue
Block a user