UNPKG

handsontable

Version:

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

30 lines (29 loc) 905 B
"use strict"; exports.__esModule = true; const command = exports.command = { name: 'extendCellsSelectionUpByViewportHeight', callback(hot) { const { selection, rowIndexMapper } = hot; const { to } = hot.getSelectedRangeLast(); const nextRowIndexToSelect = Math.max(to.row - hot.countVisibleRows(), 0); const row = rowIndexMapper.getNearestNotHiddenIndex(nextRowIndexToSelect, 1); if (row !== null) { const coords = hot._createCellCoords(row, to.col); const scrollPadding = to.row - hot.getFirstFullyVisibleRow(); const nextVerticalScroll = Math.max(coords.row - scrollPadding, 0); selection.markSource('keyboard'); selection.setRangeEnd(coords); selection.markEndSource(); hot.scrollViewportTo({ row: nextVerticalScroll, verticalSnap: 'top', horizontalSnap: 'start' }); } } };