(e: KeyboardEvent)
| 663 | } |
| 664 | |
| 665 | _handleHomeEndSelection(e: KeyboardEvent) { |
| 666 | const isRowFocused = this.currentElement!.localName === "tr"; |
| 667 | |
| 668 | if (!isRowFocused) { |
| 669 | return; |
| 670 | } |
| 671 | const rows = this.rows; |
| 672 | const previouslySelectedRows: Array<ITableRow> = this.selectedRows; |
| 673 | const currentItemIdx = this.currentItemIdx; |
| 674 | |
| 675 | if (isHomeShift(e)) { |
| 676 | rows.slice(0, currentItemIdx + 1).forEach(item => { |
| 677 | item.selected = true; |
| 678 | }); |
| 679 | rows[0].focus(); |
| 680 | } |
| 681 | |
| 682 | if (isEndShift(e)) { |
| 683 | rows.slice(currentItemIdx).forEach(item => { |
| 684 | item.selected = true; |
| 685 | }); |
| 686 | rows[rows.length - 1].focus(); |
| 687 | } |
| 688 | |
| 689 | const selectedRows: Array<ITableRow> = this.selectedRows; |
| 690 | |
| 691 | this.fireDecoratorEvent("selection-change", { |
| 692 | selectedRows, |
| 693 | previouslySelectedRows, |
| 694 | }); |
| 695 | } |
| 696 | |
| 697 | /** |
| 698 | * Handles Alt + Up/Down. |
no test coverage detected