@gridsheet/react-dev 3.4.0 → 3.4.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -2058,9 +2058,10 @@ class ee {
2058
2058
  }
2059
2059
  /** @internal */
2060
2060
  processFormula(e, { idMap: t, ...s }) {
2061
+ var i, r;
2061
2062
  if ((typeof e == "string" || e instanceof String) && e.charAt(0) === "=") {
2062
- const i = new Ue(e.substring(1));
2063
- return i.tokenize(t), i.identify({ ...s, sheet: this }), i.dependencyIds.forEach((r) => this.addDependency(r, s.dependency)), s.dependency != null && (this._formulaHasAsync(i) ? this.registry.asyncFormulaCells.add(s.dependency) : this.registry.asyncFormulaCells.delete(s.dependency)), "=" + i.identifiedFormula;
2063
+ const n = new Ue(e.substring(1));
2064
+ return n.tokenize(t), n.identify({ ...s, sheet: this }), n.dependencyIds.forEach((a) => this.addDependency(a, s.dependency)), s.dependency != null && (this._formulaHasAsync(n) ? this.registry.asyncFormulaCells.add(s.dependency) : this.registry.asyncFormulaCells.delete(s.dependency), (r = (i = this.registry).onFormula) == null || r.call(i)), "=" + n.identifiedFormula;
2064
2065
  }
2065
2066
  return s.dependency != null && this.registry.asyncFormulaCells.delete(s.dependency), e;
2066
2067
  }
@@ -3380,7 +3381,7 @@ class ee {
3380
3381
  if (!ke.is(this._stripped))
3381
3382
  return this._stripped;
3382
3383
  let i = this;
3383
- for (; i instanceof ee; )
3384
+ for (; ee.is(i); )
3384
3385
  i = (s = Ot({ sheet: i, raise: e, at: t })[0]) == null ? void 0 : s[0];
3385
3386
  return this._stripped = i, this._stripped;
3386
3387
  }
@@ -3769,7 +3770,7 @@ const pt = ({ value: o, sheet: e, point: t, raise: s = !0, resolution: i = "RESO
3769
3770
  throw e.finishSolvedCache(t, c), c;
3770
3771
  return c;
3771
3772
  }
3772
- return re.is(h) ? h = e.spill(t, h.matrix) : e.finishSolvedCache(t, h), i === "RESOLVED" && h instanceof ee && (h = Ee({ value: h, raise: s, at: r })), Q.is(h) && e.finishSolvedCache(t, h), h;
3773
+ return re.is(h) ? h = e.spill(t, h.matrix) : e.finishSolvedCache(t, h), i === "RESOLVED" && ee.is(h) && (h = Ee({ value: h, raise: s, at: r })), Q.is(h) && e.finishSolvedCache(t, h), h;
3773
3774
  }, Ot = ({ sheet: o, raise: e = !0, at: t }) => {
3774
3775
  const s = o.area;
3775
3776
  return o._toValueMatrix({ area: s, at: t, resolution: "SYSTEM" }).map((i, r) => {
@@ -3795,7 +3796,7 @@ const pt = ({ value: o, sheet: e, point: t, raise: s = !0, resolution: i = "RESO
3795
3796
  }
3796
3797
  });
3797
3798
  });
3798
- }, Ee = ({ value: o, at: e, raise: t = !0 }) => o instanceof ee ? o.strip({ raise: t, at: e }) : o, mt = new Re("asyncCacheMiss"), xi = (o) => o.some((e) => Q.is(e)), Gt = (o) => (o == null ? void 0 : o.__gsType) === "Sheet", Be = (o, e) => {
3799
+ }, Ee = ({ value: o, at: e, raise: t = !0 }) => ee.is(o) ? o.strip({ raise: t, at: e }) : o, mt = new Re("asyncCacheMiss"), xi = (o) => o.some((e) => Q.is(e)), Gt = (o) => (o == null ? void 0 : o.__gsType) === "Sheet", Be = (o, e) => {
3799
3800
  for (const t of o)
3800
3801
  if (Q.is(t) || Array.isArray(t) && Be(t, e) || re.is(t) && Be(t.matrix, e) || Gt(t) && Be(t._toValueMatrix({ at: e }), e))
3801
3802
  return !0;
@@ -3874,7 +3875,7 @@ const pt = ({ value: o, sheet: e, point: t, raise: s = !0, resolution: i = "RESO
3874
3875
  return t;
3875
3876
  if (!o)
3876
3877
  return 0;
3877
- if (o instanceof ee) {
3878
+ if (ee.is(o)) {
3878
3879
  const r = Ee({ value: o });
3879
3880
  return V(r, { alternative: t });
3880
3881
  }
@@ -3898,7 +3899,7 @@ const pt = ({ value: o, sheet: e, point: t, raise: s = !0, resolution: i = "RESO
3898
3899
  return "0";
3899
3900
  if (!o)
3900
3901
  return "";
3901
- if (o instanceof ee) {
3902
+ if (ee.is(o)) {
3902
3903
  const e = Ee({ value: o });
3903
3904
  return he(e);
3904
3905
  }
@@ -3916,7 +3917,7 @@ const pt = ({ value: o, sheet: e, point: t, raise: s = !0, resolution: i = "RESO
3916
3917
  return t;
3917
3918
  if (o === null)
3918
3919
  return !1;
3919
- if (o instanceof ee) {
3920
+ if (ee.is(o)) {
3920
3921
  const i = Ee({ value: o });
3921
3922
  return je(i, e);
3922
3923
  }
@@ -3931,7 +3932,7 @@ const pt = ({ value: o, sheet: e, point: t, raise: s = !0, resolution: i = "RESO
3931
3932
  }
3932
3933
  return !!o;
3933
3934
  }, Ie = (o, e, t) => {
3934
- if (o instanceof ee) {
3935
+ if (ee.is(o)) {
3935
3936
  const s = o.solve({ at: t });
3936
3937
  for (let i = 0; i < s.length; i++)
3937
3938
  for (let r = 0; r < s[i].length; r++)
@@ -4741,7 +4742,7 @@ class Ar extends U {
4741
4742
  ], this.category = "logical", this.broadcastDisabled = !0;
4742
4743
  }
4743
4744
  main(e) {
4744
- return re.is(e) ? e : e instanceof ee ? e._toValueMatrix() : Array.isArray(e) ? e : [[e]];
4745
+ return re.is(e) ? e : ee.is(e) ? e._toValueMatrix() : Array.isArray(e) ? e : [[e]];
4745
4746
  }
4746
4747
  }
4747
4748
  const $r = {
@@ -4794,18 +4795,19 @@ class Dr {
4794
4795
  onInsertCols: h,
4795
4796
  onSelect: c,
4796
4797
  onKeyUp: u,
4797
- onInit: f
4798
+ onInit: f,
4799
+ onFormula: d
4798
4800
  } = {}) {
4799
- this.sheetHead = 0, this.cellHead = 0, this.data = {}, this.systems = {}, this.sheetIdsByName = {}, this.contextsBySheetId = {}, this.choosingSheetId = 0, this.choosingAddress = "", this.editingSheetId = 0, this.editingAddress = "", this.paletteBySheetName = {}, this.lastFocused = null, this.solvedCaches = /* @__PURE__ */ new Map(), this.lastSpilledTargetIds = /* @__PURE__ */ new Set(), this.asyncFormulaCells = /* @__PURE__ */ new Set(), this.asyncPending = /* @__PURE__ */ new Map(), this.copyingSheetId = 0, this.copyingZone = _s, this.cutting = !1, this.histories = [], this.historyIndex = -1, this.historyLimit = bs, this._componentSheetIds = /* @__PURE__ */ new Map(), this.ready = !1, this.functions = {}, this.policies = {}, this.transmit = (d) => {
4800
- }, this.updateSheet = (d) => ({ type: 0, value: d }), e != null && (this.historyLimit = e), this.functions = {
4801
+ this.sheetHead = 0, this.cellHead = 0, this.data = {}, this.systems = {}, this.sheetIdsByName = {}, this.contextsBySheetId = {}, this.choosingSheetId = 0, this.choosingAddress = "", this.editingSheetId = 0, this.editingAddress = "", this.paletteBySheetName = {}, this.lastFocused = null, this.solvedCaches = /* @__PURE__ */ new Map(), this.lastSpilledTargetIds = /* @__PURE__ */ new Set(), this.asyncFormulaCells = /* @__PURE__ */ new Set(), this.asyncPending = /* @__PURE__ */ new Map(), this.copyingSheetId = 0, this.copyingZone = _s, this.cutting = !1, this.histories = [], this.historyIndex = -1, this.historyLimit = bs, this._componentSheetIds = /* @__PURE__ */ new Map(), this.ready = !1, this.functions = {}, this.policies = {}, this.transmit = (m) => {
4802
+ }, this.updateSheet = (m) => ({ type: 0, value: m }), e != null && (this.historyLimit = e), this.functions = {
4801
4803
  ...$r,
4802
4804
  ...t
4803
4805
  };
4804
- for (const d in this.functions) {
4805
- const m = this.functions[d];
4806
- m.__name = d;
4806
+ for (const m in this.functions) {
4807
+ const p = this.functions[m];
4808
+ p.__name = m;
4807
4809
  }
4808
- this.policies = s, this.onSave = i, this.onChange = r, this.onRemoveRows = n, this.onRemoveCols = a, this.onInsertRows = l, this.onInsertCols = h, this.onSelect = c, this.onKeyUp = u, this.onInit = f;
4810
+ this.policies = s, this.onSave = i, this.onChange = r, this.onRemoveRows = n, this.onRemoveCols = a, this.onInsertRows = l, this.onInsertCols = h, this.onSelect = c, this.onKeyUp = u, this.onInit = f, this.onFormula = d;
4809
4811
  }
4810
4812
  boot() {
4811
4813
  if (this.ready || Object.keys(this.contextsBySheetId).length === 0)