MCPcopy Index your code
hub / github.com/UI5/webcomponents / _handleHomeEndSelection

Method _handleHomeEndSelection

packages/compat/src/Table.ts:665–695  ·  view source on GitHub ↗
(e: KeyboardEvent)

Source from the content-addressed store, hash-verified

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.

Callers 1

_onkeydownMethod · 0.95

Calls 3

isHomeShiftFunction · 0.85
isEndShiftFunction · 0.85
focusMethod · 0.45

Tested by

no test coverage detected