@sheetxl/react 0.7.19 → 0.7.20

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.7.19
2
+ * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.7.20
3
3
  *
4
4
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
5
  * License: The license can be found at https://www.sheetxl.com/license.
@@ -749,7 +749,7 @@ const bt = new class {
749
749
  }, children: X("div", { style: { fontSize: "0.7em" }, children: "✕" }) })] });
750
750
  }));
751
751
  Mt.displayName = "TaskPaneTitle";
752
- const At = (e2, t2) => X(Mt, { ...e2, ref: t2 }), zt = re(se((e2, t2) => {
752
+ const At = (e2) => X(Mt, { ...e2 }), zt = re(se((e2, t2) => {
753
753
  const { children: o2, entry: n2, close: l2, listenerContainer: r2, model: i2, commands: a2, onMounted: s2, onUnmounted: d2, paneWrapper: c2, paneProps: g2, renderTaskPanelTitle: u2 = At, style: h2, className: m2, ...p2 } = e2, [f2, w2] = ae(null), [v2, q2] = ae(false), y2 = k(l2, [l2]), C2 = de(null), b2 = de(null);
754
754
  ce(() => (s2?.(n2), () => {
755
755
  d2?.(n2);
@@ -766,8 +766,8 @@ const At = (e2, t2) => X(Mt, { ...e2, ref: t2 }), zt = re(se((e2, t2) => {
766
766
  for (const e3 of S2.current) e3();
767
767
  S2.current = [];
768
768
  }, []);
769
- const T2 = ie(() => (n2.renderTaskPanelTitle ?? u2)({ title: n2.getTitle(), icon: null, readOnly: false, focused: v2, onClose: y2, onPointerDown: (e3) => {
770
- } }, b2), [n2, v2]), R2 = ie(() => {
769
+ const T2 = ie(() => (n2.renderTaskPanelTitle ?? u2)({ ref: b2, title: n2.getTitle(), icon: null, readOnly: false, focused: v2, onClose: y2, onPointerDown: (e3) => {
770
+ } }), [n2, v2]), R2 = ie(() => {
771
771
  let e3 = n2.renderTaskPane({ entryKey: n2.key, model: i2, commands: a2, frame: x2, ...g2 }, t2);
772
772
  return c2 && (e3 = c2(e3)), e3;
773
773
  }, [n2, i2, a2, t2]);
@@ -789,7 +789,7 @@ const At = (e2, t2) => X(Mt, { ...e2, ref: t2 }), zt = re(se((e2, t2) => {
789
789
  return X("div", { ref: u2, className: h2, style: s2, ...c2, children: g2 });
790
790
  }));
791
791
  Ft.displayName = "TaskPaneStrip";
792
- const Dt = (e2, t2) => X(Ft, { ref: t2, ...e2 }), It = re(se((e2, t2) => {
792
+ const Dt = (e2) => X(Ft, { ...e2 }), It = re(se((e2, t2) => {
793
793
  const { className: o2 = "", registry: n2 = bt, model: l2, commands: r2, onOpen: i2, onClose: a2, paneWrapper: s2, paneProps: d2, frameWrapper: c2, frameProps: g2, renderTaskPanelTitle: u2, renderTaskPaneStrip: h2 = Dt, alwaysShowStrip: m2, style: p2 } = e2, f2 = k(i2, [i2]), w2 = k(a2, [a2]), [v2, q2] = ae(null), y2 = de(null), [C2, b2] = ae([]), S2 = de(/* @__PURE__ */ new Set()), T2 = k(async (e3, t3 = false) => {
794
794
  const o3 = Array.from(S2.current), n3 = o3.length;
795
795
  let l3 = true;
@@ -853,7 +853,7 @@ const Dt = (e2, t2) => X(Ft, { ref: t2, ...e2 }), It = re(se((e2, t2) => {
853
853
  if (z2.length <= 1 && !m2) return null;
854
854
  return h2({ className: Rt.TaskPaneAreaStrip, taskPanes: z2, selected: v2?.key, onSelect: (e3) => {
855
855
  M2(e3);
856
- }, registry: n2 }, null);
856
+ }, registry: n2 });
857
857
  }, [z2, v2, n2, m2]), D2 = v2?.elem;
858
858
  return Y("div", { ref: A2, className: De("taskpane-area", o2, Rt.TaskPaneArea), style: p2, children: [D2, F2] });
859
859
  })), Et = new p("transparent");
@@ -2057,14 +2057,14 @@ const Vt = (e2, t2, o2 = null) => {
2057
2057
  o2?.getStage();
2058
2058
  }, [o2?.getStage()]), d2 && o2 ? d2(o2) : null;
2059
2059
  })), Xt = "_sheet-selection_12wyx_5", Yt = { key: "dragCut", description: "Drag selection to move cell contents.", cursor: "move" }, Jt = { key: "dragCutInsert", description: "Drag selection to insert cell contents.", cursor: "copy" }, Qt = { key: "dragCopy", description: "Drag selection to copy cell contents." }, eo = { key: "dragCopyInsert", description: "Drag selection to insert copied cell contents.", cursor: "move" }, to = (e2, t2) => t2.ctrlKey && t2.shiftKey ? eo : t2.ctrlKey ? Qt : t2.shiftKey ? Jt : Yt, oo = { key: "fill", description: "Drag selection to extend series or fill.", cursor: "crosshair" }, no = re(se((e2, t2) => {
2060
- const { view: o2, commands: n2, className: l2, onFirstRender: r2, onShowTooltip: i2, onCloseTooltip: a2, sheet: d2, gridRef: c2, gridStyle: g2, isActive: u2, editingCoords: h2, ...m2 } = e2, p2 = o2?.getBounds(), f2 = k(i2, [i2]), w2 = k(a2, [a2]), [v2, q2] = ae(() => d2?.getSelection().getCoords()), y2 = k((e3) => {
2061
- oe.isEqualSelectionCoords(e3, v2) || d2 && d2.getSelection().updateCoords(e3);
2062
- }, [d2, v2]), C2 = H(), b2 = de(null), [T2, R2] = ae(d2?.getProtection().isLocked()), [M2, A2] = ae(d2?.getView().getMovableSelection().length > 0), z2 = "touch" === S.detectIt().primaryInput, F2 = !z2 && u2, D2 = h2 ?? C2.getMode()?.args?.stateAndCoords?.coords ?? null, E2 = null !== D2 || M2, N2 = k((e3) => {
2060
+ const { view: o2, commands: n2, className: l2, onFirstRender: r2, onShowTooltip: i2, onCloseTooltip: a2, sheet: d2, gridRef: c2, gridStyle: g2, isActive: u2, ...h2 } = e2, m2 = o2?.getBounds(), p2 = k(i2, [i2]), f2 = k(a2, [a2]), [w2, v2] = ae(() => d2?.getSelection().getCoords()), q2 = k((e3) => {
2061
+ oe.isEqualSelectionCoords(e3, w2) || d2 && d2.getSelection().updateCoords(e3);
2062
+ }, [d2, w2]), y2 = H(), C2 = de(null), [b2, T2] = ae(d2?.getProtection().isLocked()), [R2, M2] = ae(d2?.getView().getMovableSelection().length > 0), A2 = "touch" === S.detectIt().primaryInput, z2 = !A2 && u2, F2 = y2.getMode()?.args?.stateAndCoords?.coords ?? null, D2 = null !== F2 || R2, E2 = k((e3) => {
2063
2063
  const t3 = oe.cellToRange(e3);
2064
2064
  if (d2.isClosed()) return t3;
2065
2065
  const o3 = d2.getRange(t3, { ignoreHidden: true }).getMerges();
2066
2066
  return 0 === o3.length ? t3 : o3[0];
2067
- }, [d2]), P2 = k((e3, t3, o3, n3, l3, r3) => {
2067
+ }, [d2]), N2 = k((e3, t3, o3, n3, l3, r3) => {
2068
2068
  const i3 = d2.getSelectedRange().getExtended(n3, e3).getCoords();
2069
2069
  switch (n3) {
2070
2070
  case s.Direction.Up:
@@ -2076,118 +2076,118 @@ const Vt = (e2, t2, o2 = null) => {
2076
2076
  case s.Direction.Right:
2077
2077
  return i3.colEnd;
2078
2078
  }
2079
- }, [d2]), V2 = k(() => {
2079
+ }, [d2]), P2 = k(() => {
2080
2080
  const e3 = d2.getUsedRange()?.getCoords(), t3 = d2.getRowHeaders().getUsedRange()?.getCoords(), o3 = d2.getColumnHeaders().getUsedRange()?.getCoords();
2081
2081
  return { ...e3, colEnd: Math.max(e3?.colEnd ?? 0, o3?.max ?? 0), rowEnd: Math.max(e3?.rowEnd ?? 0, t3?.max ?? 0) };
2082
- }, [d2]), L2 = k((e3, t3) => d2.getRowHeaders().hiddenHeadersAt(e3, t3), [d2]), B2 = k((e3, t3) => d2.getColumnHeaders().hiddenHeadersAt(e3, t3), [d2]), O2 = k((e3) => d2.getRange(e3, { ignoreHidden: true }).getMerges(), [d2]), W2 = k((e3) => {
2082
+ }, [d2]), V2 = k((e3, t3) => d2.getRowHeaders().hiddenHeadersAt(e3, t3), [d2]), L2 = k((e3, t3) => d2.getColumnHeaders().hiddenHeadersAt(e3, t3), [d2]), B2 = k((e3) => d2.getRange(e3, { ignoreHidden: true }).getMerges(), [d2]), O2 = k((e3) => {
2083
2083
  d2?.getSelection().setAdjusting(e3);
2084
- }, [d2]), U2 = k(async () => {
2084
+ }, [d2]), W2 = k(async () => {
2085
2085
  d2?.getSelection().setAdjusting(null);
2086
- const e3 = C2.getMode();
2087
- "formatPainter" === e3?.key && (await n2?.getCommand("pasteFormats")?.execute({}), C2.setMode(null));
2088
- }, [C2, v2, d2, n2]), _2 = ie(() => {
2089
- const e3 = C2.getMode();
2086
+ const e3 = y2.getMode();
2087
+ "formatPainter" === e3?.key && (await n2?.getCommand("pasteFormats")?.execute({}), y2.setMode(null));
2088
+ }, [y2, w2, d2, n2]), U2 = ie(() => {
2089
+ const e3 = y2.getMode();
2090
2090
  return "cut" === e3?.key || "copy" === e3?.key;
2091
- }, [C2]);
2091
+ }, [y2]);
2092
2092
  yt(d2?.getView(), { onMovableSelectionChange: () => {
2093
- A2(d2.getView().getMovableSelection().length > 0);
2093
+ M2(d2.getView().getMovableSelection().length > 0);
2094
2094
  } }), yt(d2?.getSelection(), { onChange(e3) {
2095
2095
  const t3 = d2.getSelection().getCoords();
2096
- q2(t3);
2096
+ v2(t3);
2097
2097
  } }), yt(d2, { onProtectionChange: () => {
2098
- R2(d2.getProtection().isLocked());
2098
+ T2(d2.getProtection().isLocked());
2099
2099
  } });
2100
- const { body: G2 = {} } = g2 || {}, Z2 = I(), j2 = o2.getLayout(), K2 = !(F2 && v2.ranges.length <= 1 && null === D2 && !T2 && (!C2.getMode() || _2)), { cursor: Y2, overlay: J2, onPointerDown: Q2 } = ye({ gridRef: c2, commands: n2, layout: j2, getCellCoordsAsRangeCoords: N2, selection: v2, fillHandleBorderColor: G2.fill, selectionBackgroundColor: u2 ? g2.selection.fill : g2.selectionInactive.fill, selectionBorderColor: u2 ? g2.selection.strokeFill : g2.selectionInactive.strokeFill, selectionRemoveBackgroundColor: u2 ? g2.selectionRemove.fill : g2.selectionInactive.fill, selectionRemoveBorderColor: u2 ? g2.selectionRemove.strokeFill : g2.selectionInactive.strokeFill, disableFillDrag: K2, disableMoveDrag: z2 || !(u2 && v2.ranges.length <= 1 && null === D2 && !T2), disableTouchSelection: E2, onSelectionChange: y2, onSelectionDragStart: W2, onSelectionDragEnd: U2, onMoveDragStart: (e3, t3, o3) => {
2101
- C2.setMode(to(0, o3));
2100
+ const { body: _2 = {} } = g2 || {}, G2 = I(), Z2 = o2.getLayout(), j2 = !(z2 && w2.ranges.length <= 1 && null === F2 && !b2 && (!y2.getMode() || U2)), { cursor: K2, overlay: Y2, onPointerDown: J2 } = ye({ gridRef: c2, commands: n2, layout: Z2, getCellCoordsAsRangeCoords: E2, selection: w2, fillHandleBorderColor: _2.fill, selectionBackgroundColor: u2 ? g2.selection.fill : g2.selectionInactive.fill, selectionBorderColor: u2 ? g2.selection.strokeFill : g2.selectionInactive.strokeFill, selectionRemoveBackgroundColor: u2 ? g2.selectionRemove.fill : g2.selectionInactive.fill, selectionRemoveBorderColor: u2 ? g2.selectionRemove.strokeFill : g2.selectionInactive.strokeFill, disableFillDrag: j2, disableMoveDrag: A2 || !(u2 && w2.ranges.length <= 1 && null === F2 && !b2), disableTouchSelection: D2, onSelectionChange: q2, onSelectionDragStart: O2, onSelectionDragEnd: W2, onMoveDragStart: (e3, t3, o3) => {
2101
+ y2.setMode(to(0, o3));
2102
2102
  }, onMoveDragUpdate: (e3, t3, o3) => {
2103
- C2.setMode(to(0, o3));
2103
+ y2.setMode(to(0, o3));
2104
2104
  }, onMoveDragEnd: (e3, t3) => {
2105
- C2.setMode(null);
2105
+ y2.setMode(null);
2106
2106
  }, onMoveDragDone: async (e3, t3, o3) => {
2107
2107
  if (oe.isEqualRanges(e3, t3)) return;
2108
2108
  const n3 = d2.getRange(t3);
2109
- if (Z2?.showOptions) {
2109
+ if (G2?.showOptions) {
2110
2110
  const t4 = n3.getDifferences(e3);
2111
2111
  let o4 = false;
2112
2112
  const l4 = t4.getCount();
2113
2113
  for (let e4 = 0; !o4 && e4 < l4; e4++) o4 = t4.at(e4).isContentful();
2114
2114
  if (o4) {
2115
- if ("Replace" !== await Z2?.showOptions({ title: "Confirm", description: "There is already data here. Do you want to replace it?", options: ["Replace", "Cancel"], defaultOption: "Replace" })) return;
2115
+ if ("Replace" !== await G2?.showOptions({ title: "Confirm", description: "There is already data here. Do you want to replace it?", options: ["Replace", "Cancel"], defaultOption: "Replace" })) return;
2116
2116
  }
2117
2117
  }
2118
- const l3 = !o3.ctrlKey, r3 = o3.shiftKey, i3 = r3 ? l3 ? "Insert Moved Cells" : "Insert Copied Cells" : l3 ? "Move Cells" : "Copy Cells", a3 = await Z2?.showBusy?.(i3);
2118
+ const l3 = !o3.ctrlKey, r3 = o3.shiftKey, i3 = r3 ? l3 ? "Insert Moved Cells" : "Insert Copied Cells" : l3 ? "Move Cells" : "Copy Cells", a3 = await G2?.showBusy?.(i3);
2119
2119
  try {
2120
2120
  const t4 = d2.getRange(e3);
2121
2121
  await n3.doBatch(async () => {
2122
2122
  r3 ? await n3.insertFrom(e3, { isCut: l3, undoRange: t4 }) : await n3.copyFrom(e3, { isCut: l3, undoRange: t4 }), t4.autoFit({ skipCustomSize: true, orientations: s.Orientations.Row, minContent: true }), n3.autoFit({ skipCustomSize: true, orientations: s.Orientations.Row, minContent: true });
2123
2123
  }, { description: i3, autoSelect: true });
2124
2124
  } catch (e4) {
2125
- Z2?.showError?.(e4);
2125
+ G2?.showError?.(e4);
2126
2126
  } finally {
2127
2127
  a3?.();
2128
2128
  }
2129
- }, contentfulCellFinder: P2, hiddenRowsAt: L2, hiddenColumnsAt: B2, mergedRanges: O2, getDataCoords: V2, canSelectionSpanMergedCells: (e3) => {
2129
+ }, contentfulCellFinder: N2, hiddenRowsAt: V2, hiddenColumnsAt: L2, mergedRanges: B2, getDataCoords: P2, canSelectionSpanMergedCells: (e3) => {
2130
2130
  const t3 = d2.getRange(e3);
2131
2131
  return t3.isEntireColumns() || t3.isEntireRows();
2132
2132
  }, onFill: async (e3, t3) => {
2133
- const o3 = "Auto Fill", n3 = await Z2?.showBusy?.(o3);
2133
+ const o3 = "Auto Fill", n3 = await G2?.showBusy?.(o3);
2134
2134
  try {
2135
2135
  await d2.doBatch(() => {
2136
2136
  d2.getRange(e3).autoFill(t3), d2.getRange(t3).autoFit({ orientations: s.Orientations.Row, skipCustomSize: true, minContent: true });
2137
2137
  }, { description: o3, autoSelect: true });
2138
2138
  } catch (e4) {
2139
- Z2?.showError?.(e4);
2139
+ G2?.showError?.(e4);
2140
2140
  } finally {
2141
- b2.current = null, n3?.();
2141
+ C2.current = null, n3?.();
2142
2142
  }
2143
2143
  }, onFillPreview: (e3, t3, n3) => {
2144
- if (c2.current && f2) {
2145
- C2.setMode(oo);
2144
+ if (c2.current && p2) {
2145
+ y2.setMode(oo);
2146
2146
  try {
2147
- b2.current?.direction !== n3 && (b2.current = null, d2.getRange(e3).autoFill(t3, { previewOnly: (e4) => {
2148
- b2.current = { callback: e4, direction: n3 };
2147
+ C2.current?.direction !== n3 && (C2.current = null, d2.getRange(e3).autoFill(t3, { previewOnly: (e4) => {
2148
+ C2.current = { callback: e4, direction: n3 };
2149
2149
  } }));
2150
- const l3 = b2.current?.callback?.(t3);
2150
+ const l3 = C2.current?.callback?.(t3);
2151
2151
  if (!l3 || l3.isEmpty()) return;
2152
2152
  const r3 = l3.toText();
2153
2153
  if (!r3) return;
2154
2154
  const i3 = oe.cellToRange(l3.getCoords()), a3 = o2.getRelativePointFromClient(0, 0);
2155
2155
  let c3 = 0, g3 = 0, u3 = $.Bottom;
2156
2156
  if (n3 === s.Direction.Down) {
2157
- c3 = j2.getColOffset(i3.colEnd + 1) - a3.x;
2158
- const e4 = j2.getRowOffset(i3.rowEnd), t4 = j2.getRowOffset(i3.rowEnd + 1);
2157
+ c3 = Z2.getColOffset(i3.colEnd + 1) - a3.x;
2158
+ const e4 = Z2.getRowOffset(i3.rowEnd), t4 = Z2.getRowOffset(i3.rowEnd + 1);
2159
2159
  g3 = t4 - (t4 - e4) / 2 - a3.y, u3 = $.Right;
2160
2160
  } else if (n3 === s.Direction.Right) {
2161
- g3 = j2.getRowOffset(i3.rowEnd + 1) - a3.y;
2162
- const e4 = j2.getColOffset(i3.colEnd), t4 = j2.getColOffset(i3.colEnd + 1);
2161
+ g3 = Z2.getRowOffset(i3.rowEnd + 1) - a3.y;
2162
+ const e4 = Z2.getColOffset(i3.colEnd), t4 = Z2.getColOffset(i3.colEnd + 1);
2163
2163
  c3 = t4 - (t4 - e4) / 2 - a3.x, u3 = $.Bottom;
2164
2164
  } else if (n3 === s.Direction.Up) {
2165
- c3 = j2.getColOffset(i3.colEnd + 1) - a3.x;
2166
- const e4 = j2.getRowOffset(i3.rowStart), t4 = j2.getRowOffset(i3.rowStart + 1);
2165
+ c3 = Z2.getColOffset(i3.colEnd + 1) - a3.x;
2166
+ const e4 = Z2.getRowOffset(i3.rowStart), t4 = Z2.getRowOffset(i3.rowStart + 1);
2167
2167
  g3 = t4 - (t4 - e4) / 2 - a3.y, u3 = $.Right;
2168
2168
  } else if (n3 === s.Direction.Left) {
2169
- g3 = j2.getRowOffset(i3.rowEnd + 1) - a3.y;
2170
- const e4 = j2.getColOffset(i3.colStart), t4 = j2.getColOffset(i3.colStart + 1);
2169
+ g3 = Z2.getRowOffset(i3.rowEnd + 1) - a3.y;
2170
+ const e4 = Z2.getColOffset(i3.colStart), t4 = Z2.getColOffset(i3.colStart + 1);
2171
2171
  c3 = t4 - (t4 - e4) / 2 - a3.x, u3 = $.Bottom;
2172
2172
  }
2173
- f2({ anchor: { x: c3, y: g3 }, display: r3, placement: u3 });
2173
+ p2({ anchor: { x: c3, y: g3 }, display: r3, placement: u3 });
2174
2174
  } catch (e4) {
2175
- Z2?.showError?.(e4);
2175
+ G2?.showError?.(e4);
2176
2176
  }
2177
2177
  }
2178
2178
  }, onFillDone: () => {
2179
- b2.current = null, C2.setMode(null), w2?.();
2180
- } }), ee2 = k((e3) => {
2181
- Q2(S.createSyntheticEvent(e3));
2182
- }, [Q2, D2]);
2179
+ C2.current = null, y2.setMode(null), f2?.();
2180
+ } }), Q2 = k((e3) => {
2181
+ J2(S.createSyntheticEvent(e3));
2182
+ }, [J2, F2]);
2183
2183
  ce(() => {
2184
2184
  const e3 = o2?.getStage();
2185
- if (e3) return e3.addEventListener("pointerdown", ee2), () => {
2186
- e3.removeEventListener("pointerdown", ee2);
2185
+ if (e3) return e3.addEventListener("pointerdown", Q2), () => {
2186
+ e3.removeEventListener("pointerdown", Q2);
2187
2187
  };
2188
2188
  }, [o2?.getStage()]);
2189
- const te2 = x(t2, () => ({}), []), ne2 = de(null);
2190
- return X("div", { className: De(l2, "sheet-selection", Xt), style: { position: "absolute", width: p2?.width, height: p2?.height, overflow: "hidden", pointerEvents: "none", willChange: "none" }, ref: ze([te2, ne2]), ...m2, children: J2(o2) });
2189
+ const ee2 = x(t2, () => ({}), []), te2 = de(null);
2190
+ return X("div", { className: De(l2, "sheet-selection", Xt), style: { position: "absolute", width: m2?.width, height: m2?.height, overflow: "hidden", pointerEvents: "none", willChange: "none" }, ref: ze([ee2, te2]), ...h2, children: Y2(o2) });
2191
2191
  })), lo = Object.freeze({ x: 0, y: 0, width: 0, height: 0 }), ro = { fireOnModelChange: false }, io = re(se((e2, t2) => {
2192
2192
  const { children: o2, view: n2, movable: l2, onRefLoad: r2, onRefUnload: i2, onHide: a2, onShow: s2, onUnFocus: d2, isDragging: c2, updateFrameBounds: g2, dragStart: u2, style: h2, disabled: m2, renderMovable: p2, ...f2 } = e2, [w2, v2] = ae(lo), [q2, y2] = ae(null), [C2, b2] = ae(false), S2 = de(null);
2193
2193
  ge(() => {
@@ -2355,7 +2355,7 @@ const Vt = (e2, t2, o2 = null) => {
2355
2355
  Ce2.current = true;
2356
2356
  const e3 = le.lazy(async () => {
2357
2357
  try {
2358
- const e4 = await import("./DyynNlEdsc5XrmrT.mjs");
2358
+ const e4 = await import("./oGAX8M1XYc2XuiQW.mjs");
2359
2359
  return Ce2.current = false, be2.current = true, S2([...b2]), e4;
2360
2360
  } catch (e4) {
2361
2361
  return console.warn(e4), _2.current?.(false), null;
@@ -3043,7 +3043,7 @@ const Vt = (e2, t2, o2 = null) => {
3043
3043
  return we(Qe, { ...l3, key: n3, bodyStyle: ve2, docTheme: s3.getTheme(), normalStyle: s3.getNormal(), showFormulas: ke2.isShowFormulas(), showZeros: ke2.isShowZeros(), onLinkMouseDown: a2, ...B2, value: r3 });
3044
3044
  }, [o2, _e2, ve2, Ke2, ke2?.isShowFormulas(), ke2.isShowZeros()]), To2 = ue((e3, t3) => {
3045
3045
  const { key: n3, ...l3 } = e3;
3046
- return [X(Bt, { ref: t3, getVisibleCells: ao2, sheet: o2, gridStyle: pe2, ...l3 }, `border-${n3}`), X(yo, { ref: t3, sheet: o2, commands: pt2, ...l3 }, `table-${n3}`), X(Co, { ref: t3, sheet: o2, ...l3 }, `spill-${n3}`), X(no, { ref: t3, sheet: o2, commands: pt2, onShowTooltip: K2, onCloseTooltip: se2, gridStyle: pe2, gridRef: xe2, editingCoords: Ke2, isActive: Ye2, ...l3 }, `selection-${n3}`), X(Kt, { ref: t3, sheet: o2, commands: pt2, gridStyle: pe2, element: et2, ...l3 }, `copy-paste-${n3}`), X(mo, { ref: t3, sheet: o2, commands: pt2, target: ut2, renderMovable: C2, movableProps: { onUnFocus: () => {
3046
+ return [X(Bt, { ref: t3, getVisibleCells: ao2, sheet: o2, gridStyle: pe2, ...l3 }, `border-${n3}`), X(yo, { ref: t3, sheet: o2, commands: pt2, ...l3 }, `table-${n3}`), X(Co, { ref: t3, sheet: o2, ...l3 }, `spill-${n3}`), X(no, { ref: t3, sheet: o2, commands: pt2, onShowTooltip: K2, onCloseTooltip: se2, gridStyle: pe2, gridRef: xe2, isActive: Ye2, ...l3 }, `selection-${n3}`), X(Kt, { ref: t3, sheet: o2, commands: pt2, gridStyle: pe2, element: et2, ...l3 }, `copy-paste-${n3}`), X(mo, { ref: t3, sheet: o2, commands: pt2, target: ut2, renderMovable: C2, movableProps: { onUnFocus: () => {
3047
3047
  jt2.current.focus();
3048
3048
  } }, ...l3 }, `movable-${n3}`), X(po, { ref: t3, sheet: o2, commands: pt2, gridStyle: pe2, getCellEditor: M2, showProtectedError: At2, setEditingCoords: Xe2, ...l3 }, `editor-${n3}`)];
3049
3049
  }, [o2, xe2.current, pe2, M2, pt2, Mt2]), [Ro2, Mo2] = ae(false), Ao2 = ie(() => {
@@ -3278,7 +3278,7 @@ const qn = (e2) => {
3278
3278
  return ie(() => e2 || t2, [e2]);
3279
3279
  }, Cn = "_script-editor_iy654_5", bn = { lightbulb: { enabled: false }, tabSize: 2, acceptSuggestionOnCommitCharacter: true, acceptSuggestionOnEnter: "on", accessibilitySupport: "auto", automaticLayout: true, autoIndent: false, codeLens: true, colorDecorators: true, contextmenu: true, cursorBlinking: "blink", cursorSmoothCaretAnimation: false, cursorStyle: "line", disableLayerHinting: false, disableMonospaceOptimizations: false, dragAndDrop: true, glyphMargin: true, fixedOverflowWidgets: false, folding: true, foldingStrategy: "auto", fontLigatures: false, formatOnPaste: true, formatOnType: false, hideCursorInOverviewRuler: false, highlightActiveIndentGuide: true, links: true, lineDecorationsWidth: 8, lineNumbersMinChars: 3, mouseWheelZoom: false, multiCursorMergeOverlapping: true, multiCursorModifier: "alt", overviewRulerBorder: true, overviewRulerLanes: 2, quickSuggestions: true, quickSuggestionsDelay: 100, readOnly: false, renderControlCharacters: false, renderFinalNewline: true, renderIndentGuides: true, renderLineHighlight: "all", renderWhitespace: "none", revealHorizontalRightPadding: 30, roundedSelection: true, rulers: [], scrollBeyondLastColumn: 5, scrollBeyondLastLine: true, selectOnLineNumbers: true, selectionClipboard: true, selectionHighlight: true, showLightbulbIconMode: false, showFoldingControls: "mouseover", smoothScrolling: true, suggestOnTriggerCharacters: true, wordBasedSuggestions: true, wordSeparators: `~!@#$%^&*()-=+[{]}|;:'",.<>/?`, wordWrap: "off", wordWrapBreakAfterCharacters: " })]?|&,;", wordWrapBreakBeforeCharacters: "{([+", wordWrapBreakObtrusiveCharacters: ".", wordWrapColumn: 80, wordWrapMinified: true, wrappingIndent: "none" }, Sn = le.lazy(() => import("@monaco-editor/react"));
3280
3280
  let xn, kn, Tn = ["define", "require"], Rn = false;
3281
- let Mn = "@0.7.19";
3281
+ let Mn = "@0.7.20";
3282
3282
  "@local" !== Mn && "@0.0.0" !== Mn || (Mn = "");
3283
3283
  const An = `https://cdn.jsdelivr.net/npm/@sheetxl/sdk${Mn}/types/scripting.d.ts`, zn = async (e2, t2, o2) => {
3284
3284
  const n2 = e2.getModel();
@@ -3564,7 +3564,7 @@ const Hn = re(se((e2, t2) => {
3564
3564
  }
3565
3565
  }
3566
3566
  }
3567
- const e3 = C2?.getScripts().getModules().getByName("scripts")?.getSource() ?? "";
3567
+ const e3 = C2?.getScripts().getModules()?.getByName("scripts")?.getSource() ?? "";
3568
3568
  return Y("div", { style: { display: "flex", flex: "1 1 100%", width: "100%", flexDirection: "row", position: "relative", boxSizing: "border-box" }, children: [X(fe, { children: X(Sn, { theme: i2 ? "extended-dark" : "extended", options: { ...bn, fixedOverflowWidgets: true, readOnly: r2 }, language: "typescript", value: e3, onValidate: (e4) => {
3569
3569
  let t3 = false;
3570
3570
  const o3 = e4 ? e4.length : 0;
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.7.19
2
+ * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.7.20
3
3
  *
4
4
  * (C) 2025-present SheetXL Inc. & Michael T. Ford
5
5
  * License: The license can be found at https://www.sheetxl.com/license.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@sheetxl/react",
3
3
  "description": "React - React components needed to build advanced grid and spreadsheet UIs.",
4
- "version": "0.7.19",
4
+ "version": "0.7.20",
5
5
  "license": "SEE LICENSE IN <LICENSE>",
6
6
  "type": "module",
7
7
  "exports": {
@@ -49,10 +49,10 @@
49
49
  "@dnd-kit/sortable": "^10.0.0",
50
50
  "@dnd-kit/utilities": "^3.2.2",
51
51
  "@monaco-editor/react": "^4.6.0",
52
- "@sheetxl/grid-react": "^0.7.19",
53
- "@sheetxl/sdk": "^0.7.19",
54
- "@sheetxl/utils": "^0.7.19",
55
- "@sheetxl/utils-react": "^0.7.19",
52
+ "@sheetxl/grid-react": "^0.7.20",
53
+ "@sheetxl/sdk": "^0.7.20",
54
+ "@sheetxl/utils": "^0.7.20",
55
+ "@sheetxl/utils-react": "^0.7.20",
56
56
  "clsx": "^2.1.1",
57
57
  "monaco-editor-auto-typings": "^0.4.6",
58
58
  "react-merge-refs": "^3.0.2",
package/types/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { AnchorLocation } from '@sheetxl/utils';
2
2
  import { Bounds } from '@sheetxl/utils';
3
3
  import { CellEditorProps } from '@sheetxl/grid-react';
4
- import { CellEditorRefAttribute } from '@sheetxl/grid-react';
5
4
  import { CellLayout } from '@sheetxl/utils-react';
6
5
  import { CellRendererProps } from '@sheetxl/grid-react';
7
6
  import { CommandButtonProps } from '@sheetxl/utils-react';
@@ -20,6 +19,7 @@ import { GridView } from '@sheetxl/grid-react';
20
19
  import { IAutoFilter } from '@sheetxl/sdk';
21
20
  import { IBorder } from '@sheetxl/sdk';
22
21
  import { ICell } from '@sheetxl/sdk';
22
+ import { ICellEditorElement } from '@sheetxl/grid-react';
23
23
  import { ICellRange } from '@sheetxl/sdk';
24
24
  import { ICellRanges } from '@sheetxl/sdk';
25
25
  import { IChart } from '@sheetxl/sdk';
@@ -304,7 +304,7 @@ export declare interface DocThemesProviderProps {
304
304
  children: default_2.ReactElement<any, string | default_2.JSXElementConstructor<any>>;
305
305
  }
306
306
 
307
- export declare const EditableLabel: default_2.FC<EditableLabelProps & EditableLabelRefAttribute>;
307
+ export declare const EditableLabel: default_2.NamedExoticComponent<Omit<EditableLabelProps, "ref"> & default_2.RefAttributes<IEditableLabelElement>>;
308
308
 
309
309
  export declare interface EditableLabelAttributes {
310
310
  startEdit(): void;
@@ -322,11 +322,11 @@ export declare interface EditableLabelProps extends Omit<default_2.HTMLAttribute
322
322
  onSubmit?: (value: string) => boolean | void;
323
323
  onCancel?: () => void;
324
324
  createInput?: (props: any) => default_2.ReactElement<HTMLInputElement>;
325
- }
326
-
327
- export declare type EditableLabelRefAttribute = {
325
+ /**
326
+ * Reference to the HTMLInputElement (or other) used for editing
327
+ */
328
328
  ref?: default_2.Ref<IEditableLabelElement>;
329
- };
329
+ }
330
330
 
331
331
  export declare interface EditorStateAndCoords<CT, DT> {
332
332
  sheet: ISheet;
@@ -444,7 +444,11 @@ export declare interface IFrameContainerListener {
444
444
  export declare interface IMovableAreaElement extends HTMLDivElement, MovableAreaAttributes {
445
445
  }
446
446
 
447
- export declare interface IPictureEditorElement extends HTMLDivElement, PictureEditorAttributes {
447
+ export declare interface IPictureEditorAttributes {
448
+ isPictureEditor: () => true;
449
+ }
450
+
451
+ export declare interface IPictureEditorElement extends HTMLDivElement, IPictureEditorAttributes {
448
452
  }
449
453
 
450
454
  /**
@@ -579,16 +583,56 @@ export declare namespace IScriptEditor {
579
583
  export declare interface IScriptEditorElement extends ScriptEditorAttributes, HTMLDivElement {
580
584
  }
581
585
 
586
+ /**
587
+ * Attributes and methods available on the sheet element beyond the HTMLDivElement.
588
+ */
589
+ export declare type ISheetAttributes = {
590
+ getGridElement: () => IGridElement;
591
+ getRowHeaderElement: () => ISheetHeaderElement;
592
+ getColumnHeaderElement: () => ISheetHeaderElement;
593
+ rowHeaderHeight: () => number;
594
+ colHeaderWidth: () => number;
595
+ startEdit(event?: StartEditEvent): void;
596
+ submitEdit(): void;
597
+ cancelEdit(): void;
598
+ isEditing: boolean;
599
+ contains(element: Node | null): boolean;
600
+ invalidate: (coords?: ICell.Coords | null) => void;
601
+ /**
602
+ * Focus the sheet
603
+ */
604
+ focusSheet(options?: FocusOptions): void;
605
+ /**
606
+ * Focus a specific float.
607
+ * If not provided will focus the first selected float.
608
+ *
609
+ * @remarks
610
+ * The focusMovable does not scroll.
611
+ * TODO - have this honor focus scroll options.
612
+ */
613
+ focusMovable(movable?: IMovable): Promise<boolean>;
614
+ getSheet: () => ISheet;
615
+ /**
616
+ * For runtime introspection
617
+ */
618
+ isSheetElement: () => true;
619
+ };
620
+
582
621
  /**
583
622
  * Type returned via ref property
584
623
  */
585
- export declare interface ISheetElement extends HTMLDivElement, SheetAttributes {
624
+ export declare interface ISheetElement extends HTMLDivElement, ISheetAttributes {
586
625
  }
587
626
 
627
+ declare type ISheetHeaderAttributes = {
628
+ forceRender: () => void;
629
+ getGridElement: () => IGridElement;
630
+ };
631
+
588
632
  /**
589
633
  * Type returned via ref property
590
634
  */
591
- declare interface ISheetHeaderElement extends HTMLDivElement, SheetHeaderAttributes {
635
+ declare interface ISheetHeaderElement extends HTMLDivElement, ISheetHeaderAttributes {
592
636
  }
593
637
 
594
638
  export declare interface ITaskPaneArea {
@@ -778,10 +822,6 @@ export declare const PictureEditor: default_2.FC<PictureEditorProps & {
778
822
  ref?: default_2.Ref<IPictureEditorElement>;
779
823
  }>;
780
824
 
781
- export declare interface PictureEditorAttributes {
782
- isPictureEditor: () => true;
783
- }
784
-
785
825
  export declare interface PictureEditorProps extends MovableElementProps {
786
826
  /**
787
827
  * The underlying model for the picture.
@@ -908,43 +948,11 @@ declare interface SelectedRange {
908
948
  cell?: ICell.Address;
909
949
  }
910
950
 
911
- export declare type SheetAttributes = {
912
- getGridElement: () => IGridElement;
913
- getRowHeaderElement: () => ISheetHeaderElement;
914
- getColumnHeaderElement: () => ISheetHeaderElement;
915
- rowHeaderHeight: () => number;
916
- colHeaderWidth: () => number;
917
- startEdit(event?: StartEditEvent): void;
918
- submitEdit(): void;
919
- cancelEdit(): void;
920
- isEditing: boolean;
921
- contains(element: Node | null): boolean;
922
- invalidate: (coords?: ICell.Coords | null) => void;
923
- /**
924
- * Focus the sheet
925
- */
926
- focusSheet(options?: FocusOptions): void;
927
- /**
928
- * Focus a specific float.
929
- * If not provided will focus the first selected float.
930
- *
931
- * @remarks
932
- * The focusMovable does not scroll.
933
- * TODO - have this honor focus scroll options.
934
- */
935
- focusMovable(movable?: IMovable): Promise<boolean>;
936
- getSheet: () => ISheet;
937
- /**
938
- * For runtime introspection
939
- */
940
- isSheetElement: () => true;
941
- };
942
-
943
951
  /**
944
952
  * SheetCellEditor
945
953
  * Controlled cell editor for updating state.
946
954
  */
947
- export declare const SheetCellEditor: default_2.FC<SheetCellEditorProps & CellEditorRefAttribute>;
955
+ export declare const SheetCellEditor: default_2.NamedExoticComponent<Omit<SheetCellEditorProps, "ref"> & default_2.RefAttributes<ICellEditorElement>>;
948
956
 
949
957
  export declare interface SheetCellEditorProps extends CellEditorProps<() => ICell, string> {
950
958
  /**
@@ -1080,12 +1088,7 @@ export declare interface SheetCopyPasteResults extends CopyPasteResults {
1080
1088
  * UI representation for ISheet.
1081
1089
  *
1082
1090
  */
1083
- export declare const SheetElement: default_2.FC<SheetProps & SheetRefAttribute>;
1084
-
1085
- declare type SheetHeaderAttributes = {
1086
- forceRender: () => void;
1087
- getGridElement: () => IGridElement;
1088
- };
1091
+ export declare const SheetElement: default_2.NamedExoticComponent<Omit<SheetProps, "ref"> & default_2.RefAttributes<ISheetElement>>;
1089
1092
 
1090
1093
  /**
1091
1094
  * TODO - We may not need the grid ref if we use the headers directly to measure.
@@ -1167,6 +1170,10 @@ declare interface SheetHeaderProps extends default_2.HTMLAttributes<HTMLDivEleme
1167
1170
  * Callback when selection is manually changed
1168
1171
  */
1169
1172
  onSelectionEnd?: () => void;
1173
+ /**
1174
+ * Ref for the HTMLDivElement
1175
+ */
1176
+ ref?: default_2.Ref<ISheetHeaderElement>;
1170
1177
  }
1171
1178
 
1172
1179
  export declare interface SheetLocation {
@@ -1183,8 +1190,17 @@ export declare interface SheetPasteOptions extends ReferenceableClipboard.PasteO
1183
1190
  }
1184
1191
 
1185
1192
  export declare interface SheetProps extends React.HTMLAttributes<HTMLDivElement> {
1193
+ /**
1194
+ * The `ISheet` to render.
1195
+ */
1186
1196
  sheet: ISheet;
1197
+ /**
1198
+ * Style used for grid
1199
+ */
1187
1200
  gridStyle?: GridStyle;
1201
+ /**
1202
+ * Style used for headers
1203
+ */
1188
1204
  headersStyle?: GridStyle;
1189
1205
  /**
1190
1206
  * Fire when a contentMenu is requested
@@ -1232,7 +1248,7 @@ export declare interface SheetProps extends React.HTMLAttributes<HTMLDivElement>
1232
1248
  * This should not return null but rather can canEdit.
1233
1249
  * This is called during placement after scrolling and other bookkeeping has occurred
1234
1250
  */
1235
- getCellEditor?: (props: CellEditorProps<() => ICell, string> & CellEditorRefAttribute, coords: ICell.Coords) => React.ReactElement<CellEditorProps<() => ICell, string> & CellEditorRefAttribute>;
1251
+ getCellEditor?: (props: CellEditorProps<() => ICell, string>, coords: ICell.Coords) => React.ReactElement<CellEditorProps<() => ICell, string>>;
1236
1252
  /**
1237
1253
  * Parent commands for the sheet
1238
1254
  */
@@ -1275,22 +1291,16 @@ export declare interface SheetProps extends React.HTMLAttributes<HTMLDivElement>
1275
1291
  gridProps: GridProps;
1276
1292
  /**
1277
1293
  * Allow for custom rendering of cell props.
1294
+ *
1278
1295
  * @remarks
1279
1296
  * This is used to customize filterButton popup action and any other customizations desired.
1280
1297
  * This does not invalidate the rendering
1281
1298
  */
1282
1299
  cellRenderProps: Partial<SheetCellRendererProps>;
1283
- }
1284
-
1285
- export declare type SheetRefAttribute = {
1300
+ /**
1301
+ * Ref to the sheet element.
1302
+ */
1286
1303
  ref?: React.Ref<ISheetElement>;
1287
- };
1288
-
1289
- /**
1290
- * For elements that also need the ref. Less common but some factory renderers
1291
- */
1292
- export declare interface SheetRefProps extends SheetProps {
1293
- ref?: React.Ref<HTMLDivElement>;
1294
1304
  }
1295
1305
 
1296
1306
  export declare const SheetScrollbar: default_2.NamedExoticComponent<SheetScrollbarProps & default_2.RefAttributes<HTMLDivElement>>;
@@ -1391,6 +1401,9 @@ export declare interface TabProps extends Omit<default_2.HTMLAttributes<HTMLElem
1391
1401
  dragging: boolean;
1392
1402
  }
1393
1403
 
1404
+ /**
1405
+ * TabStrip component for displaying and managing tabs.
1406
+ */
1394
1407
  export declare const TabStrip: default_2.NamedExoticComponent<TabStripProps & default_2.RefAttributes<TabStripRef>>;
1395
1408
 
1396
1409
  export declare interface TabStripProps extends Omit<default_2.HTMLAttributes<HTMLDivElement>, "onSubmit" | "onChange"> {
@@ -1483,12 +1496,12 @@ export declare interface TaskPaneAreaProps<T = any> extends default_2.HTMLAttrib
1483
1496
  * @remarks
1484
1497
  * If the registry also provides a custom title renderer that will be used instead.
1485
1498
  */
1486
- renderTaskPanelTitle?(props: TaskPaneTitleProps, ref: default_2.Ref<HTMLDivElement>): default_2.ReactElement;
1499
+ renderTaskPanelTitle?(props: TaskPaneTitleProps): default_2.ReactElement;
1487
1500
  /**
1488
1501
  * Override the default task pane strip renderer.
1489
1502
  *
1490
1503
  */
1491
- renderTaskPaneStrip?(props: TaskPaneStripProps, ref: default_2.Ref<ITaskPaneStrip>): default_2.ReactElement;
1504
+ renderTaskPaneStrip?(props: TaskPaneStripProps): default_2.ReactElement;
1492
1505
  /**
1493
1506
  * Allow for custom registry of task panes.
1494
1507
  */
@@ -1540,7 +1553,7 @@ export declare interface TaskPaneEntry {
1540
1553
  /**
1541
1554
  * Optional function to render a custom title for the task pane.
1542
1555
  */
1543
- renderTaskPanelTitle?(props: TaskPaneTitleProps, ref: React.Ref<HTMLDivElement>): React.ReactElement;
1556
+ renderTaskPanelTitle?(props: TaskPaneTitleProps): React.ReactElement;
1544
1557
  createCommand?(taskPaneArea: ITaskPaneArea): ICommand;
1545
1558
  /**
1546
1559
  * Optional function to create a button that can be placed in the command bar.
@@ -1594,7 +1607,7 @@ declare class TaskPaneRegistry implements ITaskPaneRegistry {
1594
1607
  findContributions(contributionKey: string): TaskPaneEntry[];
1595
1608
  }
1596
1609
 
1597
- export declare const TaskPaneStrip: default_2.NamedExoticComponent<TaskPaneStripProps & default_2.RefAttributes<ITaskPaneStrip>>;
1610
+ export declare const TaskPaneStrip: default_2.NamedExoticComponent<Omit<TaskPaneStripProps, "ref"> & default_2.RefAttributes<ITaskPaneStrip>>;
1598
1611
 
1599
1612
  export declare interface TaskPaneStripAttributes {
1600
1613
  isTaskPaneStrip: () => true;
@@ -1612,6 +1625,10 @@ export declare interface TaskPaneStripProps extends Omit<default_2.HTMLAttribute
1612
1625
  * If true, only show icons in the strip (no text).
1613
1626
  */
1614
1627
  iconsOnly?: boolean;
1628
+ /**
1629
+ * Ref to the task pane strip element.
1630
+ */
1631
+ ref?: default_2.Ref<ITaskPaneStrip>;
1615
1632
  }
1616
1633
 
1617
1634
  export declare const TaskPaneTitle: default_2.FC<TaskPaneTitleProps & {
@@ -1627,6 +1644,10 @@ export declare interface TaskPaneTitleProps extends Omit<default_2.HTMLAttribute
1627
1644
  * If the task pane is focused
1628
1645
  */
1629
1646
  focused: boolean;
1647
+ /**
1648
+ * Reference to the underlying element.
1649
+ */
1650
+ ref?: default_2.Ref<HTMLDivElement>;
1630
1651
  }
1631
1652
 
1632
1653
  declare interface Theme {
@@ -1679,7 +1700,14 @@ export declare const useDocThemes: () => IThemeCollection;
1679
1700
  */
1680
1701
  export declare const useModelListener: <SOURCE, EVENTS>(source: IListener.ISource<SOURCE>, listeners: IListener.Callbacks<SOURCE, EVENTS>, options?: useModelListenerOptions) => void;
1681
1702
 
1682
- export declare interface useModelListenerOptions extends IListener.Options {
1703
+ /**
1704
+ * Options for `useModelListener` hook.
1705
+ *
1706
+ * @remarks
1707
+ * This is extends IListener.Options but removes 'once' since hooks are
1708
+ * evaluated on render and adds a `fireOnModelChange` option.
1709
+ */
1710
+ export declare interface useModelListenerOptions extends Omit<IListener.Options, 'once'> {
1683
1711
  /**
1684
1712
  * If `true` (default), fires all listeners once immediately when the component mounts
1685
1713
  * or when the source changes, allowing initialization based on current model state.