handsontable
Version:
Handsontable is a JavaScript Data Grid available for React, Angular and Vue.
26 lines • 846 B
JavaScript
/**
* Calculates the total height of the merged cell.
*
* @param {Core} hotInstance The Handsontable instance.
* @param {*} row The merged cell's row index.
* @param {*} rowspan The merged cell height.
* @returns {number}
*/
export function sumCellsHeights(hotInstance, row, rowspan) {
const {
rowIndexMapper,
stylesHandler
} = hotInstance;
const defaultHeight = stylesHandler.getDefaultRowHeight();
let height = 0;
for (let i = row; i < row + rowspan; i++) {
if (!rowIndexMapper.isHidden(i)) {
var _hotInstance$getRowHe;
height += (_hotInstance$getRowHe = hotInstance.getRowHeight(i)) !== null && _hotInstance$getRowHe !== void 0 ? _hotInstance$getRowHe : defaultHeight;
if (i === 0 && !stylesHandler.isClassicTheme()) {
height += 1; // border-top-width
}
}
}
return height;
}