function createRowSectionGetter({
  valuesByKey,
  subtotalValues,
  valueFormatters,
  columnColumnIndexes,
  rowColumnIndexes,
  columnIndex,
  rowIndex,
}) {
  const formatValues = values =>
    values === undefined
      ? Array(valueFormatters.length).fill({ value: null })
      : values.map((v, i) => ({ value: valueFormatters[i](v) }));
  const getSubtotals = (breakoutIndexes, values, otherAttrs) =>
    formatValues(
      getIn(
        subtotalValues,
        [breakoutIndexes, values].map(a =>
          JSON.stringify(
            _.sortBy(a, (_value, index) => breakoutIndexes[index]),
          ),
        ),
      ),
    ).map(value => ({ ...value, isSubtotal: true, ...otherAttrs }));

  const getter = (columnIdx, rowIdx) => {
    const columnValues = columnIndex[columnIdx] || [];
    const rowValues = rowIndex[rowIdx] || [];
    const indexValues = columnValues.concat(rowValues);
    if (
      rowValues.length < rowColumnIndexes.length ||
      columnValues.length < columnColumnIndexes.length
    ) {
      // if we don't have a full-length key, we're looking for a subtotal
      const rowIndexes = rowColumnIndexes.slice(0, rowValues.length);
      const columnIndexes = columnColumnIndexes.slice(0, columnValues.length);
      const indexes = columnIndexes.concat(rowIndexes);
      const otherAttrs = rowValues.length === 0 ? { isGrandTotal: true } : {};
      return getSubtotals(indexes, indexValues, otherAttrs);
    }
    const { values, data, dimensions } =
      valuesByKey[JSON.stringify(indexValues)] || {};
    return formatValues(values).map(o =>
      data === undefined ? o : { ...o, clicked: { data, dimensions } },
    );
  };
  return _.memoize(getter, (i1, i2) => [i1, i2].join());
}
// The getter returned from this function returns the value(s) at given (column, row) location
The getter returned from this function returns the value(s) at given (column, row) location
The getter returned from this function returns the value ( s ) at given ( column row ) location
function createRowSectionGetter({
  valuesByKey,
  subtotalValues,
  valueFormatters,
  columnColumnIndexes,
  rowColumnIndexes,
  columnIndex,
  rowIndex,
}) {
  const formatValues = values =>
    values === undefined
      ? Array(valueFormatters.length).fill({ value: null })
      : values.map((v, i) => ({ value: valueFormatters[i](v) }));
  const getSubtotals = (breakoutIndexes, values, otherAttrs) =>
    formatValues(
      getIn(
        subtotalValues,
        [breakoutIndexes, values].map(a =>
          JSON.stringify(
            _.sortBy(a, (_value, index) => breakoutIndexes[index]),
          ),
        ),
      ),
    ).map(value => ({ ...value, isSubtotal: true, ...otherAttrs }));
  const getter = (columnIdx, rowIdx) => {
    const columnValues = columnIndex[columnIdx] || [];
    const rowValues = rowIndex[rowIdx] || [];
    const indexValues = columnValues.concat(rowValues);
    if (
      rowValues.length < rowColumnIndexes.length ||
      columnValues.length < columnColumnIndexes.length
    ) {
      const rowIndexes = rowColumnIndexes.slice(0, rowValues.length);
      const columnIndexes = columnColumnIndexes.slice(0, columnValues.length);
      const indexes = columnIndexes.concat(rowIndexes);
      const otherAttrs = rowValues.length === 0 ? { isGrandTotal: true } : {};
      return getSubtotals(indexes, indexValues, otherAttrs);
    }
    const { values, data, dimensions } =
      valuesByKey[JSON.stringify(indexValues)] || {};
    return formatValues(values).map(o =>
      data === undefined ? o : { ...o, clicked: { data, dimensions } },
    );
  };
  return _.memoize(getter, (i1, i2) => [i1, i2].join());
}
function createRowSectionGetter ( { valuesByKey , subtotalValues , valueFormatters , columnColumnIndexes , rowColumnIndexes , columnIndex , rowIndex , } ) { const formatValues = values => values === undefined ? Array ( valueFormatters . length ) . fill ( { value : null } ) : values . map ( ( v , i ) => ( { value : valueFormatters [ i ] ( v ) } ) ) ; const getSubtotals = ( breakoutIndexes , values , otherAttrs ) => formatValues ( getIn ( subtotalValues , [ breakoutIndexes , values ] . map ( a => JSON . stringify ( _ . sortBy ( a , ( _value , index ) => breakoutIndexes [ index ] ) , ) , ) , ) , ) . map ( value => ( { ... value , isSubtotal : true , ... otherAttrs } ) ) ; const getter = ( columnIdx , rowIdx ) => { const columnValues = columnIndex [ columnIdx ] || [ ] ; const rowValues = rowIndex [ rowIdx ] || [ ] ; const indexValues = columnValues . concat ( rowValues ) ; if ( rowValues . length < rowColumnIndexes . length || columnValues . length < columnColumnIndexes . length ) { const rowIndexes = rowColumnIndexes . slice ( 0 , rowValues . length ) ; const columnIndexes = columnColumnIndexes . slice ( 0 , columnValues . length ) ; const indexes = columnIndexes . concat ( rowIndexes ) ; const otherAttrs = rowValues . length === 0 ? { isGrandTotal : true } : { } ; return getSubtotals ( indexes , indexValues , otherAttrs ) ; } const { values , data , dimensions } = valuesByKey [ JSON . stringify ( indexValues ) ] || { } ; return formatValues ( values ) . map ( o => data === undefined ? o : { ... o , clicked : { data , dimensions } } , ) ; } ; return _ . memoize ( getter , ( i1 , i2 ) => [ i1 , i2 ] . join ( ) ) ; }
The getter returned from this function returns the value(s) at given (column, row) location
The getter returned from this function returns the value ( s ) at given ( column row ) location
// if we don't have a full-length key, we're looking for a subtotal