@extend-ai/react-xlsx 0.16.3 → 0.16.5

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.
@@ -2866,6 +2866,17 @@ function applyChartOrigins(chartsByWorkbookSheetIndex2, chartOriginsById, archiv
2866
2866
  });
2867
2867
  }
2868
2868
  }
2869
+ function hydrateWorkbookChartStyles(chartsByWorkbookSheetIndex2, imageAssets) {
2870
+ const chartOriginsById = /* @__PURE__ */ new Map();
2871
+ applyChartOrigins(chartsByWorkbookSheetIndex2, chartOriginsById, imageAssets.archive, imageAssets.sheetOrigins);
2872
+ for (const charts of chartsByWorkbookSheetIndex2) {
2873
+ for (const chart of charts) {
2874
+ applyChartStyleFromXml(chart, chart.chartPath, imageAssets.archive, imageAssets.themePalette);
2875
+ applyBuiltinChartDefaults(chart, imageAssets.themePalette);
2876
+ }
2877
+ }
2878
+ return chartOriginsById;
2879
+ }
2869
2880
  function loadWorkbookChartAssets(workbook2, imageAssets, visibleSheetIndexByWorkbookSheetIndex, showHiddenSheets = false) {
2870
2881
  const excludedChartIds = /* @__PURE__ */ new Set();
2871
2882
  const chartsByWorkbookSheetIndex2 = Array.from({ length: workbook2.sheetCount }, (_, workbookSheetIndex) => {
@@ -2966,21 +2977,14 @@ function loadWorkbookChartAssets(workbook2, imageAssets, visibleSheetIndexByWork
2966
2977
  });
2967
2978
  const chartsheets2 = Array.isArray(workbook2.chartsheets) ? workbook2.chartsheets.map((entry, index) => normalizeChartsheet(entry, index)) : [];
2968
2979
  const tabs2 = buildTabs(workbook2, chartsheets2, visibleSheetIndexByWorkbookSheetIndex, showHiddenSheets);
2969
- const chartOriginsById = /* @__PURE__ */ new Map();
2980
+ const chartOriginsById = imageAssets ? hydrateWorkbookChartStyles(chartsByWorkbookSheetIndex2, imageAssets) : /* @__PURE__ */ new Map();
2970
2981
  if (imageAssets) {
2971
- applyChartOrigins(chartsByWorkbookSheetIndex2, chartOriginsById, imageAssets.archive, imageAssets.sheetOrigins);
2972
2982
  for (let index = 0; index < chartsByWorkbookSheetIndex2.length; index += 1) {
2973
2983
  chartsByWorkbookSheetIndex2[index] = (chartsByWorkbookSheetIndex2[index] ?? []).filter((chart) => !excludedChartIds.has(chart.id));
2974
2984
  }
2975
2985
  for (const id of excludedChartIds) {
2976
2986
  chartOriginsById.delete(id);
2977
2987
  }
2978
- for (const charts of chartsByWorkbookSheetIndex2) {
2979
- for (const chart of charts) {
2980
- applyChartStyleFromXml(chart, chart.chartPath, imageAssets.archive, imageAssets.themePalette);
2981
- applyBuiltinChartDefaults(chart, imageAssets.themePalette);
2982
- }
2983
- }
2984
2988
  } else {
2985
2989
  for (let index = 0; index < chartsByWorkbookSheetIndex2.length; index += 1) {
2986
2990
  chartsByWorkbookSheetIndex2[index] = (chartsByWorkbookSheetIndex2[index] ?? []).filter((chart) => !excludedChartIds.has(chart.id));