spreadsheet/ruleJS.all.full.js
function (formula, direction, delta) {
      var type,
          counter;

      // left, right -> col
      if (['left', 'right'].indexOf(direction) !== -1) {
        type = 'col';
      } else if (['up', 'down'].indexOf(direction) !== -1) {
        type = 'row'
      }

      // down, up -> row
      if (['down', 'right'].indexOf(direction) !== -1) {
        counter = delta * 1;
      } else if(['up', 'left'].indexOf(direction) !== -1) {
        counter = delta * (-1);
      }

      if (type && counter) {
        return formula.replace(/(\$?[A-Za-z]+\$?[0-9]+)/g, function (match) {

          var alpha = instance.utils.getCellAlphaNum(match).alpha;

          var fixedCol = alpha[0] === '$' || false,
              fixedRow = alpha[alpha.length - 1] === '$' || false;

          if (type === 'row' && fixedRow) {
            return match;
          }

          if (type === 'col' && fixedCol) {
            return match;
          }

          return (type === 'row' ? instance.utils.changeRowIndex(match, counter) : instance.utils.changeColIndex(match, counter));
        });
      }

      return formula;
    }
function (formula, direction, delta) {
      var type,
          counter;

      // left, right -> col
      if (['left', 'right'].indexOf(direction) !== -1) {
        type = 'col';
      } else if (['up', 'down'].indexOf(direction) !== -1) {
        type = 'row'
      }

      // down, up -> row
      if (['down', 'right'].indexOf(direction) !== -1) {
        counter = delta * 1;
      } else if(['up', 'left'].indexOf(direction) !== -1) {
        counter = delta * (-1);
      }

      if (type && counter) {
        return formula.replace(/(\$?[A-Za-z]+\$?[0-9]+)/g, function (match) {

          var alpha = instance.utils.getCellAlphaNum(match).alpha;

          var fixedCol = alpha[0] === '$' || false,
              fixedRow = alpha[alpha.length - 1] === '$' || false;

          if (type === 'row' && fixedRow) {
            return match;
          }

          if (type === 'col' && fixedCol) {
            return match;
          }

          return (type === 'row' ? instance.utils.changeRowIndex(match, counter) : instance.utils.changeColIndex(match, counter));
        });
      }

      return formula;
    }
function ( formula , direction , delta ) { var type , counter ; // left, right -> col if ( [ 'left' , 'right' ] . indexOf ( direction ) !== - 1 ) { type = 'col' ; } else if ( [ 'up' , 'down' ] . indexOf ( direction ) !== - 1 ) { type = 'row' } // down, up -> row if ( [ 'down' , 'right' ] . indexOf ( direction ) !== - 1 ) { counter = delta * 1 ; } else if ( [ 'up' , 'left' ] . indexOf ( direction ) !== - 1 ) { counter = delta * ( - 1 ) ; } if ( type && counter ) { return formula . replace ( / (\$?[A-Za-z]+\$?[0-9]+) / g , function ( match ) { var alpha = instance . utils . getCellAlphaNum ( match ) . alpha ; var fixedCol = alpha [ 0 ] === '$' || false , fixedRow = alpha [ alpha . length - 1 ] === '$' || false ; if ( type === 'row' && fixedRow ) { return match ; } if ( type === 'col' && fixedCol ) { return match ; } return ( type === 'row' ? instance . utils . changeRowIndex ( match , counter ) : instance . utils . changeColIndex ( match , counter ) ) ; } ) ; } return formula ; }
update formula cells
@param {String} formula
@param {String} direction
@param {Number} delta
@returns {String}
update formula cells