@univerjs/sheets-conditional-formatting 0.20.1 → 0.21.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/facade.js CHANGED
@@ -1 +1,2146 @@
1
- import{BooleanNumber as e,ColorKit as t,Rectangle as n,Tools as r}from"@univerjs/core";import{AddCfCommand as i,CFNumberOperator as a,CFRuleType as o,CFSubRuleType as s,CFTextOperator as c,CFTimePeriodOperator as l,CFValueType as u,ClearRangeCfCommand as d,ClearWorksheetCfCommand as f,ConditionalFormattingRuleModel as p,DeleteCfCommand as m,EMPTY_ICON_TYPE as h,MoveCfCommand as g,SetCfCommand as _,createCfId as v,iconMap as y}from"@univerjs/sheets-conditional-formatting";import{FRange as b,FWorksheet as x}from"@univerjs/sheets/facade";import{FEnum as S}from"@univerjs/core/facade";function C(e){"@babel/helpers - typeof";return C=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},C(e)}function w(e,t){if(C(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(C(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function T(e){var t=w(e,`string`);return C(t)==`symbol`?t:t+``}function E(e,t,n){return(t=T(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var D=class e{get _ruleConfig(){return this._rule.rule||null}_getDefaultConfig(e=o.highlightCell){switch(e){case o.colorScale:return{type:e,config:[{index:0,color:new t(``).toRgbString(),value:{type:u.min}},{index:0,color:new t(`green`).toRgbString(),value:{type:u.max}}]};case o.dataBar:return{type:e,isShowValue:!0,config:{min:{type:u.min},max:{type:u.max},positiveColor:new t(`green`).toRgbString(),nativeColor:new t(``).toRgbString(),isGradient:!1}};case o.highlightCell:return{type:e,subType:s.text,operator:c.containsText,value:`abc`,style:{}};case o.iconSet:return{type:e,isShowValue:!0,config:[{operator:a.greaterThanOrEqual,value:{type:u.min},iconType:h,iconId:``},{operator:a.greaterThanOrEqual,value:{type:u.percentile,value:.5},iconType:h,iconId:``},{operator:a.lessThanOrEqual,value:{type:u.max},iconType:h,iconId:``}]}}}constructor(e={}){E(this,`_rule`,{}),this._rule=e,this._ensureAttr(this._rule,[`rule`])}_ensureAttr(e,t){return t.reduce((e,t)=>(e[t]||(e[t]={}),e[t]),e),e}build(){var e;this._rule.cfId||(this._rule.cfId=v()),this._rule.ranges||(this._rule.ranges=[]),this._rule.stopIfTrue===void 0&&(this._rule.stopIfTrue=!1),(e=this._rule.rule)!=null&&e.type||(this._rule.rule.type=o.highlightCell,this._ensureAttr(this._rule,[`rule`,`style`]));let t=this._getDefaultConfig(this._rule.rule.type);return{...this._rule,rule:{...t,...this._rule.rule}}}copy(){let t=r.deepClone(this._rule);return t.cfId&&(t.cfId=v()),new e(t)}getRanges(){return this._rule.ranges||[]}getIconMap(){return y}createCfId(){return v()}setRanges(e){return this._rule.ranges=e,this}},O=class n extends D{constructor(e={}){super(e),this._ensureAttr(this._rule,[`rule`,`style`])}copy(){let e=r.deepClone(this._rule);return e.cfId&&(e.cfId=v()),new n(e)}setAverage(e){let t=this._ruleConfig;return t.type=o.highlightCell,t.subType=s.average,t.operator=e,this}setUniqueValues(){let e=this._ruleConfig;return e.type=o.highlightCell,e.subType=s.uniqueValues,this}setDuplicateValues(){let e=this._ruleConfig;return e.type=o.highlightCell,e.subType=s.duplicateValues,this}setRank(e){let t=this._ruleConfig;return t.type=o.highlightCell,t.subType=s.rank,t.isBottom=e.isBottom,t.isPercent=e.isPercent,t.value=e.value,this}setBackground(e){var n;if(((n=this._ruleConfig)==null?void 0:n.type)===o.highlightCell)if(e){this._ensureAttr(this._ruleConfig,[`style`,`bg`]);let n=new t(e);this._ruleConfig.style.bg.rgb=n.toRgbString()}else delete this._ruleConfig.style.bg;return this}setBold(t){var n;return((n=this._ruleConfig)==null?void 0:n.type)===o.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`]),this._ruleConfig.style.bl=t?e.TRUE:e.FALSE),this}setFontColor(e){var n;if(((n=this._ruleConfig)==null?void 0:n.type)===o.highlightCell)if(e){let n=new t(e);this._ensureAttr(this._ruleConfig,[`style`,`cl`]),this._ruleConfig.style.cl.rgb=n.toRgbString()}else delete this._ruleConfig.style.cl;return this}setItalic(t){var n;return((n=this._ruleConfig)==null?void 0:n.type)===o.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`]),this._ruleConfig.style.it=t?e.TRUE:e.FALSE),this}setStrikethrough(t){var n;return((n=this._ruleConfig)==null?void 0:n.type)===o.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`,`st`]),this._ruleConfig.style.st.s=t?e.TRUE:e.FALSE),this}setUnderline(t){var n;return((n=this._ruleConfig)==null?void 0:n.type)===o.highlightCell&&(this._ensureAttr(this._ruleConfig,[`style`,`ul`]),this._ruleConfig.style.ul.s=t?e.TRUE:e.FALSE),this}whenCellEmpty(){let e=this._ruleConfig;return e.type=o.highlightCell,e.subType=s.text,e.value=``,e.operator=c.equal,this}whenCellNotEmpty(){let e=this._ruleConfig;return e.type=o.highlightCell,e.subType=s.text,e.value=``,e.operator=c.notEqual,this}whenDate(e){let t=this._ruleConfig;return t.type=o.highlightCell,t.subType=s.timePeriod,t.operator=e,this}whenFormulaSatisfied(e){let t=this._ruleConfig;return t.type=o.highlightCell,t.subType=s.formula,t.value=e,this}whenNumberBetween(e,t){let n=Math.min(e,t),r=Math.max(e,t),i=this._ruleConfig;return i.type=o.highlightCell,i.subType=s.number,i.value=[n,r],i.operator=a.between,this}whenNumberEqualTo(e){let t=this._ruleConfig;return t.type=o.highlightCell,t.subType=s.number,t.value=e,t.operator=a.equal,this}whenNumberGreaterThan(e){let t=this._ruleConfig;return t.type=o.highlightCell,t.subType=s.number,t.value=e,t.operator=a.greaterThan,this}whenNumberGreaterThanOrEqualTo(e){let t=this._ruleConfig;return t.type=o.highlightCell,t.subType=s.number,t.value=e,t.operator=a.greaterThanOrEqual,this}whenNumberLessThan(e){let t=this._ruleConfig;return t.type=o.highlightCell,t.subType=s.number,t.value=e,t.operator=a.lessThan,this}whenNumberLessThanOrEqualTo(e){let t=this._ruleConfig;return t.type=o.highlightCell,t.subType=s.number,t.value=e,t.operator=a.lessThanOrEqual,this}whenNumberNotBetween(e,t){let n=Math.min(e,t),r=Math.max(e,t),i=this._ruleConfig;return i.type=o.highlightCell,i.subType=s.number,i.value=[n,r],i.operator=a.notBetween,this}whenNumberNotEqualTo(e){let t=this._ruleConfig;return t.type=o.highlightCell,t.subType=s.number,t.value=e,t.operator=a.notEqual,this}whenTextContains(e){let t=this._ruleConfig;return t.type=o.highlightCell,t.subType=s.text,t.value=e,t.operator=c.containsText,this}whenTextDoesNotContain(e){let t=this._ruleConfig;return t.type=o.highlightCell,t.subType=s.text,t.value=e,t.operator=c.notContainsText,this}whenTextEndsWith(e){let t=this._ruleConfig;return t.type=o.highlightCell,t.subType=s.text,t.value=e,t.operator=c.endsWith,this}whenTextEqualTo(e){let t=this._ruleConfig;return t.type=o.highlightCell,t.subType=s.text,t.value=e,t.operator=c.equal,this}whenTextStartsWith(e){let t=this._ruleConfig;return t.type=o.highlightCell,t.subType=s.text,t.value=e,t.operator=c.beginsWith,this}},k=class e extends D{copy(){let t=r.deepClone(this._rule);return t.cfId&&(t.cfId=v()),new e(t)}setDataBar(e){let t=this._ruleConfig;return t.type=o.dataBar,t.isShowValue=!!e.isShowValue,t.config={min:e.min,max:e.max,positiveColor:e.positiveColor,nativeColor:e.nativeColor,isGradient:!!e.isGradient},this}},A=class e extends D{copy(){let t=r.deepClone(this._rule);return t.cfId&&(t.cfId=v()),new e(t)}setColorScale(e){let t=this._ruleConfig;return t.type=o.colorScale,t.config=e,this}},j=class e extends D{copy(){let t=r.deepClone(this._rule);return t.cfId&&(t.cfId=v()),new e(t)}setIconSet(e){let t=this._ruleConfig;return t.type=o.iconSet,t.config=e.iconConfigs,t.isShowValue=e.isShowValue,this}},M=class{constructor(e={}){this._initConfig=e}build(){return new D(this._initConfig).build()}setAverage(e){return new O(this._initConfig).setAverage(e)}setUniqueValues(){return new O(this._initConfig).setUniqueValues()}setDuplicateValues(){return new O(this._initConfig).setDuplicateValues()}setRank(e){return new O(this._initConfig).setRank(e)}getIconMap(){return y}setIconSet(e){return new j(this._initConfig).setIconSet(e)}setColorScale(e){return new A(this._initConfig).setColorScale(e)}setDataBar(e){return new k(this._initConfig).setDataBar(e)}setBackground(e){return new O(this._initConfig).setBackground(e)}setBold(e){return new O(this._initConfig).setBold(e)}setFontColor(e){return new O(this._initConfig).setFontColor(e)}setItalic(e){return new O(this._initConfig).setItalic(e)}setStrikethrough(e){return new O(this._initConfig).setStrikethrough(e)}setUnderline(e){return new O(this._initConfig).setUnderline(e)}whenCellEmpty(){return new O(this._initConfig).whenCellEmpty()}whenCellNotEmpty(){return new O(this._initConfig).whenCellNotEmpty()}whenDate(e){return new O(this._initConfig).whenDate(e)}whenFormulaSatisfied(e){return new O(this._initConfig).whenFormulaSatisfied(e)}whenNumberBetween(e,t){return new O(this._initConfig).whenNumberBetween(e,t)}whenNumberEqualTo(e){return new O(this._initConfig).whenNumberEqualTo(e)}whenNumberGreaterThan(e){return new O(this._initConfig).whenNumberGreaterThan(e)}whenNumberGreaterThanOrEqualTo(e){return new O(this._initConfig).whenNumberGreaterThanOrEqualTo(e)}whenNumberLessThan(e){return new O(this._initConfig).whenNumberLessThan(e)}whenNumberLessThanOrEqualTo(e){return new O(this._initConfig).whenNumberLessThanOrEqualTo(e)}whenNumberNotBetween(e,t){return new O(this._initConfig).whenNumberNotBetween(e,t)}whenNumberNotEqualTo(e){return new O(this._initConfig).whenNumberNotEqualTo(e)}whenTextContains(e){return new O(this._initConfig).whenTextContains(e)}whenTextDoesNotContain(e){return new O(this._initConfig).whenTextDoesNotContain(e)}whenTextEndsWith(e){return new O(this._initConfig).whenTextEndsWith(e)}whenTextEqualTo(e){return new O(this._initConfig).whenTextEqualTo(e)}whenTextStartsWith(e){return new O(this._initConfig).whenTextStartsWith(e)}},N=class extends b{_getConditionalFormattingRuleModel(){return this._injector.get(p)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]].filter(e=>e.ranges.some(e=>n.intersects(e,this._range)))}createConditionalFormattingRule(){return new M({ranges:[this._range]})}addConditionalFormattingRule(e){let t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:e};return this._commandService.syncExecuteCommand(i.id,t),this}deleteConditionalFormattingRule(e){let t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(m.id,t),this}moveConditionalFormattingRule(e,t,n=`after`){let r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:`self`},end:{id:t,type:n}};return this._commandService.syncExecuteCommand(g.id,r),this}setConditionalFormattingRule(e,t){let n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:t,cfId:e};return this._commandService.syncExecuteCommand(_.id,n),this}clearConditionalFormatRules(){let e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]};return this._commandService.syncExecuteCommand(d.id,e),this}};b.extend(N);var P=class extends x{_getConditionalFormattingRuleModel(){return this._injector.get(p)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]]}createConditionalFormattingRule(){return new M}newConditionalFormattingRule(){return new M}addConditionalFormattingRule(e){let t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:e};return this._commandService.syncExecuteCommand(i.id,t),this}deleteConditionalFormattingRule(e){let t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(m.id,t),this}moveConditionalFormattingRule(e,t,n=`after`){let r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:`self`},end:{id:t,type:n}};return this._commandService.syncExecuteCommand(g.id,r),this}setConditionalFormattingRule(e,t){let n={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e,rule:t};return this._commandService.syncExecuteCommand(_.id,n),this}clearConditionalFormatRules(){let e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()};return this._commandService.syncExecuteCommand(f.id,e),this}};x.extend(P);var F=class extends S{get ConditionFormatNumberOperatorEnum(){return a}get ConditionFormatTimePeriodOperatorEnum(){return l}};S.extend(F);export{M as FConditionalFormattingBuilder};
1
+ import { BooleanNumber, ColorKit, Rectangle, Tools } from "@univerjs/core";
2
+ import { AddCfCommand, CFNumberOperator, CFRuleType, CFSubRuleType, CFTextOperator, CFTimePeriodOperator, CFValueType, ClearRangeCfCommand, ClearWorksheetCfCommand, ConditionalFormattingRuleModel, DeleteCfCommand, EMPTY_ICON_TYPE, MoveCfCommand, SetCfCommand, createCfId, iconMap } from "@univerjs/sheets-conditional-formatting";
3
+ import { FRange, FWorksheet } from "@univerjs/sheets/facade";
4
+ import { FEnum } from "@univerjs/core/facade";
5
+
6
+ //#region \0@oxc-project+runtime@0.124.0/helpers/typeof.js
7
+ function _typeof(o) {
8
+ "@babel/helpers - typeof";
9
+ return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
10
+ return typeof o;
11
+ } : function(o) {
12
+ return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
13
+ }, _typeof(o);
14
+ }
15
+
16
+ //#endregion
17
+ //#region \0@oxc-project+runtime@0.124.0/helpers/toPrimitive.js
18
+ function toPrimitive(t, r) {
19
+ if ("object" != _typeof(t) || !t) return t;
20
+ var e = t[Symbol.toPrimitive];
21
+ if (void 0 !== e) {
22
+ var i = e.call(t, r || "default");
23
+ if ("object" != _typeof(i)) return i;
24
+ throw new TypeError("@@toPrimitive must return a primitive value.");
25
+ }
26
+ return ("string" === r ? String : Number)(t);
27
+ }
28
+
29
+ //#endregion
30
+ //#region \0@oxc-project+runtime@0.124.0/helpers/toPropertyKey.js
31
+ function toPropertyKey(t) {
32
+ var i = toPrimitive(t, "string");
33
+ return "symbol" == _typeof(i) ? i : i + "";
34
+ }
35
+
36
+ //#endregion
37
+ //#region \0@oxc-project+runtime@0.124.0/helpers/defineProperty.js
38
+ function _defineProperty(e, r, t) {
39
+ return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
40
+ value: t,
41
+ enumerable: !0,
42
+ configurable: !0,
43
+ writable: !0
44
+ }) : e[r] = t, e;
45
+ }
46
+
47
+ //#endregion
48
+ //#region src/facade/f-conditional-formatting-builder.ts
49
+ /**
50
+ * @ignore
51
+ * @hideconstructor
52
+ */
53
+ var ConditionalFormatRuleBaseBuilder = class ConditionalFormatRuleBaseBuilder {
54
+ get _ruleConfig() {
55
+ return this._rule.rule || null;
56
+ }
57
+ _getDefaultConfig(type = CFRuleType.highlightCell) {
58
+ switch (type) {
59
+ case CFRuleType.colorScale: return {
60
+ type,
61
+ config: [{
62
+ index: 0,
63
+ color: new ColorKit("").toRgbString(),
64
+ value: { type: CFValueType.min }
65
+ }, {
66
+ index: 0,
67
+ color: new ColorKit("green").toRgbString(),
68
+ value: { type: CFValueType.max }
69
+ }]
70
+ };
71
+ case CFRuleType.dataBar: return {
72
+ type,
73
+ isShowValue: true,
74
+ config: {
75
+ min: { type: CFValueType.min },
76
+ max: { type: CFValueType.max },
77
+ positiveColor: new ColorKit("green").toRgbString(),
78
+ nativeColor: new ColorKit("").toRgbString(),
79
+ isGradient: false
80
+ }
81
+ };
82
+ case CFRuleType.highlightCell: return {
83
+ type,
84
+ subType: CFSubRuleType.text,
85
+ operator: CFTextOperator.containsText,
86
+ value: "abc",
87
+ style: {}
88
+ };
89
+ case CFRuleType.iconSet: return {
90
+ type,
91
+ isShowValue: true,
92
+ config: [
93
+ {
94
+ operator: CFNumberOperator.greaterThanOrEqual,
95
+ value: { type: CFValueType.min },
96
+ iconType: EMPTY_ICON_TYPE,
97
+ iconId: ""
98
+ },
99
+ {
100
+ operator: CFNumberOperator.greaterThanOrEqual,
101
+ value: {
102
+ type: CFValueType.percentile,
103
+ value: .5
104
+ },
105
+ iconType: EMPTY_ICON_TYPE,
106
+ iconId: ""
107
+ },
108
+ {
109
+ operator: CFNumberOperator.lessThanOrEqual,
110
+ value: { type: CFValueType.max },
111
+ iconType: EMPTY_ICON_TYPE,
112
+ iconId: ""
113
+ }
114
+ ]
115
+ };
116
+ }
117
+ }
118
+ constructor(initRule = {}) {
119
+ _defineProperty(this, "_rule", {});
120
+ this._rule = initRule;
121
+ this._ensureAttr(this._rule, ["rule"]);
122
+ }
123
+ _ensureAttr(obj, keys) {
124
+ keys.reduce((pre, cur) => {
125
+ if (!pre[cur]) pre[cur] = {};
126
+ return pre[cur];
127
+ }, obj);
128
+ return obj;
129
+ }
130
+ /**
131
+ * Constructs a conditional format rule from the settings applied to the builder.
132
+ * @returns {IConditionFormattingRule} The conditional format rule.
133
+ * @example
134
+ * ```typescript
135
+ * const fWorkbook = univerAPI.getActiveWorkbook();
136
+ * const fWorksheet = fWorkbook.getActiveSheet();
137
+ *
138
+ * // Create a conditional formatting rule that highlights cells with no content in red for the range A1:D10.
139
+ * const fRange = fWorksheet.getRange('A1:D10');
140
+ * const rule = fWorksheet.newConditionalFormattingRule()
141
+ * .whenCellEmpty()
142
+ * .setBackground('#FF0000')
143
+ * .setRanges([fRange.getRange()])
144
+ * .build();
145
+ * fWorksheet.addConditionalFormattingRule(rule);
146
+ * ```
147
+ */
148
+ build() {
149
+ var _this$_rule$rule;
150
+ if (!this._rule.cfId) this._rule.cfId = createCfId();
151
+ if (!this._rule.ranges) this._rule.ranges = [];
152
+ if (this._rule.stopIfTrue === void 0) this._rule.stopIfTrue = false;
153
+ if (!((_this$_rule$rule = this._rule.rule) === null || _this$_rule$rule === void 0 ? void 0 : _this$_rule$rule.type)) {
154
+ this._rule.rule.type = CFRuleType.highlightCell;
155
+ this._ensureAttr(this._rule, ["rule", "style"]);
156
+ }
157
+ const defaultConfig = this._getDefaultConfig(this._rule.rule.type);
158
+ return {
159
+ ...this._rule,
160
+ rule: {
161
+ ...defaultConfig,
162
+ ...this._rule.rule
163
+ }
164
+ };
165
+ }
166
+ /**
167
+ * Deep clone a current builder.
168
+ * @returns {ConditionalFormatRuleBaseBuilder} A new builder with the same settings as the original.
169
+ * @example
170
+ * ```typescript
171
+ * const fWorkbook = univerAPI.getActiveWorkbook();
172
+ * const fWorksheet = fWorkbook.getActiveSheet();
173
+ *
174
+ * // Create a conditional formatting rule that highlights cells with no content in red for the range A1:D10.
175
+ * const fRange = fWorksheet.getRange('A1:D10');
176
+ * const builder = fWorksheet.newConditionalFormattingRule()
177
+ * .whenCellEmpty()
178
+ * .setBackground('#FF0000')
179
+ * .setRanges([fRange.getRange()]);
180
+ * fWorksheet.addConditionalFormattingRule(builder.build());
181
+ *
182
+ * // Copy the rule and change the background color to green for the range A1:B2.
183
+ * const newRange = fWorksheet.getRange('A1:B2');
184
+ * const newBuilder = builder.copy()
185
+ * .setBackground('#00FF00')
186
+ * .setRanges([newRange.getRange()]);
187
+ * fWorksheet.addConditionalFormattingRule(newBuilder.build());
188
+ * ```
189
+ */
190
+ copy() {
191
+ const newRule = Tools.deepClone(this._rule);
192
+ if (newRule.cfId) newRule.cfId = createCfId();
193
+ return new ConditionalFormatRuleBaseBuilder(newRule);
194
+ }
195
+ /**
196
+ * Gets the scope of the current conditional format.
197
+ * @returns {IRange[]} The ranges to which the conditional format applies.
198
+ */
199
+ getRanges() {
200
+ return this._rule.ranges || [];
201
+ }
202
+ /**
203
+ * Get the icon set mapping dictionary.
204
+ * @returns {Record<string, string[]>} The icon set mapping dictionary.
205
+ */
206
+ getIconMap() {
207
+ return iconMap;
208
+ }
209
+ /**
210
+ * Create a conditional format ID.
211
+ * @returns {string} The conditional format ID.
212
+ */
213
+ createCfId() {
214
+ return createCfId();
215
+ }
216
+ /**
217
+ * Sets the scope for conditional formatting.
218
+ * @param {IRange[]} ranges - The ranges to which the conditional format applies.
219
+ * @returns {ConditionalFormatRuleBaseBuilder} This builder for chaining.
220
+ * @example
221
+ * ```typescript
222
+ * const fWorkbook = univerAPI.getActiveWorkbook();
223
+ * const fWorksheet = fWorkbook.getActiveSheet();
224
+ *
225
+ * // Create a conditional formatting rule that highlights cells with no content in red for the range A1:D10.
226
+ * const fRange = fWorksheet.getRange('A1:D10');
227
+ * const rule = fWorksheet.newConditionalFormattingRule()
228
+ * .whenCellEmpty()
229
+ * .setBackground('#FF0000')
230
+ * .setRanges([fRange.getRange()])
231
+ * .build();
232
+ * fWorksheet.addConditionalFormattingRule(rule);
233
+ * ```
234
+ */
235
+ setRanges(ranges) {
236
+ this._rule.ranges = ranges;
237
+ return this;
238
+ }
239
+ };
240
+ /**
241
+ * @hideconstructor
242
+ */
243
+ var ConditionalFormatHighlightRuleBuilder = class ConditionalFormatHighlightRuleBuilder extends ConditionalFormatRuleBaseBuilder {
244
+ constructor(initConfig = {}) {
245
+ super(initConfig);
246
+ this._ensureAttr(this._rule, ["rule", "style"]);
247
+ }
248
+ /**
249
+ * Deep clone a current builder.
250
+ * @returns {ConditionalFormatHighlightRuleBuilder} A new builder with the same settings as the original.
251
+ * @example
252
+ * ```typescript
253
+ * const fWorkbook = univerAPI.getActiveWorkbook();
254
+ * const fWorksheet = fWorkbook.getActiveSheet();
255
+ *
256
+ * // Create a conditional formatting rule that highlights cells with no content in red for the range A1:D10.
257
+ * const fRange = fWorksheet.getRange('A1:D10');
258
+ * const builder = fWorksheet.newConditionalFormattingRule()
259
+ * .whenCellEmpty()
260
+ * .setBackground('#FF0000')
261
+ * .setRanges([fRange.getRange()]);
262
+ * fWorksheet.addConditionalFormattingRule(builder.build());
263
+ *
264
+ * // Copy the rule and change the background color to green for the range A1:B2.
265
+ * const newRange = fWorksheet.getRange('A1:B2');
266
+ * const newBuilder = builder.copy()
267
+ * .setBackground('#00FF00')
268
+ * .setRanges([newRange.getRange()]);
269
+ * fWorksheet.addConditionalFormattingRule(newBuilder.build());
270
+ * ```
271
+ */
272
+ copy() {
273
+ const newRule = Tools.deepClone(this._rule);
274
+ if (newRule.cfId) newRule.cfId = createCfId();
275
+ return new ConditionalFormatHighlightRuleBuilder(newRule);
276
+ }
277
+ /**
278
+ * Set average rule.
279
+ * @param {IAverageHighlightCell['operator']} operator - The operator to use for the average rule.
280
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
281
+ * @example
282
+ * ```typescript
283
+ * const fWorkbook = univerAPI.getActiveWorkbook();
284
+ * const fWorksheet = fWorkbook.getActiveSheet();
285
+ *
286
+ * // Create a conditional formatting rule that highlights cells with greater than average values in red for the range A1:D10.
287
+ * const fRange = fWorksheet.getRange('A1:D10');
288
+ * const rule = fWorksheet.newConditionalFormattingRule()
289
+ * .setAverage(univerAPI.Enum.ConditionFormatNumberOperatorEnum.greaterThan)
290
+ * .setBackground('#FF0000')
291
+ * .setRanges([fRange.getRange()])
292
+ * .build();
293
+ * fWorksheet.addConditionalFormattingRule(rule);
294
+ * ```
295
+ */
296
+ setAverage(operator) {
297
+ const ruleConfig = this._ruleConfig;
298
+ ruleConfig.type = CFRuleType.highlightCell;
299
+ ruleConfig.subType = CFSubRuleType.average;
300
+ ruleConfig.operator = operator;
301
+ return this;
302
+ }
303
+ /**
304
+ * Set unique values rule.
305
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
306
+ * @example
307
+ * ```typescript
308
+ * const fWorkbook = univerAPI.getActiveWorkbook();
309
+ * const fWorksheet = fWorkbook.getActiveSheet();
310
+ *
311
+ * // Create a conditional formatting rule that highlights cells with unique values in red for the range A1:D10.
312
+ * const fRange = fWorksheet.getRange('A1:D10');
313
+ * const rule = fWorksheet.newConditionalFormattingRule()
314
+ * .setUniqueValues()
315
+ * .setBackground('#FF0000')
316
+ * .setRanges([fRange.getRange()])
317
+ * .build();
318
+ * fWorksheet.addConditionalFormattingRule(rule);
319
+ * ```
320
+ */
321
+ setUniqueValues() {
322
+ const ruleConfig = this._ruleConfig;
323
+ ruleConfig.type = CFRuleType.highlightCell;
324
+ ruleConfig.subType = CFSubRuleType.uniqueValues;
325
+ return this;
326
+ }
327
+ /**
328
+ * Set duplicate values rule.
329
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
330
+ * @example
331
+ * ```typescript
332
+ * const fWorkbook = univerAPI.getActiveWorkbook();
333
+ * const fWorksheet = fWorkbook.getActiveSheet();
334
+ *
335
+ * // Create a conditional formatting rule that highlights cells with duplicate values in red for the range A1:D10.
336
+ * const fRange = fWorksheet.getRange('A1:D10');
337
+ * const rule = fWorksheet.newConditionalFormattingRule()
338
+ * .setDuplicateValues()
339
+ * .setBackground('#FF0000')
340
+ * .setRanges([fRange.getRange()])
341
+ * .build();
342
+ * fWorksheet.addConditionalFormattingRule(rule);
343
+ * ```
344
+ */
345
+ setDuplicateValues() {
346
+ const ruleConfig = this._ruleConfig;
347
+ ruleConfig.type = CFRuleType.highlightCell;
348
+ ruleConfig.subType = CFSubRuleType.duplicateValues;
349
+ return this;
350
+ }
351
+ /**
352
+ * Set rank rule.
353
+ * @param {{ isBottom: boolean, isPercent: boolean, value: number }} config - The rank rule settings.
354
+ * @param {boolean} config.isBottom - Whether to highlight the bottom rank.
355
+ * @param {boolean} config.isPercent - Whether to use a percentage rank.
356
+ * @param {number} config.value - The rank value.
357
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
358
+ * @example
359
+ * ```typescript
360
+ * const fWorkbook = univerAPI.getActiveWorkbook();
361
+ * const fWorksheet = fWorkbook.getActiveSheet();
362
+ *
363
+ * // Create a conditional formatting rule that highlights the bottom 10% of values in red for the range A1:D10.
364
+ * const fRange = fWorksheet.getRange('A1:D10');
365
+ * const rule = fWorksheet.newConditionalFormattingRule()
366
+ * .setRank({ isBottom: true, isPercent: true, value: 10 })
367
+ * .setBackground('#FF0000')
368
+ * .setRanges([fRange.getRange()])
369
+ * .build();
370
+ * fWorksheet.addConditionalFormattingRule(rule);
371
+ * ```
372
+ */
373
+ setRank(config) {
374
+ const ruleConfig = this._ruleConfig;
375
+ ruleConfig.type = CFRuleType.highlightCell;
376
+ ruleConfig.subType = CFSubRuleType.rank;
377
+ ruleConfig.isBottom = config.isBottom;
378
+ ruleConfig.isPercent = config.isPercent;
379
+ ruleConfig.value = config.value;
380
+ return this;
381
+ }
382
+ /**
383
+ * Sets the background color for the conditional format rule's format.
384
+ * @param {string} [color] - The background color to set. If not provided, the background color is removed.
385
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
386
+ * @example
387
+ * ```typescript
388
+ * const fWorkbook = univerAPI.getActiveWorkbook();
389
+ * const fWorksheet = fWorkbook.getActiveSheet();
390
+ *
391
+ * // Create a conditional formatting rule that highlights cells with no content in red for the range A1:D10.
392
+ * const fRange = fWorksheet.getRange('A1:D10');
393
+ * const rule = fWorksheet.newConditionalFormattingRule()
394
+ * .whenCellEmpty()
395
+ * .setBackground('#FF0000')
396
+ * .setRanges([fRange.getRange()])
397
+ * .build();
398
+ * fWorksheet.addConditionalFormattingRule(rule);
399
+ * ```
400
+ */
401
+ setBackground(color) {
402
+ var _this$_ruleConfig;
403
+ if (((_this$_ruleConfig = this._ruleConfig) === null || _this$_ruleConfig === void 0 ? void 0 : _this$_ruleConfig.type) === CFRuleType.highlightCell) if (color) {
404
+ this._ensureAttr(this._ruleConfig, ["style", "bg"]);
405
+ const colorKit = new ColorKit(color);
406
+ this._ruleConfig.style.bg.rgb = colorKit.toRgbString();
407
+ } else delete this._ruleConfig.style.bg;
408
+ return this;
409
+ }
410
+ /**
411
+ * Sets text bolding for the conditional format rule's format.
412
+ * @param {boolean} isBold - Whether to bold the text.
413
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
414
+ * @example
415
+ * ```typescript
416
+ * const fWorkbook = univerAPI.getActiveWorkbook();
417
+ * const fWorksheet = fWorkbook.getActiveSheet();
418
+ *
419
+ * // Create a conditional formatting rule that bolds the text for cells with not empty content in the range A1:D10.
420
+ * const fRange = fWorksheet.getRange('A1:D10');
421
+ * const rule = fWorksheet.newConditionalFormattingRule()
422
+ * .whenCellNotEmpty()
423
+ * .setBold(true)
424
+ * .setRanges([fRange.getRange()])
425
+ * .build();
426
+ * fWorksheet.addConditionalFormattingRule(rule);
427
+ * ```
428
+ */
429
+ setBold(isBold) {
430
+ var _this$_ruleConfig2;
431
+ if (((_this$_ruleConfig2 = this._ruleConfig) === null || _this$_ruleConfig2 === void 0 ? void 0 : _this$_ruleConfig2.type) === CFRuleType.highlightCell) {
432
+ this._ensureAttr(this._ruleConfig, ["style"]);
433
+ this._ruleConfig.style.bl = isBold ? BooleanNumber.TRUE : BooleanNumber.FALSE;
434
+ }
435
+ return this;
436
+ }
437
+ /**
438
+ * Sets the font color for the conditional format rule's format.
439
+ * @param {string} [color] - The font color to set. If not provided, the font color is removed.
440
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
441
+ * @example
442
+ * ```typescript
443
+ * const fWorkbook = univerAPI.getActiveWorkbook();
444
+ * const fWorksheet = fWorkbook.getActiveSheet();
445
+ *
446
+ * // Create a conditional formatting rule that changes the font color to red for cells with not empty content in the range A1:D10.
447
+ * const fRange = fWorksheet.getRange('A1:D10');
448
+ * const rule = fWorksheet.newConditionalFormattingRule()
449
+ * .whenCellNotEmpty()
450
+ * .setFontColor('#FF0000')
451
+ * .setRanges([fRange.getRange()])
452
+ * .build();
453
+ * fWorksheet.addConditionalFormattingRule(rule);
454
+ * ```
455
+ */
456
+ setFontColor(color) {
457
+ var _this$_ruleConfig3;
458
+ if (((_this$_ruleConfig3 = this._ruleConfig) === null || _this$_ruleConfig3 === void 0 ? void 0 : _this$_ruleConfig3.type) === CFRuleType.highlightCell) if (color) {
459
+ const colorKit = new ColorKit(color);
460
+ this._ensureAttr(this._ruleConfig, ["style", "cl"]);
461
+ this._ruleConfig.style.cl.rgb = colorKit.toRgbString();
462
+ } else delete this._ruleConfig.style.cl;
463
+ return this;
464
+ }
465
+ /**
466
+ * Sets text italics for the conditional format rule's format.
467
+ * @param {boolean} isItalic - Whether to italicize the text.
468
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
469
+ * @example
470
+ * ```typescript
471
+ * const fWorkbook = univerAPI.getActiveWorkbook();
472
+ * const fWorksheet = fWorkbook.getActiveSheet();
473
+ *
474
+ * // Create a conditional formatting rule that italicizes the text for cells with not empty content in the range A1:D10.
475
+ * const fRange = fWorksheet.getRange('A1:D10');
476
+ * const rule = fWorksheet.newConditionalFormattingRule()
477
+ * .whenCellNotEmpty()
478
+ * .setItalic(true)
479
+ * .setRanges([fRange.getRange()])
480
+ * .build();
481
+ * fWorksheet.addConditionalFormattingRule(rule);
482
+ * ```
483
+ */
484
+ setItalic(isItalic) {
485
+ var _this$_ruleConfig4;
486
+ if (((_this$_ruleConfig4 = this._ruleConfig) === null || _this$_ruleConfig4 === void 0 ? void 0 : _this$_ruleConfig4.type) === CFRuleType.highlightCell) {
487
+ this._ensureAttr(this._ruleConfig, ["style"]);
488
+ this._ruleConfig.style.it = isItalic ? BooleanNumber.TRUE : BooleanNumber.FALSE;
489
+ }
490
+ return this;
491
+ }
492
+ /**
493
+ * Sets text strikethrough for the conditional format rule's format.
494
+ * @param {boolean} isStrikethrough - Whether is strikethrough the text.
495
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
496
+ * @example
497
+ * ```typescript
498
+ * const fWorkbook = univerAPI.getActiveWorkbook();
499
+ * const fWorksheet = fWorkbook.getActiveSheet();
500
+ *
501
+ * // Create a conditional formatting rule that set text strikethrough for cells with not empty content in the range A1:D10.
502
+ * const fRange = fWorksheet.getRange('A1:D10');
503
+ * const rule = fWorksheet.newConditionalFormattingRule()
504
+ * .whenCellNotEmpty()
505
+ * .setStrikethrough(true)
506
+ * .setRanges([fRange.getRange()])
507
+ * .build();
508
+ * fWorksheet.addConditionalFormattingRule(rule);
509
+ * ```
510
+ */
511
+ setStrikethrough(isStrikethrough) {
512
+ var _this$_ruleConfig5;
513
+ if (((_this$_ruleConfig5 = this._ruleConfig) === null || _this$_ruleConfig5 === void 0 ? void 0 : _this$_ruleConfig5.type) === CFRuleType.highlightCell) {
514
+ this._ensureAttr(this._ruleConfig, ["style", "st"]);
515
+ this._ruleConfig.style.st.s = isStrikethrough ? BooleanNumber.TRUE : BooleanNumber.FALSE;
516
+ }
517
+ return this;
518
+ }
519
+ /**
520
+ * Sets text underlining for the conditional format rule's format.
521
+ * @param {boolean} isUnderline - Whether to underline the text.
522
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
523
+ * @example
524
+ * ```typescript
525
+ * const fWorkbook = univerAPI.getActiveWorkbook();
526
+ * const fWorksheet = fWorkbook.getActiveSheet();
527
+ *
528
+ * // Create a conditional formatting rule that underlines the text for cells with not empty content in the range A1:D10.
529
+ * const fRange = fWorksheet.getRange('A1:D10');
530
+ * const rule = fWorksheet.newConditionalFormattingRule()
531
+ * .whenCellNotEmpty()
532
+ * .setUnderline(true)
533
+ * .setRanges([fRange.getRange()])
534
+ * .build();
535
+ * fWorksheet.addConditionalFormattingRule(rule);
536
+ * ```
537
+ */
538
+ setUnderline(isUnderline) {
539
+ var _this$_ruleConfig6;
540
+ if (((_this$_ruleConfig6 = this._ruleConfig) === null || _this$_ruleConfig6 === void 0 ? void 0 : _this$_ruleConfig6.type) === CFRuleType.highlightCell) {
541
+ this._ensureAttr(this._ruleConfig, ["style", "ul"]);
542
+ this._ruleConfig.style.ul.s = isUnderline ? BooleanNumber.TRUE : BooleanNumber.FALSE;
543
+ }
544
+ return this;
545
+ }
546
+ /**
547
+ * Sets the conditional format rule to trigger when the cell is empty.
548
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
549
+ * @example
550
+ * ```typescript
551
+ * const fWorkbook = univerAPI.getActiveWorkbook();
552
+ * const fWorksheet = fWorkbook.getActiveSheet();
553
+ *
554
+ * // Create a conditional formatting rule that highlights cells with no content in red for the range A1:D10.
555
+ * const fRange = fWorksheet.getRange('A1:D10');
556
+ * const rule = fWorksheet.newConditionalFormattingRule()
557
+ * .whenCellEmpty()
558
+ * .setBackground('#FF0000')
559
+ * .setRanges([fRange.getRange()])
560
+ * .build();
561
+ * fWorksheet.addConditionalFormattingRule(rule);
562
+ * ```
563
+ */
564
+ whenCellEmpty() {
565
+ const ruleConfig = this._ruleConfig;
566
+ ruleConfig.type = CFRuleType.highlightCell;
567
+ ruleConfig.subType = CFSubRuleType.text;
568
+ ruleConfig.value = "";
569
+ ruleConfig.operator = CFTextOperator.equal;
570
+ return this;
571
+ }
572
+ /**
573
+ * Sets the conditional format rule to trigger when the cell is not empty.
574
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
575
+ * @example
576
+ * ```typescript
577
+ * const fWorkbook = univerAPI.getActiveWorkbook();
578
+ * const fWorksheet = fWorkbook.getActiveSheet();
579
+ *
580
+ * // Create a conditional formatting rule that changes the font color to red for cells with not empty content in the range A1:D10.
581
+ * const fRange = fWorksheet.getRange('A1:D10');
582
+ * const rule = fWorksheet.newConditionalFormattingRule()
583
+ * .whenCellNotEmpty()
584
+ * .setFontColor('#FF0000')
585
+ * .setRanges([fRange.getRange()])
586
+ * .build();
587
+ * fWorksheet.addConditionalFormattingRule(rule);
588
+ * ```
589
+ */
590
+ whenCellNotEmpty() {
591
+ const ruleConfig = this._ruleConfig;
592
+ ruleConfig.type = CFRuleType.highlightCell;
593
+ ruleConfig.subType = CFSubRuleType.text;
594
+ ruleConfig.value = "";
595
+ ruleConfig.operator = CFTextOperator.notEqual;
596
+ return this;
597
+ }
598
+ /**
599
+ * Sets the conditional format rule to trigger when a time period is met.
600
+ * @param {CFTimePeriodOperator} date - The time period to check for.
601
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
602
+ * @example
603
+ * ```typescript
604
+ * const fWorkbook = univerAPI.getActiveWorkbook();
605
+ * const fWorksheet = fWorkbook.getActiveSheet();
606
+ *
607
+ * // Create a conditional formatting rule that highlights cells with dates in the last 7 days in red for the range A1:D10.
608
+ * const fRange = fWorksheet.getRange('A1:D10');
609
+ * const rule = fWorksheet.newConditionalFormattingRule()
610
+ * .whenDate(univerAPI.Enum.ConditionFormatTimePeriodOperatorEnum.last7Days)
611
+ * .setBackground('#FF0000')
612
+ * .setRanges([fRange.getRange()])
613
+ * .build();
614
+ * fWorksheet.addConditionalFormattingRule(rule);
615
+ * ```
616
+ */
617
+ whenDate(date) {
618
+ const ruleConfig = this._ruleConfig;
619
+ ruleConfig.type = CFRuleType.highlightCell;
620
+ ruleConfig.subType = CFSubRuleType.timePeriod;
621
+ ruleConfig.operator = date;
622
+ return this;
623
+ }
624
+ /**
625
+ * Sets the conditional format rule to trigger when that the given formula evaluates to `true`.
626
+ * @param {string} formulaString - A custom formula that evaluates to true if the input is valid. formulaString start with '='.
627
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
628
+ * @example
629
+ * ```typescript
630
+ * const fWorkbook = univerAPI.getActiveWorkbook();
631
+ * const fWorksheet = fWorkbook.getActiveSheet();
632
+ *
633
+ * // Create a conditional formatting rule that highlights cells with values greater than 10 in red for the range A1:D10.
634
+ * const fRange = fWorksheet.getRange('A1:D10');
635
+ * const rule = fWorksheet.newConditionalFormattingRule()
636
+ * .whenFormulaSatisfied('=A1>10')
637
+ * .setBackground('#FF0000')
638
+ * .setRanges([fRange.getRange()])
639
+ * .build();
640
+ * fWorksheet.addConditionalFormattingRule(rule);
641
+ * ```
642
+ */
643
+ whenFormulaSatisfied(formulaString) {
644
+ const ruleConfig = this._ruleConfig;
645
+ ruleConfig.type = CFRuleType.highlightCell;
646
+ ruleConfig.subType = CFSubRuleType.formula;
647
+ ruleConfig.value = formulaString;
648
+ return this;
649
+ }
650
+ /**
651
+ * Sets the conditional format rule to trigger when a number falls between, or is either of, two specified values.
652
+ * @param {number} start - The lowest acceptable value.
653
+ * @param {number} end - The highest acceptable value.
654
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
655
+ * @example
656
+ * ```typescript
657
+ * const fWorkbook = univerAPI.getActiveWorkbook();
658
+ * const fWorksheet = fWorkbook.getActiveSheet();
659
+ *
660
+ * // Create a conditional formatting rule that highlights cells with values between 10 and 20 in red for the range A1:D10.
661
+ * const fRange = fWorksheet.getRange('A1:D10');
662
+ * const rule = fWorksheet.newConditionalFormattingRule()
663
+ * .whenNumberBetween(10, 20)
664
+ * .setBackground('#FF0000')
665
+ * .setRanges([fRange.getRange()])
666
+ * .build();
667
+ * fWorksheet.addConditionalFormattingRule(rule);
668
+ * ```
669
+ */
670
+ whenNumberBetween(start, end) {
671
+ const min = Math.min(start, end);
672
+ const max = Math.max(start, end);
673
+ const ruleConfig = this._ruleConfig;
674
+ ruleConfig.type = CFRuleType.highlightCell;
675
+ ruleConfig.subType = CFSubRuleType.number;
676
+ ruleConfig.value = [min, max];
677
+ ruleConfig.operator = CFNumberOperator.between;
678
+ return this;
679
+ }
680
+ /**
681
+ * Sets the conditional format rule to trigger when a number is equal to the given value.
682
+ * @param {number} value - The sole acceptable value.
683
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
684
+ * @example
685
+ * ```typescript
686
+ * const fWorkbook = univerAPI.getActiveWorkbook();
687
+ * const fWorksheet = fWorkbook.getActiveSheet();
688
+ *
689
+ * // Create a conditional formatting rule that highlights cells with values equal to 10 in red for the range A1:D10.
690
+ * const fRange = fWorksheet.getRange('A1:D10');
691
+ * const rule = fWorksheet.newConditionalFormattingRule()
692
+ * .whenNumberEqualTo(10)
693
+ * .setBackground('#FF0000')
694
+ * .setRanges([fRange.getRange()])
695
+ * .build();
696
+ * fWorksheet.addConditionalFormattingRule(rule);
697
+ * ```
698
+ */
699
+ whenNumberEqualTo(value) {
700
+ const ruleConfig = this._ruleConfig;
701
+ ruleConfig.type = CFRuleType.highlightCell;
702
+ ruleConfig.subType = CFSubRuleType.number;
703
+ ruleConfig.value = value;
704
+ ruleConfig.operator = CFNumberOperator.equal;
705
+ return this;
706
+ }
707
+ /**
708
+ * Sets the conditional format rule to trigger when a number is greater than the given value.
709
+ * @param {number} value - The highest unacceptable value.
710
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
711
+ * @example
712
+ * ```typescript
713
+ * const fWorkbook = univerAPI.getActiveWorkbook();
714
+ * const fWorksheet = fWorkbook.getActiveSheet();
715
+ *
716
+ * // Create a conditional formatting rule that highlights cells with values greater than 10 in red for the range A1:D10.
717
+ * const fRange = fWorksheet.getRange('A1:D10');
718
+ * const rule = fWorksheet.newConditionalFormattingRule()
719
+ * .whenNumberGreaterThan(10)
720
+ * .setBackground('#FF0000')
721
+ * .setRanges([fRange.getRange()])
722
+ * .build();
723
+ * fWorksheet.addConditionalFormattingRule(rule);
724
+ * ```
725
+ */
726
+ whenNumberGreaterThan(value) {
727
+ const ruleConfig = this._ruleConfig;
728
+ ruleConfig.type = CFRuleType.highlightCell;
729
+ ruleConfig.subType = CFSubRuleType.number;
730
+ ruleConfig.value = value;
731
+ ruleConfig.operator = CFNumberOperator.greaterThan;
732
+ return this;
733
+ }
734
+ /**
735
+ * Sets the conditional format rule to trigger when a number is greater than or equal to the given value.
736
+ * @param {number} value - The lowest acceptable value.
737
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
738
+ * @example
739
+ * ```typescript
740
+ * const fWorkbook = univerAPI.getActiveWorkbook();
741
+ * const fWorksheet = fWorkbook.getActiveSheet();
742
+ *
743
+ * // Create a conditional formatting rule that highlights cells with values greater than or equal to 10 in red for the range A1:D10.
744
+ * const fRange = fWorksheet.getRange('A1:D10');
745
+ * const rule = fWorksheet.newConditionalFormattingRule()
746
+ * .whenNumberGreaterThanOrEqualTo(10)
747
+ * .setBackground('#FF0000')
748
+ * .setRanges([fRange.getRange()])
749
+ * .build();
750
+ * fWorksheet.addConditionalFormattingRule(rule);
751
+ * ```
752
+ */
753
+ whenNumberGreaterThanOrEqualTo(value) {
754
+ const ruleConfig = this._ruleConfig;
755
+ ruleConfig.type = CFRuleType.highlightCell;
756
+ ruleConfig.subType = CFSubRuleType.number;
757
+ ruleConfig.value = value;
758
+ ruleConfig.operator = CFNumberOperator.greaterThanOrEqual;
759
+ return this;
760
+ }
761
+ /**
762
+ * Sets the conditional conditional format rule to trigger when a number less than the given value.
763
+ * @param {number} value - The lowest unacceptable value.
764
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
765
+ * @example
766
+ * ```typescript
767
+ * const fWorkbook = univerAPI.getActiveWorkbook();
768
+ * const fWorksheet = fWorkbook.getActiveSheet();
769
+ *
770
+ * // Create a conditional formatting rule that highlights cells with values less than 10 in red for the range A1:D10.
771
+ * const fRange = fWorksheet.getRange('A1:D10');
772
+ * const rule = fWorksheet.newConditionalFormattingRule()
773
+ * .whenNumberLessThan(10)
774
+ * .setBackground('#FF0000')
775
+ * .setRanges([fRange.getRange()])
776
+ * .build();
777
+ * fWorksheet.addConditionalFormattingRule(rule);
778
+ * ```
779
+ */
780
+ whenNumberLessThan(value) {
781
+ const ruleConfig = this._ruleConfig;
782
+ ruleConfig.type = CFRuleType.highlightCell;
783
+ ruleConfig.subType = CFSubRuleType.number;
784
+ ruleConfig.value = value;
785
+ ruleConfig.operator = CFNumberOperator.lessThan;
786
+ return this;
787
+ }
788
+ /**
789
+ * Sets the conditional format rule to trigger when a number less than or equal to the given value.
790
+ * @param {number} value - The highest acceptable value.
791
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
792
+ * @example
793
+ * ```typescript
794
+ * const fWorkbook = univerAPI.getActiveWorkbook();
795
+ * const fWorksheet = fWorkbook.getActiveSheet();
796
+ *
797
+ * // Create a conditional formatting rule that highlights cells with values less than or equal to 10 in red for the range A1:D10.
798
+ * const fRange = fWorksheet.getRange('A1:D10');
799
+ * const rule = fWorksheet.newConditionalFormattingRule()
800
+ * .whenNumberLessThanOrEqualTo(10)
801
+ * .setBackground('#FF0000')
802
+ * .setRanges([fRange.getRange()])
803
+ * .build();
804
+ * fWorksheet.addConditionalFormattingRule(rule);
805
+ * ```
806
+ */
807
+ whenNumberLessThanOrEqualTo(value) {
808
+ const ruleConfig = this._ruleConfig;
809
+ ruleConfig.type = CFRuleType.highlightCell;
810
+ ruleConfig.subType = CFSubRuleType.number;
811
+ ruleConfig.value = value;
812
+ ruleConfig.operator = CFNumberOperator.lessThanOrEqual;
813
+ return this;
814
+ }
815
+ /**
816
+ * Sets the conditional format rule to trigger when a number does not fall between, and is neither of, two specified values.
817
+ * @param {number} start - The lowest unacceptable value.
818
+ * @param {number} end - The highest unacceptable value.
819
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
820
+ * @example
821
+ * ```typescript
822
+ * const fWorkbook = univerAPI.getActiveWorkbook();
823
+ * const fWorksheet = fWorkbook.getActiveSheet();
824
+ *
825
+ * // Create a conditional formatting rule that highlights cells with values not between 10 and 20 in red for the range A1:D10.
826
+ * const fRange = fWorksheet.getRange('A1:D10');
827
+ * const rule = fWorksheet.newConditionalFormattingRule()
828
+ * .whenNumberNotBetween(10, 20)
829
+ * .setBackground('#FF0000')
830
+ * .setRanges([fRange.getRange()])
831
+ * .build();
832
+ * fWorksheet.addConditionalFormattingRule(rule);
833
+ * ```
834
+ */
835
+ whenNumberNotBetween(start, end) {
836
+ const min = Math.min(start, end);
837
+ const max = Math.max(start, end);
838
+ const ruleConfig = this._ruleConfig;
839
+ ruleConfig.type = CFRuleType.highlightCell;
840
+ ruleConfig.subType = CFSubRuleType.number;
841
+ ruleConfig.value = [min, max];
842
+ ruleConfig.operator = CFNumberOperator.notBetween;
843
+ return this;
844
+ }
845
+ /**
846
+ * Sets the conditional format rule to trigger when a number is not equal to the given value.
847
+ * @param {number} value - The sole unacceptable value.
848
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
849
+ * @example
850
+ * ```typescript
851
+ * const fWorkbook = univerAPI.getActiveWorkbook();
852
+ * const fWorksheet = fWorkbook.getActiveSheet();
853
+ *
854
+ * // Create a conditional formatting rule that highlights cells with values not equal to 10 in red for the range A1:D10.
855
+ * const fRange = fWorksheet.getRange('A1:D10');
856
+ * const rule = fWorksheet.newConditionalFormattingRule()
857
+ * .whenNumberNotEqualTo(10)
858
+ * .setBackground('#FF0000')
859
+ * .setRanges([fRange.getRange()])
860
+ * .build();
861
+ * fWorksheet.addConditionalFormattingRule(rule);
862
+ * ```
863
+ */
864
+ whenNumberNotEqualTo(value) {
865
+ const ruleConfig = this._ruleConfig;
866
+ ruleConfig.type = CFRuleType.highlightCell;
867
+ ruleConfig.subType = CFSubRuleType.number;
868
+ ruleConfig.value = value;
869
+ ruleConfig.operator = CFNumberOperator.notEqual;
870
+ return this;
871
+ }
872
+ /**
873
+ * Sets the conditional format rule to trigger when that the input contains the given value.
874
+ * @param {string} text - The value that the input must contain.
875
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
876
+ * @example
877
+ * ```typescript
878
+ * const fWorkbook = univerAPI.getActiveWorkbook();
879
+ * const fWorksheet = fWorkbook.getActiveSheet();
880
+ *
881
+ * // Create a conditional formatting rule that highlights cells with text containing 'apple' in red for the range A1:D10.
882
+ * const fRange = fWorksheet.getRange('A1:D10');
883
+ * const rule = fWorksheet.newConditionalFormattingRule()
884
+ * .whenTextContains('apple')
885
+ * .setBackground('#FF0000')
886
+ * .setRanges([fRange.getRange()])
887
+ * .build();
888
+ * fWorksheet.addConditionalFormattingRule(rule);
889
+ * ```
890
+ */
891
+ whenTextContains(text) {
892
+ const ruleConfig = this._ruleConfig;
893
+ ruleConfig.type = CFRuleType.highlightCell;
894
+ ruleConfig.subType = CFSubRuleType.text;
895
+ ruleConfig.value = text;
896
+ ruleConfig.operator = CFTextOperator.containsText;
897
+ return this;
898
+ }
899
+ /**
900
+ * Sets the conditional format rule to trigger when that the input does not contain the given value.
901
+ * @param {string} text - The value that the input must not contain.
902
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
903
+ * @example
904
+ * ```typescript
905
+ * const fWorkbook = univerAPI.getActiveWorkbook();
906
+ * const fWorksheet = fWorkbook.getActiveSheet();
907
+ *
908
+ * // Create a conditional formatting rule that highlights cells with text not containing 'apple' in red for the range A1:D10.
909
+ * const fRange = fWorksheet.getRange('A1:D10');
910
+ * const rule = fWorksheet.newConditionalFormattingRule()
911
+ * .whenTextDoesNotContain('apple')
912
+ * .setBackground('#FF0000')
913
+ * .setRanges([fRange.getRange()])
914
+ * .build();
915
+ * fWorksheet.addConditionalFormattingRule(rule);
916
+ * ```
917
+ */
918
+ whenTextDoesNotContain(text) {
919
+ const ruleConfig = this._ruleConfig;
920
+ ruleConfig.type = CFRuleType.highlightCell;
921
+ ruleConfig.subType = CFSubRuleType.text;
922
+ ruleConfig.value = text;
923
+ ruleConfig.operator = CFTextOperator.notContainsText;
924
+ return this;
925
+ }
926
+ /**
927
+ * Sets the conditional format rule to trigger when that the input ends with the given value.
928
+ * @param {string} text - Text to compare against the end of the string.
929
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
930
+ * @example
931
+ * ```typescript
932
+ * const fWorkbook = univerAPI.getActiveWorkbook();
933
+ * const fWorksheet = fWorkbook.getActiveSheet();
934
+ *
935
+ * // Create a conditional formatting rule that highlights cells with text ending with '.ai' in red for the range A1:D10.
936
+ * const fRange = fWorksheet.getRange('A1:D10');
937
+ * const rule = fWorksheet.newConditionalFormattingRule()
938
+ * .whenTextEndsWith('.ai')
939
+ * .setBackground('#FF0000')
940
+ * .setRanges([fRange.getRange()])
941
+ * .build();
942
+ * fWorksheet.addConditionalFormattingRule(rule);
943
+ * ```
944
+ */
945
+ whenTextEndsWith(text) {
946
+ const ruleConfig = this._ruleConfig;
947
+ ruleConfig.type = CFRuleType.highlightCell;
948
+ ruleConfig.subType = CFSubRuleType.text;
949
+ ruleConfig.value = text;
950
+ ruleConfig.operator = CFTextOperator.endsWith;
951
+ return this;
952
+ }
953
+ /**
954
+ * Sets the conditional format rule to trigger when that the input is equal to the given value.
955
+ * @param {string} text - The sole acceptable value.
956
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
957
+ * @example
958
+ * ```typescript
959
+ * const fWorkbook = univerAPI.getActiveWorkbook();
960
+ * const fWorksheet = fWorkbook.getActiveSheet();
961
+ *
962
+ * // Create a conditional formatting rule that highlights cells with text equal to 'apple' in red for the range A1:D10.
963
+ * const fRange = fWorksheet.getRange('A1:D10');
964
+ * const rule = fWorksheet.newConditionalFormattingRule()
965
+ * .whenTextEqualTo('apple')
966
+ * .setBackground('#FF0000')
967
+ * .setRanges([fRange.getRange()])
968
+ * .build();
969
+ * fWorksheet.addConditionalFormattingRule(rule);
970
+ * ```
971
+ */
972
+ whenTextEqualTo(text) {
973
+ const ruleConfig = this._ruleConfig;
974
+ ruleConfig.type = CFRuleType.highlightCell;
975
+ ruleConfig.subType = CFSubRuleType.text;
976
+ ruleConfig.value = text;
977
+ ruleConfig.operator = CFTextOperator.equal;
978
+ return this;
979
+ }
980
+ /**
981
+ * Sets the conditional format rule to trigger when that the input starts with the given value.
982
+ * @param {string} text - Text to compare against the beginning of the string.
983
+ * @returns {ConditionalFormatHighlightRuleBuilder} This builder for chaining.
984
+ * @example
985
+ * ```typescript
986
+ * const fWorkbook = univerAPI.getActiveWorkbook();
987
+ * const fWorksheet = fWorkbook.getActiveSheet();
988
+ *
989
+ * // Create a conditional formatting rule that highlights cells with text starting with 'https://' in red for the range A1:D10.
990
+ * const fRange = fWorksheet.getRange('A1:D10');
991
+ * const rule = fWorksheet.newConditionalFormattingRule()
992
+ * .whenTextStartsWith('https://')
993
+ * .setBackground('#FF0000')
994
+ * .setRanges([fRange.getRange()])
995
+ * .build();
996
+ * fWorksheet.addConditionalFormattingRule(rule);
997
+ * ```
998
+ */
999
+ whenTextStartsWith(text) {
1000
+ const ruleConfig = this._ruleConfig;
1001
+ ruleConfig.type = CFRuleType.highlightCell;
1002
+ ruleConfig.subType = CFSubRuleType.text;
1003
+ ruleConfig.value = text;
1004
+ ruleConfig.operator = CFTextOperator.beginsWith;
1005
+ return this;
1006
+ }
1007
+ };
1008
+ var ConditionalFormatDataBarRuleBuilder = class ConditionalFormatDataBarRuleBuilder extends ConditionalFormatRuleBaseBuilder {
1009
+ /**
1010
+ * Deep clone a current builder.
1011
+ * @returns {ConditionalFormatDataBarRuleBuilder} A new instance of the builder with the same settings as the original.
1012
+ * @example
1013
+ * ```typescript
1014
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1015
+ * const fWorksheet = fWorkbook.getActiveSheet();
1016
+ *
1017
+ * // Create a conditional formatting rule that adds a data bar to cells with values between -100 and 100 in the range A1:D10.
1018
+ * // positive values are green and negative values are red.
1019
+ * const fRange = fWorksheet.getRange('A1:D10');
1020
+ * const builder = fWorksheet.newConditionalFormattingRule()
1021
+ * .setDataBar({
1022
+ * min: { type: 'num', value: -100 },
1023
+ * max: { type: 'num', value: 100 },
1024
+ * positiveColor: '#00FF00',
1025
+ * nativeColor: '#FF0000',
1026
+ * isShowValue: true
1027
+ * })
1028
+ * .setRanges([fRange.getRange()]);
1029
+ * fWorksheet.addConditionalFormattingRule(builder.build());
1030
+ *
1031
+ * // Copy the rule and apply it to a new range.
1032
+ * const newRange = fWorksheet.getRange('F1:F10');
1033
+ * const newBuilder = builder.copy()
1034
+ * .setRanges([newRange.getRange()]);
1035
+ * fWorksheet.addConditionalFormattingRule(newBuilder.build());
1036
+ * ```
1037
+ */
1038
+ copy() {
1039
+ const newRule = Tools.deepClone(this._rule);
1040
+ if (newRule.cfId) newRule.cfId = createCfId();
1041
+ return new ConditionalFormatDataBarRuleBuilder(newRule);
1042
+ }
1043
+ /**
1044
+ * Set data bar rule.
1045
+ * @param {{
1046
+ * min: IValueConfig;
1047
+ * max: IValueConfig;
1048
+ * isGradient?: boolean;
1049
+ * positiveColor: string;
1050
+ * nativeColor: string;
1051
+ * isShowValue?: boolean;
1052
+ * }} config - The data bar rule settings.
1053
+ * @param {IValueConfig} config.min - The minimum value for the data bar.
1054
+ * @param {IValueConfig} config.max - The maximum value for the data bar.
1055
+ * @param {boolean} [config.isGradient] - Whether the data bar is gradient.
1056
+ * @param {string} config.positiveColor - The color for positive values.
1057
+ * @param {string} config.nativeColor - The color for negative values.
1058
+ * @param {boolean} [config.isShowValue] - Whether to show the value in the cell.
1059
+ * @returns {ConditionalFormatDataBarRuleBuilder} This builder for chaining.
1060
+ * @example
1061
+ * ```typescript
1062
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1063
+ * const fWorksheet = fWorkbook.getActiveSheet();
1064
+ *
1065
+ * // Create a conditional formatting rule that adds a data bar to cells with values between -100 and 100 in the range A1:D10.
1066
+ * // positive values are green and negative values are red.
1067
+ * const fRange = fWorksheet.getRange('A1:D10');
1068
+ * const rule = fWorksheet.newConditionalFormattingRule()
1069
+ * .setDataBar({
1070
+ * min: { type: 'num', value: -100 },
1071
+ * max: { type: 'num', value: 100 },
1072
+ * positiveColor: '#00FF00',
1073
+ * nativeColor: '#FF0000',
1074
+ * isShowValue: true
1075
+ * })
1076
+ * .setRanges([fRange.getRange()])
1077
+ * .build();
1078
+ * fWorksheet.addConditionalFormattingRule(rule);
1079
+ * ```
1080
+ */
1081
+ setDataBar(config) {
1082
+ const ruleConfig = this._ruleConfig;
1083
+ ruleConfig.type = CFRuleType.dataBar;
1084
+ ruleConfig.isShowValue = !!config.isShowValue;
1085
+ ruleConfig.config = {
1086
+ min: config.min,
1087
+ max: config.max,
1088
+ positiveColor: config.positiveColor,
1089
+ nativeColor: config.nativeColor,
1090
+ isGradient: !!config.isGradient
1091
+ };
1092
+ return this;
1093
+ }
1094
+ };
1095
+ var ConditionalFormatColorScaleRuleBuilder = class ConditionalFormatColorScaleRuleBuilder extends ConditionalFormatRuleBaseBuilder {
1096
+ /**
1097
+ * Deep clone a current builder.
1098
+ * @returns {ConditionalFormatColorScaleRuleBuilder} A new instance of the builder with the same settings as the original.
1099
+ * @example
1100
+ * ```typescript
1101
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1102
+ * const fWorksheet = fWorkbook.getActiveSheet();
1103
+ *
1104
+ * // Create a conditional formatting rule that adds a color scale to cells with values between 0 and 100 in the range A1:D10.
1105
+ * // The color scale is green for 0, yellow for 50, and red for 100.
1106
+ * const fRange = fWorksheet.getRange('A1:D10');
1107
+ * const builder = fWorksheet.newConditionalFormattingRule()
1108
+ * .setColorScale([
1109
+ * { index: 0, color: '#00FF00', value: { type: 'num', value: 0 } },
1110
+ * { index: 1, color: '#FFFF00', value: { type: 'num', value: 50 } },
1111
+ * { index: 2, color: '#FF0000', value: { type: 'num', value: 100 } }
1112
+ * ])
1113
+ * .setRanges([fRange.getRange()]);
1114
+ * fWorksheet.addConditionalFormattingRule(builder.build());
1115
+ *
1116
+ * // Copy the rule and apply it to a new range.
1117
+ * const newRange = fWorksheet.getRange('F1:F10');
1118
+ * const newBuilder = builder.copy()
1119
+ * .setRanges([newRange.getRange()]);
1120
+ * fWorksheet.addConditionalFormattingRule(newBuilder.build());
1121
+ * ```
1122
+ */
1123
+ copy() {
1124
+ const newRule = Tools.deepClone(this._rule);
1125
+ if (newRule.cfId) newRule.cfId = createCfId();
1126
+ return new ConditionalFormatColorScaleRuleBuilder(newRule);
1127
+ }
1128
+ /**
1129
+ * Set color scale rule.
1130
+ * @param {{ index: number; color: string; value: IValueConfig }[]} config - The color scale rule settings.
1131
+ * @param {number} config.index - The index of the color scale configuration.
1132
+ * @param {string} config.color - The color corresponding to the index of the color scale configuration.
1133
+ * @param {IValueConfig} config.value - The condition value corresponding to the index of the color scale configuration.
1134
+ * @returns {ConditionalFormatColorScaleRuleBuilder} This builder for chaining.
1135
+ * @example
1136
+ * ```typescript
1137
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1138
+ * const fWorksheet = fWorkbook.getActiveSheet();
1139
+ *
1140
+ * // Create a conditional formatting rule that adds a color scale to cells with values between 0 and 100 in the range A1:D10.
1141
+ * // The color scale is green for 0, yellow for 50, and red for 100.
1142
+ * const fRange = fWorksheet.getRange('A1:D10');
1143
+ * const rule = fWorksheet.newConditionalFormattingRule()
1144
+ * .setColorScale([
1145
+ * { index: 0, color: '#00FF00', value: { type: 'num', value: 0 } },
1146
+ * { index: 1, color: '#FFFF00', value: { type: 'num', value: 50 } },
1147
+ * { index: 2, color: '#FF0000', value: { type: 'num', value: 100 } }
1148
+ * ])
1149
+ * .setRanges([fRange.getRange()])
1150
+ * .build();
1151
+ * fWorksheet.addConditionalFormattingRule(rule);
1152
+ * ```
1153
+ */
1154
+ setColorScale(config) {
1155
+ const ruleConfig = this._ruleConfig;
1156
+ ruleConfig.type = CFRuleType.colorScale;
1157
+ ruleConfig.config = config;
1158
+ return this;
1159
+ }
1160
+ };
1161
+ var ConditionalFormatIconSetRuleBuilder = class ConditionalFormatIconSetRuleBuilder extends ConditionalFormatRuleBaseBuilder {
1162
+ /**
1163
+ * Deep clone a current builder.
1164
+ * @returns {ConditionalFormatIconSetRuleBuilder} A new instance of the builder with the same settings as the original.
1165
+ * @example
1166
+ * ```typescript
1167
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1168
+ * const fWorksheet = fWorkbook.getActiveSheet();
1169
+ *
1170
+ * // Create a 3-arrow icon set conditional formatting rule in the range A1:D10.
1171
+ * // The first arrow is green for values greater than 20.
1172
+ * // The second arrow is yellow for values greater than 10.
1173
+ * // The third arrow is red for values less than or equal to 10.
1174
+ * const fRange = fWorksheet.getRange('A1:D10');
1175
+ * const builder = fWorksheet.newConditionalFormattingRule()
1176
+ * .setIconSet({
1177
+ * iconConfigs: [
1178
+ * { iconType: '3Arrows', iconId: '0', operator: univerAPI.Enum.ConditionFormatNumberOperatorEnum.greaterThan, value: { type: 'num', value: 20 } },
1179
+ * { iconType: '3Arrows', iconId: '1', operator: univerAPI.Enum.ConditionFormatNumberOperatorEnum.greaterThan, value: { type: 'num', value: 10 } },
1180
+ * { iconType: '3Arrows', iconId: '2', operator: univerAPI.Enum.ConditionFormatNumberOperatorEnum.lessThanOrEqual, value: { type: 'num', value: 10 } }
1181
+ * ],
1182
+ * isShowValue: true,
1183
+ * })
1184
+ * .setRanges([fRange.getRange()]);
1185
+ * fWorksheet.addConditionalFormattingRule(builder.build());
1186
+ *
1187
+ * // Copy the rule and apply it to a new range.
1188
+ * const newRange = fWorksheet.getRange('F1:F10');
1189
+ * const newBuilder = builder.copy()
1190
+ * .setRanges([newRange.getRange()]);
1191
+ * fWorksheet.addConditionalFormattingRule(newBuilder.build());
1192
+ * ```
1193
+ */
1194
+ copy() {
1195
+ const newRule = Tools.deepClone(this._rule);
1196
+ if (newRule.cfId) newRule.cfId = createCfId();
1197
+ return new ConditionalFormatIconSetRuleBuilder(newRule);
1198
+ }
1199
+ /**
1200
+ * Set up icon set conditional formatting rule.
1201
+ * @param {{ iconConfigs: IIconSet['config'], isShowValue: boolean }} config - The icon set conditional formatting rule settings.
1202
+ * @param {IIconSet['config']} config.iconConfigs - The icon configurations. iconId property is a string indexing of a group icons.
1203
+ * @param {boolean} config.isShowValue - Whether to show the value in the cell.
1204
+ * @returns {ConditionalFormatIconSetRuleBuilder} This builder for chaining.
1205
+ * @example
1206
+ * ```typescript
1207
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1208
+ * const fWorksheet = fWorkbook.getActiveSheet();
1209
+ *
1210
+ * // Create a 3-arrow icon set conditional formatting rule in the range A1:D10.
1211
+ * // The first arrow is green for values greater than 20.
1212
+ * // The second arrow is yellow for values greater than 10.
1213
+ * // The third arrow is red for values less than or equal to 10.
1214
+ * const fRange = fWorksheet.getRange('A1:D10');
1215
+ * const builder = fWorksheet.newConditionalFormattingRule();
1216
+ * console.log(builder.getIconMap()); // icons key-value map
1217
+ * const rule = builder.setIconSet({
1218
+ * iconConfigs: [
1219
+ * { iconType: '3Arrows', iconId: '0', operator: univerAPI.Enum.ConditionFormatNumberOperatorEnum.greaterThan, value: { type: 'num', value: 20 } },
1220
+ * { iconType: '3Arrows', iconId: '1', operator: univerAPI.Enum.ConditionFormatNumberOperatorEnum.greaterThan, value: { type: 'num', value: 10 } },
1221
+ * { iconType: '3Arrows', iconId: '2', operator: univerAPI.Enum.ConditionFormatNumberOperatorEnum.lessThanOrEqual, value: { type: 'num', value: 10 } }
1222
+ * ],
1223
+ * isShowValue: true,
1224
+ * })
1225
+ * .setRanges([fRange.getRange()])
1226
+ * .build();
1227
+ * fWorksheet.addConditionalFormattingRule(rule);
1228
+ * ```
1229
+ */
1230
+ setIconSet(config) {
1231
+ const ruleConfig = this._ruleConfig;
1232
+ ruleConfig.type = CFRuleType.iconSet;
1233
+ ruleConfig.config = config.iconConfigs;
1234
+ ruleConfig.isShowValue = config.isShowValue;
1235
+ return this;
1236
+ }
1237
+ };
1238
+ /**
1239
+ * @hideconstructor
1240
+ */
1241
+ var FConditionalFormattingBuilder = class {
1242
+ constructor(_initConfig = {}) {
1243
+ this._initConfig = _initConfig;
1244
+ }
1245
+ /**
1246
+ * Constructs a conditional format rule from the settings applied to the builder.
1247
+ * @returns {IConditionFormattingRule} The conditional format rule.
1248
+ * @example
1249
+ * ```typescript
1250
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1251
+ * const fWorksheet = fWorkbook.getActiveSheet();
1252
+ *
1253
+ * // Create a conditional formatting rule that highlights cells with values greater than 10 in red for the range A1:D10.
1254
+ * const fRange = fWorksheet.getRange('A1:D10');
1255
+ * const rule = fWorksheet.newConditionalFormattingRule()
1256
+ * .whenNumberGreaterThan(10)
1257
+ * .setBackground('#FF0000')
1258
+ * .setRanges([fRange.getRange()])
1259
+ * .build();
1260
+ * fWorksheet.addConditionalFormattingRule(rule);
1261
+ * ```
1262
+ */
1263
+ build() {
1264
+ return new ConditionalFormatRuleBaseBuilder(this._initConfig).build();
1265
+ }
1266
+ /**
1267
+ * Set average rule.
1268
+ * @param {IAverageHighlightCell['operator']} operator - The operator to use for the average rule.
1269
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1270
+ * @example
1271
+ * ```typescript
1272
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1273
+ * const fWorksheet = fWorkbook.getActiveSheet();
1274
+ *
1275
+ * // Create a conditional formatting rule that highlights cells with greater than average values in red for the range A1:D10.
1276
+ * const fRange = fWorksheet.getRange('A1:D10');
1277
+ * const rule = fWorksheet.newConditionalFormattingRule()
1278
+ * .setAverage(univerAPI.Enum.ConditionFormatNumberOperatorEnum.greaterThan)
1279
+ * .setBackground('#FF0000')
1280
+ * .setRanges([fRange.getRange()])
1281
+ * .build();
1282
+ * fWorksheet.addConditionalFormattingRule(rule);
1283
+ * ```
1284
+ */
1285
+ setAverage(operator) {
1286
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).setAverage(operator);
1287
+ }
1288
+ /**
1289
+ * Set unique values rule.
1290
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1291
+ * @example
1292
+ * ```typescript
1293
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1294
+ * const fWorksheet = fWorkbook.getActiveSheet();
1295
+ *
1296
+ * // Create a conditional formatting rule that highlights cells with unique values in red for the range A1:D10.
1297
+ * const fRange = fWorksheet.getRange('A1:D10');
1298
+ * const rule = fWorksheet.newConditionalFormattingRule()
1299
+ * .setUniqueValues()
1300
+ * .setBackground('#FF0000')
1301
+ * .setRanges([fRange.getRange()])
1302
+ * .build();
1303
+ * fWorksheet.addConditionalFormattingRule(rule);
1304
+ * ```
1305
+ */
1306
+ setUniqueValues() {
1307
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).setUniqueValues();
1308
+ }
1309
+ /**
1310
+ * Set duplicate values rule.
1311
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1312
+ * @example
1313
+ * ```typescript
1314
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1315
+ * const fWorksheet = fWorkbook.getActiveSheet();
1316
+ *
1317
+ * // Create a conditional formatting rule that highlights cells with duplicate values in red for the range A1:D10.
1318
+ * const fRange = fWorksheet.getRange('A1:D10');
1319
+ * const rule = fWorksheet.newConditionalFormattingRule()
1320
+ * .setDuplicateValues()
1321
+ * .setBackground('#FF0000')
1322
+ * .setRanges([fRange.getRange()])
1323
+ * .build();
1324
+ * fWorksheet.addConditionalFormattingRule(rule);
1325
+ * ```
1326
+ */
1327
+ setDuplicateValues() {
1328
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).setDuplicateValues();
1329
+ }
1330
+ /**
1331
+ * Set rank rule.
1332
+ * @param {{ isBottom: boolean, isPercent: boolean, value: number }} config - The rank rule settings.
1333
+ * @param {boolean} config.isBottom - Whether to highlight the bottom rank.
1334
+ * @param {boolean} config.isPercent - Whether to use a percentage rank.
1335
+ * @param {number} config.value - The rank value.
1336
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1337
+ * @example
1338
+ * ```typescript
1339
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1340
+ * const fWorksheet = fWorkbook.getActiveSheet();
1341
+ *
1342
+ * // Create a conditional formatting rule that highlights the bottom 10% of values in red for the range A1:D10.
1343
+ * const fRange = fWorksheet.getRange('A1:D10');
1344
+ * const rule = fWorksheet.newConditionalFormattingRule()
1345
+ * .setRank({ isBottom: true, isPercent: true, value: 10 })
1346
+ * .setBackground('#FF0000')
1347
+ * .setRanges([fRange.getRange()])
1348
+ * .build();
1349
+ * fWorksheet.addConditionalFormattingRule(rule);
1350
+ * ```
1351
+ */
1352
+ setRank(config) {
1353
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).setRank(config);
1354
+ }
1355
+ /**
1356
+ * Get the icon set mapping dictionary.
1357
+ * @returns {Record<string, string[]>} The icon set mapping dictionary.
1358
+ * @example
1359
+ * ```typescript
1360
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1361
+ * const fWorksheet = fWorkbook.getActiveSheet();
1362
+ * console.log(fWorksheet.newConditionalFormattingRule().getIconMap()); // icons key-value map
1363
+ * ```
1364
+ */
1365
+ getIconMap() {
1366
+ return iconMap;
1367
+ }
1368
+ /**
1369
+ * Set up icon set conditional formatting rule.
1370
+ * @param {{ iconConfigs: IIconSet['config'], isShowValue: boolean }} config - The icon set conditional formatting rule settings.
1371
+ * @param {IIconSet['config']} config.iconConfigs - The icon configurations. iconId property is a string indexing of a group icons.
1372
+ * @param {boolean} config.isShowValue - Whether to show the value in the cell.
1373
+ * @returns {ConditionalFormatIconSetRuleBuilder} The conditional format icon set rule builder.
1374
+ * @example
1375
+ * ```typescript
1376
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1377
+ * const fWorksheet = fWorkbook.getActiveSheet();
1378
+ *
1379
+ * // Create a 3-arrow icon set conditional formatting rule in the range A1:D10.
1380
+ * // The first arrow is green for values greater than 20.
1381
+ * // The second arrow is yellow for values greater than 10.
1382
+ * // The third arrow is red for values less than or equal to 10.
1383
+ * const fRange = fWorksheet.getRange('A1:D10');
1384
+ * const builder = fWorksheet.newConditionalFormattingRule();
1385
+ * console.log(builder.getIconMap()); // icons key-value map
1386
+ * const rule = builder.setIconSet({
1387
+ * iconConfigs: [
1388
+ * { iconType: '3Arrows', iconId: '0', operator: univerAPI.Enum.ConditionFormatNumberOperatorEnum.greaterThan, value: { type: 'num', value: 20 } },
1389
+ * { iconType: '3Arrows', iconId: '1', operator: univerAPI.Enum.ConditionFormatNumberOperatorEnum.greaterThan, value: { type: 'num', value: 10 } },
1390
+ * { iconType: '3Arrows', iconId: '2', operator: univerAPI.Enum.ConditionFormatNumberOperatorEnum.lessThanOrEqual, value: { type: 'num', value: 10 } }
1391
+ * ],
1392
+ * isShowValue: true,
1393
+ * })
1394
+ * .setRanges([fRange.getRange()])
1395
+ * .build();
1396
+ * fWorksheet.addConditionalFormattingRule(rule);
1397
+ * ```
1398
+ */
1399
+ setIconSet(config) {
1400
+ return new ConditionalFormatIconSetRuleBuilder(this._initConfig).setIconSet(config);
1401
+ }
1402
+ /**
1403
+ * Set color scale rule.
1404
+ * @param {{ index: number; color: string; value: IValueConfig }[]} config - The color scale rule settings.
1405
+ * @param {number} config.index - The index of the color scale.
1406
+ * @param {string} config.color - The color for the color scale.
1407
+ * @param {IValueConfig} config.value - The value for the color scale.
1408
+ * @returns {ConditionalFormatColorScaleRuleBuilder} The conditional format color scale rule builder.
1409
+ * @example
1410
+ * ```typescript
1411
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1412
+ * const fWorksheet = fWorkbook.getActiveSheet();
1413
+ *
1414
+ * // Create a conditional formatting rule that adds a color scale to cells with values between 0 and 100 in the range A1:D10.
1415
+ * // The color scale is green for 0, yellow for 50, and red for 100.
1416
+ * const fRange = fWorksheet.getRange('A1:D10');
1417
+ * const rule = fWorksheet.newConditionalFormattingRule()
1418
+ * .setColorScale([
1419
+ * { index: 0, color: '#00FF00', value: { type: 'num', value: 0 } },
1420
+ * { index: 1, color: '#FFFF00', value: { type: 'num', value: 50 } },
1421
+ * { index: 2, color: '#FF0000', value: { type: 'num', value: 100 } }
1422
+ * ])
1423
+ * .setRanges([fRange.getRange()])
1424
+ * .build();
1425
+ * fWorksheet.addConditionalFormattingRule(rule);
1426
+ * ```
1427
+ */
1428
+ setColorScale(config) {
1429
+ return new ConditionalFormatColorScaleRuleBuilder(this._initConfig).setColorScale(config);
1430
+ }
1431
+ /**
1432
+ * Set data bar rule.
1433
+ * @param {{
1434
+ * min: IValueConfig;
1435
+ * max: IValueConfig;
1436
+ * isGradient?: boolean;
1437
+ * positiveColor: string;
1438
+ * nativeColor: string;
1439
+ * isShowValue?: boolean;
1440
+ * }} config - The data bar rule settings.
1441
+ * @param {IValueConfig} config.min - The minimum value for the data bar.
1442
+ * @param {IValueConfig} config.max - The maximum value for the data bar.
1443
+ * @param {boolean} [config.isGradient] - Whether the data bar is gradient.
1444
+ * @param {string} config.positiveColor - The color for positive values.
1445
+ * @param {string} config.nativeColor - The color for negative values.
1446
+ * @param {boolean} [config.isShowValue] - Whether to show the value in the cell.
1447
+ * @returns {ConditionalFormatDataBarRuleBuilder} The conditional format data bar rule builder.
1448
+ * @example
1449
+ * ```typescript
1450
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1451
+ * const fWorksheet = fWorkbook.getActiveSheet();
1452
+ *
1453
+ * // Create a conditional formatting rule that adds a data bar to cells with values between -100 and 100 in the range A1:D10.
1454
+ * // positive values are green and negative values are red.
1455
+ * const fRange = fWorksheet.getRange('A1:D10');
1456
+ * const rule = fWorksheet.newConditionalFormattingRule()
1457
+ * .setDataBar({
1458
+ * min: { type: 'num', value: -100 },
1459
+ * max: { type: 'num', value: 100 },
1460
+ * positiveColor: '#00FF00',
1461
+ * nativeColor: '#FF0000',
1462
+ * isShowValue: true
1463
+ * })
1464
+ * .setRanges([fRange.getRange()])
1465
+ * .build();
1466
+ * fWorksheet.addConditionalFormattingRule(rule);
1467
+ * ```
1468
+ */
1469
+ setDataBar(config) {
1470
+ return new ConditionalFormatDataBarRuleBuilder(this._initConfig).setDataBar(config);
1471
+ }
1472
+ /**
1473
+ * Sets the background color for the conditional format rule's format.
1474
+ * @param {string} [color] - The background color to set. If not provided, the background color is removed.
1475
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1476
+ * @example
1477
+ * ```typescript
1478
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1479
+ * const fWorksheet = fWorkbook.getActiveSheet();
1480
+ *
1481
+ * // Create a conditional formatting rule that highlights cells with no content in red for the range A1:D10.
1482
+ * const fRange = fWorksheet.getRange('A1:D10');
1483
+ * const rule = fWorksheet.newConditionalFormattingRule()
1484
+ * .whenCellEmpty()
1485
+ * .setBackground('#FF0000')
1486
+ * .setRanges([fRange.getRange()])
1487
+ * .build();
1488
+ * fWorksheet.addConditionalFormattingRule(rule);
1489
+ * ```
1490
+ */
1491
+ setBackground(color) {
1492
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).setBackground(color);
1493
+ }
1494
+ /**
1495
+ * Sets text bolding for the conditional format rule's format.
1496
+ * @param {boolean} isBold - Whether to bold the text.
1497
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1498
+ * @example
1499
+ * ```typescript
1500
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1501
+ * const fWorksheet = fWorkbook.getActiveSheet();
1502
+ *
1503
+ * // Create a conditional formatting rule that bolds the text for cells with not empty content in the range A1:D10.
1504
+ * const fRange = fWorksheet.getRange('A1:D10');
1505
+ * const rule = fWorksheet.newConditionalFormattingRule()
1506
+ * .whenCellNotEmpty()
1507
+ * .setBold(true)
1508
+ * .setRanges([fRange.getRange()])
1509
+ * .build();
1510
+ * fWorksheet.addConditionalFormattingRule(rule);
1511
+ * ```
1512
+ */
1513
+ setBold(isBold) {
1514
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).setBold(isBold);
1515
+ }
1516
+ /**
1517
+ * Sets the font color for the conditional format rule's format.
1518
+ * @param {string} [color] - The font color to set. If not provided, the font color is removed.
1519
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1520
+ * @example
1521
+ * ```typescript
1522
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1523
+ * const fWorksheet = fWorkbook.getActiveSheet();
1524
+ *
1525
+ * // Create a conditional formatting rule that changes the font color to red for cells with not empty content in the range A1:D10.
1526
+ * const fRange = fWorksheet.getRange('A1:D10');
1527
+ * const rule = fWorksheet.newConditionalFormattingRule()
1528
+ * .whenCellNotEmpty()
1529
+ * .setFontColor('#FF0000')
1530
+ * .setRanges([fRange.getRange()])
1531
+ * .build();
1532
+ * fWorksheet.addConditionalFormattingRule(rule);
1533
+ * ```
1534
+ */
1535
+ setFontColor(color) {
1536
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).setFontColor(color);
1537
+ }
1538
+ /**
1539
+ * Sets text italics for the conditional format rule's format.
1540
+ * @param {boolean} isItalic - Whether to italicize the text.
1541
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1542
+ * @example
1543
+ * ```typescript
1544
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1545
+ * const fWorksheet = fWorkbook.getActiveSheet();
1546
+ *
1547
+ * // Create a conditional formatting rule that italicizes the text for cells with not empty content in the range A1:D10.
1548
+ * const fRange = fWorksheet.getRange('A1:D10');
1549
+ * const rule = fWorksheet.newConditionalFormattingRule()
1550
+ * .whenCellNotEmpty()
1551
+ * .setItalic(true)
1552
+ * .setRanges([fRange.getRange()])
1553
+ * .build();
1554
+ * fWorksheet.addConditionalFormattingRule(rule);
1555
+ * ```
1556
+ */
1557
+ setItalic(isItalic) {
1558
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).setItalic(isItalic);
1559
+ }
1560
+ /**
1561
+ * Sets text strikethrough for the conditional format rule's format.
1562
+ * @param {boolean} isStrikethrough - Whether is strikethrough the text.
1563
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1564
+ * @example
1565
+ * ```typescript
1566
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1567
+ * const fWorksheet = fWorkbook.getActiveSheet();
1568
+ *
1569
+ * // Create a conditional formatting rule that set text strikethrough for cells with not empty content in the range A1:D10.
1570
+ * const fRange = fWorksheet.getRange('A1:D10');
1571
+ * const rule = fWorksheet.newConditionalFormattingRule()
1572
+ * .whenCellNotEmpty()
1573
+ * .setStrikethrough(true)
1574
+ * .setRanges([fRange.getRange()])
1575
+ * .build();
1576
+ * fWorksheet.addConditionalFormattingRule(rule);
1577
+ * ```
1578
+ */
1579
+ setStrikethrough(isStrikethrough) {
1580
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).setStrikethrough(isStrikethrough);
1581
+ }
1582
+ /**
1583
+ * Sets text underlining for the conditional format rule's format.
1584
+ * @param {boolean} isUnderline - Whether to underline the text.
1585
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1586
+ * @example
1587
+ * ```typescript
1588
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1589
+ * const fWorksheet = fWorkbook.getActiveSheet();
1590
+ *
1591
+ * // Create a conditional formatting rule that underlines the text for cells with not empty content in the range A1:D10.
1592
+ * const fRange = fWorksheet.getRange('A1:D10');
1593
+ * const rule = fWorksheet.newConditionalFormattingRule()
1594
+ * .whenCellNotEmpty()
1595
+ * .setUnderline(true)
1596
+ * .setRanges([fRange.getRange()])
1597
+ * .build();
1598
+ * fWorksheet.addConditionalFormattingRule(rule);
1599
+ * ```
1600
+ */
1601
+ setUnderline(isUnderline) {
1602
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).setUnderline(isUnderline);
1603
+ }
1604
+ /**
1605
+ * Sets the conditional format rule to trigger when the cell is empty.
1606
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1607
+ * @example
1608
+ * ```typescript
1609
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1610
+ * const fWorksheet = fWorkbook.getActiveSheet();
1611
+ *
1612
+ * // Create a conditional formatting rule that highlights cells with no content in red for the range A1:D10.
1613
+ * const fRange = fWorksheet.getRange('A1:D10');
1614
+ * const rule = fWorksheet.newConditionalFormattingRule()
1615
+ * .whenCellEmpty()
1616
+ * .setBackground('#FF0000')
1617
+ * .setRanges([fRange.getRange()])
1618
+ * .build();
1619
+ * fWorksheet.addConditionalFormattingRule(rule);
1620
+ * ```
1621
+ */
1622
+ whenCellEmpty() {
1623
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).whenCellEmpty();
1624
+ }
1625
+ /**
1626
+ * Sets the conditional format rule to trigger when the cell is not empty.
1627
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1628
+ * @example
1629
+ * ```typescript
1630
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1631
+ * const fWorksheet = fWorkbook.getActiveSheet();
1632
+ *
1633
+ * // Create a conditional formatting rule that changes the font color to red for cells with not empty content in the range A1:D10.
1634
+ * const fRange = fWorksheet.getRange('A1:D10');
1635
+ * const rule = fWorksheet.newConditionalFormattingRule()
1636
+ * .whenCellNotEmpty()
1637
+ * .setFontColor('#FF0000')
1638
+ * .setRanges([fRange.getRange()])
1639
+ * .build();
1640
+ * fWorksheet.addConditionalFormattingRule(rule);
1641
+ * ```
1642
+ */
1643
+ whenCellNotEmpty() {
1644
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).whenCellNotEmpty();
1645
+ }
1646
+ /**
1647
+ * Sets the conditional format rule to trigger when a time period is met.
1648
+ * @param {CFTimePeriodOperator} date - The time period to check for.
1649
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1650
+ * @example
1651
+ * ```typescript
1652
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1653
+ * const fWorksheet = fWorkbook.getActiveSheet();
1654
+ *
1655
+ * // Create a conditional formatting rule that highlights cells with dates in the last 7 days in red for the range A1:D10.
1656
+ * const fRange = fWorksheet.getRange('A1:D10');
1657
+ * const rule = fWorksheet.newConditionalFormattingRule()
1658
+ * .whenDate(univerAPI.Enum.ConditionFormatTimePeriodOperatorEnum.last7Days)
1659
+ * .setBackground('#FF0000')
1660
+ * .setRanges([fRange.getRange()])
1661
+ * .build();
1662
+ * fWorksheet.addConditionalFormattingRule(rule);
1663
+ * ```
1664
+ */
1665
+ whenDate(date) {
1666
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).whenDate(date);
1667
+ }
1668
+ /**
1669
+ * Sets the conditional format rule to trigger when that the given formula evaluates to `true`.
1670
+ * @param {string} formulaString - A custom formula that evaluates to true if the input is valid. formulaString start with '='.
1671
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1672
+ * @example
1673
+ * ```typescript
1674
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1675
+ * const fWorksheet = fWorkbook.getActiveSheet();
1676
+ *
1677
+ * // Create a conditional formatting rule that highlights cells with values greater than 10 in red for the range A1:D10.
1678
+ * const fRange = fWorksheet.getRange('A1:D10');
1679
+ * const rule = fWorksheet.newConditionalFormattingRule()
1680
+ * .whenFormulaSatisfied('=A1>10')
1681
+ * .setBackground('#FF0000')
1682
+ * .setRanges([fRange.getRange()])
1683
+ * .build();
1684
+ * fWorksheet.addConditionalFormattingRule(rule);
1685
+ * ```
1686
+ */
1687
+ whenFormulaSatisfied(formulaString) {
1688
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).whenFormulaSatisfied(formulaString);
1689
+ }
1690
+ /**
1691
+ * Sets the conditional format rule to trigger when a number falls between, or is either of, two specified values.
1692
+ * @param {number} start - The lowest acceptable value.
1693
+ * @param {number} end - The highest acceptable value.
1694
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1695
+ * @example
1696
+ * ```typescript
1697
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1698
+ * const fWorksheet = fWorkbook.getActiveSheet();
1699
+ *
1700
+ * // Create a conditional formatting rule that highlights cells with values between 10 and 20 in red for the range A1:D10.
1701
+ * const fRange = fWorksheet.getRange('A1:D10');
1702
+ * const rule = fWorksheet.newConditionalFormattingRule()
1703
+ * .whenNumberBetween(10, 20)
1704
+ * .setBackground('#FF0000')
1705
+ * .setRanges([fRange.getRange()])
1706
+ * .build();
1707
+ * fWorksheet.addConditionalFormattingRule(rule);
1708
+ * ```
1709
+ */
1710
+ whenNumberBetween(start, end) {
1711
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).whenNumberBetween(start, end);
1712
+ }
1713
+ /**
1714
+ * Sets the conditional format rule to trigger when a number is equal to the given value.
1715
+ * @param {number} value - The sole acceptable value.
1716
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1717
+ * @example
1718
+ * ```typescript
1719
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1720
+ * const fWorksheet = fWorkbook.getActiveSheet();
1721
+ *
1722
+ * // Create a conditional formatting rule that highlights cells with values equal to 10 in red for the range A1:D10.
1723
+ * const fRange = fWorksheet.getRange('A1:D10');
1724
+ * const rule = fWorksheet.newConditionalFormattingRule()
1725
+ * .whenNumberEqualTo(10)
1726
+ * .setBackground('#FF0000')
1727
+ * .setRanges([fRange.getRange()])
1728
+ * .build();
1729
+ * fWorksheet.addConditionalFormattingRule(rule);
1730
+ * ```
1731
+ */
1732
+ whenNumberEqualTo(value) {
1733
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).whenNumberEqualTo(value);
1734
+ }
1735
+ /**
1736
+ * Sets the conditional format rule to trigger when a number is greater than the given value.
1737
+ * @param {number} value - The highest unacceptable value.
1738
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1739
+ * @example
1740
+ * ```typescript
1741
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1742
+ * const fWorksheet = fWorkbook.getActiveSheet();
1743
+ *
1744
+ * // Create a conditional formatting rule that highlights cells with values greater than 10 in red for the range A1:D10.
1745
+ * const fRange = fWorksheet.getRange('A1:D10');
1746
+ * const rule = fWorksheet.newConditionalFormattingRule()
1747
+ * .whenNumberGreaterThan(10)
1748
+ * .setBackground('#FF0000')
1749
+ * .setRanges([fRange.getRange()])
1750
+ * .build();
1751
+ * fWorksheet.addConditionalFormattingRule(rule);
1752
+ * ```
1753
+ */
1754
+ whenNumberGreaterThan(value) {
1755
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).whenNumberGreaterThan(value);
1756
+ }
1757
+ /**
1758
+ * Sets the conditional format rule to trigger when a number is greater than or equal to the given value.
1759
+ * @param {number} value - The lowest acceptable value.
1760
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1761
+ * @example
1762
+ * ```typescript
1763
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1764
+ * const fWorksheet = fWorkbook.getActiveSheet();
1765
+ *
1766
+ * // Create a conditional formatting rule that highlights cells with values greater than or equal to 10 in red for the range A1:D10.
1767
+ * const fRange = fWorksheet.getRange('A1:D10');
1768
+ * const rule = fWorksheet.newConditionalFormattingRule()
1769
+ * .whenNumberGreaterThanOrEqualTo(10)
1770
+ * .setBackground('#FF0000')
1771
+ * .setRanges([fRange.getRange()])
1772
+ * .build();
1773
+ * fWorksheet.addConditionalFormattingRule(rule);
1774
+ * ```
1775
+ */
1776
+ whenNumberGreaterThanOrEqualTo(value) {
1777
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).whenNumberGreaterThanOrEqualTo(value);
1778
+ }
1779
+ /**
1780
+ * Sets the conditional conditional format rule to trigger when a number less than the given value.
1781
+ * @param {number} value - The lowest unacceptable value.
1782
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1783
+ * @example
1784
+ * ```typescript
1785
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1786
+ * const fWorksheet = fWorkbook.getActiveSheet();
1787
+ *
1788
+ * // Create a conditional formatting rule that highlights cells with values less than 10 in red for the range A1:D10.
1789
+ * const fRange = fWorksheet.getRange('A1:D10');
1790
+ * const rule = fWorksheet.newConditionalFormattingRule()
1791
+ * .whenNumberLessThan(10)
1792
+ * .setBackground('#FF0000')
1793
+ * .setRanges([fRange.getRange()])
1794
+ * .build();
1795
+ * fWorksheet.addConditionalFormattingRule(rule);
1796
+ * ```
1797
+ */
1798
+ whenNumberLessThan(value) {
1799
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).whenNumberLessThan(value);
1800
+ }
1801
+ /**
1802
+ * Sets the conditional format rule to trigger when a number less than or equal to the given value.
1803
+ * @param {number} value - The highest acceptable value.
1804
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1805
+ * @example
1806
+ * ```typescript
1807
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1808
+ * const fWorksheet = fWorkbook.getActiveSheet();
1809
+ *
1810
+ * // Create a conditional formatting rule that highlights cells with values less than or equal to 10 in red for the range A1:D10.
1811
+ * const fRange = fWorksheet.getRange('A1:D10');
1812
+ * const rule = fWorksheet.newConditionalFormattingRule()
1813
+ * .whenNumberLessThanOrEqualTo(10)
1814
+ * .setBackground('#FF0000')
1815
+ * .setRanges([fRange.getRange()])
1816
+ * .build();
1817
+ * fWorksheet.addConditionalFormattingRule(rule);
1818
+ * ```
1819
+ */
1820
+ whenNumberLessThanOrEqualTo(value) {
1821
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).whenNumberLessThanOrEqualTo(value);
1822
+ }
1823
+ /**
1824
+ * Sets the conditional format rule to trigger when a number does not fall between, and is neither of, two specified values.
1825
+ * @param {number} start - The lowest unacceptable value.
1826
+ * @param {number} end - The highest unacceptable value.
1827
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1828
+ * @example
1829
+ * ```typescript
1830
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1831
+ * const fWorksheet = fWorkbook.getActiveSheet();
1832
+ *
1833
+ * // Create a conditional formatting rule that highlights cells with values not between 10 and 20 in red for the range A1:D10.
1834
+ * const fRange = fWorksheet.getRange('A1:D10');
1835
+ * const rule = fWorksheet.newConditionalFormattingRule()
1836
+ * .whenNumberNotBetween(10, 20)
1837
+ * .setBackground('#FF0000')
1838
+ * .setRanges([fRange.getRange()])
1839
+ * .build();
1840
+ * fWorksheet.addConditionalFormattingRule(rule);
1841
+ * ```
1842
+ */
1843
+ whenNumberNotBetween(start, end) {
1844
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).whenNumberNotBetween(start, end);
1845
+ }
1846
+ /**
1847
+ * Sets the conditional format rule to trigger when a number is not equal to the given value.
1848
+ * @param {number} value - The sole unacceptable value.
1849
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1850
+ * @example
1851
+ * ```typescript
1852
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1853
+ * const fWorksheet = fWorkbook.getActiveSheet();
1854
+ *
1855
+ * // Create a conditional formatting rule that highlights cells with values not equal to 10 in red for the range A1:D10.
1856
+ * const fRange = fWorksheet.getRange('A1:D10');
1857
+ * const rule = fWorksheet.newConditionalFormattingRule()
1858
+ * .whenNumberNotEqualTo(10)
1859
+ * .setBackground('#FF0000')
1860
+ * .setRanges([fRange.getRange()])
1861
+ * .build();
1862
+ * fWorksheet.addConditionalFormattingRule(rule);
1863
+ * ```
1864
+ */
1865
+ whenNumberNotEqualTo(value) {
1866
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).whenNumberNotEqualTo(value);
1867
+ }
1868
+ /**
1869
+ * Sets the conditional format rule to trigger when that the input contains the given value.
1870
+ * @param {string} text - The value that the input must contain.
1871
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1872
+ * @example
1873
+ * ```typescript
1874
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1875
+ * const fWorksheet = fWorkbook.getActiveSheet();
1876
+ *
1877
+ * // Create a conditional formatting rule that highlights cells with text containing 'apple' in red for the range A1:D10.
1878
+ * const fRange = fWorksheet.getRange('A1:D10');
1879
+ * const rule = fWorksheet.newConditionalFormattingRule()
1880
+ * .whenTextContains('apple')
1881
+ * .setBackground('#FF0000')
1882
+ * .setRanges([fRange.getRange()])
1883
+ * .build();
1884
+ * fWorksheet.addConditionalFormattingRule(rule);
1885
+ * ```
1886
+ */
1887
+ whenTextContains(text) {
1888
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).whenTextContains(text);
1889
+ }
1890
+ /**
1891
+ * Sets the conditional format rule to trigger when that the input does not contain the given value.
1892
+ * @param {string} text - The value that the input must not contain.
1893
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1894
+ * @example
1895
+ * ```typescript
1896
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1897
+ * const fWorksheet = fWorkbook.getActiveSheet();
1898
+ *
1899
+ * // Create a conditional formatting rule that highlights cells with text not containing 'apple' in red for the range A1:D10.
1900
+ * const fRange = fWorksheet.getRange('A1:D10');
1901
+ * const rule = fWorksheet.newConditionalFormattingRule()
1902
+ * .whenTextDoesNotContain('apple')
1903
+ * .setBackground('#FF0000')
1904
+ * .setRanges([fRange.getRange()])
1905
+ * .build();
1906
+ * fWorksheet.addConditionalFormattingRule(rule);
1907
+ * ```
1908
+ */
1909
+ whenTextDoesNotContain(text) {
1910
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).whenTextDoesNotContain(text);
1911
+ }
1912
+ /**
1913
+ * Sets the conditional format rule to trigger when that the input ends with the given value.
1914
+ * @param {string} text - Text to compare against the end of the string.
1915
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1916
+ * @example
1917
+ * ```typescript
1918
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1919
+ * const fWorksheet = fWorkbook.getActiveSheet();
1920
+ *
1921
+ * // Create a conditional formatting rule that highlights cells with text ending with '.ai' in red for the range A1:D10.
1922
+ * const fRange = fWorksheet.getRange('A1:D10');
1923
+ * const rule = fWorksheet.newConditionalFormattingRule()
1924
+ * .whenTextEndsWith('.ai')
1925
+ * .setBackground('#FF0000')
1926
+ * .setRanges([fRange.getRange()])
1927
+ * .build();
1928
+ * fWorksheet.addConditionalFormattingRule(rule);
1929
+ * ```
1930
+ */
1931
+ whenTextEndsWith(text) {
1932
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).whenTextEndsWith(text);
1933
+ }
1934
+ /**
1935
+ * Sets the conditional format rule to trigger when that the input is equal to the given value.
1936
+ * @param {string} text - The sole acceptable value.
1937
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1938
+ * @example
1939
+ * ```typescript
1940
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1941
+ * const fWorksheet = fWorkbook.getActiveSheet();
1942
+ *
1943
+ * // Create a conditional formatting rule that highlights cells with text equal to 'apple' in red for the range A1:D10.
1944
+ * const fRange = fWorksheet.getRange('A1:D10');
1945
+ * const rule = fWorksheet.newConditionalFormattingRule()
1946
+ * .whenTextEqualTo('apple')
1947
+ * .setBackground('#FF0000')
1948
+ * .setRanges([fRange.getRange()])
1949
+ * .build();
1950
+ * fWorksheet.addConditionalFormattingRule(rule);
1951
+ * ```
1952
+ */
1953
+ whenTextEqualTo(text) {
1954
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).whenTextEqualTo(text);
1955
+ }
1956
+ /**
1957
+ * Sets the conditional format rule to trigger when that the input starts with the given value.
1958
+ * @param {string} text - Text to compare against the beginning of the string.
1959
+ * @returns {ConditionalFormatHighlightRuleBuilder} The conditional format highlight rule builder.
1960
+ * @example
1961
+ * ```typescript
1962
+ * const fWorkbook = univerAPI.getActiveWorkbook();
1963
+ * const fWorksheet = fWorkbook.getActiveSheet();
1964
+ *
1965
+ * // Create a conditional formatting rule that highlights cells with text starting with 'https://' in red for the range A1:D10.
1966
+ * const fRange = fWorksheet.getRange('A1:D10');
1967
+ * const rule = fWorksheet.newConditionalFormattingRule()
1968
+ * .whenTextStartsWith('https://')
1969
+ * .setBackground('#FF0000')
1970
+ * .setRanges([fRange.getRange()])
1971
+ * .build();
1972
+ * fWorksheet.addConditionalFormattingRule(rule);
1973
+ * ```
1974
+ */
1975
+ whenTextStartsWith(text) {
1976
+ return new ConditionalFormatHighlightRuleBuilder(this._initConfig).whenTextStartsWith(text);
1977
+ }
1978
+ };
1979
+
1980
+ //#endregion
1981
+ //#region src/facade/f-range.ts
1982
+ var FRangeSheetsConditionalFormattingMixin = class extends FRange {
1983
+ _getConditionalFormattingRuleModel() {
1984
+ return this._injector.get(ConditionalFormattingRuleModel);
1985
+ }
1986
+ getConditionalFormattingRules() {
1987
+ return [...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(), this._worksheet.getSheetId()) || []].filter((rule) => rule.ranges.some((range) => Rectangle.intersects(range, this._range)));
1988
+ }
1989
+ createConditionalFormattingRule() {
1990
+ return new FConditionalFormattingBuilder({ ranges: [this._range] });
1991
+ }
1992
+ addConditionalFormattingRule(rule) {
1993
+ const params = {
1994
+ unitId: this._workbook.getUnitId(),
1995
+ subUnitId: this._worksheet.getSheetId(),
1996
+ rule
1997
+ };
1998
+ this._commandService.syncExecuteCommand(AddCfCommand.id, params);
1999
+ return this;
2000
+ }
2001
+ deleteConditionalFormattingRule(cfId) {
2002
+ const params = {
2003
+ unitId: this._workbook.getUnitId(),
2004
+ subUnitId: this._worksheet.getSheetId(),
2005
+ cfId
2006
+ };
2007
+ this._commandService.syncExecuteCommand(DeleteCfCommand.id, params);
2008
+ return this;
2009
+ }
2010
+ moveConditionalFormattingRule(cfId, toCfId, type = "after") {
2011
+ const params = {
2012
+ unitId: this._workbook.getUnitId(),
2013
+ subUnitId: this._worksheet.getSheetId(),
2014
+ start: {
2015
+ id: cfId,
2016
+ type: "self"
2017
+ },
2018
+ end: {
2019
+ id: toCfId,
2020
+ type
2021
+ }
2022
+ };
2023
+ this._commandService.syncExecuteCommand(MoveCfCommand.id, params);
2024
+ return this;
2025
+ }
2026
+ setConditionalFormattingRule(cfId, rule) {
2027
+ const params = {
2028
+ unitId: this._workbook.getUnitId(),
2029
+ subUnitId: this._worksheet.getSheetId(),
2030
+ rule,
2031
+ cfId
2032
+ };
2033
+ this._commandService.syncExecuteCommand(SetCfCommand.id, params);
2034
+ return this;
2035
+ }
2036
+ clearConditionalFormatRules() {
2037
+ const params = {
2038
+ unitId: this._workbook.getUnitId(),
2039
+ subUnitId: this._worksheet.getSheetId(),
2040
+ ranges: [this._range]
2041
+ };
2042
+ this._commandService.syncExecuteCommand(ClearRangeCfCommand.id, params);
2043
+ return this;
2044
+ }
2045
+ };
2046
+ FRange.extend(FRangeSheetsConditionalFormattingMixin);
2047
+
2048
+ //#endregion
2049
+ //#region src/facade/f-worksheet.ts
2050
+ var FWorksheetConditionalFormattingMixin = class extends FWorksheet {
2051
+ _getConditionalFormattingRuleModel() {
2052
+ return this._injector.get(ConditionalFormattingRuleModel);
2053
+ }
2054
+ getConditionalFormattingRules() {
2055
+ return [...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(), this._worksheet.getSheetId()) || []];
2056
+ }
2057
+ createConditionalFormattingRule() {
2058
+ return new FConditionalFormattingBuilder();
2059
+ }
2060
+ newConditionalFormattingRule() {
2061
+ return new FConditionalFormattingBuilder();
2062
+ }
2063
+ addConditionalFormattingRule(rule) {
2064
+ const params = {
2065
+ unitId: this._workbook.getUnitId(),
2066
+ subUnitId: this._worksheet.getSheetId(),
2067
+ rule
2068
+ };
2069
+ this._commandService.syncExecuteCommand(AddCfCommand.id, params);
2070
+ return this;
2071
+ }
2072
+ deleteConditionalFormattingRule(cfId) {
2073
+ const params = {
2074
+ unitId: this._workbook.getUnitId(),
2075
+ subUnitId: this._worksheet.getSheetId(),
2076
+ cfId
2077
+ };
2078
+ this._commandService.syncExecuteCommand(DeleteCfCommand.id, params);
2079
+ return this;
2080
+ }
2081
+ moveConditionalFormattingRule(cfId, toCfId, type = "after") {
2082
+ const params = {
2083
+ unitId: this._workbook.getUnitId(),
2084
+ subUnitId: this._worksheet.getSheetId(),
2085
+ start: {
2086
+ id: cfId,
2087
+ type: "self"
2088
+ },
2089
+ end: {
2090
+ id: toCfId,
2091
+ type
2092
+ }
2093
+ };
2094
+ this._commandService.syncExecuteCommand(MoveCfCommand.id, params);
2095
+ return this;
2096
+ }
2097
+ setConditionalFormattingRule(cfId, rule) {
2098
+ const params = {
2099
+ unitId: this._workbook.getUnitId(),
2100
+ subUnitId: this._worksheet.getSheetId(),
2101
+ cfId,
2102
+ rule
2103
+ };
2104
+ this._commandService.syncExecuteCommand(SetCfCommand.id, params);
2105
+ return this;
2106
+ }
2107
+ clearConditionalFormatRules() {
2108
+ const params = {
2109
+ unitId: this._workbook.getUnitId(),
2110
+ subUnitId: this._worksheet.getSheetId()
2111
+ };
2112
+ this._commandService.syncExecuteCommand(ClearWorksheetCfCommand.id, params);
2113
+ return this;
2114
+ }
2115
+ };
2116
+ FWorksheet.extend(FWorksheetConditionalFormattingMixin);
2117
+
2118
+ //#endregion
2119
+ //#region src/facade/f-enum.ts
2120
+ /**
2121
+ * Copyright 2023-present DreamNum Co., Ltd.
2122
+ *
2123
+ * Licensed under the Apache License, Version 2.0 (the "License");
2124
+ * you may not use this file except in compliance with the License.
2125
+ * You may obtain a copy of the License at
2126
+ *
2127
+ * http://www.apache.org/licenses/LICENSE-2.0
2128
+ *
2129
+ * Unless required by applicable law or agreed to in writing, software
2130
+ * distributed under the License is distributed on an "AS IS" BASIS,
2131
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2132
+ * See the License for the specific language governing permissions and
2133
+ * limitations under the License.
2134
+ */
2135
+ var FSheetsConditionalFormattingEnumMixin = class extends FEnum {
2136
+ get ConditionFormatNumberOperatorEnum() {
2137
+ return CFNumberOperator;
2138
+ }
2139
+ get ConditionFormatTimePeriodOperatorEnum() {
2140
+ return CFTimePeriodOperator;
2141
+ }
2142
+ };
2143
+ FEnum.extend(FSheetsConditionalFormattingEnumMixin);
2144
+
2145
+ //#endregion
2146
+ export { FConditionalFormattingBuilder };