@sheetxl/react 0.6.9 → 0.6.11

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.6.9
2
+ * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.6.11
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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.6.9
2
+ * @license @sheetxl/react - React - React components needed to build advanced grid and spreadsheet UIs. - v0.6.11
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.
@@ -1054,8 +1054,8 @@ Continue?`, options: ["Convert", "Cancel"], defaultOption: "Convert" })) return;
1054
1054
  }), new R("formatNumberFormatDecreaseDecimal", p2, { label: "Decrease Decimal", description: "Show few decimal places." }, function() {
1055
1055
  Q2(this, (e3) => ({ numberFormat: t.Parser.adjustDecimalPlaces(e3.getNumberFormat(), -1) }));
1056
1056
  }), new R("displayPlaceholdersToggle", p2, { label: "Display Placeholders", description: "Switch between hiding objects, displaying objects, and displaying placeholders for objects.", shortcut: { key: "6", modifiers: [M.Ctrl] } }), new k("noOp", p2, { label: "Do nothing", description: "Do Nothing.", shortcut: { key: "7", modifiers: [M.Ctrl] } }, function() {
1057
- }), new R("displayOutlineSymbolsToggle", p2, { label: "Display Outline Symbols", description: "Display or hide the outline symbols.", shortcut: { key: "8", modifiers: [M.Ctrl] } }), new R("hideRows", p2, { label: "Hide Rows", description: "Hide the rows.", shortcut: { key: "9", modifiers: [M.Ctrl] } }), new R("unhideRows", p2, { label: "Unhide Rows", description: "Unhide the rows.", shortcut: { key: "(", modifiers: [M.Ctrl, M.Shift] } }), new R("hideColumns", p2, { label: "Hide Columns", description: "Hide the columns.", shortcut: [{ key: "0", modifiers: [M.Ctrl] }, { key: "0", modifiers: [M.Ctrl, M.Alt] }] }), new R("unhideColumns", p2, { label: "Unhide Columns", description: "Unhide the columns.", shortcut: { key: ")", modifiers: [M.Ctrl, M.Shift] } }), new k("calculate", p2, { label: "Calculate Sheet", description: "Recalculate the formulas on the current sheet.", shortcut: { key: "=", modifiers: [M.Ctrl] } }), new R("insertFunction", p2, { label: "Insert Function", disabled: true, scopedLabels: { insert: "Function", insertFunction: "More Functions..." }, description: "Work with the function in the current cell.", shortcut: { key: "F3", modifiers: [M.Shift] } }, function(e3, t2) {
1058
- console.log("insertFunction");
1057
+ }), new R("displayOutlineSymbolsToggle", p2, { label: "Display Outline Symbols", description: "Display or hide the outline symbols.", shortcut: { key: "8", modifiers: [M.Ctrl] } }), new R("hideRows", p2, { label: "Hide Rows", description: "Hide the rows.", shortcut: { key: "9", modifiers: [M.Ctrl] } }), new R("unhideRows", p2, { label: "Unhide Rows", description: "Unhide the rows.", shortcut: { key: "(", modifiers: [M.Ctrl, M.Shift] } }), new R("hideColumns", p2, { label: "Hide Columns", description: "Hide the columns.", shortcut: [{ key: "0", modifiers: [M.Ctrl] }, { key: "0", modifiers: [M.Ctrl, M.Alt] }] }), new R("unhideColumns", p2, { label: "Unhide Columns", description: "Unhide the columns.", shortcut: { key: ")", modifiers: [M.Ctrl, M.Shift] } }), new k("calculate", p2, { label: "Calculate Sheet", description: "Recalculate the formulas on the current sheet.", shortcut: { key: "=", modifiers: [M.Ctrl] } }), new R("insertFunction", p2, { label: "Insert Function", disabled: true, scopedLabels: { insert: "Function", insertFunction: "More Functions..." }, description: "Work with the function in the current cell.", shortcut: { key: "F3", modifiers: [M.Shift] } }, function(e3) {
1058
+ e3 && me2(this, e3.getName());
1059
1059
  }), new R("insertFunctionSum", p2, { label: "Quick Sum", scopedLabels: { insertFunction: "Sum" }, description: "Quick sum of the cells.", shortcut: { key: "=", modifiers: [M.Alt] } }, function() {
1060
1060
  me2(this, "SUM");
1061
1061
  }), new R("insertFunctionAverage", p2, { label: "Quick Average", scopedLabels: { insertFunction: "Average" }, description: "Quick average of the cells." }, function() {
@@ -2054,7 +2054,7 @@ const Rt = (e2, t2, o2 = null) => {
2054
2054
  v2 && !S2?.current?.contains(e3.relatedTarget) && y2(null), e3.relatedTarget && b2(false);
2055
2055
  }, ...f2, children: x2 });
2056
2056
  })), Kt = "_movable-area_314c6_5", Xt = ee(ne((e2, t2) => {
2057
- const { view: o2, movables: n2, movablesView: l2, renderMovable: r2, transactional: i2, onUnFocus: a2, onFocus: s2, disabled: d2 = false, disableDrag: c2 = false, disableResize: g2 = false, className: u2, style: h2, renderDirections: m2 = ["nw", "n", "ne", "w", "e", "sw", "s", "se"], onFirstRender: p2, ...f2 } = e2, q2 = o2.getBounds(), v2 = S(p2, [p2]), y2 = S(a2, [a2]), C2 = S(s2, [s2]), [k2, R2] = oe([]), [M2, T2] = oe(false), [A2, z2] = oe(false), F2 = le(true), E2 = le(/* @__PURE__ */ new Map()), D2 = le(/* @__PURE__ */ new Map()), I2 = le(/* @__PURE__ */ new Map()), N2 = le(/* @__PURE__ */ new Map()), V2 = le(/* @__PURE__ */ new Map()), L2 = le({ onRequestFocus: (e3) => (ge2(e3), null) }), H2 = le(null), B2 = le(null), O2 = le(null), [P2, $2] = se((e3) => e3 + 1, 0);
2057
+ const { view: o2, movables: n2, movablesView: l2, renderMovable: r2, transactional: i2, onUnFocus: a2, onFocus: s2, disabled: d2 = false, disableDrag: c2 = false, disableResize: g2 = false, className: u2, style: h2, renderDirections: m2 = ["nw", "n", "ne", "w", "e", "sw", "s", "se"], onFirstRender: p2, ...f2 } = e2, q2 = o2.getBounds(), v2 = S(p2, [p2]), y2 = S(a2, [a2]), C2 = S(s2, [s2]), [k2, R2] = oe([]), [M2, T2] = oe(false), [A2, z2] = oe(false), F2 = le(true), E2 = le(/* @__PURE__ */ new Map()), D2 = le(/* @__PURE__ */ new Map()), I2 = le(/* @__PURE__ */ new Map()), N2 = le(/* @__PURE__ */ new Map()), V2 = le(/* @__PURE__ */ new Map()), L2 = le({ onRequestFocus: (e3) => (ue2(e3), null) }), H2 = le(null), B2 = le(null), O2 = le(null), [P2, $2] = se((e3) => e3 + 1, 0);
2058
2058
  ie(() => {
2059
2059
  $2();
2060
2060
  }, [o2, n2]), Ct(n2, { onCollectionChange: () => {
@@ -2087,25 +2087,25 @@ const Rt = (e2, t2, o2 = null) => {
2087
2087
  if (!n3) return;
2088
2088
  -1 !== t3.indexOf(o3) && e3.push(n3);
2089
2089
  }), R2((t4) => K.isEqualArrays(t4, e3) ? t4 : e3);
2090
- }, _2 = le(null), j2 = te(() => new Promise((e3) => {
2090
+ }, _2 = le(null), j2 = le(null), X2 = te(() => (j2.current || (j2.current = new Promise((e3) => {
2091
2091
  _2.current = e3;
2092
- }), []), X2 = le(null), Y2 = S(async (e3, t3) => {
2093
- X2.current = t3;
2094
- await (async () => !(!await j2.then() || !O2.current))() && X2.current === t3 && O2.current.dragStart(e3, t3);
2095
- }, [k2]), [J2, ee2] = oe(false), ne2 = le(null), ce2 = le(null), ge2 = S(async (e3 = null) => {
2092
+ })), j2.current), []), Y2 = le(null), J2 = S(async (e3, t3) => {
2093
+ Y2.current = t3;
2094
+ await (async () => !(!await X2.then() || !O2.current))() && Y2.current === t3 && O2.current.dragStart(e3, t3);
2095
+ }, [k2]), [ee2, ne2] = oe(false), ce2 = le(null), ge2 = le(null), ue2 = S(async (e3 = null) => {
2096
2096
  if (e3 || (e3 = l2.getMovableSelection()[0]), !e3) return y2?.(), false;
2097
2097
  const t3 = I2.current.get(e3);
2098
- t3 ? (await K.whenFocus(t3), t3.focus(), ce2.current = t3, ne2.current = null) : ne2.current = e3;
2098
+ t3 ? (await K.whenFocus(t3), t3.focus(), ge2.current = t3, ce2.current = null) : ce2.current = e3;
2099
2099
  }, [l2]);
2100
2100
  re(() => {
2101
- J2 && k2.length > 0 && ce2.current !== k2[0] && ge2(), F2.current && (v2?.(), F2.current = false);
2101
+ ee2 && k2.length > 0 && ge2.current !== k2[0] && ue2(), F2.current && (v2?.(), F2.current = false);
2102
2102
  }, [k2]);
2103
- const ue2 = te(() => {
2103
+ const he2 = te(() => {
2104
2104
  const e3 = n2.getItems({ address: o2.getVisibleRangeCoords(), excludeHidden: true });
2105
2105
  if (0 === e3.length && 0 === E2.current.size) return null;
2106
2106
  const t3 = (t4, n3, l3, i4 = true) => {
2107
2107
  const a4 = t4.isSelected(), s4 = { tabIndex: l3, view: o2, movable: t4, onRefLoad: (e4) => {
2108
- ne2.current === t4 && (e4.focus(), ce2.current = e4, ne2.current = null), I2.current.set(t4, e4), D2.current.set(e4, t4), n3.rendered = true, U2();
2108
+ ce2.current === t4 && (e4.focus(), ge2.current = e4, ce2.current = null), I2.current.set(t4, e4), D2.current.set(e4, t4), n3.rendered = true, U2();
2109
2109
  }, onRefUnload: (e4) => {
2110
2110
  I2.current.delete(t4), D2.current.delete(e4), n3.rendered = false, U2();
2111
2111
  }, onUnFocus: y2, onHide: (e4) => {
@@ -2114,13 +2114,13 @@ const Rt = (e2, t2, o2 = null) => {
2114
2114
  n3.onShow = e4;
2115
2115
  }, isDragging: a4 && (A2 || M2), disabled: d2, renderMovable: r2, updateFrameBounds: (e4) => {
2116
2116
  W2(t4, e4);
2117
- }, dragStart: Y2, onMouseUp: () => {
2118
- if (X2.current = null, B2.current) {
2117
+ }, dragStart: J2, onMouseUp: () => {
2118
+ if (Y2.current = null, B2.current) {
2119
2119
  T2(false), z2(false);
2120
2120
  let e4 = false;
2121
2121
  N2.current?.forEach((t5) => {
2122
2122
  K.isEqualBounds(t5.movable.getBounds(), t5.startBounds) || (e4 = true);
2123
- }), e4 ? me2() : pe2();
2123
+ }), e4 ? pe2() : fe2();
2124
2124
  }
2125
2125
  }, style: { opacity: i4 ? M2 && a4 ? 0.7 : void 0 : 0, zIndex: M2 && a4 ? t4.getZIndex() + e3.length : void 0, pointerEvents: i4 ? void 0 : "none", cursor: A2 && a4 ? "grabbing" : d2 || c2 ? "initial" : "move", boxShadow: !a4 || A2 && !M2 ? void 0 : "1px 1px 2px 2px rgba(0,0,0,.15)" } };
2126
2126
  return G(jt, { ...s4 }, `movable-${t4.getUUID()}`);
@@ -2151,50 +2151,50 @@ const Rt = (e2, t2, o2 = null) => {
2151
2151
  }), i3.forEach((e4, o3) => {
2152
2152
  e4.frame = t3(o3, e4, -1, false), g3.push(e4.frame), e4.doHide(o3, e4), i3.delete(o3), a3.set(o3, e4);
2153
2153
  }), E2.current = a3, U2(), [...g3, ...s3];
2154
- }, [P2, o2, r2, d2, c2, g2, M2, A2]), he2 = S((e3, t3) => {
2154
+ }, [P2, o2, r2, d2, c2, g2, M2, A2]), me2 = S((e3, t3) => {
2155
2155
  const n3 = `${t3} ${1 === k2.length ? w.capitalize(D2.current?.get(k2[0]).getContent().getType()) : "Drawings"}`;
2156
2156
  B2.current && (console.warn(`Transaction ${B2.current.getDescription()} is being replaced by ${n3}`), B2.current.rollback(), B2.current = null), B2.current = i2.beginCommit({ description: n3 }), N2.current.clear();
2157
2157
  for (let e4 = 0; e4 < k2.length; e4++) {
2158
2158
  const t4 = k2[e4], n4 = D2.current?.get(t4);
2159
2159
  n4 ? N2.current.set(t4, { movable: n4, startBounds: o2.toViewBounds(n4.getBounds()) }) : console.warn("invalid element", n4);
2160
2160
  }
2161
- }, [i2, o2, k2]), me2 = ae(() => {
2161
+ }, [i2, o2, k2]), pe2 = ae(() => {
2162
2162
  if (!B2.current) return;
2163
2163
  const e3 = [];
2164
2164
  N2.current?.forEach((t3) => {
2165
2165
  e3.push(t3.movable);
2166
2166
  }), B2.current.commit({ viewAfter: { view: l2, movableSelection: e3 } }), N2.current.clear(), B2.current = null;
2167
- }, []), pe2 = ae(() => {
2167
+ }, []), fe2 = ae(() => {
2168
2168
  B2.current && (B2.current.rollback(), B2.current = null);
2169
- }, []), fe2 = le(null);
2169
+ }, []), we2 = le(null);
2170
2170
  re(() => {
2171
- fe2.current && (fe2.current.onscroll = (e3) => {
2171
+ we2.current && (we2.current.onscroll = (e3) => {
2172
2172
  e3.preventDefault(), e3.srcElement.scrollTop = 0, e3.srcElement.scrollLeft = 0;
2173
2173
  });
2174
- }, [fe2.current]);
2175
- const we2 = b(t2, () => ({ isMovableArea: () => true, focusMovable: ge2, focus: () => {
2176
- ge2();
2177
- } }), [l2]), [qe2, ve2] = oe(null), ye2 = le(false), Ce2 = le(false), be2 = le(false);
2174
+ }, [we2.current]);
2175
+ const qe2 = b(t2, () => ({ isMovableArea: () => true, focusMovable: ue2, focus: () => {
2176
+ ue2();
2177
+ } }), [l2]), [ve2, ye2] = oe(null), Ce2 = le(false), be2 = le(false), Se2 = le(false);
2178
2178
  re(() => {
2179
2179
  if (d2 || 0 === k2.length) return;
2180
- if (be2.current) return;
2181
- if (ye2.current) return;
2182
- if (Ce2.current) return void requestAnimationFrame(() => {
2183
- O2.current && H2.current && O2.current.refTargets.length > 0 && (be2.current = true, _2.current?.(true)), R2([...k2]);
2180
+ if (Se2.current) return;
2181
+ if (Ce2.current) return;
2182
+ if (be2.current) return void requestAnimationFrame(() => {
2183
+ O2.current && H2.current && O2.current.refTargets.length > 0 && (Se2.current = true, _2.current?.(true)), R2([...k2]);
2184
2184
  });
2185
- ye2.current = true;
2185
+ Ce2.current = true;
2186
2186
  const e3 = Q.lazy(async () => {
2187
2187
  try {
2188
- const e4 = await import("./Bi6qduoGUlv12Fdp.mjs");
2189
- return ye2.current = false, Ce2.current = true, R2([...k2]), e4;
2188
+ const e4 = await import("./2YYfgC6POiYmyAI_.mjs");
2189
+ return Ce2.current = false, be2.current = true, R2([...k2]), e4;
2190
2190
  } catch (e4) {
2191
2191
  return console.warn(e4), _2.current?.(false), null;
2192
2192
  }
2193
2193
  });
2194
- ve2(e3);
2194
+ ye2(e3);
2195
2195
  }, [k2, d2, c2, g2]);
2196
- const Se2 = te(() => !qe2 || d2 ? null : G(de, { children: G(qe2, { className: Me({ dragging: M2 || A2, resizing: M2, moving: A2 }), container: null, ref: O2, target: O2.current ? k2 : [], draggable: !d2 && !c2, resizable: !d2 && !g2, individualGroupable: true, edgeDraggable: false, throttleDrag: 2, throttleResize: 2, origin: false, keepRatio: false, renderDirections: m2, onResizeStart: (e3) => {
2197
- he2(e3.target, "Resize");
2196
+ const xe2 = te(() => !ve2 || d2 ? null : G(de, { children: G(ve2, { className: Me({ dragging: M2 || A2, resizing: M2, moving: A2 }), container: null, ref: O2, target: O2.current ? k2 : [], draggable: !d2 && !c2, resizable: !d2 && !g2, individualGroupable: true, edgeDraggable: false, throttleDrag: 2, throttleResize: 2, origin: false, keepRatio: false, renderDirections: m2, onResizeStart: (e3) => {
2197
+ me2(e3.target, "Resize");
2198
2198
  }, onResize: (e3) => {
2199
2199
  if (!B2.current) return e3.stopDrag(), void $2();
2200
2200
  T2(true);
@@ -2216,9 +2216,9 @@ const Rt = (e2, t2, o2 = null) => {
2216
2216
  -1 === e3.direction[0] && (p3.x = Math.max(0, Math.min(a3.startBounds.x + h3, a3.startBounds.x + h3 - p3.width))), -1 === e3.direction[1] && (p3.y = Math.min(a3.startBounds.y + m3, a3.startBounds.y + m3 - p3.height)), a3.movable.setBounds(o2.toAbsoluteBounds(p3));
2217
2217
  }
2218
2218
  }, onResizeEnd: (e3) => {
2219
- T2(false), me2();
2219
+ T2(false), pe2();
2220
2220
  }, onDragStart: (e3) => {
2221
- he2(e3.target, "Move");
2221
+ me2(e3.target, "Move");
2222
2222
  }, onDrag: (e3) => {
2223
2223
  if (!B2.current) return e3.stopDrag(), void $2();
2224
2224
  z2(true);
@@ -2228,11 +2228,11 @@ const Rt = (e2, t2, o2 = null) => {
2228
2228
  }
2229
2229
  }, onDragEnd: (e3) => {
2230
2230
  }, onMouseUp: (e3) => {
2231
- } }) }), [P2, qe2, k2, o2, d2, c2, g2, M2, A2]);
2232
- return G("div", { className: Me(u2, "movable-area", Kt), style: { width: q2.width, height: q2.height, ...h2, position: "absolute", overflow: "hidden", willChange: "transform" }, ref: ke([we2, fe2]), ...f2, children: G("div", { className: "movable-scroll", style: { position: "absolute", cursor: "initial", left: 0, top: 0, width: q2.width, height: q2.height }, ...f2, children: Z("div", { ref: H2, style: { position: "absolute", pointerEvents: "auto" }, onFocus: (e3) => {
2233
- C2?.(), ee2(true);
2231
+ } }) }), [P2, ve2, k2, o2, d2, c2, g2, M2, A2]);
2232
+ return G("div", { className: Me(u2, "movable-area", Kt), style: { width: q2.width, height: q2.height, ...h2, position: "absolute", overflow: "hidden", willChange: "transform" }, ref: ke([qe2, we2]), ...f2, children: G("div", { className: "movable-scroll", style: { position: "absolute", cursor: "initial", left: 0, top: 0, width: q2.width, height: q2.height }, ...f2, children: Z("div", { ref: H2, style: { position: "absolute", pointerEvents: "auto" }, onFocus: (e3) => {
2233
+ C2?.(), ne2(true);
2234
2234
  }, onBlur: (e3) => {
2235
- ee2(false);
2235
+ ne2(false);
2236
2236
  }, onKeyDownCapture: (e3) => {
2237
2237
  if (e3.isDefaultPrevented()) return;
2238
2238
  const t3 = e3.nativeEvent.ctrlKey, o3 = e3.nativeEvent.altKey, r3 = e3.nativeEvent.shiftKey;
@@ -2273,7 +2273,7 @@ const Rt = (e2, t2, o2 = null) => {
2273
2273
  const t4 = l2.getMovableSelection();
2274
2274
  l2.selectMovables(n2.getItems(), true), l2.selectMovables(t4, true), e3.preventDefault();
2275
2275
  } else "ArrowLeft" === e3.key ? (r3 ? s3(i3, false) : o3 ? a3(-10) : d3({ x: t3 ? -10 : -1 }), e3.preventDefault()) : "ArrowRight" === e3.key ? (r3 ? s3(i3, true) : o3 ? a3(10) : d3({ x: t3 ? 10 : 1 }), e3.preventDefault()) : "ArrowUp" === e3.key ? (r3 ? s3(i3, true) : d3({ y: t3 ? -10 : -1 }), e3.preventDefault()) : "ArrowDown" === e3.key && (r3 ? s3(i3, false) : d3({ y: t3 ? 10 : 1 }), e3.preventDefault());
2276
- }, children: [ue2, Se2] }) }) });
2276
+ }, children: [he2, xe2] }) }) });
2277
2277
  })), Yt = (e2) => {
2278
2278
  let t2 = Number.MAX_SAFE_INTEGER, o2 = Number.MAX_SAFE_INTEGER, n2 = 0, l2 = 0;
2279
2279
  for (let r2 = 0; r2 < e2.length; r2++) {
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.6.9",
4
+ "version": "0.6.11",
5
5
  "license": "SEE LICENSE IN <LICENSE>",
6
6
  "type": "module",
7
7
  "exports": {
@@ -37,10 +37,10 @@
37
37
  "@dnd-kit/sortable": "^10.0.0",
38
38
  "@dnd-kit/utilities": "^3.2.2",
39
39
  "@monaco-editor/react": "^4.6.0",
40
- "@sheetxl/grid-react": "^0.6.9",
41
- "@sheetxl/sdk": "^0.6.9",
42
- "@sheetxl/utils": "^0.6.9",
43
- "@sheetxl/utils-react": "^0.6.9",
40
+ "@sheetxl/grid-react": "^0.6.11",
41
+ "@sheetxl/sdk": "^0.6.11",
42
+ "@sheetxl/utils": "^0.6.11",
43
+ "@sheetxl/utils-react": "^0.6.11",
44
44
  "clsx": "^2.1.1",
45
45
  "monaco-editor-auto-typings": "^0.4.6",
46
46
  "react-merge-refs": "^3.0.2",