@univerjs/sheets-conditional-formatting 0.6.2 → 0.6.3

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