@univerjs/sheets-conditional-formatting 0.10.10 → 0.10.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.
package/lib/es/index.js CHANGED
@@ -6,7 +6,7 @@ import { isRangesEqual as H1 } from "@univerjs/core";
6
6
  import { getSheetCommandTarget as t2, SheetsSelectionsService as t0, findAllRectangle as n0, createTopMatrixFromMatrix as r0, SheetInterceptorService as s0, RemoveSheetCommand as i0, ReorderRangeMutation as a0, MoveRangeMutation as l0, MoveColsMutation as o0, MoveRowsMutation as c0, InsertRowMutation as u0, RemoveRowMutation as d0, RemoveColMutation as h0, InsertColMutation as g0, SetRangeValuesMutation as C0 } from "@univerjs/sheets";
7
7
  import { Subject as h2, BehaviorSubject as D0 } from "rxjs";
8
8
  import { IActiveDirtyManagerService as f0, SetFormulaCalculationResultMutation as m0, SetOtherFormulaMutation as w0, RemoveOtherFormulaMutation as F0, ERROR_TYPE_SET as S2, BooleanValue as b2 } from "@univerjs/engine-formula";
9
- import { distinctUntilChanged as v0, bufferTime as E0, filter as p0, map as A0 } from "rxjs/operators";
9
+ import { distinctUntilChanged as v0, bufferTime as p0, filter as E0, map as A0 } from "rxjs/operators";
10
10
  import { isObject as x0, SpreadsheetExtensionRegistry as W2, SheetExtension as q2, FIX_ONE_PIXEL_BLUR_OFFSET as _0 } from "@univerjs/engine-render";
11
11
  const Z2 = "SHEET_CONDITIONAL_FORMATTING_PLUGIN";
12
12
  var L = /* @__PURE__ */ ((s) => (s.beginsWith = "beginsWith", s.endsWith = "endsWith", s.containsText = "containsText", s.notContainsText = "notContainsText", s.equal = "equal", s.notEqual = "notEqual", s.containsBlanks = "containsBlanks", s.notContainsBlanks = "notContainsBlanks", s.containsErrors = "containsErrors", s.notContainsErrors = "notContainsErrors", s))(L || {}), k = /* @__PURE__ */ ((s) => (s.today = "today", s.yesterday = "yesterday", s.tomorrow = "tomorrow", s.last7Days = "last7Days", s.thisMonth = "thisMonth", s.lastMonth = "lastMonth", s.nextMonth = "nextMonth", s.thisWeek = "thisWeek", s.lastWeek = "lastWeek", s.nextWeek = "nextWeek", s))(k || {}), F = /* @__PURE__ */ ((s) => (s.greaterThan = "greaterThan", s.greaterThanOrEqual = "greaterThanOrEqual", s.lessThan = "lessThan", s.lessThanOrEqual = "lessThanOrEqual", s.notBetween = "notBetween", s.between = "between", s.equal = "equal", s.notEqual = "notEqual", s))(F || {}), S = /* @__PURE__ */ ((s) => (s.highlightCell = "highlightCell", s.dataBar = "dataBar", s.colorScale = "colorScale", s.iconSet = "iconSet", s))(S || {}), A = /* @__PURE__ */ ((s) => (s.uniqueValues = "uniqueValues", s.duplicateValues = "duplicateValues", s.rank = "rank", s.text = "text", s.timePeriod = "timePeriod", s.number = "number", s.average = "average", s.formula = "formula", s))(A || {}), I = /* @__PURE__ */ ((s) => (s.num = "num", s.min = "min", s.max = "max", s.percent = "percent", s.percentile = "percentile", s.formula = "formula", s))(I || {});
@@ -305,23 +305,23 @@ const i2 = {
305
305
  return !1;
306
306
  const g = [], h = [];
307
307
  c.forEach((w) => {
308
- const E = new O();
309
- w.ranges.forEach((p) => {
310
- U.foreach(p, (R, b) => {
311
- E.setValue(R, b, 1);
308
+ const p = new O();
309
+ w.ranges.forEach((E) => {
310
+ U.foreach(E, (R, b) => {
311
+ p.setValue(R, b, 1);
312
312
  });
313
- }), d.forEach((p) => {
314
- U.foreach(p, (R, b) => {
315
- E.realDeleteValue(R, b);
313
+ }), d.forEach((E) => {
314
+ U.foreach(E, (R, b) => {
315
+ p.realDeleteValue(R, b);
316
316
  });
317
317
  });
318
- const M = n0(r0(E));
318
+ const M = n0(r0(p));
319
319
  if (M.length) {
320
- const p = { ...w, ranges: M }, R = { unitId: l, subUnitId: o, rule: p }, b = H2(s, R);
320
+ const E = { ...w, ranges: M }, R = { unitId: l, subUnitId: o, rule: E }, b = H2(s, R);
321
321
  g.push({ id: a2.id, params: R }), h.push(...b);
322
322
  } else {
323
- const p = { unitId: l, subUnitId: o, cfId: w.cfId }, R = w2(s, p);
324
- g.push({ id: K.id, params: p }), h.push(...R);
323
+ const E = { unitId: l, subUnitId: o, cfId: w.cfId }, R = w2(s, E);
324
+ g.push({ id: K.id, params: E }), h.push(...R);
325
325
  }
326
326
  });
327
327
  const D = T2(g, n).result;
@@ -398,7 +398,7 @@ var T0 = Object.getOwnPropertyDescriptor, V0 = (s, r, t, e) => {
398
398
  for (var n = e > 1 ? void 0 : e ? T0(r, t) : r, i = s.length - 1, a; i >= 0; i--)
399
399
  (a = s[i]) && (n = a(n) || n);
400
400
  return n;
401
- }, p2 = (s, r) => (t, e) => r(t, e, s), N = /* @__PURE__ */ ((s) => (s[s.NOT_REGISTER = 1] = "NOT_REGISTER", s[s.SUCCESS = 2] = "SUCCESS", s[s.WAIT = 3] = "WAIT", s[s.ERROR = 4] = "ERROR", s))(N || {});
401
+ }, E2 = (s, r) => (t, e) => r(t, e, s), N = /* @__PURE__ */ ((s) => (s[s.NOT_REGISTER = 1] = "NOT_REGISTER", s[s.SUCCESS = 2] = "SUCCESS", s[s.WAIT = 3] = "WAIT", s[s.ERROR = 4] = "ERROR", s))(N || {});
402
402
  const O0 = (s) => {
403
403
  const r = s && s[0] && s[0][0];
404
404
  return (r == null ? void 0 : r.t) === _.BOOLEAN ? r.v === V2.TRUE || r.v === !0 : r ? r.v : !1;
@@ -583,9 +583,9 @@ let z = class extends y2 {
583
583
  }
584
584
  };
585
585
  z = V0([
586
- p2(0, x(P)),
587
- p2(1, x(f0)),
588
- p2(2, x(y))
586
+ E2(0, x(P)),
587
+ E2(1, x(f0)),
588
+ E2(2, x(y))
589
589
  ], z);
590
590
  var V = /* @__PURE__ */ ((s) => (s.preComputingStart = "preComputingStart", s.preComputing = "preComputing", s.preComputingEnd = "preComputingEnd", s.preComputingError = "preComputingError", s))(V || {});
591
591
  class F2 {
@@ -733,9 +733,9 @@ class G0 extends q2 {
733
733
  return;
734
734
  u.add($);
735
735
  }
736
- const { color: f, value: w, startPoint: E, isGradient: M } = D.dataBar, { startX: p, endX: R, startY: b, endY: v2 } = c || g ? h : d, l2 = R - p, E2 = v2 + _0 - b, Z = l2 - this._paddingRightAndLeft * 2, I2 = E2 - this._paddingTopAndBottom * 2;
736
+ const { color: f, value: w, startPoint: p, isGradient: M } = D.dataBar, { startX: E, endX: R, startY: b, endY: v2 } = c || g ? h : d, l2 = R - E, p2 = v2 + _0 - b, Z = l2 - this._paddingRightAndLeft * 2, I2 = p2 - this._paddingTopAndBottom * 2;
737
737
  if (w > 0) {
738
- const $ = Math.max(Z * (1 - E / 100) * w / 100, 1), G = p + this._paddingRightAndLeft + E / 100 * Z, H = b + this._paddingTopAndBottom;
738
+ const $ = Math.max(Z * (1 - p / 100) * w / 100, 1), G = E + this._paddingRightAndLeft + p / 100 * Z, H = b + this._paddingTopAndBottom;
739
739
  if (M) {
740
740
  const j = t.createLinearGradient(G, H, G + $, H);
741
741
  j.addColorStop(0, f), j.addColorStop(1, "rgb(255 255 255)"), t.fillStyle = j, t.strokeStyle = f, t.lineWidth = 1;
@@ -743,7 +743,7 @@ class G0 extends q2 {
743
743
  t.fillStyle = f;
744
744
  this._drawRectWithRoundedCorner(t, G, H, $, I2, !1, !0, !0, !1), M && t.stroke();
745
745
  } else {
746
- const $ = Math.max(Z * E / 100 * Math.abs(w) / 100, 1), G = p + this._paddingRightAndLeft + E / 100 * Z - $, H = b + this._paddingTopAndBottom;
746
+ const $ = Math.max(Z * p / 100 * Math.abs(w) / 100, 1), G = E + this._paddingRightAndLeft + p / 100 * Z - $, H = b + this._paddingTopAndBottom;
747
747
  if (M) {
748
748
  const j = t.createLinearGradient(G, H, G + $, H);
749
749
  j.addColorStop(0, "rgb(255 255 255)"), j.addColorStop(1, f), t.fillStyle = j, t.strokeStyle = f, t.lineWidth = 1;
@@ -772,10 +772,10 @@ class j0 extends F2 {
772
772
  const n = e.rule, i = n.rule, a = e.worksheet, u = new O();
773
773
  ![n.rule.config.max, n.rule.config.min].every((h) => h.type === I.num) && R2(n.ranges, a.getMaxRows() - 1, a.getMaxColumns() - 1).forEach((D) => {
774
774
  U.foreach(D, (f, w) => {
775
- const E = e.getCellValue(f, w), M = E && E.v;
776
- if (!B(M) && (E == null ? void 0 : E.t) === _.NUMBER) {
777
- const p = Number(M);
778
- !Number.isNaN(p) && u.setValue(f, w, p);
775
+ const p = e.getCellValue(f, w), M = p && p.v;
776
+ if (!B(M) && (p == null ? void 0 : p.t) === _.NUMBER) {
777
+ const E = Number(M);
778
+ !Number.isNaN(E) && u.setValue(f, w, E);
779
779
  }
780
780
  });
781
781
  });
@@ -1170,7 +1170,7 @@ let Q = class extends y2 {
1170
1170
  */
1171
1171
  m(this, "markRuleDirty", (() => {
1172
1172
  const r = new h2();
1173
- return this.disposeWithMe(r.pipe(E0(100), p0((t) => !!t.length), A0((t) => {
1173
+ return this.disposeWithMe(r.pipe(p0(100), E0((t) => !!t.length), A0((t) => {
1174
1174
  const e = /* @__PURE__ */ new Set(), n = [];
1175
1175
  return t.forEach((i) => {
1176
1176
  const a = `${i.unitId}_${i.subUnitId}_${i.cfId}`;
@@ -1218,6 +1218,9 @@ let Q = class extends y2 {
1218
1218
  } : null;
1219
1219
  }).filter((c) => !!c).map((c, g) => ({ ...c, priority: g })) : [];
1220
1220
  }
1221
+ dispose() {
1222
+ this._calculateUnitManagers.clear(), this._cellCache.clear(), this._rTreeManager.clear(), super.dispose();
1223
+ }
1221
1224
  _handleCustomFormulasSeparately() {
1222
1225
  this.disposeWithMe(
1223
1226
  this._conditionalFormattingRuleModel.$ruleChange.subscribe((r) => {
@@ -1654,7 +1657,7 @@ let s2 = class extends y2 {
1654
1657
  toJson: (t) => s(t),
1655
1658
  parseJson: (t) => r(t),
1656
1659
  onUnLoad: (t) => {
1657
- this._conditionalFormattingRuleModel.deleteUnitId(t);
1660
+ this._conditionalFormattingRuleModel.deleteUnitId(t), this._conditionalFormattingViewModelV2.dispose();
1658
1661
  },
1659
1662
  onLoad: (t, e) => {
1660
1663
  Object.keys(e).forEach((n) => {
@@ -1796,7 +1799,7 @@ const w1 = (s) => s.getCurrentUnitForType(m2.UNIVER_SHEET).getUnitId(), F1 = (s)
1796
1799
  var r;
1797
1800
  return (r = s.getCurrentUnitForType(m2.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : r.getSheetId();
1798
1801
  };
1799
- var v1 = Object.getOwnPropertyDescriptor, E1 = (s, r, t, e) => {
1802
+ var v1 = Object.getOwnPropertyDescriptor, p1 = (s, r, t, e) => {
1800
1803
  for (var n = e > 1 ? void 0 : e ? v1(r, t) : r, i = s.length - 1, a; i >= 0; i--)
1801
1804
  (a = s[i]) && (n = a(n) || n);
1802
1805
  return n;
@@ -1836,12 +1839,12 @@ let N2 = (u2 = class extends z2 {
1836
1839
  this._injector.get(s2), Q2(this._injector, [[s2], [Q]]);
1837
1840
  }
1838
1841
  }, m(u2, "pluginName", Z2), m(u2, "type", m2.UNIVER_SHEET), u2);
1839
- N2 = E1([
1842
+ N2 = p1([
1840
1843
  _2(1, x(M2)),
1841
1844
  _2(2, x(P)),
1842
1845
  _2(3, e0)
1843
1846
  ], N2);
1844
- const p1 = "sheet-conditional-rule-icon", A1 = 35, x1 = 15, _1 = 2, y1 = (s) => {
1847
+ const E1 = "sheet-conditional-rule-icon", A1 = 35, x1 = 15, _1 = 2, y1 = (s) => {
1845
1848
  const { startRow: r, endRow: t, startColumn: e, endColumn: n } = s;
1846
1849
  return `${r}-${t}-${e}-${n}`;
1847
1850
  };
@@ -1851,7 +1854,7 @@ class M1 extends q2 {
1851
1854
  m(this, "_paddingRightAndLeft", _1);
1852
1855
  m(this, "_width", x1);
1853
1856
  m(this, "_imageMap", /* @__PURE__ */ new Map());
1854
- m(this, "uKey", p1);
1857
+ m(this, "uKey", E1);
1855
1858
  m(this, "Z_INDEX", A1);
1856
1859
  m(this, "_radius", 1);
1857
1860
  this._init();
@@ -1871,8 +1874,8 @@ class M1 extends q2 {
1871
1874
  const { iconType: f, iconId: w } = D.iconSet;
1872
1875
  if (f === C1)
1873
1876
  return;
1874
- const E = this._imageMap.get(this._createKey(f, w));
1875
- if (!E || !this.isRenderDiffRangesByCell(h, i))
1877
+ const p = this._imageMap.get(this._createKey(f, w));
1878
+ if (!p || !this.isRenderDiffRangesByCell(h, i))
1876
1879
  return;
1877
1880
  if (c || g) {
1878
1881
  const Z = y1(h);
@@ -1880,11 +1883,11 @@ class M1 extends q2 {
1880
1883
  return;
1881
1884
  u.add(Z);
1882
1885
  }
1883
- const { startX: M, endX: p, startY: R, endY: b } = c || g ? h : d, v2 = p - M, l2 = b - R;
1886
+ const { startX: M, endX: E, startY: R, endY: b } = c || g ? h : d, v2 = E - M, l2 = b - R;
1884
1887
  if (this._width > l2 || this._width > v2 + this._paddingRightAndLeft * 2)
1885
1888
  return;
1886
- const E2 = (l2 - this._width) / 2 + R;
1887
- t.drawImage(E, M + this._paddingRightAndLeft, E2, this._width, this._width);
1889
+ const p2 = (l2 - this._width) / 2 + R;
1890
+ t.drawImage(p, M + this._paddingRightAndLeft, p2, this._width, this._width);
1888
1891
  }), t.restore();
1889
1892
  }
1890
1893
  _init() {
@@ -1941,7 +1944,7 @@ export {
1941
1944
  w2 as DeleteConditionalRuleMutationUndoFactory,
1942
1945
  C1 as EMPTY_ICON_TYPE,
1943
1946
  N as FormulaResultStatus,
1944
- p1 as IconUKey,
1947
+ E1 as IconUKey,
1945
1948
  N0 as MoveCfCommand,
1946
1949
  i2 as MoveConditionalRuleMutation,
1947
1950
  I0 as MoveConditionalRuleMutationUndoFactory,
package/lib/index.js CHANGED
@@ -6,7 +6,7 @@ import { isRangesEqual as H1 } from "@univerjs/core";
6
6
  import { getSheetCommandTarget as t2, SheetsSelectionsService as t0, findAllRectangle as n0, createTopMatrixFromMatrix as r0, SheetInterceptorService as s0, RemoveSheetCommand as i0, ReorderRangeMutation as a0, MoveRangeMutation as l0, MoveColsMutation as o0, MoveRowsMutation as c0, InsertRowMutation as u0, RemoveRowMutation as d0, RemoveColMutation as h0, InsertColMutation as g0, SetRangeValuesMutation as C0 } from "@univerjs/sheets";
7
7
  import { Subject as h2, BehaviorSubject as D0 } from "rxjs";
8
8
  import { IActiveDirtyManagerService as f0, SetFormulaCalculationResultMutation as m0, SetOtherFormulaMutation as w0, RemoveOtherFormulaMutation as F0, ERROR_TYPE_SET as S2, BooleanValue as b2 } from "@univerjs/engine-formula";
9
- import { distinctUntilChanged as v0, bufferTime as E0, filter as p0, map as A0 } from "rxjs/operators";
9
+ import { distinctUntilChanged as v0, bufferTime as p0, filter as E0, map as A0 } from "rxjs/operators";
10
10
  import { isObject as x0, SpreadsheetExtensionRegistry as W2, SheetExtension as q2, FIX_ONE_PIXEL_BLUR_OFFSET as _0 } from "@univerjs/engine-render";
11
11
  const Z2 = "SHEET_CONDITIONAL_FORMATTING_PLUGIN";
12
12
  var L = /* @__PURE__ */ ((s) => (s.beginsWith = "beginsWith", s.endsWith = "endsWith", s.containsText = "containsText", s.notContainsText = "notContainsText", s.equal = "equal", s.notEqual = "notEqual", s.containsBlanks = "containsBlanks", s.notContainsBlanks = "notContainsBlanks", s.containsErrors = "containsErrors", s.notContainsErrors = "notContainsErrors", s))(L || {}), k = /* @__PURE__ */ ((s) => (s.today = "today", s.yesterday = "yesterday", s.tomorrow = "tomorrow", s.last7Days = "last7Days", s.thisMonth = "thisMonth", s.lastMonth = "lastMonth", s.nextMonth = "nextMonth", s.thisWeek = "thisWeek", s.lastWeek = "lastWeek", s.nextWeek = "nextWeek", s))(k || {}), F = /* @__PURE__ */ ((s) => (s.greaterThan = "greaterThan", s.greaterThanOrEqual = "greaterThanOrEqual", s.lessThan = "lessThan", s.lessThanOrEqual = "lessThanOrEqual", s.notBetween = "notBetween", s.between = "between", s.equal = "equal", s.notEqual = "notEqual", s))(F || {}), S = /* @__PURE__ */ ((s) => (s.highlightCell = "highlightCell", s.dataBar = "dataBar", s.colorScale = "colorScale", s.iconSet = "iconSet", s))(S || {}), A = /* @__PURE__ */ ((s) => (s.uniqueValues = "uniqueValues", s.duplicateValues = "duplicateValues", s.rank = "rank", s.text = "text", s.timePeriod = "timePeriod", s.number = "number", s.average = "average", s.formula = "formula", s))(A || {}), I = /* @__PURE__ */ ((s) => (s.num = "num", s.min = "min", s.max = "max", s.percent = "percent", s.percentile = "percentile", s.formula = "formula", s))(I || {});
@@ -305,23 +305,23 @@ const i2 = {
305
305
  return !1;
306
306
  const g = [], h = [];
307
307
  c.forEach((w) => {
308
- const E = new O();
309
- w.ranges.forEach((p) => {
310
- U.foreach(p, (R, b) => {
311
- E.setValue(R, b, 1);
308
+ const p = new O();
309
+ w.ranges.forEach((E) => {
310
+ U.foreach(E, (R, b) => {
311
+ p.setValue(R, b, 1);
312
312
  });
313
- }), d.forEach((p) => {
314
- U.foreach(p, (R, b) => {
315
- E.realDeleteValue(R, b);
313
+ }), d.forEach((E) => {
314
+ U.foreach(E, (R, b) => {
315
+ p.realDeleteValue(R, b);
316
316
  });
317
317
  });
318
- const M = n0(r0(E));
318
+ const M = n0(r0(p));
319
319
  if (M.length) {
320
- const p = { ...w, ranges: M }, R = { unitId: l, subUnitId: o, rule: p }, b = H2(s, R);
320
+ const E = { ...w, ranges: M }, R = { unitId: l, subUnitId: o, rule: E }, b = H2(s, R);
321
321
  g.push({ id: a2.id, params: R }), h.push(...b);
322
322
  } else {
323
- const p = { unitId: l, subUnitId: o, cfId: w.cfId }, R = w2(s, p);
324
- g.push({ id: K.id, params: p }), h.push(...R);
323
+ const E = { unitId: l, subUnitId: o, cfId: w.cfId }, R = w2(s, E);
324
+ g.push({ id: K.id, params: E }), h.push(...R);
325
325
  }
326
326
  });
327
327
  const D = T2(g, n).result;
@@ -398,7 +398,7 @@ var T0 = Object.getOwnPropertyDescriptor, V0 = (s, r, t, e) => {
398
398
  for (var n = e > 1 ? void 0 : e ? T0(r, t) : r, i = s.length - 1, a; i >= 0; i--)
399
399
  (a = s[i]) && (n = a(n) || n);
400
400
  return n;
401
- }, p2 = (s, r) => (t, e) => r(t, e, s), N = /* @__PURE__ */ ((s) => (s[s.NOT_REGISTER = 1] = "NOT_REGISTER", s[s.SUCCESS = 2] = "SUCCESS", s[s.WAIT = 3] = "WAIT", s[s.ERROR = 4] = "ERROR", s))(N || {});
401
+ }, E2 = (s, r) => (t, e) => r(t, e, s), N = /* @__PURE__ */ ((s) => (s[s.NOT_REGISTER = 1] = "NOT_REGISTER", s[s.SUCCESS = 2] = "SUCCESS", s[s.WAIT = 3] = "WAIT", s[s.ERROR = 4] = "ERROR", s))(N || {});
402
402
  const O0 = (s) => {
403
403
  const r = s && s[0] && s[0][0];
404
404
  return (r == null ? void 0 : r.t) === _.BOOLEAN ? r.v === V2.TRUE || r.v === !0 : r ? r.v : !1;
@@ -583,9 +583,9 @@ let z = class extends y2 {
583
583
  }
584
584
  };
585
585
  z = V0([
586
- p2(0, x(P)),
587
- p2(1, x(f0)),
588
- p2(2, x(y))
586
+ E2(0, x(P)),
587
+ E2(1, x(f0)),
588
+ E2(2, x(y))
589
589
  ], z);
590
590
  var V = /* @__PURE__ */ ((s) => (s.preComputingStart = "preComputingStart", s.preComputing = "preComputing", s.preComputingEnd = "preComputingEnd", s.preComputingError = "preComputingError", s))(V || {});
591
591
  class F2 {
@@ -733,9 +733,9 @@ class G0 extends q2 {
733
733
  return;
734
734
  u.add($);
735
735
  }
736
- const { color: f, value: w, startPoint: E, isGradient: M } = D.dataBar, { startX: p, endX: R, startY: b, endY: v2 } = c || g ? h : d, l2 = R - p, E2 = v2 + _0 - b, Z = l2 - this._paddingRightAndLeft * 2, I2 = E2 - this._paddingTopAndBottom * 2;
736
+ const { color: f, value: w, startPoint: p, isGradient: M } = D.dataBar, { startX: E, endX: R, startY: b, endY: v2 } = c || g ? h : d, l2 = R - E, p2 = v2 + _0 - b, Z = l2 - this._paddingRightAndLeft * 2, I2 = p2 - this._paddingTopAndBottom * 2;
737
737
  if (w > 0) {
738
- const $ = Math.max(Z * (1 - E / 100) * w / 100, 1), G = p + this._paddingRightAndLeft + E / 100 * Z, H = b + this._paddingTopAndBottom;
738
+ const $ = Math.max(Z * (1 - p / 100) * w / 100, 1), G = E + this._paddingRightAndLeft + p / 100 * Z, H = b + this._paddingTopAndBottom;
739
739
  if (M) {
740
740
  const j = t.createLinearGradient(G, H, G + $, H);
741
741
  j.addColorStop(0, f), j.addColorStop(1, "rgb(255 255 255)"), t.fillStyle = j, t.strokeStyle = f, t.lineWidth = 1;
@@ -743,7 +743,7 @@ class G0 extends q2 {
743
743
  t.fillStyle = f;
744
744
  this._drawRectWithRoundedCorner(t, G, H, $, I2, !1, !0, !0, !1), M && t.stroke();
745
745
  } else {
746
- const $ = Math.max(Z * E / 100 * Math.abs(w) / 100, 1), G = p + this._paddingRightAndLeft + E / 100 * Z - $, H = b + this._paddingTopAndBottom;
746
+ const $ = Math.max(Z * p / 100 * Math.abs(w) / 100, 1), G = E + this._paddingRightAndLeft + p / 100 * Z - $, H = b + this._paddingTopAndBottom;
747
747
  if (M) {
748
748
  const j = t.createLinearGradient(G, H, G + $, H);
749
749
  j.addColorStop(0, "rgb(255 255 255)"), j.addColorStop(1, f), t.fillStyle = j, t.strokeStyle = f, t.lineWidth = 1;
@@ -772,10 +772,10 @@ class j0 extends F2 {
772
772
  const n = e.rule, i = n.rule, a = e.worksheet, u = new O();
773
773
  ![n.rule.config.max, n.rule.config.min].every((h) => h.type === I.num) && R2(n.ranges, a.getMaxRows() - 1, a.getMaxColumns() - 1).forEach((D) => {
774
774
  U.foreach(D, (f, w) => {
775
- const E = e.getCellValue(f, w), M = E && E.v;
776
- if (!B(M) && (E == null ? void 0 : E.t) === _.NUMBER) {
777
- const p = Number(M);
778
- !Number.isNaN(p) && u.setValue(f, w, p);
775
+ const p = e.getCellValue(f, w), M = p && p.v;
776
+ if (!B(M) && (p == null ? void 0 : p.t) === _.NUMBER) {
777
+ const E = Number(M);
778
+ !Number.isNaN(E) && u.setValue(f, w, E);
779
779
  }
780
780
  });
781
781
  });
@@ -1170,7 +1170,7 @@ let Q = class extends y2 {
1170
1170
  */
1171
1171
  m(this, "markRuleDirty", (() => {
1172
1172
  const r = new h2();
1173
- return this.disposeWithMe(r.pipe(E0(100), p0((t) => !!t.length), A0((t) => {
1173
+ return this.disposeWithMe(r.pipe(p0(100), E0((t) => !!t.length), A0((t) => {
1174
1174
  const e = /* @__PURE__ */ new Set(), n = [];
1175
1175
  return t.forEach((i) => {
1176
1176
  const a = `${i.unitId}_${i.subUnitId}_${i.cfId}`;
@@ -1218,6 +1218,9 @@ let Q = class extends y2 {
1218
1218
  } : null;
1219
1219
  }).filter((c) => !!c).map((c, g) => ({ ...c, priority: g })) : [];
1220
1220
  }
1221
+ dispose() {
1222
+ this._calculateUnitManagers.clear(), this._cellCache.clear(), this._rTreeManager.clear(), super.dispose();
1223
+ }
1221
1224
  _handleCustomFormulasSeparately() {
1222
1225
  this.disposeWithMe(
1223
1226
  this._conditionalFormattingRuleModel.$ruleChange.subscribe((r) => {
@@ -1654,7 +1657,7 @@ let s2 = class extends y2 {
1654
1657
  toJson: (t) => s(t),
1655
1658
  parseJson: (t) => r(t),
1656
1659
  onUnLoad: (t) => {
1657
- this._conditionalFormattingRuleModel.deleteUnitId(t);
1660
+ this._conditionalFormattingRuleModel.deleteUnitId(t), this._conditionalFormattingViewModelV2.dispose();
1658
1661
  },
1659
1662
  onLoad: (t, e) => {
1660
1663
  Object.keys(e).forEach((n) => {
@@ -1796,7 +1799,7 @@ const w1 = (s) => s.getCurrentUnitForType(m2.UNIVER_SHEET).getUnitId(), F1 = (s)
1796
1799
  var r;
1797
1800
  return (r = s.getCurrentUnitForType(m2.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : r.getSheetId();
1798
1801
  };
1799
- var v1 = Object.getOwnPropertyDescriptor, E1 = (s, r, t, e) => {
1802
+ var v1 = Object.getOwnPropertyDescriptor, p1 = (s, r, t, e) => {
1800
1803
  for (var n = e > 1 ? void 0 : e ? v1(r, t) : r, i = s.length - 1, a; i >= 0; i--)
1801
1804
  (a = s[i]) && (n = a(n) || n);
1802
1805
  return n;
@@ -1836,12 +1839,12 @@ let N2 = (u2 = class extends z2 {
1836
1839
  this._injector.get(s2), Q2(this._injector, [[s2], [Q]]);
1837
1840
  }
1838
1841
  }, m(u2, "pluginName", Z2), m(u2, "type", m2.UNIVER_SHEET), u2);
1839
- N2 = E1([
1842
+ N2 = p1([
1840
1843
  _2(1, x(M2)),
1841
1844
  _2(2, x(P)),
1842
1845
  _2(3, e0)
1843
1846
  ], N2);
1844
- const p1 = "sheet-conditional-rule-icon", A1 = 35, x1 = 15, _1 = 2, y1 = (s) => {
1847
+ const E1 = "sheet-conditional-rule-icon", A1 = 35, x1 = 15, _1 = 2, y1 = (s) => {
1845
1848
  const { startRow: r, endRow: t, startColumn: e, endColumn: n } = s;
1846
1849
  return `${r}-${t}-${e}-${n}`;
1847
1850
  };
@@ -1851,7 +1854,7 @@ class M1 extends q2 {
1851
1854
  m(this, "_paddingRightAndLeft", _1);
1852
1855
  m(this, "_width", x1);
1853
1856
  m(this, "_imageMap", /* @__PURE__ */ new Map());
1854
- m(this, "uKey", p1);
1857
+ m(this, "uKey", E1);
1855
1858
  m(this, "Z_INDEX", A1);
1856
1859
  m(this, "_radius", 1);
1857
1860
  this._init();
@@ -1871,8 +1874,8 @@ class M1 extends q2 {
1871
1874
  const { iconType: f, iconId: w } = D.iconSet;
1872
1875
  if (f === C1)
1873
1876
  return;
1874
- const E = this._imageMap.get(this._createKey(f, w));
1875
- if (!E || !this.isRenderDiffRangesByCell(h, i))
1877
+ const p = this._imageMap.get(this._createKey(f, w));
1878
+ if (!p || !this.isRenderDiffRangesByCell(h, i))
1876
1879
  return;
1877
1880
  if (c || g) {
1878
1881
  const Z = y1(h);
@@ -1880,11 +1883,11 @@ class M1 extends q2 {
1880
1883
  return;
1881
1884
  u.add(Z);
1882
1885
  }
1883
- const { startX: M, endX: p, startY: R, endY: b } = c || g ? h : d, v2 = p - M, l2 = b - R;
1886
+ const { startX: M, endX: E, startY: R, endY: b } = c || g ? h : d, v2 = E - M, l2 = b - R;
1884
1887
  if (this._width > l2 || this._width > v2 + this._paddingRightAndLeft * 2)
1885
1888
  return;
1886
- const E2 = (l2 - this._width) / 2 + R;
1887
- t.drawImage(E, M + this._paddingRightAndLeft, E2, this._width, this._width);
1889
+ const p2 = (l2 - this._width) / 2 + R;
1890
+ t.drawImage(p, M + this._paddingRightAndLeft, p2, this._width, this._width);
1888
1891
  }), t.restore();
1889
1892
  }
1890
1893
  _init() {
@@ -1941,7 +1944,7 @@ export {
1941
1944
  w2 as DeleteConditionalRuleMutationUndoFactory,
1942
1945
  C1 as EMPTY_ICON_TYPE,
1943
1946
  N as FormulaResultStatus,
1944
- p1 as IconUKey,
1947
+ E1 as IconUKey,
1945
1948
  N0 as MoveCfCommand,
1946
1949
  i2 as MoveConditionalRuleMutation,
1947
1950
  I0 as MoveConditionalRuleMutationUndoFactory,
@@ -48,6 +48,7 @@ export declare class ConditionalFormattingViewModel extends Disposable {
48
48
  * Here,multiple dirties are merged into one..
49
49
  */
50
50
  markRuleDirty: (unitId: string, subUnitId: string, cfId: string, isNeedResetPreComputingCache?: boolean) => void;
51
+ dispose(): void;
51
52
  private _handleCustomFormulasSeparately;
52
53
  private _initRuleListener;
53
54
  private _ensureCalculateUnitManager;