mirror of
https://github.com/primefaces/primevue.git
synced 2025-05-09 00:42:36 +00:00
Calendar: Alt + Up Arrow support added
This commit is contained in:
parent
91b362b6a8
commit
f8d27530c8
2 changed files with 29 additions and 19 deletions
|
@ -2031,31 +2031,37 @@ export default {
|
|||
|
||||
case 'ArrowUp': {
|
||||
cellContent.tabIndex = '-1';
|
||||
let prevRow = cell.parentElement.previousElementSibling;
|
||||
|
||||
if (prevRow) {
|
||||
let tableRowIndex = DomHandler.index(cell.parentElement);
|
||||
const tableRows = Array.from(cell.parentElement.parentElement.children);
|
||||
const prevTableRows = tableRows.slice(0, tableRowIndex).reverse();
|
||||
if (event.altKey) {
|
||||
this.overlayVisible = false;
|
||||
this.focused = true;
|
||||
} else {
|
||||
let prevRow = cell.parentElement.previousElementSibling;
|
||||
|
||||
let hasNextFocusableDate = prevTableRows.find((el) => {
|
||||
let focusCell = el.children[cellIndex].children[0];
|
||||
if (prevRow) {
|
||||
let tableRowIndex = DomHandler.index(cell.parentElement);
|
||||
const tableRows = Array.from(cell.parentElement.parentElement.children);
|
||||
const prevTableRows = tableRows.slice(0, tableRowIndex).reverse();
|
||||
|
||||
return !DomHandler.getAttribute(focusCell, 'data-p-disabled');
|
||||
});
|
||||
let hasNextFocusableDate = prevTableRows.find((el) => {
|
||||
let focusCell = el.children[cellIndex].children[0];
|
||||
|
||||
if (hasNextFocusableDate) {
|
||||
let focusCell = hasNextFocusableDate.children[cellIndex].children[0];
|
||||
return !DomHandler.getAttribute(focusCell, 'data-p-disabled');
|
||||
});
|
||||
|
||||
focusCell.tabIndex = '0';
|
||||
focusCell.focus();
|
||||
if (hasNextFocusableDate) {
|
||||
let focusCell = hasNextFocusableDate.children[cellIndex].children[0];
|
||||
|
||||
focusCell.tabIndex = '0';
|
||||
focusCell.focus();
|
||||
} else {
|
||||
this.navigationState = { backward: true };
|
||||
this.navBackward(event);
|
||||
}
|
||||
} else {
|
||||
this.navigationState = { backward: true };
|
||||
this.navBackward(event);
|
||||
}
|
||||
} else {
|
||||
this.navigationState = { backward: true };
|
||||
this.navBackward(event);
|
||||
}
|
||||
|
||||
event.preventDefault();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue