UNPKG

handsontable

Version:

Handsontable is a JavaScript Data Grid available for React, Angular and Vue.

29 lines (28 loc) 981 B
export const command = { name: 'extendCellsSelectionToMostBottom', callback(hot) { const { selection, rowIndexMapper } = hot; const { highlight, from, to } = hot.getSelectedRangeActive(); const isFocusHighlightedByHeader = highlight.isHeader() && selection.isSelectedByRowHeader(); if (highlight.isCell() || isFocusHighlightedByHeader) { const row = rowIndexMapper.getNearestNotHiddenIndex(hot.countRows() - 1, -1); const newFrom = from.clone(); newFrom.row = highlight.row; selection.markSource('keyboard'); selection.setRangeStart(newFrom, undefined, false, highlight.clone()); // Restore the row highlight by header flag after setting up a new selection. if (isFocusHighlightedByHeader) { selection.selectedByRowHeader.add(selection.getLayerLevel()); } selection.setRangeEnd(hot._createCellCoords(row, to.col)); selection.markEndSource(); } } };