src/js/extensions/table/tableRangeHandler.js
function _expandColMergedRange(tableData, tableRange, rowIndex, colIndex) {
  const rowData = tableData[rowIndex];
  const cellData = rowData[colIndex];
  const {colMergeWith} = cellData;
  let lastColMergedIndex = -1;

  if (util.isExisty(colMergeWith)) {
    if (colMergeWith < tableRange.start.colIndex) {
      tableRange.start.colIndex = colMergeWith;
    }

    lastColMergedIndex = colMergeWith + rowData[colMergeWith].colspan - 1;
  } else if (cellData.colspan > 1) {
    lastColMergedIndex = colIndex + cellData.colspan - 1;
  }

  if (lastColMergedIndex > tableRange.end.colIndex) {
    tableRange.end.colIndex = lastColMergedIndex;
  }
}
function _expandColMergedRange(tableData, tableRange, rowIndex, colIndex) {
  const rowData = tableData[rowIndex];
  const cellData = rowData[colIndex];
  const {colMergeWith} = cellData;
  let lastColMergedIndex = -1;

  if (util.isExisty(colMergeWith)) {
    if (colMergeWith < tableRange.start.colIndex) {
      tableRange.start.colIndex = colMergeWith;
    }

    lastColMergedIndex = colMergeWith + rowData[colMergeWith].colspan - 1;
  } else if (cellData.colspan > 1) {
    lastColMergedIndex = colIndex + cellData.colspan - 1;
  }

  if (lastColMergedIndex > tableRange.end.colIndex) {
    tableRange.end.colIndex = lastColMergedIndex;
  }
}
function _expandColMergedRange ( tableData , tableRange , rowIndex , colIndex ) { const rowData = tableData [ rowIndex ] ; const cellData = rowData [ colIndex ] ; const { colMergeWith } = cellData ; let lastColMergedIndex = - 1 ; if ( util . isExisty ( colMergeWith ) ) { if ( colMergeWith < tableRange . start . colIndex ) { tableRange . start . colIndex = colMergeWith ; } lastColMergedIndex = colMergeWith + rowData [ colMergeWith ] . colspan - 1 ; } else if ( cellData . colspan > 1 ) { lastColMergedIndex = colIndex + cellData . colspan - 1 ; } if ( lastColMergedIndex > tableRange . end . colIndex ) { tableRange . end . colIndex = lastColMergedIndex ; } }
Expand table range by column merge properties like colspan, colMergeWith.
@param {Array.<Array.<object>>} tableData - table data
@param {{
start: {rowIndex: number, colIndex: number},
end: {rowIndex: number, colIndex: number}
}} tableRange - table range
@param {number} rowIndex - row index
@param {number} colIndex - column index
@private
Expand table range by column merge properties like colspan colMergeWith .