Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 修复选中项移动边界问题 #1954

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 26 additions & 8 deletions packages/keyboard/src/hook.ts
Original file line number Diff line number Diff line change
Expand Up @@ -334,14 +334,32 @@ const tableKeyboardHook: VxeGlobalHooksHandles.HookOptions = {
const _rowIndex = $xetable.getVTRowIndex(params.row)
const _columnIndex = $xetable.getVTColumnIndex(params.column)
evnt.preventDefault()
if (isUpArrow && _rowIndex > 0) {
// 移动到上一行
params.rowIndex = _rowIndex - 1
params.row = afterFullData[params.rowIndex]
} else if (isDwArrow && _rowIndex < afterFullData.length - 1) {
// 移动到下一行
params.rowIndex = _rowIndex + 1
params.row = afterFullData[params.rowIndex]
if (isUpArrow) {
if (_rowIndex > 0) {
// 移动到上一行
params.rowIndex = _rowIndex - 1
params.row = afterFullData[params.rowIndex]
} else if (_columnIndex > 0) {
// 移动到上一列最后一行
params.rowIndex = afterFullData.length - 1
params.row = afterFullData[params.rowIndex]
params.columnIndex = _columnIndex - 1
params.column = visibleColumn[params.columnIndex]
}
// 第一行第一列,静默
} else if (isDwArrow) {
if (_rowIndex < afterFullData.length - 1) {
// 移动到下一行
params.rowIndex = _rowIndex + 1
params.row = afterFullData[params.rowIndex]
} else if (_columnIndex < visibleColumn.length - 1) {
// 移动到下一列第一行
params.rowIndex = 0
params.row = afterFullData[params.rowIndex]
params.columnIndex = _columnIndex + 1
params.column = visibleColumn[params.columnIndex]
}
// 最后一列最后一行,静默
} else if (isLeftArrow && _columnIndex) {
// 移动到左侧单元格
params.columnIndex = _columnIndex - 1
Expand Down