@univerjs/sheets-conditional-formatting 0.1.16 → 0.2.0

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
@@ -1,12 +1,12 @@
1
1
  var CA = Object.defineProperty;
2
2
  var YA = (f, v, e) => v in f ? CA(f, v, { enumerable: !0, configurable: !0, writable: !0, value: e }) : f[v] = e;
3
- var u = (f, v, e) => YA(f, typeof v != "symbol" ? v + "" : v, e);
4
- import { Tools as $, ObjectMatrix as Y, Range as W, CommandType as eA, ICommandService as BA, Disposable as WA, toDisposable as OA, RefAlias as jA, CellValueType as c, BooleanNumber as EA, ColorKit as JA, Rectangle as R, createInterceptorKey as hA, OnLifecycle as UA, LifecycleStages as RA, IUniverInstanceService as MA, IResourceManagerService as VA, afterInitApply as bA, InterceptorManager as FA, UniverInstanceType as XA, Plugin as IA } from "@univerjs/core";
5
- import { Inject as J, Injector as LA } from "@wendellhu/redi";
3
+ var D = (f, v, e) => YA(f, typeof v != "symbol" ? v + "" : v, e);
4
+ import { Tools as _, ObjectMatrix as Y, Range as W, CommandType as vA, ICommandService as PA, Disposable as WA, toDisposable as OA, RefAlias as jA, CellValueType as c, BooleanNumber as EA, ColorKit as JA, Rectangle as R, createInterceptorKey as hA, OnLifecycle as UA, LifecycleStages as RA, IUniverInstanceService as MA, IResourceManagerService as VA, afterInitApply as bA, InterceptorManager as FA, UniverInstanceType as NA, Plugin as IA } from "@univerjs/core";
5
+ import { Inject as J, Injector as XA } from "@wendellhu/redi";
6
6
  import { SheetInterceptorService as zA, RemoveSheetCommand as qA, ReorderRangeMutation as KA, MoveRangeMutation as yA, MoveColsMutation as xA, MoveRowsMutation as GA, InsertRowMutation as _A, RemoveRowMutation as $A, RemoveColMutation as Av, InsertColMutation as vv, SetRangeValuesMutation as ev } from "@univerjs/sheets";
7
- import { Subject as tA } from "rxjs";
7
+ import { Subject as LA } from "rxjs";
8
8
  import { bufferTime as Zv, filter as iA, map as fv } from "rxjs/operators";
9
- import { IActiveDirtyManagerService as nv, SetFormulaCalculationResultMutation as mv, SetOtherFormulaMutation as Tv, RemoveOtherFormulaMutation as Sv, BooleanValue as DA, LexerTreeBuilder as lv, sequenceNodeType as Nv, deserializeRangeWithSheet as Xv, serializeRange as Lv, generateStringWithSequence as tv, ERROR_TYPE_SET as rA } from "@univerjs/engine-formula";
9
+ import { IActiveDirtyManagerService as nv, SetFormulaCalculationResultMutation as mv, SetOtherFormulaMutation as Tv, RemoveOtherFormulaMutation as Sv, BooleanValue as uA, LexerTreeBuilder as lv, sequenceNodeType as Nv, deserializeRangeWithSheet as Xv, serializeRange as Lv, generateStringWithSequence as tv, ERROR_TYPE_SET as DA } from "@univerjs/engine-formula";
10
10
  import E from "dayjs";
11
11
  import { isObject as kv, SpreadsheetExtensionRegistry as aA, SheetExtension as sA, FIX_ONE_PIXEL_BLUR_OFFSET as wv } from "@univerjs/engine-render";
12
12
  const oA = "SHEET_CONDITIONAL_FORMATTING_PLUGIN";
@@ -57,7 +57,7 @@ const re = "#fff", He = "#000000", Qe = () => ({
57
57
  return v !== void 0 ? v : 10;
58
58
  }
59
59
  return "";
60
- }, Pv = () => `${$.generateRandomId(8)}`, q = (f, v, e) => {
60
+ }, Pv = () => `${_.generateRandomId(8)}`, q = (f, v, e) => {
61
61
  if (!v)
62
62
  return null;
63
63
  const A = v.findIndex((Z) => e(Z) === f.id);
@@ -134,12 +134,12 @@ const re = "#fff", He = "#000000", Qe = () => ({
134
134
  }
135
135
  return null;
136
136
  }, Je = (f, v) => f.id === v.id && f.type === v.type;
137
- class ZA {
137
+ class eA {
138
138
  constructor() {
139
139
  // Map<unitID ,<sheetId ,ObjectMatrix>>
140
- u(this, "_model", /* @__PURE__ */ new Map());
141
- u(this, "_markDirty$", new tA());
142
- u(this, "markDirty$", this._markDirty$.asObservable());
140
+ D(this, "_model", /* @__PURE__ */ new Map());
141
+ D(this, "_markDirty$", new LA());
142
+ D(this, "markDirty$", this._markDirty$.asObservable());
143
143
  }
144
144
  _ensureMatrix(v, e) {
145
145
  let A = this.getMatrix(v, e);
@@ -214,13 +214,13 @@ var uv = Object.defineProperty, Dv = Object.getOwnPropertyDescriptor, rv = (f, v
214
214
  for (var Z = A > 1 ? void 0 : A ? Dv(v, e) : v, n = f.length - 1, m; n >= 0; n--)
215
215
  (m = f[n]) && (Z = (A ? m(v, e, Z) : m(Z)) || Z);
216
216
  return A && Z && uv(v, e, Z), Z;
217
- }, HA = (f, v) => (e, A) => v(e, A, f);
217
+ }, rA = (f, v) => (e, A) => v(e, A, f);
218
218
  let O = class {
219
219
  constructor(f, v) {
220
220
  // Map<unitID ,<sheetId ,IConditionFormattingRule[]>>
221
- u(this, "_model", /* @__PURE__ */ new Map());
222
- u(this, "_ruleChange$", new tA());
223
- u(this, "$ruleChange", this._ruleChange$.asObservable());
221
+ D(this, "_model", /* @__PURE__ */ new Map());
222
+ D(this, "_ruleChange$", new LA());
223
+ D(this, "$ruleChange", this._ruleChange$.asObservable());
224
224
  this._conditionalFormattingViewModel = f, this._injector = v;
225
225
  }
226
226
  _ensureList(f, v) {
@@ -257,7 +257,7 @@ let O = class {
257
257
  setRule(f, v, e, A) {
258
258
  const Z = this._ensureList(f, v), n = Z.find((m) => m.cfId === A);
259
259
  if (n) {
260
- const m = Z.map((N) => N.cfId).reduce((N, X, k) => (N.set(X, k), N), /* @__PURE__ */ new Map()), T = [...n.ranges], l = this._injector.get(_);
260
+ const m = Z.map((N) => N.cfId).reduce((N, X, k) => (N.set(X, k), N), /* @__PURE__ */ new Map()), T = [...n.ranges], l = this._injector.get(G);
261
261
  Object.assign(n, e);
262
262
  const S = l.interceptorManager.intercept(l.interceptorManager.getInterceptPoints().beforeUpdateRuleResult, {
263
263
  handler: (N, X, k) => {
@@ -320,11 +320,11 @@ let O = class {
320
320
  }
321
321
  };
322
322
  O = rv([
323
- HA(0, J(ZA)),
324
- HA(1, J(LA))
323
+ rA(0, J(eA)),
324
+ rA(1, J(XA))
325
325
  ], O);
326
- const ie = (f, v) => ({ id: pA.id, params: { unitId: v.unitId, subUnitId: v.subUnitId, cfId: v.rule.cfId } }), gA = {
327
- type: eA.MUTATION,
326
+ const ie = (f, v) => ({ id: dA.id, params: { unitId: v.unitId, subUnitId: v.subUnitId, cfId: v.rule.cfId } }), gA = {
327
+ type: vA.MUTATION,
328
328
  id: "sheet.mutation.add-conditional-rule",
329
329
  handler(f, v) {
330
330
  if (!v)
@@ -332,8 +332,8 @@ const ie = (f, v) => ({ id: pA.id, params: { unitId: v.unitId, subUnitId: v.subU
332
332
  const { unitId: e, subUnitId: A, rule: Z } = v;
333
333
  return f.get(O).addRule(e, A, Z), !0;
334
334
  }
335
- }, dA = {
336
- type: eA.MUTATION,
335
+ }, BA = {
336
+ type: vA.MUTATION,
337
337
  id: "sheet.mutation.move-conditional-rule",
338
338
  handler(f, v) {
339
339
  if (!v)
@@ -348,7 +348,7 @@ const ie = (f, v) => ({ id: pA.id, params: { unitId: v.unitId, subUnitId: v.subU
348
348
  const [Z, n] = A;
349
349
  return [
350
350
  {
351
- id: dA.id,
351
+ id: BA.id,
352
352
  params: { unitId: v, subUnitId: e, start: Z, end: n }
353
353
  }
354
354
  ];
@@ -357,7 +357,7 @@ const ie = (f, v) => ({ id: pA.id, params: { unitId: v.unitId, subUnitId: v.subU
357
357
  if (T > -1) {
358
358
  const S = m[T], N = [{
359
359
  id: gA.id,
360
- params: { unitId: A, subUnitId: Z, rule: $.deepClone(S) }
360
+ params: { unitId: A, subUnitId: Z, rule: _.deepClone(S) }
361
361
  }];
362
362
  if (m.splice(T, 1), T !== 0) {
363
363
  const X = m[0];
@@ -371,14 +371,14 @@ const ie = (f, v) => ({ id: pA.id, params: { unitId: v.unitId, subUnitId: v.subU
371
371
  start: w,
372
372
  end: L
373
373
  };
374
- N.push({ id: dA.id, params: t });
374
+ N.push({ id: BA.id, params: t });
375
375
  }
376
376
  }
377
377
  return N;
378
378
  }
379
379
  return [];
380
- }, pA = {
381
- type: eA.MUTATION,
380
+ }, dA = {
381
+ type: vA.MUTATION,
382
382
  id: "sheet.mutation.delete-conditional-rule",
383
383
  handler(f, v) {
384
384
  if (!v)
@@ -387,7 +387,7 @@ const ie = (f, v) => ({ id: pA.id, params: { unitId: v.unitId, subUnitId: v.subU
387
387
  return f.get(O).deleteRule(e, A, Z), !0;
388
388
  }
389
389
  }, mA = {
390
- type: eA.MUTATION,
390
+ type: vA.MUTATION,
391
391
  id: "sheet.mutation.conditional-formatting-formula-mark-dirty",
392
392
  handler() {
393
393
  return !0;
@@ -397,7 +397,7 @@ var Qv = Object.defineProperty, Wv = Object.getOwnPropertyDescriptor, Ev = (f, v
397
397
  for (var Z = A > 1 ? void 0 : A ? Wv(v, e) : v, n = f.length - 1, m; n >= 0; n--)
398
398
  (m = f[n]) && (Z = (A ? m(v, e, Z) : m(Z)) || Z);
399
399
  return A && Z && Qv(v, e, Z), Z;
400
- }, AA = (f, v) => (e, A) => v(e, A, f), s = /* @__PURE__ */ ((f) => (f[f.NOT_REGISTER = 1] = "NOT_REGISTER", f[f.SUCCESS = 2] = "SUCCESS", f[f.WAIT = 3] = "WAIT", f[f.ERROR = 4] = "ERROR", f))(s || {});
400
+ }, $ = (f, v) => (e, A) => v(e, A, f), s = /* @__PURE__ */ ((f) => (f[f.NOT_REGISTER = 1] = "NOT_REGISTER", f[f.SUCCESS = 2] = "SUCCESS", f[f.WAIT = 3] = "WAIT", f[f.ERROR = 4] = "ERROR", f))(s || {});
401
401
  const Jv = (f) => {
402
402
  const v = f && f[0] && f[0][0];
403
403
  return (v == null ? void 0 : v.t) === c.BOOLEAN ? v.v === EA.TRUE || v.v === !0 : v ? v.v : !1;
@@ -405,16 +405,16 @@ const Jv = (f) => {
405
405
  let M = class extends WA {
406
406
  constructor(v, e, A, Z, n) {
407
407
  super();
408
- u(this, "_formulaMap", /* @__PURE__ */ new Map());
409
- u(this, "_cache", /* @__PURE__ */ new Map());
410
- u(this, "_formulaChange$", new tA());
411
- u(this, "formulaChange$", this._formulaChange$.asObservable());
408
+ D(this, "_formulaMap", /* @__PURE__ */ new Map());
409
+ D(this, "_cache", /* @__PURE__ */ new Map());
410
+ D(this, "_formulaChange$", new LA());
411
+ D(this, "formulaChange$", this._formulaChange$.asObservable());
412
412
  this._commandService = v, this._injector = e, this._activeDirtyManagerService = A, this._conditionalFormattingViewModel = Z, this._conditionalFormattingRuleModel = n, this._initFormulaCalculationResultChange(), this._initRuleChange(), this._initCache(), this.disposeWithMe(OA(() => {
413
413
  this._cache.clear(), this._formulaMap.clear();
414
414
  }));
415
415
  }
416
416
  _initCache() {
417
- const v = this._injector.get(_);
417
+ const v = this._injector.get(G);
418
418
  this.disposeWithMe(v.ruleComputeStatus$.subscribe((e) => {
419
419
  const { unitId: A, subUnitId: Z, status: n, result: m, cfId: T } = e;
420
420
  n === "end" && m && this._ensureCacheMap(A, Z).set(T, m);
@@ -550,15 +550,15 @@ let M = class extends WA {
550
550
  };
551
551
  }
552
552
  _createFormulaId(v, e) {
553
- return `sheet.cf_${v}_${e}_${$.generateRandomId(8)}`;
553
+ return `sheet.cf_${v}_${e}_${_.generateRandomId(8)}`;
554
554
  }
555
555
  };
556
556
  M = Ev([
557
- AA(0, J(BA)),
558
- AA(1, J(LA)),
559
- AA(2, J(nv)),
560
- AA(3, J(ZA)),
561
- AA(4, J(O))
557
+ $(0, J(PA)),
558
+ $(1, J(XA)),
559
+ $(2, J(nv)),
560
+ $(3, J(eA)),
561
+ $(4, J(O))
562
562
  ], M);
563
563
  function TA(f, v) {
564
564
  return Math.abs(f - v) < Number.EPSILON;
@@ -568,10 +568,10 @@ const C = (f) => [void 0, null].includes(f), U = (f) => {
568
568
  if (!f)
569
569
  return null;
570
570
  if (f.t === c.BOOLEAN)
571
- return f.v === EA.TRUE ? DA.TRUE : DA.FALSE;
571
+ return f.v === EA.TRUE ? uA.TRUE : uA.FALSE;
572
572
  const v = f.v, e = (Z = (A = f.p) == null ? void 0 : A.body) == null ? void 0 : Z.dataStream.replace(/\r\n$/, "");
573
573
  return C(v) ? C(e) ? null : e : v;
574
- }, PA = 86400;
574
+ }, wA = 86400;
575
575
  function iv(f, v = !0) {
576
576
  if (v && f >= 0) {
577
577
  if (f === 0)
@@ -593,10 +593,10 @@ function iv(f, v = !0) {
593
593
  }
594
594
  const av = (f) => {
595
595
  let v = f | 0;
596
- const e = PA * (f - v);
596
+ const e = wA * (f - v);
597
597
  let A = Math.floor(e);
598
- e - A > 0.9999 && (A += 1, A === PA && (A = 0, v += 1));
599
- const Z = A < 0 ? PA + A : A, [n, m, T] = iv(f, !0), l = Math.floor(Z / 60 / 60) % 60, S = Math.floor(Z / 60) % 60, N = Math.floor(Z) % 60, X = /* @__PURE__ */ new Date(0);
598
+ e - A > 0.9999 && (A += 1, A === wA && (A = 0, v += 1));
599
+ const Z = A < 0 ? wA + A : A, [n, m, T] = iv(f, !0), l = Math.floor(Z / 60 / 60) % 60, S = Math.floor(Z / 60) % 60, N = Math.floor(Z) % 60, X = /* @__PURE__ */ new Date(0);
600
600
  return X.setUTCFullYear(n, m - 1, T), X.setUTCHours(l, S, N), X.getTime();
601
601
  }, SA = (f, v, e) => {
602
602
  switch (f.type) {
@@ -649,7 +649,7 @@ const av = (f) => {
649
649
  }
650
650
  }
651
651
  }, se = (f, v, e, A) => {
652
- const { accessor: Z } = A, n = Z.get(ZA), m = new Y();
652
+ const { accessor: Z } = A, n = Z.get(eA), m = new Y();
653
653
  return e.ranges.forEach((T) => {
654
654
  W.foreach(T, (l, S) => {
655
655
  const N = n.getCellCf(f, v, l, S);
@@ -659,7 +659,7 @@ const av = (f) => {
659
659
  }
660
660
  });
661
661
  }), m;
662
- }, vA = (f, v) => {
662
+ }, AA = (f, v) => {
663
663
  switch (f.operator) {
664
664
  case H.between: {
665
665
  if (typeof f.value != "object" || !f.value.length)
@@ -727,7 +727,7 @@ const av = (f) => {
727
727
  }
728
728
  } else
729
729
  return f[f.length - 1].color.toRgbString();
730
- }, kA = (f, v, e) => f.map((A) => {
730
+ }, tA = (f, v, e) => f.map((A) => {
731
731
  if (A.startColumn > e || A.startRow > v)
732
732
  return null;
733
733
  const Z = { ...A };
@@ -737,12 +737,12 @@ Object.freeze(K);
737
737
  const gv = {
738
738
  type: h.dataBar,
739
739
  handle: async (f, v) => {
740
- const e = f.rule, A = v.accessor.get(M), { worksheet: Z } = v, n = new Y(), m = kA(f.ranges, Z.getMaxRows() - 1, Z.getMaxColumns() - 1);
740
+ const e = f.rule, A = v.accessor.get(M), { worksheet: Z } = v, n = new Y(), m = tA(f.ranges, Z.getMaxRows() - 1, Z.getMaxColumns() - 1);
741
741
  m.forEach((t) => {
742
742
  W.foreach(t, (B, d) => {
743
- const r = Z == null ? void 0 : Z.getCellRaw(B, d), D = r && r.v;
744
- if (!C(D) && (r == null ? void 0 : r.t) === c.NUMBER) {
745
- const p = Number(D);
743
+ const r = Z == null ? void 0 : Z.getCellRaw(B, d), u = r && r.v;
744
+ if (!C(u) && (r == null ? void 0 : r.t) === c.NUMBER) {
745
+ const p = Number(u);
746
746
  !Number.isNaN(p) && n.setValue(B, d, p);
747
747
  }
748
748
  });
@@ -773,30 +773,30 @@ const gv = {
773
773
  if (!(N === X || X < N)) {
774
774
  if (N < 0 && X <= 0) {
775
775
  const t = X - N, B = 100;
776
- n.forValue((d, r, D) => {
777
- if (D > X)
776
+ n.forValue((d, r, u) => {
777
+ if (u > X)
778
778
  return;
779
- const p = L((X - D) / t * 100);
779
+ const p = L((X - u) / t * 100);
780
780
  T.setValue(d, r, { color: e.config.nativeColor, startPoint: B, value: -p, isGradient: k, isShowValue: w });
781
781
  });
782
782
  } else if (N < 0 && X > 0) {
783
783
  const t = Math.abs(X) + Math.abs(N), B = Math.abs(N) / t * 100;
784
- n.forValue((d, r, D) => {
785
- if (D)
786
- if (D > 0) {
787
- const p = L(Math.min(D / X, 1) * 100);
784
+ n.forValue((d, r, u) => {
785
+ if (u)
786
+ if (u > 0) {
787
+ const p = L(Math.min(u / X, 1) * 100);
788
788
  T.setValue(d, r, { color: e.config.positiveColor, startPoint: B, value: p, isGradient: k, isShowValue: w });
789
789
  } else {
790
- const p = L(Math.min(Math.abs(D) / Math.abs(N), 1) * 100);
790
+ const p = L(Math.min(Math.abs(u) / Math.abs(N), 1) * 100);
791
791
  T.setValue(d, r, { color: e.config.nativeColor, startPoint: B, value: -p, isGradient: k, isShowValue: w });
792
792
  }
793
793
  });
794
794
  } else if (N >= 0 && X > 0) {
795
795
  const t = X - N, B = 0;
796
- n.forValue((d, r, D) => {
797
- if (D < N)
796
+ n.forValue((d, r, u) => {
797
+ if (u < N)
798
798
  return;
799
- const p = L((1 - (X - D) / t) * 100);
799
+ const p = L((1 - (X - u) / t) * 100);
800
800
  T.setValue(d, r, { color: e.config.positiveColor, startPoint: B, value: p, isGradient: k, isShowValue: w });
801
801
  });
802
802
  }
@@ -806,7 +806,7 @@ const gv = {
806
806
  }, cv = {
807
807
  type: h.highlightCell,
808
808
  handle: async (f, v) => {
809
- const e = f.rule, { worksheet: A } = v, Z = kA(f.ranges, A.getMaxRows() - 1, A.getMaxColumns() - 1), m = (() => {
809
+ const e = f.rule, { worksheet: A } = v, Z = tA(f.ranges, A.getMaxRows() - 1, A.getMaxColumns() - 1), m = (() => {
810
810
  switch (e.subType) {
811
811
  case a.average: {
812
812
  let S = 0, N = 0;
@@ -856,7 +856,7 @@ const gv = {
856
856
  if (C(k) || Number.isNaN(k) || (X == null ? void 0 : X.t) !== c.NUMBER)
857
857
  return !1;
858
858
  const w = e;
859
- return vA({ operator: w.operator, value: w.value || 0 }, k || 0);
859
+ return AA({ operator: w.operator, value: w.value || 0 }, k || 0);
860
860
  }
861
861
  case a.text: {
862
862
  const k = e, w = U(X), L = w === null ? "" : String(w), t = k.value || "";
@@ -868,9 +868,9 @@ const gv = {
868
868
  case o.notContainsBlanks:
869
869
  return !/^\s*$/.test(L);
870
870
  case o.containsErrors:
871
- return rA.has(L);
871
+ return DA.has(L);
872
872
  case o.notContainsErrors:
873
- return !rA.has(L);
873
+ return !DA.has(L);
874
874
  case o.containsText:
875
875
  return L.indexOf(t) > -1;
876
876
  case o.notContainsText:
@@ -975,7 +975,7 @@ const gv = {
975
975
  case a.formula: {
976
976
  if (!(m != null && m.sequenceNodes))
977
977
  return !1;
978
- const { unitId: k, subUnitId: w } = v, L = v.accessor.get(M), t = (p, Q) => ({ startRow: p, endRow: p, startColumn: Q, endColumn: Q }), B = t(f.ranges[0].startRow, f.ranges[0].startColumn), d = $.deepClone(m.sequenceNodes), r = Array.isArray(d) ? d.map((p) => {
978
+ const { unitId: k, subUnitId: w } = v, L = v.accessor.get(M), t = (p, Q) => ({ startRow: p, endRow: p, startColumn: Q, endColumn: Q }), B = t(f.ranges[0].startRow, f.ranges[0].startColumn), d = _.deepClone(m.sequenceNodes), r = Array.isArray(d) ? d.map((p) => {
979
979
  if (typeof p == "object" && p.nodeType === Nv.REFERENCE) {
980
980
  const Q = Xv(p.token), i = R.getRelativeRange(Q.range, B), j = R.getPositionRange(i, t(S, N), Q.range), y = Lv(j);
981
981
  return {
@@ -985,10 +985,10 @@ const gv = {
985
985
  }
986
986
  return p;
987
987
  }) : d;
988
- let D = r && tv(r);
989
- if (D) {
990
- D = `=${D}`, L.registerFormula(k, w, f.cfId, D);
991
- const p = L.getFormulaResult(k, w, D);
988
+ let u = r && tv(r);
989
+ if (u) {
990
+ u = `=${u}`, L.registerFormula(k, w, f.cfId, u);
991
+ const p = L.getFormulaResult(k, w, u);
992
992
  if (p && p.status === s.SUCCESS)
993
993
  return p.result === !0;
994
994
  {
@@ -1010,7 +1010,7 @@ const gv = {
1010
1010
  type: h.colorScale,
1011
1011
  handle: async (f, v) => {
1012
1012
  var X;
1013
- const e = f.rule, A = v.accessor.get(M), { worksheet: Z } = v, n = new Y(), m = kA(f.ranges, Z.getMaxRows() - 1, Z.getMaxColumns() - 1);
1013
+ const e = f.rule, A = v.accessor.get(M), { worksheet: Z } = v, n = new Y(), m = tA(f.ranges, Z.getMaxRows() - 1, Z.getMaxColumns() - 1);
1014
1014
  m.forEach((k) => {
1015
1015
  W.foreach(k, (w, L) => {
1016
1016
  const t = Z == null ? void 0 : Z.getCellRaw(w, L), B = t && t.v;
@@ -1045,7 +1045,7 @@ const gv = {
1045
1045
  type: h.iconSet,
1046
1046
  handle: async (f, v) => {
1047
1047
  var k;
1048
- const e = f.rule, A = v.accessor.get(M), { worksheet: Z } = v, n = new Y(), m = kA(f.ranges, Z.getMaxRows() - 1, Z.getMaxColumns() - 1);
1048
+ const e = f.rule, A = v.accessor.get(M), { worksheet: Z } = v, n = new Y(), m = tA(f.ranges, Z.getMaxRows() - 1, Z.getMaxColumns() - 1);
1049
1049
  m.forEach((w) => {
1050
1050
  W.foreach(w, (L, t) => {
1051
1051
  const B = Z == null ? void 0 : Z.getCellRaw(L, t), d = B && B.v;
@@ -1073,15 +1073,15 @@ const gv = {
1073
1073
  w.push({ ...L, iconId: d.iconId, iconType: d.iconType });
1074
1074
  else {
1075
1075
  const r = B[t - 1];
1076
- vA(r, L.value) || w.push({ ...L, iconId: d.iconId, iconType: d.iconType });
1076
+ AA(r, L.value) || w.push({ ...L, iconId: d.iconId, iconType: d.iconType });
1077
1077
  }
1078
1078
  return w;
1079
1079
  }, []), X = e.isShowValue === void 0 ? !0 : !!e.isShowValue;
1080
1080
  return n.forValue((w, L, t) => {
1081
1081
  for (let B = 0; B < N.length; B++) {
1082
- const d = N[B], r = { ...d }, D = { ...d }, { iconId: p, iconType: Q } = d;
1082
+ const d = N[B], r = { ...d }, u = { ...d }, { iconId: p, iconType: Q } = d;
1083
1083
  if (B === 0) {
1084
- if (vA(d, t)) {
1084
+ if (AA(d, t)) {
1085
1085
  T.setValue(w, L, { iconId: p, iconType: Q, isShowValue: X });
1086
1086
  return;
1087
1087
  }
@@ -1090,7 +1090,7 @@ const gv = {
1090
1090
  return;
1091
1091
  } else {
1092
1092
  const i = N[B - 1];
1093
- if (D.operator = sv(i.operator), D.value = i.value, vA(r, t) && vA(D, t)) {
1093
+ if (u.operator = sv(i.operator), u.value = i.value, AA(r, t) && AA(u, t)) {
1094
1094
  T.setValue(w, L, { iconId: p, iconType: Q, isShowValue: X });
1095
1095
  return;
1096
1096
  }
@@ -1105,16 +1105,16 @@ var jv = Object.defineProperty, hv = Object.getOwnPropertyDescriptor, Uv = (f, v
1105
1105
  return A && Z && jv(v, e, Z), Z;
1106
1106
  }, I = (f, v) => (e, A) => v(e, A, f);
1107
1107
  const Rv = hA("conditional-formatting-before-update-rule-result");
1108
- let _ = class extends WA {
1108
+ let G = class extends WA {
1109
1109
  constructor(v, e, A, Z, n, m, T) {
1110
1110
  super();
1111
- u(this, "_afterInitApplyPromise");
1111
+ D(this, "_afterInitApplyPromise");
1112
1112
  // <unitId,<subUnitId,<cfId,IComputeCache>>>
1113
- u(this, "_ruleCacheMap", /* @__PURE__ */ new Map());
1114
- u(this, "_ruleComputeStatus$", new tA());
1115
- u(this, "ruleComputeStatus$", this._ruleComputeStatus$.asObservable());
1116
- u(this, "interceptorManager", new FA({ beforeUpdateRuleResult: Rv }));
1117
- u(this, "_calculationUnitMap", /* @__PURE__ */ new Map());
1113
+ D(this, "_ruleCacheMap", /* @__PURE__ */ new Map());
1114
+ D(this, "_ruleComputeStatus$", new LA());
1115
+ D(this, "ruleComputeStatus$", this._ruleComputeStatus$.asObservable());
1116
+ D(this, "interceptorManager", new FA({ beforeUpdateRuleResult: Rv }));
1117
+ D(this, "_calculationUnitMap", /* @__PURE__ */ new Map());
1118
1118
  this._conditionalFormattingRuleModel = v, this._injector = e, this._conditionalFormattingViewModel = A, this._univerInstanceService = Z, this._resourceManagerService = n, this._sheetInterceptorService = m, this._commandService = T, this._initCellChange(), this._initCacheManager(), this._initRemoteCalculate(), this._initSnapshot(), this._initSheetChange(), this._registerCalculationUnit(gv), this._registerCalculationUnit(Yv), this._registerCalculationUnit(cv), this._registerCalculationUnit(Ov), this._afterInitApplyPromise = bA(T);
1119
1119
  }
1120
1120
  composeStyle(v, e, A, Z) {
@@ -1125,7 +1125,7 @@ let _ = class extends WA {
1125
1125
  var w;
1126
1126
  const X = N.rule.type, k = n.cfList.find((L) => L.cfId === N.cfId);
1127
1127
  if (k != null && k.isDirty && this._handleCalculateUnit(v, e, N), X === h.highlightCell)
1128
- k.ruleCache && $.deepMerge(S, { style: k.ruleCache });
1128
+ k.ruleCache && _.deepMerge(S, { style: k.ruleCache });
1129
1129
  else if (X === h.colorScale) {
1130
1130
  const L = k == null ? void 0 : k.ruleCache;
1131
1131
  L && (S.style = { ...(w = S.style) != null ? w : {}, bg: { rgb: L } });
@@ -1159,7 +1159,7 @@ let _ = class extends WA {
1159
1159
  this.disposeWithMe(
1160
1160
  this._resourceManagerService.registerPluginResource({
1161
1161
  pluginName: oA,
1162
- businesses: [XA.UNIVER_SHEET],
1162
+ businesses: [NA.UNIVER_SHEET],
1163
1163
  toJson: (A) => v(A),
1164
1164
  parseJson: (A) => e(A),
1165
1165
  onUnLoad: (A) => {
@@ -1194,7 +1194,7 @@ let _ = class extends WA {
1194
1194
  cfId: l.cfId
1195
1195
  };
1196
1196
  m.push({
1197
- id: pA.id,
1197
+ id: dA.id,
1198
1198
  params: S
1199
1199
  }), T.push(...Hv(this._injector, S));
1200
1200
  }), {
@@ -1341,21 +1341,21 @@ let _ = class extends WA {
1341
1341
  this._ruleComputeStatus$.next({ status: "end", unitId: v, subUnitId: e, cfId: A.cfId, result: S });
1342
1342
  }
1343
1343
  };
1344
- _ = Uv([
1345
- UA(RA.Starting, _),
1344
+ G = Uv([
1345
+ UA(RA.Starting, G),
1346
1346
  I(0, J(O)),
1347
- I(1, J(LA)),
1348
- I(2, J(ZA)),
1347
+ I(1, J(XA)),
1348
+ I(2, J(eA)),
1349
1349
  I(3, J(MA)),
1350
1350
  I(4, J(VA)),
1351
1351
  I(5, J(zA)),
1352
- I(6, J(BA))
1353
- ], _);
1354
- const Mv = (f) => f.getCurrentUnitForType(XA.UNIVER_SHEET).getUnitId(), Vv = (f) => {
1352
+ I(6, J(PA))
1353
+ ], G);
1354
+ const Mv = (f) => f.getCurrentUnitForType(NA.UNIVER_SHEET).getUnitId(), Vv = (f) => {
1355
1355
  var v;
1356
- return (v = f.getCurrentUnitForType(XA.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : v.getSheetId();
1356
+ return (v = f.getCurrentUnitForType(NA.UNIVER_SHEET).getActiveSheet()) == null ? void 0 : v.getSheetId();
1357
1357
  }, cA = {
1358
- type: eA.MUTATION,
1358
+ type: vA.MUTATION,
1359
1359
  id: "sheet.mutation.set-conditional-rule",
1360
1360
  handler(f, v) {
1361
1361
  if (!v)
@@ -1372,7 +1372,7 @@ const Mv = (f) => f.getCurrentUnitForType(XA.UNIVER_SHEET).getUnitId(), Vv = (f)
1372
1372
  unitId: A,
1373
1373
  subUnitId: Z,
1374
1374
  cfId: n,
1375
- rule: $.deepClone(m)
1375
+ rule: _.deepClone(m)
1376
1376
  }
1377
1377
  }
1378
1378
  ] : [];
@@ -1381,37 +1381,34 @@ var bv = Object.defineProperty, Fv = Object.getOwnPropertyDescriptor, Iv = (f, v
1381
1381
  for (var Z = A > 1 ? void 0 : A ? Fv(v, e) : v, n = f.length - 1, m; n >= 0; n--)
1382
1382
  (m = f[n]) && (Z = (A ? m(v, e, Z) : m(Z)) || Z);
1383
1383
  return A && Z && bv(v, e, Z), Z;
1384
- }, QA = (f, v) => (e, A) => v(e, A, f), G;
1385
- let lA = (G = class extends IA {
1384
+ }, HA = (f, v) => (e, A) => v(e, A, f), nA;
1385
+ let QA = (nA = class extends IA {
1386
1386
  constructor(f, v, e) {
1387
- super(), this._injector = v, this._commandService = e, this._initCommand();
1387
+ super(), this._injector = v, this._commandService = e;
1388
1388
  }
1389
1389
  onStarting() {
1390
- lA.dependencyList.forEach((f) => {
1390
+ [
1391
+ [G],
1392
+ [M],
1393
+ [O],
1394
+ [eA]
1395
+ ].forEach((f) => {
1391
1396
  this._injector.add(f);
1392
- });
1393
- }
1394
- _initCommand() {
1395
- lA.mutationList.forEach((f) => {
1397
+ }), [
1398
+ gA,
1399
+ dA,
1400
+ cA,
1401
+ BA,
1402
+ mA
1403
+ ].forEach((f) => {
1396
1404
  this._commandService.registerCommand(f);
1397
1405
  });
1398
1406
  }
1399
- }, u(G, "pluginName", oA), u(G, "type", XA.UNIVER_SHEET), u(G, "dependencyList", [
1400
- [_],
1401
- [M],
1402
- [O],
1403
- [ZA]
1404
- ]), u(G, "mutationList", [
1405
- gA,
1406
- pA,
1407
- cA,
1408
- dA,
1409
- mA
1410
- ]), G);
1411
- lA = Iv([
1412
- QA(1, J(LA)),
1413
- QA(2, J(BA))
1414
- ], lA);
1407
+ }, D(nA, "pluginName", oA), D(nA, "type", NA.UNIVER_SHEET), nA);
1408
+ QA = Iv([
1409
+ HA(1, J(XA)),
1410
+ HA(2, J(PA))
1411
+ ], QA);
1415
1412
  const ge = (f) => {
1416
1413
  var e;
1417
1414
  return ((e = f.body) == null ? void 0 : e.dataStream.replace(/\r\n$/, "")) || "";
@@ -1431,11 +1428,11 @@ const qv = "sheet-conditional-rule-data-bar", Kv = 34;
1431
1428
  class yv extends sA {
1432
1429
  constructor() {
1433
1430
  super(...arguments);
1434
- u(this, "_paddingRightAndLeft", 2);
1435
- u(this, "_paddingTopAndBottom", 2);
1436
- u(this, "uKey", qv);
1437
- u(this, "Z_INDEX", Kv);
1438
- u(this, "_radius", 1);
1431
+ D(this, "_paddingRightAndLeft", 2);
1432
+ D(this, "_paddingTopAndBottom", 2);
1433
+ D(this, "uKey", qv);
1434
+ D(this, "Z_INDEX", Kv);
1435
+ D(this, "_radius", 1);
1439
1436
  }
1440
1437
  draw(e, A, Z, n) {
1441
1438
  const { rowHeightAccumulation: m, columnWidthAccumulation: T, worksheet: l, dataMergeCache: S } = Z;
@@ -1447,26 +1444,26 @@ class yv extends sA {
1447
1444
  if (!l.getColVisible(X) || !l.getRowRawVisible(N))
1448
1445
  return;
1449
1446
  const { color: w, value: L, startPoint: t, isGradient: B } = k.dataBar, d = this.getCellIndex(N, X, m, T, S);
1450
- let { isMerged: r, isMergedMainCell: D, mergeInfo: p, startY: Q, endY: i, startX: j, endX: y } = d;
1451
- if (r || (D && (Q = p.startY, i = p.endY, j = p.startX, y = p.endX), !this.isRenderDiffRangesByCell(p, n)))
1447
+ let { isMerged: r, isMergedMainCell: u, mergeInfo: p, startY: Q, endY: i, startX: j, endX: y } = d;
1448
+ if (r || (u && (Q = p.startY, i = p.endY, j = p.startX, y = p.endX), !this.isRenderDiffRangesByCell(p, n)))
1452
1449
  return;
1453
- const fA = y - j, wA = i + wv - Q, nA = fA - this._paddingRightAndLeft * 2, uA = wA - this._paddingTopAndBottom * 2;
1450
+ const ZA = y - j, kA = i + wv - Q, fA = ZA - this._paddingRightAndLeft * 2, pA = kA - this._paddingTopAndBottom * 2;
1454
1451
  if (L > 0) {
1455
- const x = Math.max(nA * (1 - t / 100) * L / 100, 1), V = j + this._paddingRightAndLeft + t / 100 * nA, b = Q + this._paddingTopAndBottom;
1452
+ const x = Math.max(fA * (1 - t / 100) * L / 100, 1), V = j + this._paddingRightAndLeft + t / 100 * fA, b = Q + this._paddingTopAndBottom;
1456
1453
  if (B) {
1457
1454
  const F = e.createLinearGradient(V, b, V + x, b);
1458
1455
  F.addColorStop(0, w), F.addColorStop(1, "rgb(255 255 255)"), e.fillStyle = F, e.strokeStyle = w, e.lineWidth = 1;
1459
1456
  } else
1460
1457
  e.fillStyle = w;
1461
- this._drawRectWithRoundedCorner(e, V, b, x, uA, !1, !0, !0, !1), B && e.stroke();
1458
+ this._drawRectWithRoundedCorner(e, V, b, x, pA, !1, !0, !0, !1), B && e.stroke();
1462
1459
  } else {
1463
- const x = Math.max(nA * t / 100 * Math.abs(L) / 100, 1), V = j + this._paddingRightAndLeft + t / 100 * nA - x, b = Q + this._paddingTopAndBottom;
1460
+ const x = Math.max(fA * t / 100 * Math.abs(L) / 100, 1), V = j + this._paddingRightAndLeft + t / 100 * fA - x, b = Q + this._paddingTopAndBottom;
1464
1461
  if (B) {
1465
1462
  const F = e.createLinearGradient(V, b, V + x, b);
1466
1463
  F.addColorStop(0, "rgb(255 255 255)"), F.addColorStop(1, w), e.fillStyle = F, e.strokeStyle = w, e.lineWidth = 1;
1467
1464
  } else
1468
1465
  e.fillStyle = w;
1469
- this._drawRectWithRoundedCorner(e, V, b, x, uA, !0, !1, !1, !0), B && e.stroke();
1466
+ this._drawRectWithRoundedCorner(e, V, b, x, pA, !0, !1, !1, !0), B && e.stroke();
1470
1467
  }
1471
1468
  }
1472
1469
  }), e.restore();
@@ -1636,26 +1633,26 @@ const xv = {
1636
1633
  }
1637
1634
  ]
1638
1635
  }
1639
- ], NA = me.reduce((f, v) => {
1636
+ ], lA = me.reduce((f, v) => {
1640
1637
  const { group: e } = v;
1641
1638
  for (const A of e)
1642
1639
  f[A.name] = A.list;
1643
1640
  return f;
1644
1641
  }, {});
1645
- for (const f in NA) {
1646
- const v = NA[f];
1642
+ for (const f in lA) {
1643
+ const v = lA[f];
1647
1644
  Object.freeze(v);
1648
1645
  }
1649
1646
  const Te = "EMPTY_ICON_TYPE", Se = "sheet-conditional-rule-icon", le = 35, Ne = 15, Xe = 2;
1650
1647
  class Le extends sA {
1651
1648
  constructor() {
1652
1649
  super();
1653
- u(this, "_paddingRightAndLeft", Xe);
1654
- u(this, "_width", Ne);
1655
- u(this, "_imageMap", /* @__PURE__ */ new Map());
1656
- u(this, "uKey", Se);
1657
- u(this, "Z_INDEX", le);
1658
- u(this, "_radius", 1);
1650
+ D(this, "_paddingRightAndLeft", Xe);
1651
+ D(this, "_width", Ne);
1652
+ D(this, "_imageMap", /* @__PURE__ */ new Map());
1653
+ D(this, "uKey", Se);
1654
+ D(this, "Z_INDEX", le);
1655
+ D(this, "_radius", 1);
1659
1656
  this._init();
1660
1657
  }
1661
1658
  draw(e, A, Z, n) {
@@ -1674,20 +1671,20 @@ class Le extends sA {
1674
1671
  if (!t)
1675
1672
  return;
1676
1673
  const B = this.getCellIndex(N, X, m, T, S);
1677
- let { isMerged: d, isMergedMainCell: r, mergeInfo: D, startY: p, endY: Q, startX: i, endX: j } = B;
1678
- if (d || (r && (p = D.startY, Q = D.endY, i = D.startX, j = D.endX), !this.isRenderDiffRangesByCell(D, n)))
1674
+ let { isMerged: d, isMergedMainCell: r, mergeInfo: u, startY: p, endY: Q, startX: i, endX: j } = B;
1675
+ if (d || (r && (p = u.startY, Q = u.endY, i = u.startX, j = u.endX), !this.isRenderDiffRangesByCell(u, n)))
1679
1676
  return;
1680
- const y = j - i, fA = Q - p;
1681
- if (this._width > fA || this._width > y + this._paddingRightAndLeft * 2)
1677
+ const y = j - i, ZA = Q - p;
1678
+ if (this._width > ZA || this._width > y + this._paddingRightAndLeft * 2)
1682
1679
  return;
1683
- const wA = (fA - this._width) / 2 + p;
1684
- e.drawImage(t, i + this._paddingRightAndLeft, wA, this._width, this._width);
1680
+ const kA = (ZA - this._width) / 2 + p;
1681
+ e.drawImage(t, i + this._paddingRightAndLeft, kA, this._width, this._width);
1685
1682
  }
1686
1683
  }), e.restore();
1687
1684
  }
1688
1685
  _init() {
1689
- for (const e in NA)
1690
- NA[e].forEach((Z, n) => {
1686
+ for (const e in lA)
1687
+ lA[e].forEach((Z, n) => {
1691
1688
  const m = this._createKey(e, String(n)), T = new Image();
1692
1689
  T.onload = () => {
1693
1690
  this._imageMap.set(m, T);
@@ -1708,35 +1705,36 @@ export {
1708
1705
  o as CFTextOperator,
1709
1706
  g as CFTimePeriodOperator,
1710
1707
  z as CFValueType,
1708
+ mA as ConditionalFormattingFormulaMarkDirty,
1711
1709
  M as ConditionalFormattingFormulaService,
1712
1710
  Le as ConditionalFormattingIcon,
1713
1711
  O as ConditionalFormattingRuleModel,
1714
- _ as ConditionalFormattingService,
1715
- ZA as ConditionalFormattingViewModel,
1712
+ G as ConditionalFormattingService,
1713
+ eA as ConditionalFormattingViewModel,
1716
1714
  re as DEFAULT_BG_COLOR,
1717
1715
  He as DEFAULT_FONT_COLOR,
1718
1716
  Xe as DEFAULT_PADDING,
1719
1717
  Ne as DEFAULT_WIDTH,
1720
1718
  yv as DataBar,
1721
- pA as DeleteConditionalRuleMutation,
1719
+ dA as DeleteConditionalRuleMutation,
1722
1720
  Hv as DeleteConditionalRuleMutationUndoFactory,
1723
1721
  Te as EMPTY_ICON_TYPE,
1724
1722
  K as EMPTY_STYLE,
1725
1723
  s as FormulaResultStatus,
1726
1724
  Se as IconUKey,
1727
- dA as MoveConditionalRuleMutation,
1725
+ BA as MoveConditionalRuleMutation,
1728
1726
  ae as MoveConditionalRuleMutationUndoFactory,
1729
1727
  oA as SHEET_CONDITIONAL_FORMATTING_PLUGIN,
1730
1728
  cA as SetConditionalRuleMutation,
1731
- lA as SheetsConditionalFormattingPlugin,
1729
+ QA as UniverSheetsConditionalFormattingPlugin,
1732
1730
  pv as anchorUndoFactory,
1733
- vA as compareWithNumber,
1731
+ AA as compareWithNumber,
1734
1732
  Pv as createCfId,
1735
1733
  Qe as createDefaultRule,
1736
1734
  We as createDefaultValue,
1737
1735
  Ee as createDefaultValueByValueType,
1738
1736
  qv as dataBarUKey,
1739
- kA as filterRange,
1737
+ tA as filterRange,
1740
1738
  q as findIndexByAnchor,
1741
1739
  se as getCacheStyleMatrix,
1742
1740
  U as getCellValue,
@@ -1745,7 +1743,7 @@ export {
1745
1743
  ge as getStringFromDataStream,
1746
1744
  SA as getValueByType,
1747
1745
  me as iconGroup,
1748
- NA as iconMap,
1746
+ lA as iconMap,
1749
1747
  Je as isAnchorEqual,
1750
1748
  TA as isFloatsEqual,
1751
1749
  C as isNullable,