@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.
package/dist/index.js CHANGED
@@ -5287,9 +5287,7 @@ function mapDukeFormControlKind(kind, themePalette) {
5287
5287
  ...resolveDukeDrawingText(kind.caption, themePalette),
5288
5288
  kind: kind.objectType.toLowerCase() === "editbox" ? "editbox" : "unknown",
5289
5289
  legacyObjectType: kind.legacyObjectType,
5290
- objectType: kind.objectType,
5291
- rawObj: kind.rawObj,
5292
- rawProperties: kind.rawProperties
5290
+ objectType: kind.objectType
5293
5291
  };
5294
5292
  }
5295
5293
  }
@@ -5306,6 +5304,8 @@ function mapDukeFormControl(control, controlIndex, workbookSheetIndex, themePale
5306
5304
  name: control.name,
5307
5305
  printable: control.printable,
5308
5306
  rawClientData: control.formControl.rawClientData,
5307
+ rawObj: control.formControl.rawObj,
5308
+ rawProperties: control.formControl.rawProperties,
5309
5309
  sheetIndex: workbookSheetIndex,
5310
5310
  title: control.title,
5311
5311
  workbookSheetIndex,
@@ -7490,18 +7490,14 @@ function xlsxFormControlKindToDukeKind(kind) {
7490
7490
  caption: xlsxCaptionToDukeText(kind.caption),
7491
7491
  kind: "unknown",
7492
7492
  legacyObjectType: kind.legacyObjectType,
7493
- objectType: "EditBox",
7494
- rawObj: kind.rawObj,
7495
- rawProperties: kind.rawProperties
7493
+ objectType: "EditBox"
7496
7494
  };
7497
7495
  case "unknown":
7498
7496
  return {
7499
7497
  caption: kind.caption ? xlsxCaptionToDukeText(kind.caption) : void 0,
7500
7498
  kind: "unknown",
7501
7499
  legacyObjectType: kind.legacyObjectType,
7502
- objectType: kind.objectType,
7503
- rawObj: kind.rawObj,
7504
- rawProperties: kind.rawProperties
7500
+ objectType: kind.objectType
7505
7501
  };
7506
7502
  default:
7507
7503
  return { ...kind };
@@ -7516,9 +7512,7 @@ function dukeFormControlKindToInput(kind) {
7516
7512
  caption: kind.caption,
7517
7513
  kind: "unknown",
7518
7514
  legacyObjectType: kind.legacyObjectType,
7519
- objectType: kind.objectType,
7520
- rawObj: kind.rawObj,
7521
- rawProperties: kind.rawProperties
7515
+ objectType: kind.objectType
7522
7516
  };
7523
7517
  }
7524
7518
  return { ...kind };
@@ -7530,7 +7524,9 @@ function formControlInputFromDukeControl(control) {
7530
7524
  formControl: {
7531
7525
  kind: dukeFormControlKindToInput(control.formControl.kind),
7532
7526
  macroName: control.formControl.macroName,
7533
- rawClientData: control.formControl.rawClientData
7527
+ rawClientData: control.formControl.rawClientData,
7528
+ rawObj: control.formControl.rawObj,
7529
+ rawProperties: control.formControl.rawProperties
7534
7530
  },
7535
7531
  hidden: control.hidden,
7536
7532
  kind: "formControl",
@@ -7547,7 +7543,9 @@ function xlsxFormControlInputToDukeDrawing(input) {
7547
7543
  formControl: {
7548
7544
  kind: xlsxFormControlKindToDukeKind(input.kind),
7549
7545
  macroName: input.macroName,
7550
- rawClientData: input.rawClientData
7546
+ rawClientData: input.rawClientData,
7547
+ rawObj: input.kind.kind === "editbox" || input.kind.kind === "unknown" ? input.kind.rawObj : void 0,
7548
+ rawProperties: input.kind.kind === "editbox" || input.kind.kind === "unknown" ? input.kind.rawProperties : void 0
7551
7549
  },
7552
7550
  hidden: input.hidden,
7553
7551
  kind: "formControl",
@@ -9591,11 +9589,11 @@ function useXlsxViewerController(options) {
9591
9589
  if (currentControl.formControl.kind.kind === "unknown" && nextKind.kind === "unknown") {
9592
9590
  nextKind = {
9593
9591
  ...nextKind,
9594
- legacyObjectType: nextKind.legacyObjectType ?? currentControl.formControl.kind.legacyObjectType,
9595
- rawObj: nextKind.rawObj ?? currentControl.formControl.kind.rawObj,
9596
- rawProperties: nextKind.rawProperties ?? currentControl.formControl.kind.rawProperties
9592
+ legacyObjectType: nextKind.legacyObjectType ?? currentControl.formControl.kind.legacyObjectType
9597
9593
  };
9598
9594
  }
9595
+ const patchedRawObj = patch.kind?.kind === "editbox" || patch.kind?.kind === "unknown" ? patch.kind.rawObj : void 0;
9596
+ const patchedRawProperties = patch.kind?.kind === "editbox" || patch.kind?.kind === "unknown" ? patch.kind.rawProperties : void 0;
9599
9597
  const nextInput = {
9600
9598
  altText: "altText" in patch ? patch.altText : currentControl.altText,
9601
9599
  anchor: nextAnchor,
@@ -9603,7 +9601,9 @@ function useXlsxViewerController(options) {
9603
9601
  ...currentInput.formControl,
9604
9602
  kind: nextKind,
9605
9603
  macroName: "macroName" in patch ? patch.macroName : currentControl.formControl.macroName,
9606
- rawClientData: "rawClientData" in patch ? patch.rawClientData : currentControl.formControl.rawClientData
9604
+ rawClientData: "rawClientData" in patch ? patch.rawClientData : currentControl.formControl.rawClientData,
9605
+ rawObj: patchedRawObj ?? currentControl.formControl.rawObj,
9606
+ rawProperties: patchedRawProperties ?? currentControl.formControl.rawProperties
9607
9607
  },
9608
9608
  hidden: "hidden" in patch ? patch.hidden : currentControl.hidden,
9609
9609
  kind: "formControl",
@@ -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;