@extend-ai/react-xlsx 0.16.0 → 0.16.2

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.
Binary file
package/dist/index.cjs CHANGED
@@ -5337,9 +5337,7 @@ function mapDukeFormControlKind(kind, themePalette) {
5337
5337
  ...resolveDukeDrawingText(kind.caption, themePalette),
5338
5338
  kind: kind.objectType.toLowerCase() === "editbox" ? "editbox" : "unknown",
5339
5339
  legacyObjectType: kind.legacyObjectType,
5340
- objectType: kind.objectType,
5341
- rawObj: kind.rawObj,
5342
- rawProperties: kind.rawProperties
5340
+ objectType: kind.objectType
5343
5341
  };
5344
5342
  }
5345
5343
  }
@@ -5356,6 +5354,8 @@ function mapDukeFormControl(control, controlIndex, workbookSheetIndex, themePale
5356
5354
  name: control.name,
5357
5355
  printable: control.printable,
5358
5356
  rawClientData: control.formControl.rawClientData,
5357
+ rawObj: control.formControl.rawObj,
5358
+ rawProperties: control.formControl.rawProperties,
5359
5359
  sheetIndex: workbookSheetIndex,
5360
5360
  title: control.title,
5361
5361
  workbookSheetIndex,
@@ -7541,18 +7541,14 @@ function xlsxFormControlKindToDukeKind(kind) {
7541
7541
  caption: xlsxCaptionToDukeText(kind.caption),
7542
7542
  kind: "unknown",
7543
7543
  legacyObjectType: kind.legacyObjectType,
7544
- objectType: "EditBox",
7545
- rawObj: kind.rawObj,
7546
- rawProperties: kind.rawProperties
7544
+ objectType: "EditBox"
7547
7545
  };
7548
7546
  case "unknown":
7549
7547
  return {
7550
7548
  caption: kind.caption ? xlsxCaptionToDukeText(kind.caption) : void 0,
7551
7549
  kind: "unknown",
7552
7550
  legacyObjectType: kind.legacyObjectType,
7553
- objectType: kind.objectType,
7554
- rawObj: kind.rawObj,
7555
- rawProperties: kind.rawProperties
7551
+ objectType: kind.objectType
7556
7552
  };
7557
7553
  default:
7558
7554
  return { ...kind };
@@ -7567,9 +7563,7 @@ function dukeFormControlKindToInput(kind) {
7567
7563
  caption: kind.caption,
7568
7564
  kind: "unknown",
7569
7565
  legacyObjectType: kind.legacyObjectType,
7570
- objectType: kind.objectType,
7571
- rawObj: kind.rawObj,
7572
- rawProperties: kind.rawProperties
7566
+ objectType: kind.objectType
7573
7567
  };
7574
7568
  }
7575
7569
  return { ...kind };
@@ -7581,7 +7575,9 @@ function formControlInputFromDukeControl(control) {
7581
7575
  formControl: {
7582
7576
  kind: dukeFormControlKindToInput(control.formControl.kind),
7583
7577
  macroName: control.formControl.macroName,
7584
- rawClientData: control.formControl.rawClientData
7578
+ rawClientData: control.formControl.rawClientData,
7579
+ rawObj: control.formControl.rawObj,
7580
+ rawProperties: control.formControl.rawProperties
7585
7581
  },
7586
7582
  hidden: control.hidden,
7587
7583
  kind: "formControl",
@@ -7598,7 +7594,9 @@ function xlsxFormControlInputToDukeDrawing(input) {
7598
7594
  formControl: {
7599
7595
  kind: xlsxFormControlKindToDukeKind(input.kind),
7600
7596
  macroName: input.macroName,
7601
- rawClientData: input.rawClientData
7597
+ rawClientData: input.rawClientData,
7598
+ rawObj: input.kind.kind === "editbox" || input.kind.kind === "unknown" ? input.kind.rawObj : void 0,
7599
+ rawProperties: input.kind.kind === "editbox" || input.kind.kind === "unknown" ? input.kind.rawProperties : void 0
7602
7600
  },
7603
7601
  hidden: input.hidden,
7604
7602
  kind: "formControl",
@@ -9642,11 +9640,11 @@ function useXlsxViewerController(options) {
9642
9640
  if (currentControl.formControl.kind.kind === "unknown" && nextKind.kind === "unknown") {
9643
9641
  nextKind = {
9644
9642
  ...nextKind,
9645
- legacyObjectType: nextKind.legacyObjectType ?? currentControl.formControl.kind.legacyObjectType,
9646
- rawObj: nextKind.rawObj ?? currentControl.formControl.kind.rawObj,
9647
- rawProperties: nextKind.rawProperties ?? currentControl.formControl.kind.rawProperties
9643
+ legacyObjectType: nextKind.legacyObjectType ?? currentControl.formControl.kind.legacyObjectType
9648
9644
  };
9649
9645
  }
9646
+ const patchedRawObj = patch.kind?.kind === "editbox" || patch.kind?.kind === "unknown" ? patch.kind.rawObj : void 0;
9647
+ const patchedRawProperties = patch.kind?.kind === "editbox" || patch.kind?.kind === "unknown" ? patch.kind.rawProperties : void 0;
9650
9648
  const nextInput = {
9651
9649
  altText: "altText" in patch ? patch.altText : currentControl.altText,
9652
9650
  anchor: nextAnchor,
@@ -9654,7 +9652,9 @@ function useXlsxViewerController(options) {
9654
9652
  ...currentInput.formControl,
9655
9653
  kind: nextKind,
9656
9654
  macroName: "macroName" in patch ? patch.macroName : currentControl.formControl.macroName,
9657
- rawClientData: "rawClientData" in patch ? patch.rawClientData : currentControl.formControl.rawClientData
9655
+ rawClientData: "rawClientData" in patch ? patch.rawClientData : currentControl.formControl.rawClientData,
9656
+ rawObj: patchedRawObj ?? currentControl.formControl.rawObj,
9657
+ rawProperties: patchedRawProperties ?? currentControl.formControl.rawProperties
9658
9658
  },
9659
9659
  hidden: "hidden" in patch ? patch.hidden : currentControl.hidden,
9660
9660
  kind: "formControl",
@@ -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;