@univerjs/sheets-conditional-formatting 0.16.1 → 0.17.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/facade.js CHANGED
@@ -1,10 +1,10 @@
1
- var U = Object.defineProperty;
2
- var q = (u, e, t) => e in u ? U(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
3
- var T = (u, e, t) => q(u, typeof e != "symbol" ? e + "" : e, t);
4
- import { ColorKit as m, Tools as f, BooleanNumber as a, Rectangle as B, ColorBuilder as A } from "@univerjs/core";
5
- import { iconMap as I, CFRuleType as n, EMPTY_ICON_TYPE as _, CFValueType as C, CFNumberOperator as s, CFTextOperator as g, CFSubRuleType as o, createCfId as d, ConditionalFormattingRuleModel as x, AddCfCommand as S, DeleteCfCommand as E, MoveCfCommand as k, SetCfCommand as F, ClearRangeCfCommand as M, ClearWorksheetCfCommand as O, CFTimePeriodOperator as D } from "@univerjs/sheets-conditional-formatting";
6
- import { FRange as v, FWorkbook as R, FWorksheet as N } from "@univerjs/sheets/facade";
7
- import { FEnum as V } from "@univerjs/core/facade";
1
+ var N = Object.defineProperty;
2
+ var U = (l, e, t) => e in l ? N(l, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : l[e] = t;
3
+ var T = (l, e, t) => U(l, typeof e != "symbol" ? e + "" : e, t);
4
+ import { ColorKit as m, Tools as f, BooleanNumber as a, Rectangle as q } from "@univerjs/core";
5
+ import { iconMap as I, CFRuleType as n, EMPTY_ICON_TYPE as _, CFValueType as C, CFNumberOperator as s, CFTextOperator as g, CFSubRuleType as o, createCfId as d, ConditionalFormattingRuleModel as S, AddCfCommand as x, DeleteCfCommand as E, MoveCfCommand as k, SetCfCommand as v, ClearRangeCfCommand as B, ClearWorksheetCfCommand as A, CFTimePeriodOperator as O } from "@univerjs/sheets-conditional-formatting";
6
+ import { FRange as F, FWorksheet as R } from "@univerjs/sheets/facade";
7
+ import { FEnum as M } from "@univerjs/core/facade";
8
8
  class c {
9
9
  constructor(e = {}) {
10
10
  T(this, "_rule", {});
@@ -62,7 +62,7 @@ class c {
62
62
  }
63
63
  // eslint-disable-next-line ts/no-explicit-any
64
64
  _ensureAttr(e, t) {
65
- return t.reduce((r, l) => (r[l] || (r[l] = {}), r[l]), e), e;
65
+ return t.reduce((r, u) => (r[u] || (r[u] = {}), r[u]), e), e;
66
66
  }
67
67
  /**
68
68
  * Constructs a conditional format rule from the settings applied to the builder.
@@ -547,8 +547,8 @@ class i extends c {
547
547
  * ```
548
548
  */
549
549
  whenNumberBetween(e, t) {
550
- const r = Math.min(e, t), l = Math.max(e, t), h = this._ruleConfig;
551
- return h.type = n.highlightCell, h.subType = o.number, h.value = [r, l], h.operator = s.between, this;
550
+ const r = Math.min(e, t), u = Math.max(e, t), h = this._ruleConfig;
551
+ return h.type = n.highlightCell, h.subType = o.number, h.value = [r, u], h.operator = s.between, this;
552
552
  }
553
553
  /**
554
554
  * Sets the conditional format rule to trigger when a number is equal to the given value.
@@ -686,8 +686,8 @@ class i extends c {
686
686
  * ```
687
687
  */
688
688
  whenNumberNotBetween(e, t) {
689
- const r = Math.min(e, t), l = Math.max(e, t), h = this._ruleConfig;
690
- return h.type = n.highlightCell, h.subType = o.number, h.value = [r, l], h.operator = s.notBetween, this;
689
+ const r = Math.min(e, t), u = Math.max(e, t), h = this._ruleConfig;
690
+ return h.type = n.highlightCell, h.subType = o.number, h.value = [r, u], h.operator = s.notBetween, this;
691
691
  }
692
692
  /**
693
693
  * Sets the conditional format rule to trigger when a number is not equal to the given value.
@@ -1785,12 +1785,12 @@ class w {
1785
1785
  return new i(this._initConfig).whenTextStartsWith(e);
1786
1786
  }
1787
1787
  }
1788
- class W extends v {
1788
+ class D extends F {
1789
1789
  _getConditionalFormattingRuleModel() {
1790
- return this._injector.get(x);
1790
+ return this._injector.get(S);
1791
1791
  }
1792
1792
  getConditionalFormattingRules() {
1793
- return [...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(), this._worksheet.getSheetId()) || []].filter((t) => t.ranges.some((r) => B.intersects(r, this._range)));
1793
+ return [...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(), this._worksheet.getSheetId()) || []].filter((t) => t.ranges.some((r) => q.intersects(r, this._range)));
1794
1794
  }
1795
1795
  createConditionalFormattingRule() {
1796
1796
  return new w({ ranges: [this._range] });
@@ -1801,7 +1801,7 @@ class W extends v {
1801
1801
  subUnitId: this._worksheet.getSheetId(),
1802
1802
  rule: e
1803
1803
  };
1804
- return this._commandService.syncExecuteCommand(S.id, t), this;
1804
+ return this._commandService.syncExecuteCommand(x.id, t), this;
1805
1805
  }
1806
1806
  deleteConditionalFormattingRule(e) {
1807
1807
  const t = {
@@ -1812,13 +1812,13 @@ class W extends v {
1812
1812
  return this._commandService.syncExecuteCommand(E.id, t), this;
1813
1813
  }
1814
1814
  moveConditionalFormattingRule(e, t, r = "after") {
1815
- const l = {
1815
+ const u = {
1816
1816
  unitId: this._workbook.getUnitId(),
1817
1817
  subUnitId: this._worksheet.getSheetId(),
1818
1818
  start: { id: e, type: "self" },
1819
1819
  end: { id: t, type: r }
1820
1820
  };
1821
- return this._commandService.syncExecuteCommand(k.id, l), this;
1821
+ return this._commandService.syncExecuteCommand(k.id, u), this;
1822
1822
  }
1823
1823
  setConditionalFormattingRule(e, t) {
1824
1824
  const r = {
@@ -1827,7 +1827,7 @@ class W extends v {
1827
1827
  rule: t,
1828
1828
  cfId: e
1829
1829
  };
1830
- return this._commandService.syncExecuteCommand(F.id, r), this;
1830
+ return this._commandService.syncExecuteCommand(v.id, r), this;
1831
1831
  }
1832
1832
  clearConditionalFormatRules() {
1833
1833
  const e = {
@@ -1835,19 +1835,13 @@ class W extends v {
1835
1835
  subUnitId: this._worksheet.getSheetId(),
1836
1836
  ranges: [this._range]
1837
1837
  };
1838
- return this._commandService.syncExecuteCommand(M.id, e), this;
1838
+ return this._commandService.syncExecuteCommand(B.id, e), this;
1839
1839
  }
1840
1840
  }
1841
- v.extend(W);
1842
- class L extends R {
1843
- newColor() {
1844
- return new A();
1845
- }
1846
- }
1847
- R.extend(L);
1848
- class G extends N {
1841
+ F.extend(D);
1842
+ class V extends R {
1849
1843
  _getConditionalFormattingRuleModel() {
1850
- return this._injector.get(x);
1844
+ return this._injector.get(S);
1851
1845
  }
1852
1846
  getConditionalFormattingRules() {
1853
1847
  return [...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(), this._worksheet.getSheetId()) || []];
@@ -1864,7 +1858,7 @@ class G extends N {
1864
1858
  subUnitId: this._worksheet.getSheetId(),
1865
1859
  rule: e
1866
1860
  };
1867
- return this._commandService.syncExecuteCommand(S.id, t), this;
1861
+ return this._commandService.syncExecuteCommand(x.id, t), this;
1868
1862
  }
1869
1863
  deleteConditionalFormattingRule(e) {
1870
1864
  const t = {
@@ -1875,13 +1869,13 @@ class G extends N {
1875
1869
  return this._commandService.syncExecuteCommand(E.id, t), this;
1876
1870
  }
1877
1871
  moveConditionalFormattingRule(e, t, r = "after") {
1878
- const l = {
1872
+ const u = {
1879
1873
  unitId: this._workbook.getUnitId(),
1880
1874
  subUnitId: this._worksheet.getSheetId(),
1881
1875
  start: { id: e, type: "self" },
1882
1876
  end: { id: t, type: r }
1883
1877
  };
1884
- return this._commandService.syncExecuteCommand(k.id, l), this;
1878
+ return this._commandService.syncExecuteCommand(k.id, u), this;
1885
1879
  }
1886
1880
  setConditionalFormattingRule(e, t) {
1887
1881
  const r = {
@@ -1890,26 +1884,26 @@ class G extends N {
1890
1884
  cfId: e,
1891
1885
  rule: t
1892
1886
  };
1893
- return this._commandService.syncExecuteCommand(F.id, r), this;
1887
+ return this._commandService.syncExecuteCommand(v.id, r), this;
1894
1888
  }
1895
1889
  clearConditionalFormatRules() {
1896
1890
  const e = {
1897
1891
  unitId: this._workbook.getUnitId(),
1898
1892
  subUnitId: this._worksheet.getSheetId()
1899
1893
  };
1900
- return this._commandService.syncExecuteCommand(O.id, e), this;
1894
+ return this._commandService.syncExecuteCommand(A.id, e), this;
1901
1895
  }
1902
1896
  }
1903
- N.extend(G);
1904
- class P {
1897
+ R.extend(V);
1898
+ class W {
1905
1899
  get ConditionFormatNumberOperatorEnum() {
1906
1900
  return s;
1907
1901
  }
1908
1902
  get ConditionFormatTimePeriodOperatorEnum() {
1909
- return D;
1903
+ return O;
1910
1904
  }
1911
1905
  }
1912
- V.extend(P);
1906
+ M.extend(W);
1913
1907
  export {
1914
1908
  w as FConditionalFormattingBuilder
1915
1909
  };