@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.cjs CHANGED
@@ -11089,6 +11089,14 @@ function useXlsxViewerController(options) {
11089
11089
  var React4 = __toESM(require("react"), 1);
11090
11090
  var import_react_virtual = require("@tanstack/react-virtual");
11091
11091
 
11092
+ // src/cell-text-clip.ts
11093
+ function resolveCellTextClipOverscan(overscan, usesWrappedText) {
11094
+ return {
11095
+ horizontal: overscan,
11096
+ vertical: usesWrappedText ? 0 : overscan
11097
+ };
11098
+ }
11099
+
11092
11100
  // src/chart-renderer.tsx
11093
11101
  var import_d3_hierarchy = require("d3-hierarchy");
11094
11102
  var import_d3_geo = require("d3-geo");
@@ -22816,6 +22824,16 @@ function GridRow({
22816
22824
  width: "100%",
22817
22825
  wordBreak: "inherit"
22818
22826
  };
22827
+ const usesWrappedText = cellData.style.whiteSpace === "pre-wrap" || cellData.value.includes("\n");
22828
+ const wrappedTextStyle = usesWrappedText ? {
22829
+ display: "block",
22830
+ flex: "0 0 auto",
22831
+ maxWidth: "100%",
22832
+ minWidth: 0
22833
+ } : null;
22834
+ if (usesWrappedText) {
22835
+ cellContentStyle.overflow = "clip";
22836
+ }
22819
22837
  const trailingInset = (adornment ? 20 : 0) + (cellData.conditionalIcon ? 18 : 0);
22820
22838
  if (cellData.conditionalDataBar) {
22821
22839
  cellContentStyle.position = "relative";
@@ -23011,7 +23029,7 @@ function GridRow({
23011
23029
  },
23012
23030
  children: renderCheckboxControl(cellData.checkboxState, palette, zoomFactor)
23013
23031
  }
23014
- ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: cellContentStyle, children: rotatedTextStyle ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: rotatedTextStyle, children: cellData.value }) : cellData.value })
23032
+ ) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { style: cellContentStyle, children: rotatedTextStyle ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: rotatedTextStyle, children: cellData.value }) : wrappedTextStyle ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { style: wrappedTextStyle, children: cellData.value }) : cellData.value })
23015
23033
  ]
23016
23034
  },
23017
23035
  key
@@ -27735,14 +27753,18 @@ function XlsxGrid({
27735
27753
  zoomFactor * 1.5,
27736
27754
  activeFontSizePx * (cellData.textRotationDeg ? 0.75 : 0.18)
27737
27755
  );
27756
+ const textClip = resolveCellTextClipOverscan(
27757
+ textClipOverscan,
27758
+ canvasCellStyle.usesWrappedText || rawText.includes("\n")
27759
+ );
27738
27760
  flushPendingGridlines();
27739
27761
  paneContext.save();
27740
27762
  paneContext.beginPath();
27741
27763
  paneContext.rect(
27742
- contentLeft - textClipOverscan,
27743
- contentTop - textClipOverscan,
27744
- contentWidth + textClipOverscan * 2,
27745
- contentHeight + textClipOverscan * 2
27764
+ contentLeft - textClip.horizontal,
27765
+ contentTop - textClip.vertical,
27766
+ contentWidth + textClip.horizontal * 2,
27767
+ contentHeight + textClip.vertical * 2
27746
27768
  );
27747
27769
  paneContext.clip();
27748
27770
  paneContext.font = cellData.shrinkToFitFontSizePx ? resolveCanvasFontWithPxSize(cellStyle, cellData.shrinkToFitFontSizePx) : canvasCellStyle.baseFont;