JSFiddle - React, Tailwind, and code Playground

by Flexmonster Pivot Table

HTML

<link rel="stylesheet" href="https://s3.amazonaws.com/flexmonster/2.3/demo.css">
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.21/lodash.min.js"></script>
<script src="https://cdn.flexmonster.com/flexmonster.js"></script>

<div id="pivotContainer"></div>

CSS

.editable {
  z-index: 3;
}

JavaScript

var pivot = new Flexmonster({
  container: "pivotContainer",
  componentFolder: "https://cdn.flexmonster.com/",
  toolbar: true,
  report: {
    "dataSource": {
      "type": "json",
      "filename": "https://cdn.flexmonster.com/data/data.json"
    },
    "slice": {
      "rows": [{
          "uniqueName": "Category"
        },
        {
          "uniqueName": "Country"
        },
        {
          "uniqueName": "Size"
        }
      ],
      "columns": [{
          "uniqueName": "Business Type"
        },
        {
          "uniqueName": "Destination"
        },
        {
          "uniqueName": "Color"
        },
        {
          "uniqueName": "[Measures]"
        }
      ],
      "measures": [{
          "uniqueName": "Price",
          "aggregation": "sum"
        },
        {
          "uniqueName": "Discount",
          "aggregation": "sum"
        },
        {
          "uniqueName": "Quantity",
          "aggregation": "sum"
        }
      ],
      "expands": {
        "expandAll": true
      },
      "drills": {
        "drillAll": true
      }
    }
  }
});

pivot.customizeCell((cell, data) => {
  if (!_.isEmpty(data) && !data.isTotal && data.type === 'value') {
    const cellnumber = `${data.rowIndex}-${data.columnIndex}`;

    if (_.has(this._cellState, cellnumber)) {
      cell.addClass(this._cellState[cellnumber]);
    }

    cell.addClass('editable');

    cell.text = `<input type='text' value='${data.label}' tabindex='-1' autocomplete='off' onchange='handleChange(event)'>`;
  } else if (data.isTotal && !data.isGrandTotal) {
    cell.addClass('editable');

    cell.text = `<input type='text' value='${data.label}' tabindex='-1' autocomplete='off' onchange='handleChange(event)'>`;
  }
});

function handleChange(event) {
  console.log(`"${event.type}" event dispatched`);
}