1
0
mirror of https://github.com/lana-k/sqliteviz.git synced 2025-12-06 10:08:52 +08:00
This commit is contained in:
lana-k
2023-10-28 19:48:36 +02:00
parent ac1f7de62c
commit 07d31dbfe9

View File

@@ -39,7 +39,7 @@
:data-row="rowIndex - 1"
:key="colIndex"
:aria-selected="false"
@click="selectCell($event.target)"
@click="onCellClick"
>
<div class="cell-data" :style="cellStyle">
{{ dataSet.values[col][rowIndex - 1 + currentPageData.start] }}
@@ -135,16 +135,26 @@ export default {
if (!Object.keys(keyCodeMap).includes(e.keyCode.toString())) {
return
}
e.preventDefault()
this.moveFocusInTable(this.selectedCellElement, keyCodeMap[e.keyCode])
},
onCellClick (e) {
this.selectCell(e.target.closest('td'))
},
selectCell (cell) {
if (this.selectedCellElement) {
this.selectedCellElement.ariaSelected = false
if (!cell.ariaSelected || cell.ariaSelected === 'false') {
if (this.selectedCellElement) {
this.selectedCellElement.ariaSelected = 'false'
}
cell.ariaSelected = 'true'
this.selectedCellElement = cell
} else {
cell.ariaSelected = 'false'
this.selectedCellElement = null
}
cell.ariaSelected = true
this.selectedCellElement = cell
this.$emit('updateSelectedCell', cell)
this.$emit('updateSelectedCell', this.selectedCellElement)
},
moveFocusInTable (initialCell, direction) {
const currentRowIndex = +initialCell.dataset.row