@extend-ai/react-xlsx 0.16.0 → 0.16.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
@@ -11040,6 +11040,14 @@ import {
11040
11040
  useVirtualizer
11041
11041
  } from "@tanstack/react-virtual";
11042
11042
 
11043
+ // src/cell-text-clip.ts
11044
+ function resolveCellTextClipOverscan(overscan, usesWrappedText) {
11045
+ return {
11046
+ horizontal: overscan,
11047
+ vertical: usesWrappedText ? 0 : overscan
11048
+ };
11049
+ }
11050
+
11043
11051
  // src/chart-renderer.tsx
11044
11052
  import { hierarchy as d3Hierarchy, partition as d3Partition, treemap as d3Treemap, treemapBinary, treemapDice } from "d3-hierarchy";
11045
11053
  import { geoIdentity, geoMercator, geoNaturalEarth1, geoPath } from "d3-geo";
@@ -22782,6 +22790,16 @@ function GridRow({
22782
22790
  width: "100%",
22783
22791
  wordBreak: "inherit"
22784
22792
  };
22793
+ const usesWrappedText = cellData.style.whiteSpace === "pre-wrap" || cellData.value.includes("\n");
22794
+ const wrappedTextStyle = usesWrappedText ? {
22795
+ display: "block",
22796
+ flex: "0 0 auto",
22797
+ maxWidth: "100%",
22798
+ minWidth: 0
22799
+ } : null;
22800
+ if (usesWrappedText) {
22801
+ cellContentStyle.overflow = "clip";
22802
+ }
22785
22803
  const trailingInset = (adornment ? 20 : 0) + (cellData.conditionalIcon ? 18 : 0);
22786
22804
  if (cellData.conditionalDataBar) {
22787
22805
  cellContentStyle.position = "relative";
@@ -22977,7 +22995,7 @@ function GridRow({
22977
22995
  },
22978
22996
  children: renderCheckboxControl(cellData.checkboxState, palette, zoomFactor)
22979
22997
  }
22980
- ) : /* @__PURE__ */ jsx3("div", { style: cellContentStyle, children: rotatedTextStyle ? /* @__PURE__ */ jsx3("span", { style: rotatedTextStyle, children: cellData.value }) : cellData.value })
22998
+ ) : /* @__PURE__ */ jsx3("div", { style: cellContentStyle, children: rotatedTextStyle ? /* @__PURE__ */ jsx3("span", { style: rotatedTextStyle, children: cellData.value }) : wrappedTextStyle ? /* @__PURE__ */ jsx3("span", { style: wrappedTextStyle, children: cellData.value }) : cellData.value })
22981
22999
  ]
22982
23000
  },
22983
23001
  key
@@ -27701,14 +27719,18 @@ function XlsxGrid({
27701
27719
  zoomFactor * 1.5,
27702
27720
  activeFontSizePx * (cellData.textRotationDeg ? 0.75 : 0.18)
27703
27721
  );
27722
+ const textClip = resolveCellTextClipOverscan(
27723
+ textClipOverscan,
27724
+ canvasCellStyle.usesWrappedText || rawText.includes("\n")
27725
+ );
27704
27726
  flushPendingGridlines();
27705
27727
  paneContext.save();
27706
27728
  paneContext.beginPath();
27707
27729
  paneContext.rect(
27708
- contentLeft - textClipOverscan,
27709
- contentTop - textClipOverscan,
27710
- contentWidth + textClipOverscan * 2,
27711
- contentHeight + textClipOverscan * 2
27730
+ contentLeft - textClip.horizontal,
27731
+ contentTop - textClip.vertical,
27732
+ contentWidth + textClip.horizontal * 2,
27733
+ contentHeight + textClip.vertical * 2
27712
27734
  );
27713
27735
  paneContext.clip();
27714
27736
  paneContext.font = cellData.shrinkToFitFontSizePx ? resolveCanvasFontWithPxSize(cellStyle, cellData.shrinkToFitFontSizePx) : canvasCellStyle.baseFont;