@gridsheet/react-core 3.0.4 → 3.0.5

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
@@ -1,8 +1,8 @@
1
1
  import { calcSideStyle as Vn, clampPopup as Jt, clampLeft as qn, zoneToArea as ge, focus as L, Lexer as qe, getFunctionHelps as $t, expandInput as Gn, y2r as ve, x2c as me, resetInput as Qn, handleFormulaQuoteAutoClose as en, areaToZone as Ge, insertTextAtCursor as tn, operations as H, isRefInsertable as nn, COLOR_PALETTE as De, DEFAULT_WIDTH as yt, DEFAULT_HEIGHT as vt, between as Te, makeSequence as Pt, p2a as Ne, MIN_HEIGHT as Xt, MIN_WIDTH as Ot, zoneShape as ne, getLabel as bt, FormulaError as Jn, Pending as es, insertRef as Me, areaToRange as sn, calcBelowPosition as ts, hAlignTransform as ns, among as ss, getAreaInTabular as Ht, isFocus as rs, Autofill as os, getCellRectPositions as Ie, a2p as wt, virtualize as Lt, stripAddressAbsolute as is, stripSheetName as ls, preventSafariBounce as as, smartScroll as cs, isZoneNotSelected as us, Sheet as ds, embedStyle as gs, getMaxSizesFromCells as rn, HEADER_HEIGHT as hs, DEFAULT_ROW_KEY as fs, SHEET_HEIGHT as Bt, HEADER_WIDTH as ms, DEFAULT_COL_KEY as ps, SHEET_WIDTH as Kt } from "@gridsheet/core";
2
- import { BaseFunction as Ir, BaseFunctionAsync as Fr, DEFAULT_HISTORY_LIMIT as Yr, FormulaError as $r, FormulaParser as Pr, Lexer as Xr, Pending as Or, PercentagePolicyMixin as Hr, Policy as Lr, RangeEntity as Br, RefEntity as Kr, Registry as Zr, Sheet as Ur, Spilling as zr, ThousandSeparatorPolicyMixin as Wr, Time as _r, ValueEntity as jr, a2p as Vr, aa2oa as qr, addressesToAreas as Gr, addressesToCols as Qr, addressesToRows as Jr, areaToRange as eo, areaToZone as to, buildInitialCells as no, buildInitialCellsFromOrigin as so, c2x as ro, ch as oo, check as io, conditionArg as lo, createBook as ao, createBooleanMask as co, createRegistry as uo, eachMatrix as go, ensureBoolean as ho, ensureDate as fo, ensureNumber as mo, ensureString as po, matrixShape as yo, oa2aa as vo, operations as bo, p2a as wo, r2y as Ro, rh as Co, stripMatrix as So, toCellCols as No, toCellMatrix as xo, toCellObject as Eo, toCellRows as ko, toValueCols as To, toValueMatrix as Ao, toValueObject as Mo, toValueRows as Do, x2c as Io, y2r as Fo, zoneToArea as Yo } from "@gridsheet/core";
2
+ import { BaseFunction as Ir, BaseFunctionAsync as Fr, DEFAULT_HISTORY_LIMIT as Yr, FormulaError as $r, FormulaParser as Pr, Lexer as Xr, Pending as Or, PercentagePolicyMixin as Hr, Policy as Lr, RangeEntity as Br, RefEntity as Kr, Registry as Zr, Sheet as Ur, Spilling as Wr, ThousandSeparatorPolicyMixin as zr, Time as _r, ValueEntity as jr, a2p as Vr, aa2oa as qr, addressesToAreas as Gr, addressesToCols as Qr, addressesToRows as Jr, areaToRange as eo, areaToZone as to, buildInitialCells as no, buildInitialCellsFromOrigin as so, c2x as ro, ch as oo, check as io, conditionArg as lo, createBook as ao, createBooleanMask as co, createRegistry as uo, eachMatrix as go, ensureBoolean as ho, ensureDate as fo, ensureNumber as mo, ensureString as po, matrixShape as yo, oa2aa as vo, operations as bo, p2a as wo, r2y as Ro, rh as Co, stripMatrix as So, toCellCols as No, toCellMatrix as xo, toCellObject as Eo, toCellRows as ko, toValueCols as To, toValueMatrix as Ao, toValueObject as Mo, toValueRows as Do, x2c as Io, y2r as Fo, zoneToArea as Yo } from "@gridsheet/core";
3
3
  import { jsxs as F, jsx as c, Fragment as we } from "react/jsx-runtime";
4
- import lt, { createContext as on, useRef as ie, useContext as le, useLayoutEffect as at, useState as te, useMemo as Ye, useCallback as A, memo as tt, useEffect as z, createRef as ln, useReducer as ys } from "react";
5
- import { u as vs, s as de, w as Ze, a as oe, b as Ue, r as ct, c as an, d as cn, e as $e, f as un, g as dn, h as be, i as _e, j as bs, k as Zt, l as ut, p as dt, m as Qe, n as Se, o as gt, q as ht, t as Fe, v as Rt, x as gn, y as hn, z as fn, A as mn, B as pn, C as yn, D as ze, E as Je, F as ft, G as nt, H as ws, I as Pe, J as fe, K as Ee, L as vn, M as Ke, N as Ut, O as bn, P as zt, Q as Wt, R as Rs, S as Cs, T as _t, U as Ss, V as Ns } from "./hooks-Y7BI_RNj.mjs";
4
+ import lt, { createContext as on, useRef as ie, useContext as le, useLayoutEffect as at, useState as te, useMemo as Ye, useCallback as A, memo as tt, useEffect as W, createRef as ln, useReducer as ys } from "react";
5
+ import { u as vs, s as de, w as Ze, a as oe, b as Ue, r as ct, c as an, d as cn, e as $e, f as un, g as dn, h as be, i as _e, j as bs, k as Zt, l as ut, p as dt, m as Qe, n as Se, o as gt, q as ht, t as Fe, v as Rt, x as gn, y as hn, z as fn, A as mn, B as pn, C as yn, D as We, E as Je, F as ft, G as nt, H as ws, I as Pe, J as fe, K as Ee, L as vn, M as Ke, N as Ut, O as bn, P as Wt, Q as zt, R as Rs, S as Cs, T as _t, U as Ss, V as Ns } from "./hooks-Y7BI_RNj.mjs";
6
6
  import { W as Po } from "./hooks-Y7BI_RNj.mjs";
7
7
  import { createPortal as Ct } from "react-dom";
8
8
  const ae = on(
@@ -546,16 +546,16 @@ const Sn = (e, n = " ") => {
546
546
  optionsAll: v,
547
547
  functions: p == null ? void 0 : p.registry.functions
548
548
  });
549
- z(() => {
549
+ W(() => {
550
550
  L(S == null ? void 0 : S.current);
551
- }, [S]), z(() => {
551
+ }, [S]), W(() => {
552
552
  p && p.registry.lastFocused != null && p.registry.lastFocused === S.current && p.registry.lastFocused === $.current && t(de(""));
553
- }, [p == null ? void 0 : p.registry.lastFocused, p, S, $, t]), z(() => {
553
+ }, [p == null ? void 0 : p.registry.lastFocused, p, S, $, t]), W(() => {
554
554
  p && (p.registry.editingSheetId = X, p.registry.editingAddress = g);
555
- }, [g, p, X]), z(() => {
555
+ }, [g, p, X]), W(() => {
556
556
  Gn(S.current);
557
557
  }, [d, g, S]);
558
- const { y: U, x: Z } = a, G = `${ve(U)}`, W = `${me(Z)}${G}`, O = g === W, Q = p == null ? void 0 : p.getCell({ y: U, x: Z }, { resolution: "RAW" }), Y = p ? p.getSerializedValue({ point: a, cell: Q, resolution: "RAW" }) : "", [I, ee] = te(Y), J = A(
558
+ const { y: Z, x: U } = a, G = `${ve(Z)}`, z = `${me(U)}${G}`, O = g === z, Q = p == null ? void 0 : p.getCell({ y: Z, x: U }, { resolution: "RAW" }), Y = p ? p.getSerializedValue({ point: a, cell: Q, resolution: "RAW" }) : "", [I, ee] = te(Y), J = A(
559
559
  (k) => {
560
560
  I !== k && t(Ze({ value: k })), ee(k);
561
561
  },
@@ -573,7 +573,7 @@ const Sn = (e, n = " ") => {
573
573
  }, 0);
574
574
  } else {
575
575
  const re = p.update({
576
- diff: { [W]: { value: j.value } },
576
+ diff: { [z]: { value: j.value } },
577
577
  partial: !0
578
578
  });
579
579
  t(Ue(re.clone())), t(de("")), t(oe(""));
@@ -581,12 +581,12 @@ const Sn = (e, n = " ") => {
581
581
  B(0);
582
582
  }
583
583
  },
584
- [T, p, W, d, J, t, S]
584
+ [T, p, z, d, J, t, S]
585
585
  );
586
- z(() => {
586
+ W(() => {
587
587
  p && (ee(Y), t(oe(Y)), Qn(S.current, p, a));
588
588
  }, [a, Y, t, S, p]);
589
- const { y: xe, x: We, height: Tt, width: At } = b, Ln = Y.split(`
589
+ const { y: xe, x: ze, height: Tt, width: At } = b, Ln = Y.split(`
590
590
  `).length, [Mt, Dt] = te(!1), Bn = A(
591
591
  (k) => {
592
592
  var ue, Oe, Ae, He, Le, Yt;
@@ -644,11 +644,11 @@ const Sn = (e, n = " ") => {
644
644
  ), k.preventDefault(), !1;
645
645
  case "Backspace":
646
646
  if (!O)
647
- return ((Ae = p.getSystem({ y: U, x: Z })) == null ? void 0 : Ae.spilledFrom) != null ? (k.preventDefault(), !1) : (t(Zt(null)), t(oe("")), !1);
647
+ return ((Ae = p.getSystem({ y: Z, x: U })) == null ? void 0 : Ae.spilledFrom) != null ? (k.preventDefault(), !1) : (t(Zt(null)), t(oe("")), !1);
648
648
  break;
649
649
  case "Delete":
650
650
  if (!O)
651
- return ((He = p.getSystem({ y: U, x: Z })) == null ? void 0 : He.spilledFrom) != null ? (k.preventDefault(), !1) : (t(Zt(null)), t(oe("")), !1);
651
+ return ((He = p.getSystem({ y: Z, x: U })) == null ? void 0 : He.spilledFrom) != null ? (k.preventDefault(), !1) : (t(Zt(null)), t(oe("")), !1);
652
652
  break;
653
653
  case "Shift":
654
654
  return r(!0), !1;
@@ -781,7 +781,7 @@ const Sn = (e, n = " ") => {
781
781
  (k.ctrlKey || k.metaKey) && (O || (k.preventDefault(), J((/* @__PURE__ */ new Date()).toDateString())));
782
782
  break;
783
783
  }
784
- return k.ctrlKey || k.metaKey ? !1 : H.hasOperation(Q == null ? void 0 : Q.prevention, H.Write) ? (console.warn("This cell is protected from writing."), !1) : (t(de(W)), O || t(oe("")), B(0), !1);
784
+ return k.ctrlKey || k.metaKey ? !1 : H.hasOperation(Q == null ? void 0 : Q.prevention, H.Write) ? (console.warn("This cell is protected from writing."), !1) : (t(de(z)), O || t(oe("")), B(0), !1);
785
785
  },
786
786
  [
787
787
  Mt,
@@ -795,7 +795,7 @@ const Sn = (e, n = " ") => {
795
795
  a,
796
796
  n,
797
797
  Q,
798
- W,
798
+ z,
799
799
  J,
800
800
  E,
801
801
  d
@@ -812,13 +812,13 @@ const Sn = (e, n = " ") => {
812
812
  return;
813
813
  }
814
814
  const j = k.currentTarget;
815
- O || (t(oe(Y)), t(de(W)), requestAnimationFrame(() => {
815
+ O || (t(oe(Y)), t(de(z)), requestAnimationFrame(() => {
816
816
  j.style.width = `${j.scrollWidth}px`, j.style.height = `${j.scrollHeight}px`;
817
817
  const re = new String(Y).length;
818
818
  j.setSelectionRange(re, re);
819
819
  }));
820
820
  },
821
- [Q, O, Y, W]
821
+ [Q, O, Y, z]
822
822
  ), Un = A(
823
823
  (k) => {
824
824
  if (f(!1), nn(k.currentTarget))
@@ -826,12 +826,12 @@ const Sn = (e, n = " ") => {
826
826
  O && J(k.currentTarget.value), t(de(""));
827
827
  },
828
828
  [O, J, t]
829
- ), zn = A(
829
+ ), Wn = A(
830
830
  (k) => {
831
831
  H.hasOperation(Q == null ? void 0 : Q.prevention, H.Write) || (t(oe(k.currentTarget.value)), i(k.currentTarget.selectionStart), B(0));
832
832
  },
833
833
  [Q]
834
- ), Wn = A(
834
+ ), zn = A(
835
835
  (k) => {
836
836
  var ue, Oe, Ae, He;
837
837
  if (O)
@@ -869,11 +869,11 @@ const Sn = (e, n = " ") => {
869
869
  st,
870
870
  {
871
871
  className: `gs-editor ${O ? "gs-editing" : ""}`,
872
- style: O ? { top: xe, left: We, height: Tt } : {},
872
+ style: O ? { top: xe, left: ze, height: Tt } : {},
873
873
  "data-mode": e,
874
874
  "data-sheet-id": X,
875
875
  children: [
876
- /* @__PURE__ */ c("div", { className: `gs-cell-label ${O ? " gs-hidden" : ""}`, children: W }),
876
+ /* @__PURE__ */ c("div", { className: `gs-cell-label ${O ? " gs-hidden" : ""}`, children: z }),
877
877
  /* @__PURE__ */ F("div", { className: "gs-editor-inner", style: { width: At }, children: [
878
878
  /* @__PURE__ */ c(
879
879
  "pre",
@@ -903,9 +903,9 @@ const Sn = (e, n = " ") => {
903
903
  onDoubleClick: Zn,
904
904
  onBlur: Un,
905
905
  value: d,
906
- onChange: zn,
906
+ onChange: Wn,
907
907
  onSelect: x,
908
- onPaste: Wn,
908
+ onPaste: zn,
909
909
  onKeyDown: Bn,
910
910
  onKeyUp: _n,
911
911
  onMouseEnter: () => {
@@ -1001,9 +1001,9 @@ const As = ({
1001
1001
  mode: i
1002
1002
  }) => {
1003
1003
  const { store: h, dispatch: f } = le(ae), { sheetReactive: a } = h, d = a.current;
1004
- z(() => {
1004
+ W(() => {
1005
1005
  d && e && e !== d.name && (d.name = e, d.registry.sheetIdsByName[e] = d.id, delete d.registry.sheetIdsByName[d.prevName], d.prevName = e);
1006
- }, [e]), z(() => {
1006
+ }, [e]), W(() => {
1007
1007
  if (!d)
1008
1008
  return;
1009
1009
  const { registry: g } = d;
@@ -1019,17 +1019,17 @@ const As = ({
1019
1019
  },
1020
1020
  dispatch: f
1021
1021
  });
1022
- }, [h, d, s, r]), z(() => {
1022
+ }, [h, d, s, r]), W(() => {
1023
1023
  n && f(Se({ sheetHeight: n }));
1024
- }, [n, f]), z(() => {
1024
+ }, [n, f]), W(() => {
1025
1025
  t && f(Se({ sheetWidth: t }));
1026
- }, [t]), z(() => {
1026
+ }, [t]), W(() => {
1027
1027
  typeof o < "u" && f(Se({ editingOnEnter: o }));
1028
- }, [o]), z(() => {
1028
+ }, [o]), W(() => {
1029
1029
  i && f(Se({ mode: i }));
1030
1030
  }, [i]);
1031
1031
  const [w, b] = En();
1032
- return z(() => {
1032
+ return W(() => {
1033
1033
  w && (b.setStore(h), b.setApply(() => f));
1034
1034
  }, [h, w, b]), /* @__PURE__ */ c(we, {});
1035
1035
  }, Ms = () => {
@@ -1100,7 +1100,7 @@ const As = ({
1100
1100
  );
1101
1101
  }, Ds = () => {
1102
1102
  const { store: e } = le(ae), { choosing: n, selectingZone: t, sheetReactive: s } = e, r = s.current;
1103
- return z(() => {
1103
+ return W(() => {
1104
1104
  r != null && r.isInitialized && r.currentVersion > 0 && r.registry.onChange && r.registry.onChange({
1105
1105
  sheet: r,
1106
1106
  points: {
@@ -1109,7 +1109,7 @@ const As = ({
1109
1109
  selectingTo: { y: t.endY, x: t.endX }
1110
1110
  }
1111
1111
  });
1112
- }, [s]), z(() => {
1112
+ }, [s]), W(() => {
1113
1113
  r && r.registry.onSelect && r.registry.onSelect({
1114
1114
  sheet: r,
1115
1115
  points: {
@@ -1614,11 +1614,11 @@ const Et = ({
1614
1614
  );
1615
1615
  }, kt = () => /* @__PURE__ */ c("li", { className: "gs-menu-divider" }), Ks = () => {
1616
1616
  const { store: e, dispatch: n } = le(ae), { contextMenuPosition: t, contextMenu: s } = e, { y: r, x: o } = t, i = ie(null);
1617
- if (z(() => {
1617
+ if (W(() => {
1618
1618
  i.current && Jt(i.current);
1619
1619
  }), r === -1)
1620
1620
  return null;
1621
- const h = () => n(ze({ y: -1, x: -1 })), f = Nt(e, n, h);
1621
+ const h = () => n(We({ y: -1, x: -1 })), f = Nt(e, n, h);
1622
1622
  return /* @__PURE__ */ c(
1623
1623
  st,
1624
1624
  {
@@ -1665,7 +1665,7 @@ const Et = ({
1665
1665
  // eslint-disable-next-line react-hooks/exhaustive-deps
1666
1666
  [e]
1667
1667
  );
1668
- z(() => {
1668
+ W(() => {
1669
1669
  if (i) {
1670
1670
  const C = i.getCell({ y: 0, x: e }, { resolution: "SYSTEM" }), p = C == null ? void 0 : C.filter;
1671
1671
  p && p.conditions.length > 0 ? (f(p.conditions.map((l) => ({ ...l, value: [...l.value] }))), d(p.mode || "or")) : (f([{ ...je, value: [""] }]), d("or"));
@@ -1674,9 +1674,9 @@ const Et = ({
1674
1674
  const m = A(() => {
1675
1675
  b(null), t == null || t(null), n();
1676
1676
  }, [n, t]);
1677
- z(() => {
1677
+ W(() => {
1678
1678
  w && (t == null || t("Filtering…", m));
1679
- }, [w]), z(() => {
1679
+ }, [w]), W(() => {
1680
1680
  if (!w)
1681
1681
  return;
1682
1682
  let C = !1;
@@ -1796,9 +1796,9 @@ const Us = ({ x: e, close: n, onWaiting: t }) => {
1796
1796
  const { store: s, dispatch: r } = le(ae), { sheetReactive: o } = s, i = o.current, [h, f] = te(null), a = A(() => {
1797
1797
  f(null), t == null || t(null), n();
1798
1798
  }, [n, t]);
1799
- if (z(() => {
1799
+ if (W(() => {
1800
1800
  h && (t == null || t("Sorting…", a));
1801
- }, [h]), z(() => {
1801
+ }, [h]), W(() => {
1802
1802
  if (!h)
1803
1803
  return;
1804
1804
  let b = !1;
@@ -1840,9 +1840,9 @@ const Us = ({ x: e, close: n, onWaiting: t }) => {
1840
1840
  ] });
1841
1841
  };
1842
1842
  xt("col-sort", Us);
1843
- const zs = ({ x: e, close: n }) => {
1843
+ const Ws = ({ x: e, close: n }) => {
1844
1844
  const { store: t, dispatch: s } = le(ae), { sheetReactive: r } = t, o = r.current, i = ie(null), [h, f] = te("");
1845
- z(() => {
1845
+ W(() => {
1846
1846
  if (o) {
1847
1847
  const g = o.getCell({ y: 0, x: e }, { resolution: "SYSTEM" });
1848
1848
  f((g == null ? void 0 : g.label) ?? "");
@@ -1891,8 +1891,8 @@ const zs = ({ x: e, close: n }) => {
1891
1891
  /* @__PURE__ */ c("button", { className: "gs-label-apply-btn", onClick: a, disabled: w, children: "UPDATE" })
1892
1892
  ] }) });
1893
1893
  };
1894
- xt("col-label", zs);
1895
- const Ws = () => {
1894
+ xt("col-label", Ws);
1895
+ const zs = () => {
1896
1896
  const { store: e, dispatch: n } = le(ae), { columnMenuState: t, editorRef: s, colMenu: r } = e, o = e.sheetReactive.current, i = t == null ? void 0 : t.x, h = t == null ? void 0 : t.position, [f, a] = te(null), d = A(() => {
1897
1897
  n(Je(null)), L(s.current);
1898
1898
  }, [n, s]), w = A(
@@ -2035,7 +2035,7 @@ const js = () => {
2035
2035
  })
2036
2036
  );
2037
2037
  }, [i]);
2038
- z(() => {
2038
+ W(() => {
2039
2039
  if (p && !h.current) {
2040
2040
  l();
2041
2041
  return;
@@ -2079,7 +2079,7 @@ const js = () => {
2079
2079
  }
2080
2080
  },
2081
2081
  [S, se, _]
2082
- ), U = A(
2082
+ ), Z = A(
2083
2083
  (I) => {
2084
2084
  if (!Xe(I) || I.type.startsWith("touch") || !N)
2085
2085
  return !1;
@@ -2107,7 +2107,7 @@ const js = () => {
2107
2107
  m,
2108
2108
  M
2109
2109
  ]
2110
- ), Z = A(
2110
+ ), U = A(
2111
2111
  (I) => {
2112
2112
  i(Ke({ x: n, y: e })), i(Ee(!0)), I.stopPropagation();
2113
2113
  },
@@ -2118,8 +2118,8 @@ const js = () => {
2118
2118
  I && d(ts(I));
2119
2119
  }, []), V = A(() => {
2120
2120
  d(null);
2121
- }, []), W = A(
2122
- (I) => $.length > 0 ? (I.stopPropagation(), he(I), i(ze({ y: I.clientY, x: I.clientX })), !1) : !0,
2121
+ }, []), z = A(
2122
+ (I) => $.length > 0 ? (I.stopPropagation(), he(I), i(We({ y: I.clientY, x: I.clientX })), !1) : !0,
2123
2123
  [$.length]
2124
2124
  ), O = A(
2125
2125
  (I) => {
@@ -2140,7 +2140,7 @@ const js = () => {
2140
2140
  style: {
2141
2141
  ...u == null ? void 0 : u.style
2142
2142
  },
2143
- onContextMenu: W,
2143
+ onContextMenu: z,
2144
2144
  onDoubleClick: O,
2145
2145
  children: /* @__PURE__ */ F(
2146
2146
  "div",
@@ -2148,7 +2148,7 @@ const js = () => {
2148
2148
  className: "gs-cell-inner-wrap",
2149
2149
  onMouseDown: ce,
2150
2150
  onTouchStart: ce,
2151
- onMouseEnter: U,
2151
+ onMouseEnter: Z,
2152
2152
  onMouseUp: K,
2153
2153
  children: [
2154
2154
  /* @__PURE__ */ F(
@@ -2196,7 +2196,7 @@ const js = () => {
2196
2196
  children: T
2197
2197
  }
2198
2198
  ),
2199
- /* @__PURE__ */ c("div", { className: Q, onMouseDown: Z })
2199
+ /* @__PURE__ */ c("div", { className: Q, onMouseDown: U })
2200
2200
  ]
2201
2201
  }
2202
2202
  )
@@ -2301,7 +2301,7 @@ function ke({ style: e, horizontal: n = 0, vertical: t = 0, className: s = "" })
2301
2301
  ), p = A(() => {
2302
2302
  P();
2303
2303
  }, [P]);
2304
- return z(() => P, [P]), !w.current || !a && !f ? /* @__PURE__ */ c("div", { className: `gs-scroll-handle gs-hidden ${s}` }) : /* @__PURE__ */ c(
2304
+ return W(() => P, [P]), !w.current || !a && !f ? /* @__PURE__ */ c("div", { className: `gs-scroll-handle gs-hidden ${s}` }) : /* @__PURE__ */ c(
2305
2305
  "div",
2306
2306
  {
2307
2307
  style: e,
@@ -2389,7 +2389,7 @@ const Qs = tt(({ x: e }) => {
2389
2389
  "data-x": e,
2390
2390
  className: `gs-th gs-th-top ${i.x === e ? "gs-choosing" : ""} ${Te({ start: h.startX, end: h.endX }, e) ? f ? "gs-th-selecting" : "gs-selecting" : ""}`,
2391
2391
  style: { ...y == null ? void 0 : y.style, width: D, minWidth: D, maxWidth: D },
2392
- onContextMenu: (l) => b.length > 0 ? (l.stopPropagation(), he(l), s(ze({ y: l.clientY, x: l.clientX })), !1) : !0,
2392
+ onContextMenu: (l) => b.length > 0 ? (l.stopPropagation(), he(l), s(We({ y: l.clientY, x: l.clientX })), !1) : !0,
2393
2393
  children: /* @__PURE__ */ c(
2394
2394
  "div",
2395
2395
  {
@@ -2485,7 +2485,7 @@ const Qs = tt(({ x: e }) => {
2485
2485
  return s(be({ startY: e, startX: m.numCols, endY: e, endX: 0 })), !1;
2486
2486
  let v = l.shiftKey ? i.startY : e;
2487
2487
  return v === -1 && (v = r.y), s(
2488
- zt({
2488
+ Wt({
2489
2489
  range: { start: v, end: e },
2490
2490
  numCols: m.numCols
2491
2491
  })
@@ -2523,7 +2523,7 @@ const Qs = tt(({ x: e }) => {
2523
2523
  }
2524
2524
  return !1;
2525
2525
  }, 100), p = A(
2526
- (l) => b.length > 0 ? (l.stopPropagation(), he(l), s(ze({ y: l.clientY, x: l.clientX })), !1) : !0,
2526
+ (l) => b.length > 0 ? (l.stopPropagation(), he(l), s(We({ y: l.clientY, x: l.clientX })), !1) : !0,
2527
2527
  [b.length]
2528
2528
  );
2529
2529
  return m ? /* @__PURE__ */ c(
@@ -2566,7 +2566,7 @@ const Qs = tt(({ x: e }) => {
2566
2566
  if (Math.abs(l.clientX - v) > 4 || Math.abs(l.clientY - x) > 4)
2567
2567
  return;
2568
2568
  const R = u.getBoundingClientRect();
2569
- (g == null ? void 0 : g.y) === e ? s(ft(null)) : (Te({ start: i.startY, end: i.endY }, e) && i.startX === 1 && i.endX === m.numCols || s(zt({ range: { start: e, end: e }, numCols: m.numCols })), s(ft({ y: e, position: { y: R.bottom, x: R.right } })));
2569
+ (g == null ? void 0 : g.y) === e ? s(ft(null)) : (Te({ start: i.startY, end: i.endY }, e) && i.startX === 1 && i.endX === m.numCols || s(Wt({ range: { start: e, end: e }, numCols: m.numCols })), s(ft({ y: e, position: { y: R.bottom, x: R.right } })));
2570
2570
  },
2571
2571
  children: "⋮"
2572
2572
  }
@@ -2628,10 +2628,10 @@ const Qs = tt(({ x: e }) => {
2628
2628
  Ve(M, g, u, v, C, p, K.wholeArea, ir, 1, [5, 5]);
2629
2629
  }
2630
2630
  {
2631
- const { y: K, x: U } = r;
2632
- if (K !== -1 && U !== -1) {
2633
- const Z = Ie(g, { y: K, x: U }), G = Z.left - v, V = Z.top - u;
2634
- pt(M, G, V, Z.width, Z.height, it, 2, []);
2631
+ const { y: K, x: Z } = r;
2632
+ if (K !== -1 && Z !== -1) {
2633
+ const U = Ie(g, { y: K, x: Z }), G = U.left - v, V = U.top - u;
2634
+ pt(M, G, V, U.width, U.height, it, 2, []);
2635
2635
  }
2636
2636
  }
2637
2637
  const { copyingSheetId: B, copyingZone: q, cutting: _ } = l;
@@ -2639,21 +2639,21 @@ const Qs = tt(({ x: e }) => {
2639
2639
  const K = ge(q);
2640
2640
  Ve(M, g, u, v, C, p, K, _ ? sr : nr, 2.5, _ ? [4, 4] : [6, 4]);
2641
2641
  }
2642
- Object.entries(e).forEach(([K, U]) => {
2643
- const Z = De[U % De.length];
2642
+ Object.entries(e).forEach(([K, Z]) => {
2643
+ const U = De[Z % De.length];
2644
2644
  try {
2645
2645
  const G = g.rangeToArea(K);
2646
- Ve(M, g, u, v, C, p, G, Z, 2, [5, 5]);
2646
+ Ve(M, g, u, v, C, p, G, U, 2, [5, 5]);
2647
2647
  } catch {
2648
2648
  }
2649
- }), i.forEach((K, U) => {
2650
- const { y: Z, x: G } = wt(K), V = Ie(g, { y: Z, x: G }), W = V.left - v, O = V.top - u;
2651
- if (W + V.width < 0 || W > C || O + V.height < 0 || O > p)
2649
+ }), i.forEach((K, Z) => {
2650
+ const { y: U, x: G } = wt(K), V = Ie(g, { y: U, x: G }), z = V.left - v, O = V.top - u;
2651
+ if (z + V.width < 0 || z > C || O + V.height < 0 || O > p)
2652
2652
  return;
2653
- const Q = U === h;
2653
+ const Q = Z === h;
2654
2654
  pt(
2655
2655
  M,
2656
- W,
2656
+ z,
2657
2657
  O,
2658
2658
  V.width,
2659
2659
  V.height,
@@ -2665,26 +2665,26 @@ const Qs = tt(({ x: e }) => {
2665
2665
  }), M.restore();
2666
2666
  const se = g.numCols, ce = g.numRows;
2667
2667
  for (let K = 1; K <= se; K++) {
2668
- let U = null, Z = null;
2669
- if (Te({ start: o.startX, end: o.endX }, K) && (U = "rgba(80, 180, 255, 1)", Z = a ? "rgba(128, 128, 128, 0.25)" : "rgba(0, 119, 255, 0.05)"), r.x === K && (U = it, Z = a ? "rgba(128, 128, 128, 0.45)" : "rgba(0, 119, 255, 0.15)"), !U)
2668
+ let Z = null, U = null;
2669
+ if (Te({ start: o.startX, end: o.endX }, K) && (Z = "rgba(80, 180, 255, 1)", U = a ? "rgba(128, 128, 128, 0.25)" : "rgba(0, 119, 255, 0.05)"), r.x === K && (Z = it, U = a ? "rgba(128, 128, 128, 0.45)" : "rgba(0, 119, 255, 0.15)"), !Z)
2670
2670
  continue;
2671
2671
  const G = Ie(g, { y: 1, x: K }), V = G.left - v;
2672
2672
  if (V + G.width < x || V > C)
2673
2673
  continue;
2674
- const W = Math.max(V, x), O = Math.min(V + G.width, C) - W;
2675
- O > 0 && (Z && Qt(M, W, 0, O, T, Z), M.strokeStyle = U, M.lineWidth = 2, M.beginPath(), M.moveTo(W, T + 1), M.lineTo(W + O, T + 1), M.stroke());
2674
+ const z = Math.max(V, x), O = Math.min(V + G.width, C) - z;
2675
+ O > 0 && (U && Qt(M, z, 0, O, T, U), M.strokeStyle = Z, M.lineWidth = 2, M.beginPath(), M.moveTo(z, T + 1), M.lineTo(z + O, T + 1), M.stroke());
2676
2676
  }
2677
2677
  for (let K = 1; K <= ce; K++) {
2678
2678
  if (g.isRowFiltered(K))
2679
2679
  continue;
2680
- let U = null, Z = null;
2681
- if (Te({ start: o.startY, end: o.endY }, K) && (U = "rgba(80, 180, 255, 1)", Z = d ? "rgba(128, 128, 128, 0.25)" : "rgba(0, 119, 255, 0.05)"), r.y === K && (U = it, Z = d ? "rgba(128, 128, 128, 0.45)" : "rgba(0, 119, 255, 0.15)"), !U)
2680
+ let Z = null, U = null;
2681
+ if (Te({ start: o.startY, end: o.endY }, K) && (Z = "rgba(80, 180, 255, 1)", U = d ? "rgba(128, 128, 128, 0.25)" : "rgba(0, 119, 255, 0.05)"), r.y === K && (Z = it, U = d ? "rgba(128, 128, 128, 0.45)" : "rgba(0, 119, 255, 0.15)"), !Z)
2682
2682
  continue;
2683
2683
  const G = Ie(g, { y: K, x: 1 }), V = G.top - u;
2684
2684
  if (V + G.height < T || V > p)
2685
2685
  continue;
2686
- const W = Math.max(V, T), O = Math.min(V + G.height, p) - W;
2687
- O > 0 && (Z && Qt(M, 0, W, x, O, Z), M.strokeStyle = U, M.lineWidth = 2, M.beginPath(), M.moveTo(x + 1, W), M.lineTo(x + 1, W + O), M.stroke());
2686
+ const z = Math.max(V, T), O = Math.min(V + G.height, p) - z;
2687
+ O > 0 && (U && Qt(M, 0, z, x, O, U), M.strokeStyle = Z, M.lineWidth = 2, M.beginPath(), M.moveTo(x + 1, z), M.lineTo(x + 1, z + O), M.stroke());
2688
2688
  }
2689
2689
  }, [
2690
2690
  g,
@@ -2704,7 +2704,7 @@ const Qs = tt(({ x: e }) => {
2704
2704
  }, [E]), $ = A(() => {
2705
2705
  E();
2706
2706
  }, [E]);
2707
- return z(() => (S(), () => cancelAnimationFrame(y.current)), [S]), z(() => {
2707
+ return W(() => (S(), () => cancelAnimationFrame(y.current)), [S]), W(() => {
2708
2708
  const N = s.current;
2709
2709
  if (!N)
2710
2710
  return;
@@ -2772,7 +2772,7 @@ const Qs = tt(({ x: e }) => {
2772
2772
  );
2773
2773
  }));
2774
2774
  }, [r]);
2775
- z(() => {
2775
+ W(() => {
2776
2776
  if (!y)
2777
2777
  return;
2778
2778
  if (!(i && w.startsWith("="))) {
@@ -2784,21 +2784,21 @@ const Qs = tt(({ x: e }) => {
2784
2784
  let se = 0;
2785
2785
  for (const ce of _.tokens)
2786
2786
  if (ce.type === "REF" || ce.type === "RANGE") {
2787
- const K = is(ce.stringify()), U = K.indexOf("!");
2788
- if (U !== -1) {
2789
- const Z = K.substring(0, U), G = K.substring(U + 1), V = ls(Z), W = G.toUpperCase();
2790
- q[V] == null && (q[V] = {}), q[V][W] == null && (q[V][W] = se++);
2787
+ const K = is(ce.stringify()), Z = K.indexOf("!");
2788
+ if (Z !== -1) {
2789
+ const U = K.substring(0, Z), G = K.substring(Z + 1), V = ls(U), z = G.toUpperCase();
2790
+ q[V] == null && (q[V] = {}), q[V][z] == null && (q[V][z] = se++);
2791
2791
  } else {
2792
- const Z = K.toUpperCase();
2793
- B[Z] == null && (B[Z] = se++);
2792
+ const U = K.toUpperCase();
2793
+ B[U] == null && (B[U] = se++);
2794
2794
  }
2795
2795
  }
2796
2796
  n(B), y.registry.paletteBySheetName = q;
2797
- }, [t.inputting, t.editingAddress, r]), z(() => {
2797
+ }, [t.inputting, t.editingAddress, r]), W(() => {
2798
2798
  y && (y.registry.choosingAddress = Ne(o), y.registry.choosingSheetId = y.id);
2799
- }, [o]), z(() => {
2799
+ }, [o]), W(() => {
2800
2800
  y && E(Lt(y, h.current));
2801
- }, [h.current, r, (P = f.current) == null ? void 0 : P.clientHeight, (X = f.current) == null ? void 0 : X.clientWidth]), z(() => {
2801
+ }, [h.current, r, (P = f.current) == null ? void 0 : P.clientHeight, (X = f.current) == null ? void 0 : X.clientWidth]), W(() => {
2802
2802
  const R = h.current;
2803
2803
  if (R)
2804
2804
  return as(R);
@@ -2861,7 +2861,7 @@ const Qs = tt(({ x: e }) => {
2861
2861
  if (Math.abs(R.clientX - q) > 4 || Math.abs(R.clientY - _) > 4)
2862
2862
  return;
2863
2863
  const ce = B.getBoundingClientRect();
2864
- s(ze({ y: ce.bottom, x: ce.left }));
2864
+ s(We({ y: ce.bottom, x: ce.left }));
2865
2865
  },
2866
2866
  children: "⋮"
2867
2867
  }
@@ -2924,7 +2924,7 @@ const Qs = tt(({ x: e }) => {
2924
2924
  editingAddress: y,
2925
2925
  dragging: D
2926
2926
  } = n, E = g.current, S = ie(null), $ = a.x === -1 ? "" : Ne(a), N = E == null ? void 0 : E.getCell(a, { resolution: "SYSTEM" }), M = (O = E == null ? void 0 : E.getSystem(a)) == null ? void 0 : O.spilledFrom, P = M ? wt(M) : void 0, X = P != null ? Ne(P) : void 0;
2927
- z(() => {
2927
+ W(() => {
2928
2928
  var I;
2929
2929
  if (!E)
2930
2930
  return;
@@ -2937,7 +2937,7 @@ const Qs = tt(({ x: e }) => {
2937
2937
  },
2938
2938
  [s]
2939
2939
  );
2940
- z(() => {
2940
+ W(() => {
2941
2941
  const Y = new ResizeObserver((I) => {
2942
2942
  I.forEach(K);
2943
2943
  });
@@ -2964,7 +2964,7 @@ const Qs = tt(({ x: e }) => {
2964
2964
  i(Y.currentTarget.selectionStart);
2965
2965
  }, []), K = A(() => {
2966
2966
  !S.current || !b.current || (S.current.style.height = `${b.current.clientHeight}px`, S.current.scrollLeft = b.current.scrollLeft, S.current.scrollTop = b.current.scrollTop);
2967
- }, []), U = A(
2967
+ }, []), Z = A(
2968
2968
  (Y) => {
2969
2969
  !_ || !E || (f(!0), t(de($)), E.registry.lastFocused = Y.currentTarget);
2970
2970
  },
@@ -2978,7 +2978,7 @@ const Qs = tt(({ x: e }) => {
2978
2978
  },
2979
2979
  [y, C]
2980
2980
  );
2981
- const Z = A(
2981
+ const U = A(
2982
2982
  (Y) => {
2983
2983
  if (Y.ctrlKey || !E)
2984
2984
  return !0;
@@ -2990,9 +2990,9 @@ const Qs = tt(({ x: e }) => {
2990
2990
  if (Y.preventDefault(), u.length) {
2991
2991
  const J = u[v];
2992
2992
  if (J == null ? void 0 : J.isFunction) {
2993
- const { value: xe, selectionStart: We } = x(J);
2993
+ const { value: xe, selectionStart: ze } = x(J);
2994
2994
  return t(oe(xe)), setTimeout(() => {
2995
- b.current && (L(b.current), b.current.setSelectionRange(We, We));
2995
+ b.current && (L(b.current), b.current.setSelectionRange(ze, ze));
2996
2996
  }, 0), !1;
2997
2997
  } else {
2998
2998
  const xe = E.update({ diff: { [$]: { value: J.value } }, partial: !0 });
@@ -3084,7 +3084,7 @@ const Qs = tt(({ x: e }) => {
3084
3084
  /* @__PURE__ */ c("div", { className: "gs-fx", children: "Fx" }),
3085
3085
  /* @__PURE__ */ c("div", { className: "gs-formula-bar-editor-inner", children: /* @__PURE__ */ c("textarea", {}) })
3086
3086
  ] });
3087
- const W = () => {
3087
+ const z = () => {
3088
3088
  var J;
3089
3089
  if (!h || typeof document > "u" || b.current !== document.activeElement)
3090
3090
  return null;
@@ -3153,12 +3153,12 @@ const Qs = tt(({ x: e }) => {
3153
3153
  value: m,
3154
3154
  readOnly: X != null,
3155
3155
  onInput: se,
3156
- onFocus: U,
3156
+ onFocus: Z,
3157
3157
  onSelect: ce,
3158
3158
  onPaste: (Y) => {
3159
3159
  Y.stopPropagation();
3160
3160
  },
3161
- onKeyDown: Z,
3161
+ onKeyDown: U,
3162
3162
  onKeyUp: K,
3163
3163
  onScroll: K,
3164
3164
  onMouseEnter: (Y) => {
@@ -3169,7 +3169,7 @@ const Qs = tt(({ x: e }) => {
3169
3169
  }
3170
3170
  }
3171
3171
  ),
3172
- W()
3172
+ z()
3173
3173
  ] })
3174
3174
  ]
3175
3175
  }
@@ -3213,7 +3213,7 @@ const Qs = tt(({ x: e }) => {
3213
3213
  matchingCells: b,
3214
3214
  sheetReactive: g
3215
3215
  } = e, m = g.current, y = b[w];
3216
- z(() => {
3216
+ W(() => {
3217
3217
  if (!y || !m)
3218
3218
  return;
3219
3219
  const u = wt(y);
@@ -3223,7 +3223,7 @@ const Qs = tt(({ x: e }) => {
3223
3223
  const v = u.currentTarget.previousSibling;
3224
3224
  (v == null ? void 0 : v.nodeName) === "INPUT" && L(v);
3225
3225
  }, []), E = A(() => {
3226
- n(Wt(1));
3226
+ n(zt(1));
3227
3227
  }, []), S = A((u) => {
3228
3228
  n($e(u.currentTarget.value));
3229
3229
  }, []), $ = A(
@@ -3232,7 +3232,7 @@ const Qs = tt(({ x: e }) => {
3232
3232
  const v = s == null ? void 0 : s.current;
3233
3233
  v && L(v), n($e(void 0));
3234
3234
  }
3235
- return u.key === "f" && (u.ctrlKey || u.metaKey) ? (u.preventDefault(), !1) : u.key === "Enter" ? (n(Wt(u.shiftKey ? -1 : 1)), u.preventDefault(), !1) : !0;
3235
+ return u.key === "f" && (u.ctrlKey || u.metaKey) ? (u.preventDefault(), !1) : u.key === "Enter" ? (n(zt(u.shiftKey ? -1 : 1)), u.preventDefault(), !1) : !0;
3236
3236
  },
3237
3237
  [s]
3238
3238
  ), N = A(() => {
@@ -3348,12 +3348,12 @@ function kr({
3348
3348
  const { sheetResize: f, showFormulaBar: a = !0, mode: d = "light" } = r, w = ie(null), b = ie(null), g = ie(null), m = ie(null), y = ie(null), D = ie(null), E = ie(null), S = hr(), $ = t ?? S, N = fr(), M = s ?? N, P = Ss({}), X = h ?? P, { registry: C } = X, [p] = te(() => n ? (C._componentSheetIds.has(n) || C._componentSheetIds.set(n, ++C.sheetHead), C._componentSheetIds.get(n)) : ++C.sheetHead), l = ie(null), [u] = te(() => {
3349
3349
  var Q;
3350
3350
  n || (n = `Sheet${p}`, console.debug("GridSheet: sheetName is not provided, using default name:", n));
3351
- const { limits: U, contextMenu: Z, rowMenu: G, colMenu: V } = r, W = new ds({
3352
- limits: U,
3351
+ const { limits: Z, contextMenu: U, rowMenu: G, colMenu: V } = r, z = new ds({
3352
+ limits: Z,
3353
3353
  name: n,
3354
3354
  registry: C
3355
3355
  });
3356
- return W.id = p, C.sheetIdsByName[n] = p, W.initialize(e), (Q = C.onInit) == null || Q.call(C, { sheet: W }), W.setTotalSize(), l.current = W, {
3356
+ return z.id = p, C.sheetIdsByName[n] = p, z.initialize(e), (Q = C.onInit) == null || Q.call(C, { sheet: z }), z.setTotalSize(), l.current = z, {
3357
3357
  sheetId: p,
3358
3358
  sheetReactive: l,
3359
3359
  rootRef: w,
@@ -3381,7 +3381,7 @@ function kr({
3381
3381
  searchRegex: !1,
3382
3382
  editingOnEnter: !0,
3383
3383
  contextMenuPosition: { y: -1, x: -1 },
3384
- contextMenu: Z ?? Os,
3384
+ contextMenu: U ?? Os,
3385
3385
  rowMenu: G ?? Hs,
3386
3386
  colMenu: V ?? Ls,
3387
3387
  resizingPositionY: [-1, -1, -1],
@@ -3396,26 +3396,26 @@ function kr({
3396
3396
  u,
3397
3397
  () => u
3398
3398
  );
3399
- z(() => {
3399
+ W(() => {
3400
3400
  gs();
3401
3401
  }, []);
3402
3402
  const [T, R] = te((r == null ? void 0 : r.sheetHeight) || mr(e)), [B, q] = te((r == null ? void 0 : r.sheetWidth) || pr(e));
3403
- return z(() => {
3404
- const U = g.current;
3405
- if (!U)
3403
+ return W(() => {
3404
+ const Z = g.current;
3405
+ if (!Z)
3406
3406
  return;
3407
- let Z = !0;
3407
+ let U = !0;
3408
3408
  const G = new ResizeObserver(() => {
3409
- if (Z) {
3410
- Z = !1;
3409
+ if (U) {
3410
+ U = !1;
3411
3411
  return;
3412
3412
  }
3413
- r.sheetHeight || R(U.clientHeight), r.sheetWidth || q(U.clientWidth);
3413
+ R(r.sheetHeight ? Math.min(r.sheetHeight, Z.clientHeight) : Z.clientHeight), q(r.sheetWidth ? Math.min(r.sheetWidth, Z.clientWidth) : Z.clientWidth);
3414
3414
  });
3415
- return G.observe(U), () => G.disconnect();
3416
- }, []), z(() => {
3415
+ return G.observe(Z), () => G.disconnect();
3416
+ }, []), W(() => {
3417
3417
  r.sheetHeight && R(r.sheetHeight);
3418
- }, [r.sheetHeight]), z(() => {
3418
+ }, [r.sheetHeight]), W(() => {
3419
3419
  r.sheetWidth && q(r.sheetWidth);
3420
3420
  }, [r.sheetWidth]), /* @__PURE__ */ c(ae.Provider, { value: { store: v, dispatch: x }, children: /* @__PURE__ */ F(
3421
3421
  "div",
@@ -3449,7 +3449,7 @@ function kr({
3449
3449
  /* @__PURE__ */ c(ar, {}),
3450
3450
  /* @__PURE__ */ c(As, { ...r, sheetHeight: T, sheetWidth: B, sheetName: n, sheetRef: $, storeRef: M }),
3451
3451
  /* @__PURE__ */ c(Ks, {}),
3452
- /* @__PURE__ */ c(Ws, {}),
3452
+ /* @__PURE__ */ c(zs, {}),
3453
3453
  /* @__PURE__ */ c(js, {}),
3454
3454
  /* @__PURE__ */ c(Ms, {}),
3455
3455
  /* @__PURE__ */ c(Ds, {})
@@ -3519,8 +3519,8 @@ export {
3519
3519
  Kr as RefEntity,
3520
3520
  Zr as Registry,
3521
3521
  Ur as Sheet,
3522
- zr as Spilling,
3523
- Wr as ThousandSeparatorPolicyMixin,
3522
+ Wr as Spilling,
3523
+ zr as ThousandSeparatorPolicyMixin,
3524
3524
  _r as Time,
3525
3525
  jr as ValueEntity,
3526
3526
  Vr as a2p,