20260712212917
This commit is contained in:
1 parent
4677f6c519
commit
00472688ab
361 files changed
-153949
No files matched your search
@@ -1,40 +0,0 @@
|
||||
export function processGridKeydown(event, $table) {
|
||||
if (!$table) {
|
||||
return;
|
||||
}
|
||||
|
||||
const currentRow = $table.getCurrentRecord();
|
||||
const currentRowIndex = $table.getRowIndex(currentRow);
|
||||
const currentColumn = $table.getCurrentColumn();
|
||||
const { key } = event;
|
||||
|
||||
// 获取表格的所有数据和列配置
|
||||
const fullData = $table.getFullData();
|
||||
const columns = $table.getColumns();
|
||||
const currentColumnIndex = $table.getColumnIndex(currentColumn);
|
||||
|
||||
// ArrowUp - 向上移动一行
|
||||
if (key === "ArrowUp" && currentRowIndex > 0) {
|
||||
const toIndex = currentRowIndex - 1;
|
||||
$table.setEditRow(fullData[toIndex], currentColumn.property);
|
||||
$table.setCurrentRow(fullData[toIndex]);
|
||||
}
|
||||
// ArrowDown - 向下移动一行
|
||||
else if (key === "ArrowDown" && currentRowIndex < fullData.length - 1) {
|
||||
const toIndex = currentRowIndex + 1;
|
||||
$table.setEditRow(fullData[toIndex], currentColumn.property);
|
||||
$table.setCurrentRow(fullData[toIndex]);
|
||||
}
|
||||
// ArrowLeft - 向左移动一列
|
||||
else if (key === "ArrowLeft" && currentColumnIndex > 0) {
|
||||
const toIndex = currentColumnIndex - 1;
|
||||
$table.setEditCell(currentRow, columns[toIndex]);
|
||||
$table.setCurrentColumn(columns[toIndex]);
|
||||
}
|
||||
// ArrowRight - 向右移动一列
|
||||
else if (key === "ArrowRight" && currentColumnIndex < columns.length - 1) {
|
||||
const toIndex = currentColumnIndex + 1;
|
||||
$table.setEditCell(currentRow, columns[toIndex]);
|
||||
$table.setCurrentColumn(columns[toIndex]);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user