@extend-ai/react-xlsx 0.16.6 → 0.17.1

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.
package/dist/index.js CHANGED
@@ -3581,7 +3581,7 @@ function resolveWorkbookColor(color, themePalette) {
3581
3581
  if (directHex) {
3582
3582
  return normalizeHexColor2(directHex);
3583
3583
  }
3584
- const themeValue = color.theme;
3584
+ const themeValue = color.theme ?? color.themeIndex;
3585
3585
  const numericTheme = typeof themeValue === "number" ? themeValue : typeof themeValue === "string" && themeValue.trim().length > 0 ? Number(themeValue) : Number.NaN;
3586
3586
  const themeColor = Number.isFinite(numericTheme) ? themePalette?.colorsByIndex[numericTheme] ?? null : null;
3587
3587
  if (!themeColor) {
@@ -3739,7 +3739,8 @@ function resolveWorksheetMergeMetadata(worksheet) {
3739
3739
  hasHorizontalMerges: false,
3740
3740
  hasVerticalMerges: false,
3741
3741
  maxHorizontalMergeEndCol: -1,
3742
- maxVerticalMergeEndRow: -1
3742
+ maxVerticalMergeEndRow: -1,
3743
+ mergedRanges: []
3743
3744
  };
3744
3745
  const mergedRegions = Array.isArray(worksheet.mergedRegions) ? worksheet.mergedRegions : [];
3745
3746
  for (const rawRegion of mergedRegions) {
@@ -3770,6 +3771,7 @@ function resolveWorksheetMergeMetadata(worksheet) {
3770
3771
  if (!range) {
3771
3772
  continue;
3772
3773
  }
3774
+ mergeMetadata.mergedRanges.push(range);
3773
3775
  if (range.end.col > range.start.col) {
3774
3776
  mergeMetadata.hasHorizontalMerges = true;
3775
3777
  mergeMetadata.maxHorizontalMergeEndCol = Math.max(mergeMetadata.maxHorizontalMergeEndCol, range.end.col);
@@ -4207,6 +4209,12 @@ function parseSpreadsheetFont(node) {
4207
4209
  return void 0;
4208
4210
  }
4209
4211
  const font = {};
4212
+ for (const [tag, property] of [["b", "bold"], ["i", "italic"], ["strike", "strikethrough"]]) {
4213
+ const flag = getFirstChild(node, tag);
4214
+ if (flag) {
4215
+ font[property] = hasEnabledSpreadsheetFlag(flag);
4216
+ }
4217
+ }
4210
4218
  const size = getFirstChild(node, "sz")?.getAttribute("val");
4211
4219
  const name = getFirstChild(node, "name")?.getAttribute("val");
4212
4220
  const family = getFirstChild(node, "family")?.getAttribute("val");
@@ -4214,15 +4222,6 @@ function parseSpreadsheetFont(node) {
4214
4222
  const charset = getFirstChild(node, "charset")?.getAttribute("val");
4215
4223
  const verticalAlign = getFirstChild(node, "vertAlign")?.getAttribute("val");
4216
4224
  const color = parseSpreadsheetColor(getFirstChild(node, "color"));
4217
- if (hasEnabledSpreadsheetFlag(getFirstChild(node, "b"))) {
4218
- font.bold = true;
4219
- }
4220
- if (hasEnabledSpreadsheetFlag(getFirstChild(node, "i"))) {
4221
- font.italic = true;
4222
- }
4223
- if (hasEnabledSpreadsheetFlag(getFirstChild(node, "strike"))) {
4224
- font.strikethrough = true;
4225
- }
4226
4225
  if (getFirstChild(node, "u")) {
4227
4226
  font.underline = getFirstChild(node, "u")?.getAttribute("val") ?? "single";
4228
4227
  }
@@ -4471,7 +4470,14 @@ function parseWorkbookStyles(archive) {
4471
4470
  const styleById = {};
4472
4471
  const tableStyleByName = {};
4473
4472
  getChildElements(cellXfsNode, "xf").forEach((xfNode, index) => {
4474
- styleById[index] = parseResolvedXfStyle(xfNode, fonts, fills, borders, checkboxComplementIndices);
4473
+ const style = parseResolvedXfStyle(xfNode, fonts, fills, borders, checkboxComplementIndices);
4474
+ const overrides = {};
4475
+ for (const component of ["font", "fill", "border"]) {
4476
+ if (Number(xfNode.getAttribute(`${component}Id`) ?? 0) > 0 && xfNode.getAttribute(`apply${component[0].toUpperCase()}${component.slice(1)}`) !== "0") {
4477
+ Object.assign(overrides, { [component]: style[component] });
4478
+ }
4479
+ }
4480
+ styleById[index] = { ...style, tableStyleOverrides: overrides };
4475
4481
  });
4476
4482
  getChildElements(cellStylesNode ?? document2.documentElement, "cellStyle").forEach((cellStyleNode) => {
4477
4483
  const name = cellStyleNode.getAttribute("name");
@@ -4815,6 +4821,7 @@ function parseSheetState(archive, path, options) {
4815
4821
  const rowHeightOverridesPx = {};
4816
4822
  const colWidthOverridesPx = {};
4817
4823
  const rowStyleIds = {};
4824
+ const cellStyleIds = {};
4818
4825
  const colStyleIds = {};
4819
4826
  let minContentCol = Number.POSITIVE_INFINITY;
4820
4827
  let minContentRow = Number.POSITIVE_INFINITY;
@@ -4864,6 +4871,10 @@ function parseSheetState(archive, path, options) {
4864
4871
  }
4865
4872
  getChildElements(rowNode, "c").forEach((cellNode) => {
4866
4873
  const cellRef = cellNode.getAttribute("r");
4874
+ const cellStyleId = Number(cellNode.getAttribute("s") ?? Number.NaN);
4875
+ if (cellRef && Number.isFinite(cellStyleId)) {
4876
+ cellStyleIds[cellRef] = cellStyleId;
4877
+ }
4867
4878
  if (isMeaningfulCellNode(cellNode)) {
4868
4879
  trackContentCell(cellRef);
4869
4880
  }
@@ -4902,6 +4913,7 @@ function parseSheetState(archive, path, options) {
4902
4913
  return {
4903
4914
  autoFilterRanges,
4904
4915
  cachedFormulaValues,
4916
+ cellStyleIds,
4905
4917
  columnWidthCharacterWidthPx,
4906
4918
  colWidthOverridesPx,
4907
4919
  colStyleIds,
@@ -6673,6 +6685,102 @@ function tryRecalculate(workbook) {
6673
6685
  }
6674
6686
  }
6675
6687
 
6688
+ // src/range-reference.ts
6689
+ var XLSX_MAX_ROWS = 1048576;
6690
+ var XLSX_MAX_COLUMNS = 16384;
6691
+ function parseColumn(value) {
6692
+ let column = 0;
6693
+ for (const character of value.toUpperCase()) {
6694
+ column = column * 26 + character.charCodeAt(0) - 64;
6695
+ }
6696
+ return column > 0 && column <= XLSX_MAX_COLUMNS ? column - 1 : null;
6697
+ }
6698
+ function parseRow(value) {
6699
+ const row = Number(value);
6700
+ return row > 0 && row <= XLSX_MAX_ROWS ? row - 1 : null;
6701
+ }
6702
+ function parseCell(value) {
6703
+ const match = /^\$?([a-z]{1,3})\$?([1-9]\d{0,6})$/i.exec(value);
6704
+ if (!match) {
6705
+ return null;
6706
+ }
6707
+ const col = parseColumn(match[1]);
6708
+ const row = parseRow(match[2]);
6709
+ return col === null || row === null ? null : { col, row };
6710
+ }
6711
+ function parseXlsxRange(reference) {
6712
+ if (typeof reference !== "string") {
6713
+ return null;
6714
+ }
6715
+ let address = reference.trim().replace(/^=\s*/, "");
6716
+ let sheetName = null;
6717
+ if (address.startsWith("'")) {
6718
+ const match = /^'((?:[^']|'')+)'!(.+)$/.exec(address);
6719
+ if (!match) {
6720
+ return null;
6721
+ }
6722
+ sheetName = match[1].replace(/''/g, "'");
6723
+ address = match[2];
6724
+ } else if (address.includes("!")) {
6725
+ const match = /^([^\s'!\[\]:*?/\\+,;(){}=<>"&^%\-]+)!(.+)$/.exec(address);
6726
+ if (!match) {
6727
+ return null;
6728
+ }
6729
+ sheetName = match[1];
6730
+ address = match[2];
6731
+ }
6732
+ if (sheetName !== null && (sheetName.length > 31 || /[\[\]:*?/\\\u0000-\u001f]/.test(sheetName) || sheetName.startsWith("'") || sheetName.endsWith("'"))) {
6733
+ return null;
6734
+ }
6735
+ const parts = address.split(":");
6736
+ if (parts.length > 2) {
6737
+ return null;
6738
+ }
6739
+ const start = parseCell(parts[0]);
6740
+ const end = parseCell(parts[1] ?? parts[0]);
6741
+ if (start && end) {
6742
+ return {
6743
+ kind: "cells",
6744
+ range: {
6745
+ start: { col: Math.min(start.col, end.col), row: Math.min(start.row, end.row) },
6746
+ end: { col: Math.max(start.col, end.col), row: Math.max(start.row, end.row) }
6747
+ },
6748
+ sheetName
6749
+ };
6750
+ }
6751
+ const columns = /^\$?([a-z]{1,3}):\$?([a-z]{1,3})$/i.exec(address);
6752
+ if (columns) {
6753
+ const first = parseColumn(columns[1]);
6754
+ const last = parseColumn(columns[2]);
6755
+ if (first !== null && last !== null) {
6756
+ return {
6757
+ kind: "columns",
6758
+ range: {
6759
+ start: { col: Math.min(first, last), row: 0 },
6760
+ end: { col: Math.max(first, last), row: XLSX_MAX_ROWS - 1 }
6761
+ },
6762
+ sheetName
6763
+ };
6764
+ }
6765
+ }
6766
+ const rows = /^\$?([1-9]\d{0,6}):\$?([1-9]\d{0,6})$/.exec(address);
6767
+ if (rows) {
6768
+ const first = parseRow(rows[1]);
6769
+ const last = parseRow(rows[2]);
6770
+ if (first !== null && last !== null) {
6771
+ return {
6772
+ kind: "rows",
6773
+ range: {
6774
+ start: { col: 0, row: Math.min(first, last) },
6775
+ end: { col: XLSX_MAX_COLUMNS - 1, row: Math.max(first, last) }
6776
+ },
6777
+ sheetName
6778
+ };
6779
+ }
6780
+ }
6781
+ return null;
6782
+ }
6783
+
6676
6784
  // src/wasm.ts
6677
6785
  var wasmModulePromise = null;
6678
6786
  var hasConfiguredWasmSource = false;
@@ -7294,6 +7402,7 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
7294
7402
  hasVerticalMerges: mergeMetadata.hasVerticalMerges,
7295
7403
  maxHorizontalMergeEndCol: mergeMetadata.maxHorizontalMergeEndCol,
7296
7404
  maxVerticalMergeEndRow: mergeMetadata.maxVerticalMergeEndRow,
7405
+ mergedRanges: mergeMetadata.mergedRanges,
7297
7406
  hiddenCols: [],
7298
7407
  hiddenRows: [],
7299
7408
  minUsedCol: -1,
@@ -7307,6 +7416,7 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
7307
7416
  colCount: 0,
7308
7417
  rowHeightOverridesPx: sheetState?.rowHeightOverridesPx ?? {},
7309
7418
  rowStyleIds: sheetState?.rowStyleIds ?? {},
7419
+ cellStyleIds: sheetState?.cellStyleIds ?? {},
7310
7420
  styleById: styleById ?? {},
7311
7421
  sparklines: sheetState?.sparklines ?? [],
7312
7422
  tableStyleByName: tableStyleByName ?? {},
@@ -7381,6 +7491,7 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
7381
7491
  hasVerticalMerges: mergeMetadata.hasVerticalMerges,
7382
7492
  maxHorizontalMergeEndCol: mergeMetadata.maxHorizontalMergeEndCol,
7383
7493
  maxVerticalMergeEndRow: mergeMetadata.maxVerticalMergeEndRow,
7494
+ mergedRanges: mergeMetadata.mergedRanges,
7384
7495
  hiddenCols: resolveWorksheetHiddenCols(worksheet, maxCol),
7385
7496
  hiddenRows: resolveWorksheetHiddenRows(worksheet, maxRow),
7386
7497
  minUsedCol: minCol,
@@ -7392,6 +7503,7 @@ function buildSheetList(workbook, sheetStatesByWorkbookSheetIndex, themePalette,
7392
7503
  namedCellStyleByName: namedCellStyleByName ?? {},
7393
7504
  rowHeightOverridesPx: sheetState?.rowHeightOverridesPx ?? {},
7394
7505
  rowStyleIds: sheetState?.rowStyleIds ?? {},
7506
+ cellStyleIds: sheetState?.cellStyleIds ?? {},
7395
7507
  showGridLines: sheetState?.showGridLines ?? true,
7396
7508
  styleById: styleById ?? {},
7397
7509
  sparklines: sheetState?.sparklines ?? [],
@@ -8382,6 +8494,7 @@ function useXlsxViewerController(options) {
8382
8494
  const [zoomScaleOverridesByTabId, setZoomScaleOverridesByTabId] = React.useState({});
8383
8495
  const [activeCell, setActiveCell] = React.useState(null);
8384
8496
  const [selection, setSelection] = React.useState(null);
8497
+ const [highlightedRanges, setHighlightedRanges] = React.useState([]);
8385
8498
  const [selectedChartId, setSelectedChartId] = React.useState(null);
8386
8499
  const [selectedChartElement, setSelectedChartElement] = React.useState(null);
8387
8500
  const [selectedImageId, setSelectedImageId] = React.useState(null);
@@ -8667,6 +8780,7 @@ function useXlsxViewerController(options) {
8667
8780
  setActiveTabIndexState(0);
8668
8781
  setActiveCell(null);
8669
8782
  setSelection(null);
8783
+ setHighlightedRanges([]);
8670
8784
  setSelectedChartId(null);
8671
8785
  setSelectedChartElement(null);
8672
8786
  setSelectedImageId(null);
@@ -8696,6 +8810,7 @@ function useXlsxViewerController(options) {
8696
8810
  setActiveTabIndexState(0);
8697
8811
  setActiveCell(null);
8698
8812
  setSelection(null);
8813
+ setHighlightedRanges([]);
8699
8814
  setSelectedChartId(null);
8700
8815
  setSelectedChartElement(null);
8701
8816
  setSelectedImageId(null);
@@ -8887,6 +9002,41 @@ function useXlsxViewerController(options) {
8887
9002
  return index;
8888
9003
  });
8889
9004
  }, [tabs]);
9005
+ const highlightRanges = React.useCallback((references, options2 = {}) => {
9006
+ const inputs = typeof references === "string" ? [references] : references;
9007
+ if (!Array.isArray(inputs) || isLoading || error) {
9008
+ return false;
9009
+ }
9010
+ const nextHighlights = [];
9011
+ let firstSheetIndex = activeSheetIndex;
9012
+ for (const reference of inputs) {
9013
+ const parsed = parseXlsxRange(reference);
9014
+ if (!parsed) {
9015
+ return false;
9016
+ }
9017
+ const requestedSheetName = parsed.sheetName?.toLowerCase();
9018
+ const sheetIndex = requestedSheetName === void 0 ? options2.sheetIndex ?? activeSheetIndex : sheets.findIndex((sheet2) => sheet2.name.toLowerCase() === requestedSheetName);
9019
+ const sheet = Number.isInteger(sheetIndex) ? sheets[sheetIndex] : void 0;
9020
+ if (!sheet) {
9021
+ return false;
9022
+ }
9023
+ if (nextHighlights.length === 0) {
9024
+ firstSheetIndex = sheetIndex;
9025
+ }
9026
+ nextHighlights.push({
9027
+ ...parsed,
9028
+ autoScroll: nextHighlights.length === 0 && (options2.autoScroll ?? true),
9029
+ sheetName: sheet.name,
9030
+ workbookSheetIndex: sheet.workbookSheetIndex
9031
+ });
9032
+ }
9033
+ setHighlightedRanges(nextHighlights);
9034
+ if (nextHighlights[0]?.autoScroll) {
9035
+ setActiveSheetIndex(firstSheetIndex);
9036
+ }
9037
+ return true;
9038
+ }, [activeSheetIndex, error, isLoading, setActiveSheetIndex, sheets]);
9039
+ const clearHighlightedRanges = React.useCallback(() => setHighlightedRanges([]), []);
8890
9040
  const setZoomScale = React.useCallback((nextZoomScale) => {
8891
9041
  const normalizedZoomScale = clampZoomScale(nextZoomScale);
8892
9042
  setZoomScaleOverridesByTabId((current) => {
@@ -9817,7 +9967,7 @@ function useXlsxViewerController(options) {
9817
9967
  return;
9818
9968
  }
9819
9969
  const dataStartRow = targetTable.start.row + Math.max(targetTable.headerRowCount, 1);
9820
- const totalsRowOffset = targetTable.totalsRowShown ? Math.max(targetTable.totalsRowCount, 1) : 0;
9970
+ const totalsRowOffset = targetTable.totalsRowCount;
9821
9971
  const dataEndRow = targetTable.end.row - totalsRowOffset;
9822
9972
  const startCol = targetTable.start.col;
9823
9973
  const endCol = targetTable.end.col;
@@ -10945,6 +11095,9 @@ function useXlsxViewerController(options) {
10945
11095
  clearSelectedCells,
10946
11096
  clearSelectedImage,
10947
11097
  clearSelection,
11098
+ clearHighlightedRanges,
11099
+ highlightRanges,
11100
+ highlightedRanges,
10948
11101
  continueDeferredLoad,
10949
11102
  copySelectionToClipboard,
10950
11103
  defaultZoomScale,
@@ -11065,6 +11218,9 @@ function useXlsxViewerController(options) {
11065
11218
  clearSelectedCells,
11066
11219
  clearSelectedImage,
11067
11220
  continueDeferredLoad,
11221
+ clearHighlightedRanges,
11222
+ highlightRanges,
11223
+ highlightedRanges,
11068
11224
  copySelectionToClipboard,
11069
11225
  defaultZoomScale,
11070
11226
  deferredLoadFileSize,
@@ -11750,6 +11906,62 @@ function growScrollDisplayLimit(current, growth, maximum, readOnly) {
11750
11906
  return readOnly ? Math.max(current, Math.min(maximum, nextLimit)) : nextLimit;
11751
11907
  }
11752
11908
 
11909
+ // src/range-highlight.ts
11910
+ function expandHighlightedRange(range, mergedRanges) {
11911
+ const expanded = { start: { ...range.start }, end: { ...range.end } };
11912
+ let changed;
11913
+ do {
11914
+ changed = false;
11915
+ for (const merged of mergedRanges) {
11916
+ if (merged.end.row < expanded.start.row || merged.start.row > expanded.end.row || merged.end.col < expanded.start.col || merged.start.col > expanded.end.col) {
11917
+ continue;
11918
+ }
11919
+ const startRow = Math.min(expanded.start.row, merged.start.row);
11920
+ const startCol = Math.min(expanded.start.col, merged.start.col);
11921
+ const endRow = Math.max(expanded.end.row, merged.end.row);
11922
+ const endCol = Math.max(expanded.end.col, merged.end.col);
11923
+ if (startRow !== expanded.start.row || startCol !== expanded.start.col || endRow !== expanded.end.row || endCol !== expanded.end.col) {
11924
+ expanded.start = { row: startRow, col: startCol };
11925
+ expanded.end = { row: endRow, col: endCol };
11926
+ changed = true;
11927
+ }
11928
+ }
11929
+ } while (changed);
11930
+ return expanded;
11931
+ }
11932
+ function lowerBound(indices, value) {
11933
+ let low = 0;
11934
+ let high = indices.length;
11935
+ while (low < high) {
11936
+ const middle = low + high >>> 1;
11937
+ if (indices[middle] < value) {
11938
+ low = middle + 1;
11939
+ } else {
11940
+ high = middle;
11941
+ }
11942
+ }
11943
+ return low;
11944
+ }
11945
+ function getHighlightAxisExtent(indices, prefixSums, start, end) {
11946
+ const first = lowerBound(indices, start);
11947
+ const afterLast = lowerBound(indices, end + 1);
11948
+ if (first >= afterLast) {
11949
+ return null;
11950
+ }
11951
+ return { start: prefixSums[first] ?? 0, end: prefixSums[afterLast] ?? 0 };
11952
+ }
11953
+ function getHighlightScrollOffset(start, end, frozenExtent, viewportExtent, currentOffset) {
11954
+ if (end <= frozenExtent || viewportExtent <= frozenExtent) {
11955
+ return currentOffset;
11956
+ }
11957
+ const scrollableStart = Math.max(start, frozenExtent);
11958
+ const availableExtent = viewportExtent - frozenExtent;
11959
+ if (scrollableStart < currentOffset + frozenExtent || end - scrollableStart > availableExtent) {
11960
+ return Math.max(0, scrollableStart - frozenExtent);
11961
+ }
11962
+ return end > currentOffset + viewportExtent ? end - viewportExtent : currentOffset;
11963
+ }
11964
+
11753
11965
  // src/chart-renderer.tsx
11754
11966
  import { hierarchy as d3Hierarchy, partition as d3Partition, treemap as d3Treemap, treemapBinary, treemapDice } from "d3-hierarchy";
11755
11967
  import { geoIdentity, geoMercator, geoNaturalEarth1, geoPath } from "d3-geo";
@@ -18573,6 +18785,17 @@ function resolveViewerPalette(isDark = false, headerBackgroundColor, headerTextC
18573
18785
 
18574
18786
  // src/XlsxViewer.tsx
18575
18787
  import { Fragment as Fragment4, jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
18788
+ var RANGE_HIGHLIGHT_STYLES = `
18789
+ :where(.react-xlsx-range-highlight) {
18790
+ background: var(--xlsx-highlight-fill, rgb(59 130 246 / 8%));
18791
+ border: var(--xlsx-highlight-border, var(--xlsx-highlight-default-border-width, 1px) solid #3b82f6);
18792
+ border-radius: var(--xlsx-highlight-radius, 2px);
18793
+ }
18794
+ :where(.react-xlsx-range-highlight[data-dark="true"]) {
18795
+ background: var(--xlsx-highlight-fill, rgb(147 197 253 / 12%));
18796
+ border: var(--xlsx-highlight-border, var(--xlsx-highlight-default-border-width, 1px) solid #93c5fd);
18797
+ }
18798
+ `;
18576
18799
  var DEFAULT_ROW_HEIGHT2 = 24;
18577
18800
  var DEFAULT_COL_WIDTH2 = 80;
18578
18801
  var HEADER_HEIGHT = 24;
@@ -18925,7 +19148,8 @@ function applyCanvasBorderDash(context, style, width) {
18925
19148
  context.setLineDash([]);
18926
19149
  }
18927
19150
  function strokeCanvasBorderSide(context, side, rect, border) {
18928
- const halfWidth = border.width / 2;
19151
+ const strokeWidth = border.style === "double" ? border.width / 3 : border.width;
19152
+ const halfWidth = strokeWidth / 2;
18929
19153
  const left = rect.left;
18930
19154
  const right = rect.left + rect.width;
18931
19155
  const top = rect.top;
@@ -18951,8 +19175,8 @@ function strokeCanvasBorderSide(context, side, rect, border) {
18951
19175
  context.stroke();
18952
19176
  };
18953
19177
  if (border.style === "double") {
18954
- const inset = Math.max(1, border.width);
18955
- context.lineWidth = Math.max(1, border.width / 3);
19178
+ const inset = border.width - strokeWidth;
19179
+ context.lineWidth = strokeWidth;
18956
19180
  context.setLineDash([]);
18957
19181
  strokeLine(0);
18958
19182
  strokeLine(inset);
@@ -21865,6 +22089,43 @@ function mergeResolvedCellStyle(base, overlay, options) {
21865
22089
  }
21866
22090
  return nextStyle;
21867
22091
  }
22092
+ function resolveCellTableOverrides(rawStyle, sheet, row, col) {
22093
+ const styleId = sheet?.cellStyleIds?.[cellAddressToA12({ row, col })] ?? sheet?.rowStyleIds[row] ?? sheet?.colStyleIds[col];
22094
+ const declared = styleId === void 0 ? void 0 : sheet?.styleById[styleId]?.tableStyleOverrides;
22095
+ const overrides = {};
22096
+ const font = asRecord(rawStyle?.font);
22097
+ if (font) {
22098
+ const explicitFont = {};
22099
+ const fontDefaults = {
22100
+ name: "Calibri",
22101
+ size: 11,
22102
+ bold: false,
22103
+ italic: false,
22104
+ underline: "none",
22105
+ strikethrough: false,
22106
+ verticalAlign: "baseline"
22107
+ };
22108
+ for (const [key, value] of Object.entries(font)) {
22109
+ const isExplicit = declared ? Object.hasOwn(declared.font ?? {}, key) : key === "color" ? asRecord(value)?.colorType !== "auto" : value !== fontDefaults[key];
22110
+ if (isExplicit) {
22111
+ explicitFont[key] = value;
22112
+ }
22113
+ }
22114
+ overrides.font = explicitFont;
22115
+ }
22116
+ const fill = asRecord(rawStyle?.fill);
22117
+ if (fill && fill.fillType !== "none") {
22118
+ overrides.fill = fill;
22119
+ }
22120
+ const border = asRecord(rawStyle?.border);
22121
+ if (border) {
22122
+ overrides.border = Object.fromEntries(Object.entries(border).filter(([, edge]) => {
22123
+ const style = asRecord(edge)?.style;
22124
+ return typeof style === "string" && style !== "none";
22125
+ }));
22126
+ }
22127
+ return overrides;
22128
+ }
21868
22129
  function resolveBorderEdgePriority(edge) {
21869
22130
  const style = typeof edge?.style === "string" ? edge.style : "none";
21870
22131
  const stylePriority = {
@@ -21993,7 +22254,7 @@ function resolveTableCellStyle(table, row, col, activeSheet) {
21993
22254
  return null;
21994
22255
  }
21995
22256
  const headerRowCount = Math.max(table.headerRowCount, 1);
21996
- const totalsRowCount = table.totalsRowShown ? Math.max(table.totalsRowCount, 1) : 0;
22257
+ const totalsRowCount = table.totalsRowCount;
21997
22258
  const headerEndRow = table.start.row + headerRowCount - 1;
21998
22259
  const totalsStartRow = table.end.row - totalsRowCount + 1;
21999
22260
  const bodyStartRow = headerEndRow + 1;
@@ -24064,6 +24325,7 @@ function XlsxGrid({
24064
24325
  errorState,
24065
24326
  fileTooLargeState,
24066
24327
  getCellStyle,
24328
+ highlightClassName,
24067
24329
  loadingComponent,
24068
24330
  loadingState,
24069
24331
  onFormControlAction,
@@ -24108,6 +24370,7 @@ function XlsxGrid({
24108
24370
  getClipboardData,
24109
24371
  getCellDisplayValue: getControllerCellDisplayValue,
24110
24372
  getFormControlItems,
24373
+ highlightedRanges,
24111
24374
  images,
24112
24375
  shapes,
24113
24376
  isLoadDeferred,
@@ -24154,6 +24417,7 @@ function XlsxGrid({
24154
24417
  ), [formControls, getFormControlItems]);
24155
24418
  const canResizeHeaders = !readOnly || allowResizeInReadOnly;
24156
24419
  const scrollRef = React4.useRef(null);
24420
+ const scrolledHighlightRef = React4.useRef(null);
24157
24421
  const wrapperRef = React4.useRef(null);
24158
24422
  const tableRef = React4.useRef(null);
24159
24423
  const gridKeyboardActiveRef = React4.useRef(false);
@@ -24342,6 +24606,10 @@ function XlsxGrid({
24342
24606
  const resolveMergeAnchorCell = React4.useCallback((cell) => {
24343
24607
  return mergedSecondaryAnchorMap.get(`${cell.row}:${cell.col}`) ?? cell;
24344
24608
  }, [mergedSecondaryAnchorMap]);
24609
+ const highlightedCellRanges = React4.useMemo(
24610
+ () => highlightedRanges.flatMap((highlight, index) => activeSheet?.workbookSheetIndex === highlight.workbookSheetIndex ? [{ highlight, index, range: expandHighlightedRange(highlight.range, activeSheet?.mergedRanges ?? mergedRegions) }] : []),
24611
+ [activeSheet?.mergedRanges, activeSheet?.workbookSheetIndex, highlightedRanges, mergedRegions]
24612
+ );
24345
24613
  const normalizedSelection = React4.useMemo(() => selection ? normalizeRange2(selection) : null, [selection]);
24346
24614
  const zoomFactor = React4.useMemo(() => Math.max(0.1, zoomScale / 100), [zoomScale]);
24347
24615
  const previousZoomFactorRef = React4.useRef(zoomFactor);
@@ -24381,7 +24649,7 @@ function XlsxGrid({
24381
24649
  frozenPaneRight: liveFrozenPaneRight
24382
24650
  } = canvasLayoutMetricsRef.current;
24383
24651
  const currentLiveGestureZoom = liveGestureZoomRef.current;
24384
- const isLiveZooming2 = currentLiveGestureZoom !== null && zoomScale === currentLiveGestureZoom.baseZoomScale;
24652
+ const isLiveZooming2 = experimentalCanvas && currentLiveGestureZoom !== null && zoomScale === currentLiveGestureZoom.baseZoomScale;
24385
24653
  const liveZoomScale2 = isLiveZooming2 ? Math.max(0.1, currentLiveGestureZoom.targetZoomScale / currentLiveGestureZoom.baseZoomScale) : 1;
24386
24654
  const scrollDeltaX = paintedViewport.left - nextLiveViewport.left;
24387
24655
  const scrollDeltaY = paintedViewport.top - nextLiveViewport.top;
@@ -25352,7 +25620,7 @@ function XlsxGrid({
25352
25620
  }, [shouldUseDomVirtualizer, syncDrawingViewport, zoomFactor]);
25353
25621
  React4.useLayoutEffect(() => {
25354
25622
  syncDrawingViewport(scrollRef.current, { immediate: true });
25355
- }, [activeSheet, activeTabIndex, displayColLimit, displayRowLimit, syncDrawingViewport, zoomFactor]);
25623
+ }, [activeSheet, activeTabIndex, displayColLimit, displayRowLimit, highlightedCellRanges, syncDrawingViewport, zoomFactor]);
25356
25624
  React4.useLayoutEffect(() => {
25357
25625
  const scroller = scrollRef.current;
25358
25626
  if (!scroller) {
@@ -26310,7 +26578,10 @@ function XlsxGrid({
26310
26578
  });
26311
26579
  const targetTable = getTableAtCell(effectiveTables, targetRow, targetCol);
26312
26580
  const targetTableStyle = resolveTableCellStyle(targetTable, targetRow, targetCol, activeSheet);
26313
- const resolvedStyle = mergeResolvedCellStyle(targetRawStyle, targetTableStyle);
26581
+ const resolvedStyle = targetTableStyle ? mergeResolvedCellStyle(
26582
+ mergeResolvedCellStyle(targetRawStyle, targetTableStyle),
26583
+ resolveCellTableOverrides(targetRawStyle, activeSheet, targetRow, targetCol)
26584
+ ) : targetRawStyle;
26314
26585
  cellBaseRawStyleCacheRef.current.set(targetCacheKey, resolvedStyle);
26315
26586
  return resolvedStyle;
26316
26587
  };
@@ -26496,11 +26767,11 @@ function XlsxGrid({
26496
26767
  if (textWidth > availableTextWidth) {
26497
26768
  const baseFontSizePx = resolveCanvasFontSizePx(nextData.style, 12 * zoomFactor);
26498
26769
  const minimumFontSizePx = Math.max(6 * zoomFactor, baseFontSizePx * 0.4);
26499
- let lowerBound = minimumFontSizePx;
26770
+ let lowerBound2 = minimumFontSizePx;
26500
26771
  let upperBound = baseFontSizePx;
26501
26772
  let bestFontSizePx = minimumFontSizePx;
26502
- while (upperBound - lowerBound > 0.25) {
26503
- const candidateFontSizePx = (lowerBound + upperBound) / 2;
26773
+ while (upperBound - lowerBound2 > 0.25) {
26774
+ const candidateFontSizePx = (lowerBound2 + upperBound) / 2;
26504
26775
  const candidateStyle = {
26505
26776
  ...nextData.style,
26506
26777
  font: void 0,
@@ -26509,7 +26780,7 @@ function XlsxGrid({
26509
26780
  const candidateWidth = measureTextWidth(nextData.value, candidateStyle);
26510
26781
  if (candidateWidth <= availableTextWidth) {
26511
26782
  bestFontSizePx = candidateFontSizePx;
26512
- lowerBound = candidateFontSizePx;
26783
+ lowerBound2 = candidateFontSizePx;
26513
26784
  } else {
26514
26785
  upperBound = candidateFontSizePx;
26515
26786
  }
@@ -26560,6 +26831,51 @@ function XlsxGrid({
26560
26831
  };
26561
26832
  }, [colIndexByActual, colPrefixSums, displayHeaderHeight, displayRowHeaderWidth, displayedSelection, rowIndexByActual, rowPrefixSums]);
26562
26833
  const resolvedSelectionOverlay = selectionOverlay;
26834
+ const rangeHighlightRects = React4.useMemo(() => highlightedCellRanges.map(({ highlight, index, range }) => {
26835
+ const rows = getHighlightAxisExtent(visibleRows, rowPrefixSums, range.start.row, range.end.row);
26836
+ const cols = getHighlightAxisExtent(visibleCols, colPrefixSums, range.start.col, range.end.col);
26837
+ return {
26838
+ highlight,
26839
+ index,
26840
+ range,
26841
+ rect: rows && cols ? {
26842
+ height: rows.end - rows.start,
26843
+ left: displayRowHeaderWidth + cols.start,
26844
+ top: displayHeaderHeight + rows.start,
26845
+ width: cols.end - cols.start
26846
+ } : null
26847
+ };
26848
+ }), [colPrefixSums, displayHeaderHeight, displayRowHeaderWidth, highlightedCellRanges, rowPrefixSums, visibleCols, visibleRows]);
26849
+ React4.useEffect(() => {
26850
+ let requiredRows = 0;
26851
+ let requiredCols = 0;
26852
+ for (const { highlight, range } of highlightedCellRanges) {
26853
+ if (highlight.kind !== "columns") {
26854
+ requiredRows = Math.max(requiredRows, Math.min(XLSX_MAX_ROWS, range.end.row + OPEN_GRID_ROW_PADDING + 1));
26855
+ }
26856
+ if (highlight.kind !== "rows") {
26857
+ requiredCols = Math.max(requiredCols, Math.min(XLSX_MAX_COLUMNS, range.end.col + OPEN_GRID_COL_PADDING + 1));
26858
+ }
26859
+ }
26860
+ setDisplayRowLimit((current) => Math.max(current, requiredRows));
26861
+ setDisplayColLimit((current) => Math.max(current, requiredCols));
26862
+ }, [activeSheet?.maxUsedCol, activeSheet?.maxUsedRow, highlightedCellRanges, activeSheetIndex, isWorkerBacked]);
26863
+ React4.useEffect(() => {
26864
+ const scroller = scrollRef.current;
26865
+ const target = rangeHighlightRects.find(({ highlight: highlight2 }) => highlight2.autoScroll);
26866
+ if (!scroller || !target?.rect || scrolledHighlightRef.current === target.highlight || isLoading || scroller.clientWidth === 0 || scroller.clientHeight === 0 || target.highlight.kind !== "columns" && displayRowLimit <= target.range.end.row || target.highlight.kind !== "rows" && displayColLimit <= target.range.end.col) {
26867
+ return;
26868
+ }
26869
+ const { highlight, rect } = target;
26870
+ if (highlight.kind !== "columns") {
26871
+ scroller.scrollTop = getHighlightScrollOffset(rect.top, rect.top + rect.height, frozenPaneBottom, scroller.clientHeight, scroller.scrollTop);
26872
+ }
26873
+ if (highlight.kind !== "rows") {
26874
+ scroller.scrollLeft = getHighlightScrollOffset(rect.left, rect.left + rect.width, frozenPaneRight, scroller.clientWidth, scroller.scrollLeft);
26875
+ }
26876
+ scrolledHighlightRef.current = highlight;
26877
+ syncDrawingViewport(scroller, { immediate: true });
26878
+ }, [displayColLimit, displayRowLimit, drawingViewport.height, drawingViewport.width, frozenPaneBottom, frozenPaneRight, isLoading, rangeHighlightRects, syncDrawingViewport]);
26563
26879
  const { fill: selectionFill, header: selectionHeaderSurface, stroke: selectionStroke } = React4.useMemo(() => resolveSelectionColors({
26564
26880
  palette,
26565
26881
  selectionColor,
@@ -28636,6 +28952,14 @@ function XlsxGrid({
28636
28952
  hasPendingGridlinePath = false;
28637
28953
  };
28638
28954
  const drawnMergedAnchorKeys = /* @__PURE__ */ new Set();
28955
+ const deferredDoubleBorders = [];
28956
+ const drawCellBorder = (side, rect, border) => {
28957
+ if (border.style === "double") {
28958
+ deferredDoubleBorders.push({ side, rect, border });
28959
+ } else {
28960
+ strokeCanvasBorderSide(paneContext, side, rect, border);
28961
+ }
28962
+ };
28639
28963
  for (const rowItem of paneAxisItems.rows) {
28640
28964
  for (const colItem of paneAxisItems.cols) {
28641
28965
  const cell = { row: rowItem.actualRow, col: colItem.actualCol };
@@ -28782,16 +29106,24 @@ function XlsxGrid({
28782
29106
  flushPendingGridlines();
28783
29107
  }
28784
29108
  if (topBorder && drawRowIndex === 0) {
28785
- strokeCanvasBorderSide(paneContext, "top", localRect, topBorder);
29109
+ drawCellBorder("top", localRect, topBorder);
28786
29110
  }
28787
29111
  if (resolvedRightBorder) {
28788
- strokeCanvasBorderSide(paneContext, "right", localRect, resolvedRightBorder);
29112
+ if (resolvedRightBorder.style === "double" && resolvedRightBorder === rightNeighborLeftBorder) {
29113
+ drawCellBorder("left", { ...localRect, left: localRect.left + localRect.width }, resolvedRightBorder);
29114
+ } else {
29115
+ drawCellBorder("right", localRect, resolvedRightBorder);
29116
+ }
28789
29117
  }
28790
29118
  if (resolvedBottomBorder) {
28791
- strokeCanvasBorderSide(paneContext, "bottom", localRect, resolvedBottomBorder);
29119
+ if (resolvedBottomBorder.style === "double" && resolvedBottomBorder === bottomNeighborTopBorder) {
29120
+ drawCellBorder("top", { ...localRect, top: localRect.top + localRect.height }, resolvedBottomBorder);
29121
+ } else {
29122
+ drawCellBorder("bottom", localRect, resolvedBottomBorder);
29123
+ }
28792
29124
  }
28793
29125
  if (leftBorder && drawColIndex === 0) {
28794
- strokeCanvasBorderSide(paneContext, "left", localRect, leftBorder);
29126
+ drawCellBorder("left", localRect, leftBorder);
28795
29127
  }
28796
29128
  if (cellData.chartHighlight) {
28797
29129
  const highlightBorder = {
@@ -29064,6 +29396,9 @@ function XlsxGrid({
29064
29396
  }
29065
29397
  }
29066
29398
  flushPendingGridlines();
29399
+ for (const { side, rect, border } of deferredDoubleBorders) {
29400
+ strokeCanvasBorderSide(paneContext, side, rect, border);
29401
+ }
29067
29402
  }
29068
29403
  for (const pane of cellPaneOrder) {
29069
29404
  const paneContext = bodyContexts[pane];
@@ -29575,6 +29910,7 @@ function XlsxGrid({
29575
29910
  backgroundColor: palette.headerSurface,
29576
29911
  borderBottom: "none",
29577
29912
  borderRight: "none",
29913
+ boxSizing: "border-box",
29578
29914
  boxShadow: gutterSeparatorShadow,
29579
29915
  color: palette.headerText,
29580
29916
  fontSize: "11px",
@@ -31266,6 +31602,51 @@ function XlsxGrid({
31266
31602
  width: "100%"
31267
31603
  }
31268
31604
  };
31605
+ const rangeHighlightNodes = rangeHighlightRects.flatMap(({ index, rect }) => rect ? [
31606
+ /* @__PURE__ */ jsx3(
31607
+ "div",
31608
+ {
31609
+ "aria-hidden": "true",
31610
+ className: classNames("react-xlsx-range-highlight", highlightClassName),
31611
+ "data-dark": paletteIsDark(palette) ? "true" : void 0,
31612
+ "data-xlsx-range-highlight": index,
31613
+ style: {
31614
+ ...rect,
31615
+ ["--xlsx-highlight-default-border-width"]: `${selectionBorderWidth}px`,
31616
+ boxSizing: "border-box",
31617
+ pointerEvents: "none",
31618
+ position: "absolute",
31619
+ zIndex: maxDrawingOverlayZIndex + 1
31620
+ }
31621
+ },
31622
+ index
31623
+ )
31624
+ ] : []);
31625
+ const drawingOverlayPanes = experimentalCanvas && hasCanvasDomDrawingOverlays || rangeHighlightNodes.length > 0 ? /* @__PURE__ */ jsx3("div", { style: { ...canvasBodyViewportLayerStyle, zIndex: experimentalCanvas ? 23 : 34 }, children: [
31626
+ { pane: "scroll", style: canvasScrollOverlayPaneStyle, ref: canvasScrollOverlayContentRef, left: -drawingViewport.left - frozenPaneRight, top: -drawingViewport.top - frozenPaneBottom },
31627
+ { pane: "top", style: canvasTopOverlayPaneStyle, ref: canvasTopOverlayContentRef, left: -drawingViewport.left - frozenPaneRight, top: -displayHeaderHeight },
31628
+ { pane: "left", style: canvasLeftOverlayPaneStyle, ref: canvasLeftOverlayContentRef, left: -displayRowHeaderWidth, top: -drawingViewport.top - frozenPaneBottom },
31629
+ { pane: "corner", style: canvasCornerOverlayPaneStyle, ref: canvasCornerOverlayContentRef, left: -displayRowHeaderWidth, top: -displayHeaderHeight }
31630
+ ].map(({ pane, style, ref, left, top }) => /* @__PURE__ */ jsx3("div", { style, children: /* @__PURE__ */ jsxs3(
31631
+ "div",
31632
+ {
31633
+ ref,
31634
+ style: {
31635
+ height: sheetContentHeight,
31636
+ left: 0,
31637
+ pointerEvents: "none",
31638
+ position: "absolute",
31639
+ top: 0,
31640
+ transform: `translate(${left}px, ${top}px)`,
31641
+ transformOrigin: "0 0",
31642
+ width: totalWidth
31643
+ },
31644
+ children: [
31645
+ experimentalCanvas ? paneDrawingNodes[pane] : null,
31646
+ rangeHighlightNodes
31647
+ ]
31648
+ }
31649
+ ) }, pane)) }) : null;
31269
31650
  const scrollerContent = /* @__PURE__ */ jsx3(
31270
31651
  "div",
31271
31652
  {
@@ -31299,6 +31680,7 @@ function XlsxGrid({
31299
31680
  /* @__PURE__ */ jsx3("div", { style: cornerOverlayStyle, children: paneDrawingNodes.corner }),
31300
31681
  /* @__PURE__ */ jsx3("div", { style: scrollOverlayStyle, children: paneDrawingNodes.scroll })
31301
31682
  ] }) : null,
31683
+ drawingOverlayPanes,
31302
31684
  experimentalCanvas ? /* @__PURE__ */ jsxs3(Fragment4, { children: [
31303
31685
  /* @__PURE__ */ jsxs3("div", { style: canvasBodyViewportLayerStyle, children: [
31304
31686
  /* @__PURE__ */ jsx3(
@@ -31340,77 +31722,7 @@ function XlsxGrid({
31340
31722
  onPointerDown: handleCanvasBodyPointerDown,
31341
31723
  style: canvasCornerBodyStyle
31342
31724
  }
31343
- ),
31344
- hasCanvasDomDrawingOverlays ? /* @__PURE__ */ jsxs3(Fragment4, { children: [
31345
- /* @__PURE__ */ jsx3("div", { style: canvasScrollOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
31346
- "div",
31347
- {
31348
- ref: canvasScrollOverlayContentRef,
31349
- style: {
31350
- height: sheetContentHeight,
31351
- left: 0,
31352
- pointerEvents: "none",
31353
- position: "absolute",
31354
- top: 0,
31355
- transform: `translate(${-drawingViewport.left - frozenPaneRight}px, ${-drawingViewport.top - frozenPaneBottom}px)`,
31356
- transformOrigin: "0 0",
31357
- width: totalWidth
31358
- },
31359
- children: paneDrawingNodes.scroll
31360
- }
31361
- ) }),
31362
- /* @__PURE__ */ jsx3("div", { style: canvasTopOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
31363
- "div",
31364
- {
31365
- ref: canvasTopOverlayContentRef,
31366
- style: {
31367
- height: sheetContentHeight,
31368
- left: 0,
31369
- pointerEvents: "none",
31370
- position: "absolute",
31371
- top: 0,
31372
- transform: `translate(${-drawingViewport.left - frozenPaneRight}px, ${-displayHeaderHeight}px)`,
31373
- transformOrigin: "0 0",
31374
- width: totalWidth
31375
- },
31376
- children: paneDrawingNodes.top
31377
- }
31378
- ) }),
31379
- /* @__PURE__ */ jsx3("div", { style: canvasLeftOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
31380
- "div",
31381
- {
31382
- ref: canvasLeftOverlayContentRef,
31383
- style: {
31384
- height: sheetContentHeight,
31385
- left: 0,
31386
- pointerEvents: "none",
31387
- position: "absolute",
31388
- top: 0,
31389
- transform: `translate(${-displayRowHeaderWidth}px, ${-drawingViewport.top - frozenPaneBottom}px)`,
31390
- transformOrigin: "0 0",
31391
- width: totalWidth
31392
- },
31393
- children: paneDrawingNodes.left
31394
- }
31395
- ) }),
31396
- /* @__PURE__ */ jsx3("div", { style: canvasCornerOverlayPaneStyle, children: /* @__PURE__ */ jsx3(
31397
- "div",
31398
- {
31399
- ref: canvasCornerOverlayContentRef,
31400
- style: {
31401
- height: sheetContentHeight,
31402
- left: 0,
31403
- pointerEvents: "none",
31404
- position: "absolute",
31405
- top: 0,
31406
- transform: `translate(${-displayRowHeaderWidth}px, ${-displayHeaderHeight}px)`,
31407
- transformOrigin: "0 0",
31408
- width: totalWidth
31409
- },
31410
- children: paneDrawingNodes.corner
31411
- }
31412
- ) })
31413
- ] }) : null
31725
+ )
31414
31726
  ] }),
31415
31727
  /* @__PURE__ */ jsxs3("div", { style: canvasHeaderViewportLayerStyle, children: [
31416
31728
  /* @__PURE__ */ jsx3(
@@ -31856,6 +32168,7 @@ function XlsxGrid({
31856
32168
  }
31857
32169
  function XlsxViewerInner({
31858
32170
  allowResizeInReadOnly = false,
32171
+ autoScrollToHighlightedRanges = true,
31859
32172
  className,
31860
32173
  controller,
31861
32174
  emptyState,
@@ -31868,6 +32181,8 @@ function XlsxViewerInner({
31868
32181
  headerBackgroundColor,
31869
32182
  headerTextColor,
31870
32183
  height,
32184
+ highlightClassName,
32185
+ highlightedRanges,
31871
32186
  isDark = false,
31872
32187
  loadingComponent,
31873
32188
  loadingState,
@@ -31890,6 +32205,26 @@ function XlsxViewerInner({
31890
32205
  }) {
31891
32206
  const palette = useViewerPalette(isDark, headerBackgroundColor, headerTextColor);
31892
32207
  const { displayFileName, error } = controller;
32208
+ const appliedHighlightRef = React4.useRef(null);
32209
+ const { clearHighlightedRanges, file, highlightRanges, isLoading, sheets, src } = controller;
32210
+ React4.useEffect(() => {
32211
+ if (isLoading || highlightedRanges === void 0) {
32212
+ appliedHighlightRef.current = null;
32213
+ return;
32214
+ }
32215
+ if (highlightedRanges !== null && sheets.length === 0) {
32216
+ return;
32217
+ }
32218
+ const referenceKey = JSON.stringify(typeof highlightedRanges === "string" ? [highlightedRanges] : highlightedRanges ?? []);
32219
+ const previous = appliedHighlightRef.current;
32220
+ if (previous && previous.referenceKey === referenceKey && previous.autoScroll === autoScrollToHighlightedRanges && previous.file === file && previous.src === src && previous.clear === clearHighlightedRanges) {
32221
+ return;
32222
+ }
32223
+ appliedHighlightRef.current = { autoScroll: autoScrollToHighlightedRanges, clear: clearHighlightedRanges, file, referenceKey, src };
32224
+ if (highlightedRanges === null || !highlightRanges(highlightedRanges, { autoScroll: autoScrollToHighlightedRanges })) {
32225
+ clearHighlightedRanges();
32226
+ }
32227
+ }, [autoScrollToHighlightedRanges, clearHighlightedRanges, file, highlightRanges, highlightedRanges, isLoading, sheets.length, src]);
31893
32228
  const customFileTooLarge = error instanceof XlsxFileSizeLimitExceededError ? renderCustomFileTooLarge(
31894
32229
  fileTooLargeState,
31895
32230
  {
@@ -31922,6 +32257,7 @@ function XlsxViewerInner({
31922
32257
  width: "100%"
31923
32258
  },
31924
32259
  children: [
32260
+ /* @__PURE__ */ jsx3("style", { children: RANGE_HIGHLIGHT_STYLES }),
31925
32261
  resolveToolbar(toolbar, showDefaultToolbar, controller, palette),
31926
32262
  /* @__PURE__ */ jsx3("div", { style: { display: "flex", flex: 1, minHeight: 0, minWidth: 0 }, children: /* @__PURE__ */ jsx3(
31927
32263
  XlsxGrid,
@@ -31935,6 +32271,7 @@ function XlsxViewerInner({
31935
32271
  experimentalCanvas,
31936
32272
  fileTooLargeState,
31937
32273
  getCellStyle,
32274
+ highlightClassName,
31938
32275
  loadingComponent,
31939
32276
  loadingState,
31940
32277
  onFormControlAction,
@@ -33091,6 +33428,7 @@ export {
33091
33428
  XlsxViewer,
33092
33429
  XlsxViewerProvider,
33093
33430
  initWasm,
33431
+ parseXlsxRange,
33094
33432
  setWasmSource,
33095
33433
  useXlsxViewer,
33096
33434
  useXlsxViewerCharts,