-
Notifications
You must be signed in to change notification settings - Fork 331
fix(grid): [grid] fix enter board event do not work #2788
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -94,25 +94,25 @@ export function handleEscKeyDown({ event, actived, mouseConfig }) { | |
|
|
||
| export function handleEnterKeyDown({ event, selected, actived }) { | ||
| const { highlightCurrentRow, currentRow, treeConfig } = this | ||
| let isLeftArrow = event.keyCode === 37 | ||
| let isUpArrow = event.keyCode === 38 | ||
| let isRightArrow = event.keyCode === 39 | ||
| const isLeftArrow = event.keyCode === 37 | ||
| const isUpArrow = event.keyCode === 38 | ||
| const isRightArrow = event.keyCode === 39 | ||
| // 如果是激活状态,退则出到下一行 | ||
| if (selected.row || actived.row) { | ||
| this.moveSelected({ | ||
| args: selected.row ? selected.args : actived.args, | ||
| isLeftArrow, | ||
| isUpArrow, | ||
| isRightArrow, | ||
| isDwArrow: true, | ||
| isDownArrow: true, | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fix inconsistent down arrow key handling. While other arrow keys are computed based on the event's keyCode, Consider computing it like other arrow keys: - isDownArrow: true,
+ isDownArrow: event.keyCode === 40,
|
||
| event | ||
| }) | ||
| } else if (treeConfig && highlightCurrentRow && currentRow) { | ||
| // 如果是树形表格当前行回车移动到子节点 | ||
| let childrens = currentRow[treeConfig.children] | ||
| if (childrens && childrens.length) { | ||
| const children = currentRow[treeConfig.children] | ||
| if (children && children.length) { | ||
| event.preventDefault() | ||
| let targetRow = childrens[0] | ||
| const targetRow = children[0] | ||
| this.setTreeExpansion(currentRow, true) | ||
| .then(() => this.scrollToRow(targetRow)) | ||
| .then(() => this.triggerCurrentRowEvent(event, { $table: this, row: targetRow })) | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
修复拼写错误:将
isDwArrow更正为isDownArrow,确保键盘事件的正确处理。