@univerjs/sheets-conditional-formatting 0.15.3 → 0.15.4

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/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  var H2 = Object.defineProperty;
2
2
  var j2 = (s, r, t) => r in s ? H2(s, r, { enumerable: !0, configurable: !0, writable: !0, value: t }) : s[r] = t;
3
3
  var m = (s, r, t) => j2(s, typeof r != "symbol" ? r + "" : r, t);
4
- import { generateRandomId as X2, Tools as J, CommandType as O, IUndoRedoService as e2, ICommandService as W, IUniverInstanceService as q, ObjectMatrix as V, Range as T, sequenceExecute as B2, Inject as S, Disposable as x2, RefAlias as K2, CellValueType as x, BooleanNumber as N2, LRUMap as T2, ColorKit as U2, dayjs as v, Injector as M2, RTree as Y2, IResourceManagerService as J2, merge as V2, UniverInstanceType as D2, isInternalEditorID as z2, Rectangle as n2, DependentOn as Q2, IConfigService as e0, Plugin as t0, touchDependencies as n0 } from "@univerjs/core";
4
+ import { generateRandomId as X2, Tools as J, CommandType as O, IUndoRedoService as e2, ICommandService as W, IUniverInstanceService as q, ObjectMatrix as V, Range as T, sequenceExecute as B2, Inject as b, Disposable as x2, RefAlias as K2, CellValueType as M, BooleanNumber as N2, LRUMap as T2, ColorKit as U2, dayjs as v, Injector as M2, RTree as Y2, IResourceManagerService as J2, merge as V2, UniverInstanceType as D2, isInternalEditorID as z2, Rectangle as n2, DependentOn as Q2, IConfigService as e0, Plugin as t0, touchDependencies as n0 } from "@univerjs/core";
5
5
  import { isRangesEqual as X1 } from "@univerjs/core";
6
6
  import { getSheetCommandTarget as t2, SheetsSelectionsService as r0, findAllRectangle as s0, createTopMatrixFromMatrix as i0, SheetInterceptorService as a0, RemoveSheetCommand as l0, CopySheetCommand as o0, ReorderRangeMutation as u0, MoveRangeMutation as c0, MoveColsMutation as d0, MoveRowsMutation as h0, InsertRowMutation as g0, RemoveRowMutation as C0, RemoveColMutation as f0, InsertColMutation as D0, SetRangeValuesMutation as m0 } from "@univerjs/sheets";
7
7
  import { Subject as d2, BehaviorSubject as F0 } from "rxjs";
@@ -9,7 +9,7 @@ import { RegisterOtherFormulaService as w0, FormulaResultStatus as p, OtherFormu
9
9
  import { distinctUntilChanged as E0, bufferTime as A0, filter as _0, map as x0 } from "rxjs/operators";
10
10
  import { isObject as M0, SpreadsheetExtensionRegistry as O2, SheetExtension as $2, FIX_ONE_PIXEL_BLUR_OFFSET as y0 } from "@univerjs/engine-render";
11
11
  const P2 = "SHEET_CONDITIONAL_FORMATTING_PLUGIN";
12
- var k = /* @__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))(k || {}), B = /* @__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))(B || {}), w = /* @__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))(w || {}), M = /* @__PURE__ */ ((s) => (s.highlightCell = "highlightCell", s.dataBar = "dataBar", s.colorScale = "colorScale", s.iconSet = "iconSet", s))(M || {}), _ = /* @__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))(_ || {}), b = /* @__PURE__ */ ((s) => (s.num = "num", s.min = "min", s.max = "max", s.percent = "percent", s.percentile = "percentile", s.formula = "formula", s))(b || {});
12
+ var B = /* @__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))(B || {}), N = /* @__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))(N || {}), w = /* @__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))(w || {}), y = /* @__PURE__ */ ((s) => (s.highlightCell = "highlightCell", s.dataBar = "dataBar", s.colorScale = "colorScale", s.iconSet = "iconSet", s))(y || {}), _ = /* @__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))(_ || {}), L = /* @__PURE__ */ ((s) => (s.num = "num", s.min = "min", s.max = "max", s.percent = "percent", s.percentile = "percentile", s.formula = "formula", s))(L || {});
13
13
  const V1 = "#fff", O1 = "#000000", $1 = () => ({
14
14
  cfId: void 0,
15
15
  ranges: [],
@@ -133,7 +133,7 @@ const V1 = "#fff", O1 = "#000000", $1 = () => ({
133
133
  }
134
134
  return null;
135
135
  }, q1 = (s, r) => s.id === r.id && s.type === r.type, S0 = () => `${X2(8)}`;
136
- class y {
136
+ class R {
137
137
  constructor() {
138
138
  // Map<unitID ,<sheetId ,IConditionFormattingRule[]>>
139
139
  m(this, "_model", /* @__PURE__ */ new Map());
@@ -206,7 +206,7 @@ const i2 = {
206
206
  if (!r)
207
207
  return !1;
208
208
  const { unitId: t, subUnitId: e, start: n, end: i } = r;
209
- return s.get(y).moveRulePriority(t, e, n, i), !0;
209
+ return s.get(R).moveRulePriority(t, e, n, i), !0;
210
210
  }
211
211
  }, b0 = (s) => {
212
212
  const { unitId: r, subUnitId: t } = s, e = I0(s.start, s.end);
@@ -217,7 +217,7 @@ const i2 = {
217
217
  { id: i2.id, params: { unitId: r, subUnitId: t, start: n, end: i } }
218
218
  ];
219
219
  }, m2 = (s, r) => {
220
- const t = s.get(y), { unitId: e, subUnitId: n, cfId: i } = r, a = [...t.getSubunitRules(e, n) || []], c = a.findIndex((o) => o.cfId === i), l = a[c - 1];
220
+ const t = s.get(R), { unitId: e, subUnitId: n, cfId: i } = r, a = [...t.getSubunitRules(e, n) || []], c = a.findIndex((o) => o.cfId === i), l = a[c - 1];
221
221
  if (c > -1) {
222
222
  const o = a[c], d = [{
223
223
  id: a2.id,
@@ -248,7 +248,7 @@ const i2 = {
248
248
  if (!r)
249
249
  return !1;
250
250
  const { unitId: t, subUnitId: e, cfId: n } = r;
251
- return s.get(y).deleteRule(t, e, n), !0;
251
+ return s.get(R).deleteRule(t, e, n), !0;
252
252
  }
253
253
  }, q2 = (s, r) => ({ id: K.id, params: { unitId: r.unitId, subUnitId: r.subUnitId, cfId: r.rule.cfId } }), a2 = {
254
254
  type: O.MUTATION,
@@ -257,7 +257,7 @@ const i2 = {
257
257
  if (!r)
258
258
  return !1;
259
259
  const { unitId: t, subUnitId: e, rule: n } = r;
260
- return s.get(y).addRule(t, e, n), !0;
260
+ return s.get(R).addRule(t, e, n), !0;
261
261
  }
262
262
  }, L0 = {
263
263
  type: O.COMMAND,
@@ -265,7 +265,7 @@ const i2 = {
265
265
  handler(s, r) {
266
266
  if (!r)
267
267
  return !1;
268
- const { rule: t } = r, e = s.get(e2), n = s.get(W), i = s.get(y), a = s.get(q), c = t2(a, r);
268
+ const { rule: t } = r, e = s.get(e2), n = s.get(W), i = s.get(R), a = s.get(q), c = t2(a, r);
269
269
  if (!c) return !1;
270
270
  const { unitId: l, subUnitId: o } = c, d = i.createCfId(l, o), u = { unitId: l, subUnitId: o, rule: { ...t, cfId: t.cfId || d } }, h = q2(s, u), g = n.syncExecuteCommand(a2.id, u);
271
271
  return g && e.pushUndoRedo({
@@ -281,10 +281,10 @@ const i2 = {
281
281
  if (!r)
282
282
  return !1;
283
283
  const { unitId: t, subUnitId: e, rule: n } = r, i = r.cfId || r.rule.cfId;
284
- return s.get(y).setRule(t, e, n, i), !0;
284
+ return s.get(R).setRule(t, e, n, i), !0;
285
285
  }
286
286
  }, Z2 = (s, r) => {
287
- const t = s.get(y), { unitId: e, subUnitId: n } = r, i = r.cfId || r.rule.cfId, a = t.getRule(e, n, i);
287
+ const t = s.get(R), { unitId: e, subUnitId: n } = r, i = r.cfId || r.rule.cfId, a = t.getRule(e, n, i);
288
288
  return a ? [{
289
289
  id: l2.id,
290
290
  params: {
@@ -301,7 +301,7 @@ const i2 = {
301
301
  var D;
302
302
  if (!r)
303
303
  return !1;
304
- const t = s.get(y), e = s.get(q), n = s.get(W), i = s.get(e2), a = s.get(r0), c = t2(e, r);
304
+ const t = s.get(R), e = s.get(q), n = s.get(W), i = s.get(e2), a = s.get(r0), c = t2(e, r);
305
305
  if (!c) return !1;
306
306
  const { unitId: l, subUnitId: o } = c, d = ((D = a.getCurrentSelections()) == null ? void 0 : D.map((F) => F.range)) || [], u = t.getSubunitRules(l, o);
307
307
  if (!(u != null && u.length) || !d.length)
@@ -310,21 +310,21 @@ const i2 = {
310
310
  u.forEach((F) => {
311
311
  const E = new V();
312
312
  F.ranges.forEach((A) => {
313
- T.foreach(A, (I, L) => {
314
- E.setValue(I, L, 1);
313
+ T.foreach(A, (S, k) => {
314
+ E.setValue(S, k, 1);
315
315
  });
316
316
  }), d.forEach((A) => {
317
- T.foreach(A, (I, L) => {
318
- E.realDeleteValue(I, L);
317
+ T.foreach(A, (S, k) => {
318
+ E.realDeleteValue(S, k);
319
319
  });
320
320
  });
321
- const R = s0(i0(E));
322
- if (R.length) {
323
- const A = { ...F, ranges: R }, I = { unitId: l, subUnitId: o, rule: A }, L = Z2(s, I);
324
- h.push({ id: l2.id, params: I }), g.push(...L);
321
+ const I = s0(i0(E));
322
+ if (I.length) {
323
+ const A = { ...F, ranges: I }, S = { unitId: l, subUnitId: o, rule: A }, k = Z2(s, S);
324
+ h.push({ id: l2.id, params: S }), g.push(...k);
325
325
  } else {
326
- const A = { unitId: l, subUnitId: o, cfId: F.cfId }, I = m2(s, A);
327
- h.push({ id: K.id, params: A }), g.push(...I);
326
+ const A = { unitId: l, subUnitId: o, cfId: F.cfId }, S = m2(s, A);
327
+ h.push({ id: K.id, params: A }), g.push(...S);
328
328
  }
329
329
  });
330
330
  const f = B2(h, n).result;
@@ -338,7 +338,7 @@ const i2 = {
338
338
  type: O.COMMAND,
339
339
  id: "sheet.command.clear-worksheet-conditional-rule",
340
340
  handler(s, r) {
341
- const t = s.get(y), e = s.get(q), n = s.get(W), i = s.get(e2), a = t2(e, r);
341
+ const t = s.get(R), e = s.get(q), n = s.get(W), i = s.get(e2), a = t2(e, r);
342
342
  if (!a) return !1;
343
343
  const { unitId: c, subUnitId: l } = a, o = t.getSubunitRules(c, l);
344
344
  if (!(o != null && o.length))
@@ -367,7 +367,7 @@ const i2 = {
367
367
  handler(s, r) {
368
368
  if (!r)
369
369
  return !1;
370
- const t = s.get(e2), e = s.get(W), n = s.get(q), i = s.get(y), a = t2(n, r);
370
+ const t = s.get(e2), e = s.get(W), n = s.get(q), i = s.get(R), a = t2(n, r);
371
371
  if (!a) return !1;
372
372
  const { unitId: c, subUnitId: l } = a, o = W2(r.start, r.end, i.getSubunitRules(c, l) || [], (D) => D.cfId);
373
373
  if (!o)
@@ -408,12 +408,12 @@ let z = class extends x2 {
408
408
  _initRuleChange() {
409
409
  const r = (t) => {
410
410
  switch (t.type) {
411
- case M.colorScale:
412
- return t.config.some((e) => e.value.type === b.formula);
413
- case M.dataBar:
414
- return [t.config.max, t.config.min].some((e) => e.type === b.formula);
415
- case M.iconSet:
416
- return t.config.some((e) => e.value.type === b.formula);
411
+ case y.colorScale:
412
+ return t.config.some((e) => e.value.type === L.formula);
413
+ case y.dataBar:
414
+ return [t.config.max, t.config.min].some((e) => e.type === L.formula);
415
+ case y.iconSet:
416
+ return t.config.some((e) => e.value.type === L.formula);
417
417
  }
418
418
  };
419
419
  this.disposeWithMe(this._conditionalFormattingRuleModel.$ruleChange.subscribe((t) => {
@@ -426,7 +426,7 @@ let z = class extends x2 {
426
426
  */
427
427
  _registerRuleFormulas(r, t, e) {
428
428
  switch (e.rule.type) {
429
- case M.highlightCell: {
429
+ case y.highlightCell: {
430
430
  if (e.rule.subType === _.formula) {
431
431
  const n = e.rule.value;
432
432
  n && this.registerFormulaWithRange(
@@ -526,7 +526,7 @@ let z = class extends x2 {
526
526
  if (!r || !r[0] || !r[0][0])
527
527
  return !1;
528
528
  const t = r[0][0];
529
- return (t == null ? void 0 : t.t) === x.BOOLEAN ? t.v === N2.TRUE || t.v === !0 : t == null ? void 0 : t.v;
529
+ return (t == null ? void 0 : t.t) === M.BOOLEAN ? t.v === N2.TRUE || t.v === !0 : t == null ? void 0 : t.v;
530
530
  }
531
531
  /**
532
532
  * If `formulaText` is not provided, then all caches related to `cfId` will be deleted.
@@ -557,8 +557,8 @@ let z = class extends x2 {
557
557
  }
558
558
  };
559
559
  z = O0([
560
- S2(0, S(w0)),
561
- S2(1, S(y))
560
+ S2(0, b(w0)),
561
+ S2(1, b(R))
562
562
  ], z);
563
563
  var U = /* @__PURE__ */ ((s) => (s.preComputingStart = "preComputingStart", s.preComputing = "preComputing", s.preComputingEnd = "preComputingEnd", s.preComputingError = "preComputingError", s))(U || {});
564
564
  class F2 {
@@ -637,10 +637,10 @@ class F2 {
637
637
  class $0 extends F2 {
638
638
  preComputing(r, t, e) {
639
639
  const n = e.rule, i = e.worksheet, a = new V();
640
- !n.rule.config.every((d) => d.value.type === b.num) && w2(n.ranges, i.getMaxRows() - 1, i.getMaxColumns() - 1).forEach((u) => {
640
+ !n.rule.config.every((d) => d.value.type === L.num) && w2(n.ranges, i.getMaxRows() - 1, i.getMaxColumns() - 1).forEach((u) => {
641
641
  T.foreach(u, (h, g) => {
642
642
  const f = e.getCellValue(h, g), D = f && f.v;
643
- if (!N(D) && (f == null ? void 0 : f.t) === x.NUMBER) {
643
+ if (!x(D) && (f == null ? void 0 : f.t) === M.NUMBER) {
644
644
  const F = Number(D);
645
645
  !Number.isNaN(F) && a.setValue(h, g, F);
646
646
  }
@@ -667,7 +667,7 @@ class $0 extends F2 {
667
667
  if (!e)
668
668
  return null;
669
669
  const i = n.getCellValue(r, t);
670
- if (i.t === x.NUMBER) {
670
+ if (i.t === M.NUMBER) {
671
671
  const a = Number(i.v);
672
672
  if (!Number.isNaN(a))
673
673
  return n1(e, a);
@@ -706,23 +706,23 @@ class G0 extends $2 {
706
706
  return;
707
707
  c.add($);
708
708
  }
709
- const { color: D, value: F, startPoint: E, isGradient: R } = f.dataBar, { startX: A, endX: I, startY: L, endY: v2 } = u || h ? g : d, o2 = I - A, p2 = v2 + y0 - L, Z = o2 - this._paddingRightAndLeft * 2, y2 = p2 - this._paddingTopAndBottom * 2;
709
+ const { color: D, value: F, startPoint: E, isGradient: I } = f.dataBar, { startX: A, endX: S, startY: k, endY: v2 } = u || h ? g : d, o2 = S - A, p2 = v2 + y0 - k, Z = o2 - this._paddingRightAndLeft * 2, y2 = p2 - this._paddingTopAndBottom * 2;
710
710
  if (F > 0) {
711
- const $ = Math.max(Z * (1 - E / 100) * F / 100, 1), G = A + this._paddingRightAndLeft + E / 100 * Z, H = L + this._paddingTopAndBottom;
712
- if (R) {
711
+ const $ = Math.max(Z * (1 - E / 100) * F / 100, 1), G = A + this._paddingRightAndLeft + E / 100 * Z, H = k + this._paddingTopAndBottom;
712
+ if (I) {
713
713
  const j = t.createLinearGradient(G, H, G + $, H);
714
714
  j.addColorStop(0, D), j.addColorStop(1, "rgb(255 255 255)"), t.fillStyle = j, t.strokeStyle = D, t.lineWidth = 1;
715
715
  } else
716
716
  t.fillStyle = D;
717
- this._drawRectWithRoundedCorner(t, G, H, $, y2, !1, !0, !0, !1), R && t.stroke();
717
+ this._drawRectWithRoundedCorner(t, G, H, $, y2, !1, !0, !0, !1), I && t.stroke();
718
718
  } else {
719
- const $ = Math.max(Z * E / 100 * Math.abs(F) / 100, 1), G = A + this._paddingRightAndLeft + E / 100 * Z - $, H = L + this._paddingTopAndBottom;
720
- if (R) {
719
+ const $ = Math.max(Z * E / 100 * Math.abs(F) / 100, 1), G = A + this._paddingRightAndLeft + E / 100 * Z - $, H = k + this._paddingTopAndBottom;
720
+ if (I) {
721
721
  const j = t.createLinearGradient(G, H, G + $, H);
722
722
  j.addColorStop(0, "rgb(255 255 255)"), j.addColorStop(1, D), t.fillStyle = j, t.strokeStyle = D, t.lineWidth = 1;
723
723
  } else
724
724
  t.fillStyle = D;
725
- this._drawRectWithRoundedCorner(t, G, H, $, y2, !0, !1, !1, !0), R && t.stroke();
725
+ this._drawRectWithRoundedCorner(t, G, H, $, y2, !0, !1, !1, !0), I && t.stroke();
726
726
  }
727
727
  }), t.restore();
728
728
  }
@@ -734,7 +734,7 @@ class G0 extends $2 {
734
734
  O2.add(G0);
735
735
  const u2 = (s) => Math.max(Math.min(100, s), 0), H0 = (s, r, t) => {
736
736
  const e = t(s, r);
737
- if (e && e.t === x.NUMBER) {
737
+ if (e && e.t === M.NUMBER) {
738
738
  const n = Number(e.v);
739
739
  return Number.isNaN(n) ? null : n;
740
740
  }
@@ -743,11 +743,11 @@ const u2 = (s) => Math.max(Math.min(100, s), 0), H0 = (s, r, t) => {
743
743
  class j0 extends F2 {
744
744
  preComputing(r, t, e) {
745
745
  const n = e.rule, i = n.rule, a = e.worksheet, c = new V();
746
- ![n.rule.config.max, n.rule.config.min].every((g) => g.type === b.num) && w2(n.ranges, a.getMaxRows() - 1, a.getMaxColumns() - 1).forEach((f) => {
746
+ ![n.rule.config.max, n.rule.config.min].every((g) => g.type === L.num) && w2(n.ranges, a.getMaxRows() - 1, a.getMaxColumns() - 1).forEach((f) => {
747
747
  T.foreach(f, (D, F) => {
748
- const E = e.getCellValue(D, F), R = E && E.v;
749
- if (!N(R) && (E == null ? void 0 : E.t) === x.NUMBER) {
750
- const A = Number(R);
748
+ const E = e.getCellValue(D, F), I = E && E.v;
749
+ if (!x(I) && (E == null ? void 0 : E.t) === M.NUMBER) {
750
+ const A = Number(I);
751
751
  !Number.isNaN(A) && c.setValue(D, F, A);
752
752
  }
753
753
  });
@@ -809,8 +809,8 @@ class X0 extends F2 {
809
809
  let l = 0, o = 0;
810
810
  return i.forEach((d) => {
811
811
  T.foreach(d, (u, h) => {
812
- const g = e.getCellValue(u, h), f = P(g || void 0);
813
- g && g.t === x.NUMBER && f !== void 0 && (l += Number(f) || 0, o++);
812
+ const g = e.getCellValue(u, h), f = P(g);
813
+ g && g.t === M.NUMBER && !x(f) && (l += Number(f) || 0, o++);
814
814
  });
815
815
  }), { value: l / o, type: n.subType };
816
816
  }
@@ -819,8 +819,8 @@ class X0 extends F2 {
819
819
  const l = /* @__PURE__ */ new Map();
820
820
  return i.forEach((o) => {
821
821
  T.foreach(o, (d, u) => {
822
- const h = e.getCellValue(d, u), g = P(h || void 0);
823
- if (g !== void 0) {
822
+ const h = e.getCellValue(d, u), g = P(h);
823
+ if (!x(g)) {
824
824
  const f = l.get(g);
825
825
  f ? l.set(g, f + 1) : l.set(g, 1);
826
826
  }
@@ -831,8 +831,8 @@ class X0 extends F2 {
831
831
  let l = [];
832
832
  i.forEach((u) => {
833
833
  T.foreach(u, (h, g) => {
834
- const f = e.getCellValue(h, g), D = P(f || void 0);
835
- f && f.t === x.NUMBER && D !== void 0 && l.push(Number(D) || 0);
834
+ const f = e.getCellValue(h, g), D = P(f);
835
+ f && f.t === M.NUMBER && !x(D) && l.push(Number(D) || 0);
836
836
  });
837
837
  }), l.sort((u, h) => h - u);
838
838
  const o = e.rule.rule;
@@ -855,7 +855,7 @@ class X0 extends F2 {
855
855
  }
856
856
  case _.timePeriod:
857
857
  switch (n.operator) {
858
- case B.last7Days:
858
+ case N.last7Days:
859
859
  return {
860
860
  value: {
861
861
  start: v().subtract(7, "day").valueOf(),
@@ -863,7 +863,7 @@ class X0 extends F2 {
863
863
  },
864
864
  type: n.subType
865
865
  };
866
- case B.lastMonth:
866
+ case N.lastMonth:
867
867
  return {
868
868
  value: {
869
869
  start: v().startOf("month").subtract(1, "month").valueOf(),
@@ -871,7 +871,7 @@ class X0 extends F2 {
871
871
  },
872
872
  type: n.subType
873
873
  };
874
- case B.lastWeek:
874
+ case N.lastWeek:
875
875
  return {
876
876
  value: {
877
877
  start: v().startOf("week").subtract(1, "week").valueOf(),
@@ -879,7 +879,7 @@ class X0 extends F2 {
879
879
  },
880
880
  type: n.subType
881
881
  };
882
- case B.nextMonth:
882
+ case N.nextMonth:
883
883
  return {
884
884
  value: {
885
885
  start: v().startOf("month").add(1, "month").valueOf(),
@@ -887,7 +887,7 @@ class X0 extends F2 {
887
887
  },
888
888
  type: n.subType
889
889
  };
890
- case B.nextWeek:
890
+ case N.nextWeek:
891
891
  return {
892
892
  value: {
893
893
  start: v().startOf("week").add(1, "week").valueOf(),
@@ -895,7 +895,7 @@ class X0 extends F2 {
895
895
  },
896
896
  type: n.subType
897
897
  };
898
- case B.thisMonth:
898
+ case N.thisMonth:
899
899
  return {
900
900
  value: {
901
901
  start: v().startOf("month").valueOf(),
@@ -903,7 +903,7 @@ class X0 extends F2 {
903
903
  },
904
904
  type: n.subType
905
905
  };
906
- case B.thisWeek:
906
+ case N.thisWeek:
907
907
  return {
908
908
  value: {
909
909
  start: v().startOf("week").valueOf(),
@@ -911,7 +911,7 @@ class X0 extends F2 {
911
911
  },
912
912
  type: n.subType
913
913
  };
914
- case B.today:
914
+ case N.today:
915
915
  return {
916
916
  value: {
917
917
  start: v().startOf("day").valueOf(),
@@ -919,7 +919,7 @@ class X0 extends F2 {
919
919
  },
920
920
  type: n.subType
921
921
  };
922
- case B.tomorrow:
922
+ case N.tomorrow:
923
923
  return {
924
924
  value: {
925
925
  start: v().startOf("day").add(1, "day").valueOf(),
@@ -927,7 +927,7 @@ class X0 extends F2 {
927
927
  },
928
928
  type: n.subType
929
929
  };
930
- case B.yesterday:
930
+ case N.yesterday:
931
931
  return {
932
932
  value: {
933
933
  start: v().startOf("day").subtract(1, "day").valueOf(),
@@ -946,31 +946,31 @@ class X0 extends F2 {
946
946
  return (() => {
947
947
  switch (a.subType) {
948
948
  case _.number: {
949
- const o = i && Number(i.v), d = (i == null ? void 0 : i.t) === x.NUMBER, u = a;
950
- return d ? N(o) || Number.isNaN(o) ? void 0 : r2({ operator: u.operator, value: u.value || 0 }, o || 0) : !![w.notEqual, w.notBetween].includes(u.operator);
949
+ const o = i && Number(i.v), d = (i == null ? void 0 : i.t) === M.NUMBER, u = a;
950
+ return d ? x(o) || Number.isNaN(o) ? void 0 : r2({ operator: u.operator, value: u.value || 0 }, o || 0) : !![w.notEqual, w.notBetween].includes(u.operator);
951
951
  }
952
952
  case _.text: {
953
- const o = a, d = P(i), u = d === null ? "" : String(d), h = o.value || "";
953
+ const o = a, d = P(i), u = x(d) ? "" : String(d), h = o.value || "";
954
954
  switch (o.operator) {
955
- case k.beginsWith:
955
+ case B.beginsWith:
956
956
  return u.startsWith(h);
957
- case k.containsBlanks:
957
+ case B.containsBlanks:
958
958
  return /^\s*$/.test(u);
959
- case k.notContainsBlanks:
959
+ case B.notContainsBlanks:
960
960
  return !/^\s*$/.test(u);
961
- case k.containsErrors:
961
+ case B.containsErrors:
962
962
  return R2.has(u);
963
- case k.notContainsErrors:
963
+ case B.notContainsErrors:
964
964
  return !R2.has(u);
965
- case k.containsText:
965
+ case B.containsText:
966
966
  return u.indexOf(h) > -1;
967
- case k.notContainsText:
967
+ case B.notContainsText:
968
968
  return u.indexOf(h) === -1;
969
- case k.endsWith:
969
+ case B.endsWith:
970
970
  return u.endsWith(h);
971
- case k.equal:
971
+ case B.equal:
972
972
  return u === h;
973
- case k.notEqual:
973
+ case B.notEqual:
974
974
  return u !== h;
975
975
  default:
976
976
  return !1;
@@ -978,16 +978,16 @@ class X0 extends F2 {
978
978
  }
979
979
  case _.timePeriod: {
980
980
  const o = P(i);
981
- if (N(o) || Number.isNaN(Number(o)) || (i == null ? void 0 : i.t) !== x.NUMBER || !e)
981
+ if (x(o) || Number.isNaN(Number(o)) || (i == null ? void 0 : i.t) !== M.NUMBER || !e)
982
982
  return;
983
983
  const d = e1(Number(o)), { start: u, end: h } = e.value;
984
984
  return d >= u && d <= h;
985
985
  }
986
986
  case _.average: {
987
- const o = i && i.v, d = Number(o), u = (i == null ? void 0 : i.t) === x.NUMBER, h = a;
987
+ const o = i && i.v, d = Number(o), u = (i == null ? void 0 : i.t) === M.NUMBER, h = a;
988
988
  if (!u)
989
989
  return w.notEqual === h.operator;
990
- if (N(o) || Number.isNaN(d) || !e)
990
+ if (x(o) || Number.isNaN(d) || !e)
991
991
  return !1;
992
992
  const g = e.value;
993
993
  switch (h.operator) {
@@ -1009,18 +1009,21 @@ class X0 extends F2 {
1009
1009
  }
1010
1010
  case _.rank: {
1011
1011
  const o = P(i), d = Number(o);
1012
- if (N(o) || Number.isNaN(d) || (i == null ? void 0 : i.t) !== x.NUMBER || !e)
1012
+ if (x(o) || Number.isNaN(d) || (i == null ? void 0 : i.t) !== M.NUMBER || !e)
1013
1013
  return !1;
1014
1014
  const u = e.value;
1015
1015
  return a.isBottom ? d <= u : d >= u;
1016
1016
  }
1017
1017
  case _.uniqueValues: {
1018
1018
  const o = P(i);
1019
- return N(o) || !e ? !1 : e.value.get(o) === 1;
1019
+ return x(o) || !e ? !1 : e.value.get(o) === 1;
1020
1020
  }
1021
1021
  case _.duplicateValues: {
1022
1022
  const o = P(i);
1023
- return N(o) || !e ? !1 : e.value.get(o) !== 1;
1023
+ if (x(o) || !e)
1024
+ return !1;
1025
+ const d = e.value.get(o);
1026
+ return d && d !== 1;
1024
1027
  }
1025
1028
  case _.formula: {
1026
1029
  const o = e == null ? void 0 : e.value;
@@ -1036,7 +1039,7 @@ class X0 extends F2 {
1036
1039
  }
1037
1040
  const K0 = (s, r, t) => {
1038
1041
  const e = t(s, r);
1039
- if (e && e.t === x.NUMBER) {
1042
+ if (e && e.t === M.NUMBER) {
1040
1043
  const n = Number(e.v);
1041
1044
  return Number.isNaN(n) ? null : n;
1042
1045
  }
@@ -1045,10 +1048,10 @@ const K0 = (s, r, t) => {
1045
1048
  class Y0 extends F2 {
1046
1049
  preComputing(r, t, e) {
1047
1050
  const n = e.rule.rule, i = e.worksheet, a = new V();
1048
- !n.config.every((d) => d.value.type === b.num) && w2(e.rule.ranges, i.getMaxRows() - 1, i.getMaxColumns() - 1).forEach((u) => {
1051
+ !n.config.every((d) => d.value.type === L.num) && w2(e.rule.ranges, i.getMaxRows() - 1, i.getMaxColumns() - 1).forEach((u) => {
1049
1052
  T.foreach(u, (h, g) => {
1050
1053
  const f = e.getCellValue(h, g), D = f && f.v;
1051
- if (!N(D) && (f == null ? void 0 : f.t) === x.NUMBER) {
1054
+ if (!x(D) && (f == null ? void 0 : f.t) === M.NUMBER) {
1052
1055
  const F = Number(D);
1053
1056
  !Number.isNaN(F) && a.setValue(h, g, F);
1054
1057
  }
@@ -1203,7 +1206,7 @@ let Q = class extends x2 {
1203
1206
  this._conditionalFormattingRuleModel.$ruleChange.subscribe((r) => {
1204
1207
  if (r.type === "set") {
1205
1208
  const { unitId: t, subUnitId: e } = r, n = r.oldRule;
1206
- n.rule.type === M.highlightCell && n.rule.subType === _.formula && this._conditionalFormattingFormulaService.deleteCache(t, e, n.cfId);
1209
+ n.rule.type === y.highlightCell && n.rule.subType === _.formula && this._conditionalFormattingFormulaService.deleteCache(t, e, n.cfId);
1207
1210
  }
1208
1211
  })
1209
1212
  );
@@ -1264,13 +1267,13 @@ let Q = class extends x2 {
1264
1267
  getCellValue: (c, l) => i.getCellRaw(c, l) || {}
1265
1268
  };
1266
1269
  switch (e.rule.type) {
1267
- case M.colorScale:
1270
+ case y.colorScale:
1268
1271
  return new $0(a);
1269
- case M.dataBar:
1272
+ case y.dataBar:
1270
1273
  return new j0(a);
1271
- case M.highlightCell:
1274
+ case y.highlightCell:
1272
1275
  return new X0(a);
1273
- case M.iconSet:
1276
+ case y.iconSet:
1274
1277
  return new Y0(a);
1275
1278
  }
1276
1279
  }
@@ -1288,22 +1291,22 @@ let Q = class extends x2 {
1288
1291
  }
1289
1292
  };
1290
1293
  Q = z0([
1291
- c2(0, S(M2)),
1292
- c2(1, S(y)),
1293
- c2(2, S(z)),
1294
+ c2(0, b(M2)),
1295
+ c2(1, b(R)),
1296
+ c2(2, b(z)),
1294
1297
  c2(3, q)
1295
1298
  ], Q);
1296
1299
  function h2(s, r) {
1297
1300
  return Math.abs(s - r) < Number.EPSILON;
1298
1301
  }
1299
- const N = (s) => [void 0, null].includes(s), P = (s) => {
1302
+ const x = (s) => s == null || typeof s == "string" && s.trim() === "", P = (s) => {
1300
1303
  var e, n;
1301
1304
  if (!s)
1302
1305
  return null;
1303
- if (s.t === x.BOOLEAN)
1306
+ if (s.t === M.BOOLEAN)
1304
1307
  return s.v === N2.TRUE ? I2.TRUE : I2.FALSE;
1305
1308
  const r = s.v, t = (n = (e = s.p) == null ? void 0 : e.body) == null ? void 0 : n.dataStream.replace(/\r\n$/, "");
1306
- return N(r) ? N(t) ? null : t : r;
1309
+ return x(r) ? x(t) ? null : t : r;
1307
1310
  }, A2 = 86400;
1308
1311
  function Q0(s, r = !0) {
1309
1312
  if (r && s >= 0) {
@@ -1333,7 +1336,7 @@ const e1 = (s) => {
1333
1336
  return v(`${i}/${a}/${c} ${l}:${o}:${d}`).valueOf();
1334
1337
  }, g2 = (s, r, t) => {
1335
1338
  switch (s.type) {
1336
- case b.max: {
1339
+ case L.max: {
1337
1340
  let e = 0;
1338
1341
  return r.forValue((n, i, a) => {
1339
1342
  a > e && (e = a);
@@ -1342,7 +1345,7 @@ const e1 = (s) => {
1342
1345
  result: e
1343
1346
  };
1344
1347
  }
1345
- case b.min: {
1348
+ case L.min: {
1346
1349
  let e;
1347
1350
  return r.forValue((n, i, a) => {
1348
1351
  e === void 0 && (e = a), a < e && (e = a);
@@ -1351,7 +1354,7 @@ const e1 = (s) => {
1351
1354
  result: e
1352
1355
  };
1353
1356
  }
1354
- case b.percent: {
1357
+ case L.percent: {
1355
1358
  let e, n;
1356
1359
  r.forValue((c, l, o) => {
1357
1360
  (e === void 0 || n === void 0) && (e = o, n = o), o > e && (e = o), o < n && (n = o);
@@ -1362,18 +1365,18 @@ const e1 = (s) => {
1362
1365
  result: i * (a / 100) + (n || 0)
1363
1366
  };
1364
1367
  }
1365
- case b.percentile: {
1368
+ case L.percentile: {
1366
1369
  const e = r.toNativeArray().sort((o, d) => o - d), n = Math.max(Math.min(Number(s.value) || 0, 100), 0), i = (e.length - 1) * n / 100, a = Math.floor(i), c = i - a, l = e[a] + (e[Math.min(a + 1, e.length - 1)] - e[a]) * c;
1367
1370
  return {
1368
1371
  status: p.SUCCESS,
1369
1372
  result: l
1370
1373
  };
1371
1374
  }
1372
- case b.formula: {
1375
+ case L.formula: {
1373
1376
  const { accessor: e, unitId: n, subUnitId: i, cfId: a } = t, c = String(s.value), l = e.get(z);
1374
1377
  return l.registerFormulaWithRange(n, i, a, c), l.getFormulaResultWithCoords(n, i, a, c);
1375
1378
  }
1376
- case b.num:
1379
+ case L.num:
1377
1380
  default: {
1378
1381
  const e = Number(s.value);
1379
1382
  return {
@@ -1595,15 +1598,15 @@ let s2 = class extends x2 {
1595
1598
  return a > -1 && i.splice(a + 1), i.reduce((l, o) => {
1596
1599
  var h;
1597
1600
  const d = o.rule.type, u = n.find((g) => g.cfId === o.cfId);
1598
- if (d === M.highlightCell)
1601
+ if (d === y.highlightCell)
1599
1602
  u.result && V2(l, { style: u.result });
1600
- else if (d === M.colorScale) {
1603
+ else if (d === y.colorScale) {
1601
1604
  const g = u == null ? void 0 : u.result;
1602
1605
  g && typeof g == "string" && (l.style = { ...(h = l.style) != null ? h : {}, bg: { rgb: g } });
1603
- } else if (d === M.dataBar) {
1606
+ } else if (d === y.dataBar) {
1604
1607
  const g = u == null ? void 0 : u.result;
1605
1608
  g && (l.dataBar = g, l.isShowValue = g.isShowValue);
1606
- } else if (d === M.iconSet) {
1609
+ } else if (d === y.iconSet) {
1607
1610
  const g = u == null ? void 0 : u.result;
1608
1611
  g && (l.iconSet = g, l.isShowValue = g.isShowValue);
1609
1612
  }
@@ -1784,12 +1787,12 @@ let s2 = class extends x2 {
1784
1787
  }
1785
1788
  };
1786
1789
  s2 = m1([
1787
- Y(0, S(y)),
1788
- Y(1, S(M2)),
1789
- Y(2, S(q)),
1790
- Y(3, S(J2)),
1791
- Y(4, S(a0)),
1792
- Y(5, S(W))
1790
+ Y(0, b(R)),
1791
+ Y(1, b(M2)),
1792
+ Y(2, b(q)),
1793
+ Y(3, b(J2)),
1794
+ Y(4, b(a0)),
1795
+ Y(5, b(W))
1793
1796
  ], s2);
1794
1797
  const F1 = (s) => s.getCurrentUnitForType(D2.UNIVER_SHEET).getUnitId(), w1 = (s) => {
1795
1798
  var r;
@@ -1811,7 +1814,7 @@ let f2 = class extends t0 {
1811
1814
  this._configService.setConfig(f1, n), [
1812
1815
  [s2],
1813
1816
  [z],
1814
- [y],
1817
+ [R],
1815
1818
  [Q]
1816
1819
  ].forEach((i) => {
1817
1820
  this._injector.add(i);
@@ -1841,8 +1844,8 @@ G2(f2, "pluginName", P2);
1841
1844
  G2(f2, "type", D2.UNIVER_SHEET);
1842
1845
  f2 = A1([
1843
1846
  Q2(p0),
1844
- _2(1, S(M2)),
1845
- _2(2, S(W)),
1847
+ _2(1, b(M2)),
1848
+ _2(2, b(W)),
1846
1849
  _2(3, e0)
1847
1850
  ], f2);
1848
1851
  const _1 = "sheet-conditional-rule-icon", x1 = 35, M1 = 15, y1 = 2, R1 = (s) => {
@@ -1884,11 +1887,11 @@ class I1 extends $2 {
1884
1887
  return;
1885
1888
  c.add(Z);
1886
1889
  }
1887
- const { startX: R, endX: A, startY: I, endY: L } = u || h ? g : d, v2 = A - R, o2 = L - I;
1890
+ const { startX: I, endX: A, startY: S, endY: k } = u || h ? g : d, v2 = A - I, o2 = k - S;
1888
1891
  if (this._width > o2 || this._width > v2 + this._paddingRightAndLeft * 2)
1889
1892
  return;
1890
- const p2 = (o2 - this._width) / 2 + I;
1891
- t.drawImage(E, R + this._paddingRightAndLeft, p2, this._width, this._width);
1893
+ const p2 = (o2 - this._width) / 2 + S;
1894
+ t.drawImage(E, I + this._paddingRightAndLeft, p2, this._width, this._width);
1892
1895
  }), t.restore();
1893
1896
  }
1894
1897
  _init() {
@@ -1921,17 +1924,17 @@ export {
1921
1924
  a2 as AddConditionalRuleMutation,
1922
1925
  q2 as AddConditionalRuleMutationUndoFactory,
1923
1926
  w as CFNumberOperator,
1924
- M as CFRuleType,
1927
+ y as CFRuleType,
1925
1928
  _ as CFSubRuleType,
1926
- k as CFTextOperator,
1927
- B as CFTimePeriodOperator,
1928
- b as CFValueType,
1929
+ B as CFTextOperator,
1930
+ N as CFTimePeriodOperator,
1931
+ L as CFValueType,
1929
1932
  E2 as CONDITIONAL_FORMATTING_VIEWPORT_CACHE_LENGTH,
1930
1933
  k0 as ClearRangeCfCommand,
1931
1934
  B0 as ClearWorksheetCfCommand,
1932
1935
  z as ConditionalFormattingFormulaService,
1933
1936
  I1 as ConditionalFormattingIcon,
1934
- y as ConditionalFormattingRuleModel,
1937
+ R as ConditionalFormattingRuleModel,
1935
1938
  s2 as ConditionalFormattingService,
1936
1939
  Q as ConditionalFormattingViewModel,
1937
1940
  V1 as DEFAULT_BG_COLOR,
@@ -1973,7 +1976,7 @@ export {
1973
1976
  C2 as iconMap,
1974
1977
  q1 as isAnchorEqual,
1975
1978
  h2 as isFloatsEqual,
1976
- N as isNullable,
1979
+ x as isNullable,
1977
1980
  X1 as isRangesEqual,
1978
1981
  R0 as moveByAnchor,
1979
1982
  S1 as removeUndefinedAttr,