@extend-ai/react-xlsx 0.4.0 → 0.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4560,7 +4560,7 @@ function cellAddressToA1(cell) {
4560
4560
  }
4561
4561
  return `${label}${cell.row + 1}`;
4562
4562
  }
4563
- async function loadWorkbook(buffer) {
4563
+ async function loadWorkbook(buffer, skipXmlParsing = false) {
4564
4564
  const wasmModule = await getSheetsWasmModule();
4565
4565
  const bytes = new Uint8Array(buffer);
4566
4566
  const nextWorkbook = wasmModule.Workbook.fromBytes(bytes);
@@ -4572,7 +4572,7 @@ async function loadWorkbook(buffer) {
4572
4572
  nextWorkbook.calculate();
4573
4573
  }
4574
4574
  const shouldUseFastStructureParse = bytes.byteLength >= FAST_STRUCTURE_PARSE_THRESHOLD_BYTES && totalFormulas <= FORMULA_COUNT_THRESHOLD;
4575
- const structureAssets = shouldUseFastStructureParse ? null : parseWorkbookStructureAssets(bytes, {
4575
+ const structureAssets = skipXmlParsing || shouldUseFastStructureParse ? null : parseWorkbookStructureAssets(bytes, {
4576
4576
  includeCachedFormulaValues: true
4577
4577
  });
4578
4578
  workbook = nextWorkbook;
@@ -4591,7 +4591,7 @@ async function loadWorkbook(buffer) {
4591
4591
  const hasModernCharts = Array.isArray(worksheet.chartsEx) && worksheet.chartsEx.length > 0;
4592
4592
  return hasClassicCharts || hasModernCharts;
4593
4593
  }).some(Boolean);
4594
- const chartStyleAssets = hasCharts ? parseWorkbookChartStyleAssets(bytes) : null;
4594
+ const chartStyleAssets = skipXmlParsing || !hasCharts ? null : parseWorkbookChartStyleAssets(bytes);
4595
4595
  const chartAssets = loadWorkbookChartAssets(nextWorkbook, chartStyleAssets, visibleSheetIndexByWorkbookSheetIndex);
4596
4596
  chartsByWorkbookSheetIndex = chartAssets.chartsByWorkbookSheetIndex;
4597
4597
  chartsheets = chartAssets.chartsheets;
@@ -4604,7 +4604,7 @@ async function loadWorkbook(buffer) {
4604
4604
  tabs
4605
4605
  };
4606
4606
  }
4607
- async function parseCharts(buffer) {
4607
+ async function parseCharts(buffer, skipXmlParsing = false) {
4608
4608
  const wasmModule = await getSheetsWasmModule();
4609
4609
  const bytes = new Uint8Array(buffer);
4610
4610
  const nextWorkbook = wasmModule.Workbook.fromBytes(bytes);
@@ -4616,7 +4616,7 @@ async function parseCharts(buffer) {
4616
4616
  nextWorkbook.calculate();
4617
4617
  }
4618
4618
  const visibleSheetIndexByWorkbookSheetIndex = buildVisibleSheetIndexByWorkbookSheetIndex(nextWorkbook);
4619
- const chartStyleAssets = parseWorkbookChartStyleAssets(bytes);
4619
+ const chartStyleAssets = skipXmlParsing ? null : parseWorkbookChartStyleAssets(bytes);
4620
4620
  const chartAssets = loadWorkbookChartAssets(nextWorkbook, chartStyleAssets, visibleSheetIndexByWorkbookSheetIndex);
4621
4621
  return {
4622
4622
  chartsByWorkbookSheetIndex: chartAssets.chartsByWorkbookSheetIndex,
@@ -4630,10 +4630,10 @@ function respond(message) {
4630
4630
  async function handleMessage(message) {
4631
4631
  switch (message.type) {
4632
4632
  case "load": {
4633
- return loadWorkbook(message.payload.buffer);
4633
+ return loadWorkbook(message.payload.buffer, message.payload.skipXmlParsing);
4634
4634
  }
4635
4635
  case "parseCharts": {
4636
- return parseCharts(message.payload.buffer);
4636
+ return parseCharts(message.payload.buffer, message.payload.skipXmlParsing);
4637
4637
  }
4638
4638
  case "getCellSnapshot": {
4639
4639
  if (!workbook) {