src/js/extensions/table/tableRangeHandler.js
function _expandRowMergedRange(tableData, tableRange, rangeType) {
  const {rowIndex} = tableRange[rangeType];
  const rowData = tableData[rowIndex];

  util.range(tableRange.start.colIndex, tableRange.end.colIndex + 1).forEach(colIndex => {
    const cellData = rowData[colIndex];
    const {rowMergeWith} = cellData;
    let lastRowMergedIndex = -1;

    if (util.isExisty(rowMergeWith)) {
      if (rowMergeWith < tableRange.start.rowIndex) {
        tableRange.start.rowIndex = rowMergeWith;
      }

      lastRowMergedIndex = rowMergeWith + tableData[rowMergeWith][colIndex].rowspan - 1;
    } else if (cellData.rowspan > 1) {
      lastRowMergedIndex = rowIndex + cellData.rowspan - 1;
    }

    if (lastRowMergedIndex > tableRange.end.rowIndex) {
      tableRange.end.rowIndex = lastRowMergedIndex;
    }
  });
}
function _expandRowMergedRange(tableData, tableRange, rangeType) {
  const {rowIndex} = tableRange[rangeType];
  const rowData = tableData[rowIndex];

  util.range(tableRange.start.colIndex, tableRange.end.colIndex + 1).forEach(colIndex => {
    const cellData = rowData[colIndex];
    const {rowMergeWith} = cellData;
    let lastRowMergedIndex = -1;

    if (util.isExisty(rowMergeWith)) {
      if (rowMergeWith < tableRange.start.rowIndex) {
        tableRange.start.rowIndex = rowMergeWith;
      }

      lastRowMergedIndex = rowMergeWith + tableData[rowMergeWith][colIndex].rowspan - 1;
    } else if (cellData.rowspan > 1) {
      lastRowMergedIndex = rowIndex + cellData.rowspan - 1;
    }

    if (lastRowMergedIndex > tableRange.end.rowIndex) {
      tableRange.end.rowIndex = lastRowMergedIndex;
    }
  });
}
function _expandRowMergedRange ( tableData , tableRange , rangeType ) { const { rowIndex } = tableRange [ rangeType ] ; const rowData = tableData [ rowIndex ] ; util . range ( tableRange . start . colIndex , tableRange . end . colIndex + 1 ) . forEach ( colIndex => { const cellData = rowData [ colIndex ] ; const { rowMergeWith } = cellData ; let lastRowMergedIndex = - 1 ; if ( util . isExisty ( rowMergeWith ) ) { if ( rowMergeWith < tableRange . start . rowIndex ) { tableRange . start . rowIndex = rowMergeWith ; } lastRowMergedIndex = rowMergeWith + tableData [ rowMergeWith ] [ colIndex ] . rowspan - 1 ; } else if ( cellData . rowspan > 1 ) { lastRowMergedIndex = rowIndex + cellData . rowspan - 1 ; } if ( lastRowMergedIndex > tableRange . end . rowIndex ) { tableRange . end . rowIndex = lastRowMergedIndex ; } } ) ; }
Expand table range by row merge properties like rowspan, rowMergeWith.
@param {Array.<Array.<object>>} tableData - table data
@param {{
start: {rowIndex: number, colIndex: number},
end: {rowIndex: number, colIndex: number}
}} tableRange - table range
@param {string} rangeType - range type like start, end
@private
Expand table range by row merge properties like rowspan rowMergeWith .