src/js/extensions/table/tableDataHandler.js
function _addMergedCell(base, cellData, startRowIndex, startCellIndex) {
  const {
    colspan,
    rowspan,
    nodeName
  } = cellData;
  const colMerged = colspan > 1;
  const rowMerged = rowspan > 1;

  if (!colMerged && !rowMerged) {
    return;
  }

  const limitRowIndex = startRowIndex + rowspan;
  const limitCellIndex = startCellIndex + colspan;

  util.range(startRowIndex, limitRowIndex).forEach(rowIndex => {
    base[rowIndex] = base[rowIndex] || [];

    util.range(startCellIndex, limitCellIndex).forEach(cellIndex => {
      const mergedData = {
        nodeName
      };

      if (rowIndex === startRowIndex && cellIndex === startCellIndex) {
        return;
      }

      if (colMerged) {
        mergedData.colMergeWith = startCellIndex;
      }

      if (rowMerged) {
        mergedData.rowMergeWith = startRowIndex;
      }

      base[rowIndex][cellIndex] = mergedData;
    });
  });
}
function _addMergedCell(base, cellData, startRowIndex, startCellIndex) {
  const {
    colspan,
    rowspan,
    nodeName
  } = cellData;
  const colMerged = colspan > 1;
  const rowMerged = rowspan > 1;

  if (!colMerged && !rowMerged) {
    return;
  }

  const limitRowIndex = startRowIndex + rowspan;
  const limitCellIndex = startCellIndex + colspan;

  util.range(startRowIndex, limitRowIndex).forEach(rowIndex => {
    base[rowIndex] = base[rowIndex] || [];

    util.range(startCellIndex, limitCellIndex).forEach(cellIndex => {
      const mergedData = {
        nodeName
      };

      if (rowIndex === startRowIndex && cellIndex === startCellIndex) {
        return;
      }

      if (colMerged) {
        mergedData.colMergeWith = startCellIndex;
      }

      if (rowMerged) {
        mergedData.rowMergeWith = startRowIndex;
      }

      base[rowIndex][cellIndex] = mergedData;
    });
  });
}
function _addMergedCell ( base , cellData , startRowIndex , startCellIndex ) { const { colspan , rowspan , nodeName } = cellData ; const colMerged = colspan > 1 ; const rowMerged = rowspan > 1 ; if ( ! colMerged && ! rowMerged ) { return ; } const limitRowIndex = startRowIndex + rowspan ; const limitCellIndex = startCellIndex + colspan ; util . range ( startRowIndex , limitRowIndex ) . forEach ( rowIndex => { base [ rowIndex ] = base [ rowIndex ] || [ ] ; util . range ( startCellIndex , limitCellIndex ) . forEach ( cellIndex => { const mergedData = { nodeName } ; if ( rowIndex === startRowIndex && cellIndex === startCellIndex ) { return ; } if ( colMerged ) { mergedData . colMergeWith = startCellIndex ; } if ( rowMerged ) { mergedData . rowMergeWith = startRowIndex ; } base [ rowIndex ] [ cellIndex ] = mergedData ; } ) ; } ) ; }
Add merged cell.
@param {object} base - base table data
@param {object} cellData - cell data
@param {number} startRowIndex - start row index
@param {number} startCellIndex - start cell index
@private
Add merged cell .