@univerjs/sheets-conditional-formatting 0.5.1 → 0.5.2

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.
@@ -0,0 +1,487 @@
1
+ import { IRange } from '@univerjs/core';
2
+ import { CFTimePeriodOperator, IAverageHighlightCell, IColorScale, IConditionalFormattingRuleConfig, IConditionFormattingRule, IIconSet, IValueConfig, CFRuleType } from '@univerjs/sheets-conditional-formatting';
3
+ declare class ConditionalFormatRuleBaseBuilder {
4
+ protected _rule: Partial<IConditionFormattingRule>;
5
+ protected get _ruleConfig(): IConditionalFormattingRuleConfig | null;
6
+ protected _getDefaultConfig(type?: CFRuleType): IConditionalFormattingRuleConfig;
7
+ constructor(initRule?: Partial<IConditionFormattingRule>);
8
+ protected _ensureAttr(obj: Record<string, any>, keys: string[]): Record<string, any>;
9
+ build(): IConditionFormattingRule<IConditionalFormattingRuleConfig>;
10
+ /**
11
+ * deep clone a current builder.
12
+ *
13
+ * @return {*}
14
+ * @memberof ConditionalFormatRuleBuilder
15
+ */
16
+ copy(): ConditionalFormatRuleBaseBuilder;
17
+ /**
18
+ * Gets the scope of the current conditional format
19
+ * @return {*}
20
+ * @memberof ConditionalFormatRuleBuilder
21
+ */
22
+ getRanges(): IRange[];
23
+ /**
24
+ * Get the icon set mapping dictionary
25
+ */
26
+ getIconMap(): Record<string, string[]>;
27
+ /**
28
+ * create a conditional format ID.
29
+ * @return {*}
30
+ * @memberof ConditionalFormatRuleBuilder
31
+ */
32
+ createCfId(): string;
33
+ /**
34
+ * Sets the scope for conditional formatting
35
+ * @param {IRange[]} ranges
36
+ * @return {*}
37
+ * @memberof ConditionalFormatRuleBuilder
38
+ */
39
+ setRanges(ranges: IRange[]): this;
40
+ }
41
+ declare class ConditionalFormatHighlightRuleBuilder extends ConditionalFormatRuleBaseBuilder {
42
+ constructor(initConfig?: Partial<IConditionFormattingRule>);
43
+ copy(): ConditionalFormatHighlightRuleBuilder;
44
+ /**
45
+ * Set average rule
46
+ *
47
+ * @param {IAverageHighlightCell['operator']} operator
48
+ * @memberof ConditionalFormatHighlightRuleBuilder
49
+ */
50
+ setAverage(operator: IAverageHighlightCell['operator']): this;
51
+ /**
52
+ * Set uniqueValues rule
53
+ *
54
+ * @memberof ConditionalFormatHighlightRuleBuilder
55
+ */
56
+ setUniqueValues(): this;
57
+ /**
58
+ * Set duplicateValues rule
59
+ *
60
+ * @memberof ConditionalFormatHighlightRuleBuilder
61
+ */
62
+ setDuplicateValues(): this;
63
+ /**
64
+ * Set rank rule
65
+ *
66
+ * @param {{ isBottom: boolean, isPercent: boolean, value: number }} config
67
+ * @memberof ConditionalFormatHighlightRuleBuilder
68
+ */
69
+ setRank(config: {
70
+ isBottom: boolean;
71
+ isPercent: boolean;
72
+ value: number;
73
+ }): this;
74
+ /**
75
+ * Sets the background color
76
+ * @param {string} [color]
77
+ * @return {*}
78
+ * @memberof ConditionalFormatRuleBuilder
79
+ */
80
+ setBackground(color?: string): this;
81
+ /**
82
+ * Set Bold
83
+ * @param {boolean} isBold
84
+ * @return {*}
85
+ * @memberof ConditionalFormatRuleBuilder
86
+ */
87
+ setBold(isBold: boolean): this;
88
+ /**
89
+ * Sets the font color
90
+ * @param {string} [color]
91
+ * @return {*}
92
+ * @memberof ConditionalFormatRuleBuilder
93
+ */
94
+ setFontColor(color?: string): this;
95
+ /**
96
+ * Set the text to italic
97
+ * @param {boolean} isItalic
98
+ * @return {*}
99
+ * @memberof ConditionalFormatRuleBuilder
100
+ */
101
+ setItalic(isItalic: boolean): this;
102
+ /**
103
+ * Set the strikethrough
104
+ * @param {boolean} isStrikethrough
105
+ * @return {*}
106
+ * @memberof ConditionalFormatRuleBuilder
107
+ */
108
+ setStrikethrough(isStrikethrough: boolean): this;
109
+ /**
110
+ * Set the underscore
111
+ * @param {boolean} isUnderline
112
+ * @return {*}
113
+ * @memberof ConditionalFormatRuleBuilder
114
+ */
115
+ setUnderline(isUnderline: boolean): this;
116
+ /**
117
+ * Sets the conditional formatting rule to fire when the cell is empty.
118
+ */
119
+ whenCellEmpty(): this;
120
+ /**
121
+ * Sets the conditional formatting rule to fire when the cell is not empty
122
+ * @return {*}
123
+ * @memberof ConditionalFormatRuleBuilder
124
+ */
125
+ whenCellNotEmpty(): this;
126
+ /**
127
+ * Highlight when the date is in a time period, custom time is not supported.
128
+ *
129
+ * @param {CFTimePeriodOperator} date
130
+ * @return {*}
131
+ * @memberof ConditionalFormatRuleBuilder
132
+ */
133
+ whenDate(date: CFTimePeriodOperator): this;
134
+ /**
135
+ * Sets a conditional formatting rule to fire when a given formula evaluates to true.
136
+ * @param {string} formulaString formulaString start with' = '
137
+ * @memberof ConditionalFormatRuleBuilder
138
+ */
139
+ whenFormulaSatisfied(formulaString: string): this;
140
+ /**
141
+ * Sets the conditional formatting rule to fire when a number is between two specified values or equal to one of them.
142
+ * @param {number} start
143
+ * @param {number} end
144
+ * @memberof ConditionalFormatRuleBuilder
145
+ */
146
+ whenNumberBetween(start: number, end: number): this;
147
+ /**
148
+ * Sets the conditional formatting rule to fire when the number equals the given value
149
+ *
150
+ * @param {number} value
151
+ * @memberof ConditionalFormatRuleBuilder
152
+ */
153
+ whenNumberEqualTo(value: number): this;
154
+ /**
155
+ * Sets the conditional formatting rule to fire when the number is greater than the given value
156
+ * @param {number} value
157
+ * @memberof ConditionalFormatRuleBuilder
158
+ */
159
+ whenNumberGreaterThan(value: number): this;
160
+ /**
161
+ * Sets a conditional formatting rule to fire when a number is greater than or equal to a given value.
162
+ * @param {number} value
163
+ * @memberof ConditionalFormatRuleBuilder
164
+ */
165
+ whenNumberGreaterThanOrEqualTo(value: number): this;
166
+ /**
167
+ * Sets a conditional formatting rule to fire when the number is less than the given value.
168
+ * @param {number} value
169
+ * @memberof ConditionalFormatRuleBuilder
170
+ */
171
+ whenNumberLessThan(value: number): this;
172
+ /**
173
+ * Sets the conditional formatting rule to fire when the value is less than or equal to the given value.
174
+ * @param {number} value
175
+ * @memberof ConditionalFormatRuleBuilder
176
+ */
177
+ whenNumberLessThanOrEqualTo(value: number): this;
178
+ /**
179
+ * Sets a conditional formatting rule to fire when a number is not between two specified values and is not equal to them.
180
+ * @param {number} start
181
+ * @param {number} end
182
+ * @memberof ConditionalFormatRuleBuilder
183
+ */
184
+ whenNumberNotBetween(start: number, end: number): this;
185
+ /**
186
+ * Sets the conditional formatting rule to fire when a number does not equal a given value.
187
+ * @memberof ConditionalFormatRuleBuilder
188
+ */
189
+ whenNumberNotEqualTo(value: number): this;
190
+ /**
191
+ * Sets the conditional formatting rule to fire when the input contains the given value.
192
+ * @param {string} text
193
+ * @memberof ConditionalFormatRuleBuilder
194
+ */
195
+ whenTextContains(text: string): this;
196
+ /**
197
+ * Sets a conditional formatting rule to fire when the input does not contain the given value.
198
+ * @param {string} text
199
+ * @memberof ConditionalFormatRuleBuilder
200
+ */
201
+ whenTextDoesNotContain(text: string): this;
202
+ /**
203
+ * Sets a conditional formatting rule to fire when input ends with a specified value.
204
+ * @param {string} text
205
+ * @memberof ConditionalFormatRuleBuilder
206
+ */
207
+ whenTextEndsWith(text: string): this;
208
+ /**
209
+ * Sets the conditional formatting rule to fire when the input equals the given value.
210
+ * @param {string} text
211
+ * @memberof ConditionalFormatRuleBuilder
212
+ */
213
+ whenTextEqualTo(text: string): this;
214
+ /**
215
+ * Sets the conditional formatting rule to fire when the input value begins with the given value.
216
+ * @param {string} text
217
+ * @memberof ConditionalFormatRuleBuilder
218
+ */
219
+ whenTextStartsWith(text: string): this;
220
+ }
221
+ declare class ConditionalFormatDataBarRuleBuilder extends ConditionalFormatRuleBaseBuilder {
222
+ copy(): ConditionalFormatDataBarRuleBuilder;
223
+ /**
224
+ * Data bar settings
225
+ *
226
+ * @param {{
227
+ * min: IValueConfig;
228
+ * max: IValueConfig;
229
+ * isGradient?: boolean;
230
+ * positiveColor: string;
231
+ * nativeColor: string;
232
+ * isShowValue?: boolean;
233
+ * }} config
234
+ * @memberof ConditionalFormatRuleBuilder
235
+ */
236
+ setDataBar(config: {
237
+ min: IValueConfig;
238
+ max: IValueConfig;
239
+ isGradient?: boolean;
240
+ positiveColor: string;
241
+ nativeColor: string;
242
+ isShowValue?: boolean;
243
+ }): this;
244
+ }
245
+ declare class ConditionalFormatColorScaleRuleBuilder extends ConditionalFormatRuleBaseBuilder {
246
+ copy(): ConditionalFormatColorScaleRuleBuilder;
247
+ /**
248
+ * Color scale set
249
+ * @param {{ index: number; color: string; value: IValueConfig }[]} config
250
+ * @memberof ConditionalFormatRuleBuilder
251
+ */
252
+ setColorScale(config: IColorScale['config']): this;
253
+ }
254
+ declare class ConditionalFormatIconSetRuleBuilder extends ConditionalFormatRuleBaseBuilder {
255
+ copy(): ConditionalFormatIconSetRuleBuilder;
256
+ /**
257
+ *
258
+ * Icon Set
259
+ * @param {{ iconConfigs: IIconSet['config'], isShowValue: boolean }} config
260
+ * @memberof ConditionalFormatRuleBuilder
261
+ */
262
+ setIconSet(config: {
263
+ iconConfigs: IIconSet['config'];
264
+ isShowValue: boolean;
265
+ }): this;
266
+ }
267
+ export declare class FConditionalFormattingBuilder {
268
+ private _initConfig;
269
+ constructor(_initConfig?: {
270
+ ranges?: IRange[];
271
+ });
272
+ build(): IConditionFormattingRule<IConditionalFormattingRuleConfig>;
273
+ /**
274
+ * Set average rule
275
+ *
276
+ * @param {IAverageHighlightCell['operator']} operator
277
+ * @memberof ConditionalFormatHighlightRuleBuilder
278
+ */
279
+ setAverage(operator: IAverageHighlightCell['operator']): ConditionalFormatHighlightRuleBuilder;
280
+ /**
281
+ * Set uniqueValues rule
282
+ *
283
+ * @memberof ConditionalFormatHighlightRuleBuilder
284
+ */
285
+ setUniqueValues(): ConditionalFormatHighlightRuleBuilder;
286
+ /**
287
+ * Set duplicateValues rule
288
+ *
289
+ * @memberof ConditionalFormatHighlightRuleBuilder
290
+ */
291
+ setDuplicateValues(): ConditionalFormatHighlightRuleBuilder;
292
+ /**
293
+ * Set rank rule
294
+ *
295
+ * @param {{ isBottom: boolean, isPercent: boolean, value: number }} config
296
+ * @memberof ConditionalFormatHighlightRuleBuilder
297
+ */
298
+ setRank(config: {
299
+ isBottom: boolean;
300
+ isPercent: boolean;
301
+ value: number;
302
+ }): ConditionalFormatHighlightRuleBuilder;
303
+ /**
304
+ *
305
+ * Set iconSet rule
306
+ * @param {{ iconConfigs: IIconSet['config'], isShowValue: boolean }} config
307
+ * @memberof ConditionalFormatRuleBuilder
308
+ */
309
+ setIconSet(config: {
310
+ iconConfigs: IIconSet['config'];
311
+ isShowValue: boolean;
312
+ }): ConditionalFormatIconSetRuleBuilder;
313
+ /**
314
+ * Set colorScale rule
315
+ * @param {{ index: number; color: string; value: IValueConfig }[]} config
316
+ * @memberof ConditionalFormatRuleBuilder
317
+ */
318
+ setColorScale(config: IColorScale['config']): ConditionalFormatColorScaleRuleBuilder;
319
+ /**
320
+ * Set dataBar rule
321
+ *
322
+ * @param {{
323
+ * min: IValueConfig;
324
+ * max: IValueConfig;
325
+ * isGradient?: boolean;
326
+ * positiveColor: string;
327
+ * nativeColor: string;
328
+ * isShowValue?: boolean;
329
+ * }} config
330
+ * @memberof ConditionalFormatRuleBuilder
331
+ */
332
+ setDataBar(config: {
333
+ min: IValueConfig;
334
+ max: IValueConfig;
335
+ isGradient?: boolean;
336
+ positiveColor: string;
337
+ nativeColor: string;
338
+ isShowValue?: boolean;
339
+ }): ConditionalFormatDataBarRuleBuilder;
340
+ /**
341
+ * Sets the background color
342
+ * @param {string} [color]
343
+ * @return {*}
344
+ * @memberof ConditionalFormatRuleBuilder
345
+ */
346
+ setBackground(color?: string): ConditionalFormatHighlightRuleBuilder;
347
+ /**
348
+ * Set Bold
349
+ * @param {boolean} isBold
350
+ * @return {*}
351
+ * @memberof ConditionalFormatRuleBuilder
352
+ */
353
+ setBold(isBold: boolean): ConditionalFormatHighlightRuleBuilder;
354
+ /**
355
+ * Sets the font color
356
+ * @param {string} [color]
357
+ * @return {*}
358
+ * @memberof ConditionalFormatRuleBuilder
359
+ */
360
+ setFontColor(color?: string): ConditionalFormatHighlightRuleBuilder;
361
+ /**
362
+ * Set the text to italic
363
+ * @param {boolean} isItalic
364
+ * @return {*}
365
+ * @memberof ConditionalFormatRuleBuilder
366
+ */
367
+ setItalic(isItalic: boolean): ConditionalFormatHighlightRuleBuilder;
368
+ /**
369
+ * Set the strikethrough
370
+ * @param {boolean} isStrikethrough
371
+ * @return {*}
372
+ * @memberof ConditionalFormatRuleBuilder
373
+ */
374
+ setStrikethrough(isStrikethrough: boolean): ConditionalFormatHighlightRuleBuilder;
375
+ /**
376
+ * Set the underscore
377
+ * @param {boolean} isUnderline
378
+ * @return {*}
379
+ * @memberof ConditionalFormatRuleBuilder
380
+ */
381
+ setUnderline(isUnderline: boolean): ConditionalFormatHighlightRuleBuilder;
382
+ /**
383
+ * Sets the conditional formatting rule to fire when the cell is empty.
384
+ */
385
+ whenCellEmpty(): ConditionalFormatHighlightRuleBuilder;
386
+ /**
387
+ * Sets the conditional formatting rule to fire when the cell is not empty
388
+ * @return {*}
389
+ * @memberof ConditionalFormatRuleBuilder
390
+ */
391
+ whenCellNotEmpty(): ConditionalFormatHighlightRuleBuilder;
392
+ /**
393
+ * Highlight when the date is in a time period, custom time is not supported.
394
+ *
395
+ * @param {CFTimePeriodOperator} date
396
+ * @return {*}
397
+ * @memberof ConditionalFormatRuleBuilder
398
+ */
399
+ whenDate(date: CFTimePeriodOperator): ConditionalFormatHighlightRuleBuilder;
400
+ /**
401
+ * Sets a conditional formatting rule to fire when a given formula evaluates to true.
402
+ * @param {string} formulaString formulaString start with' = '
403
+ * @memberof ConditionalFormatRuleBuilder
404
+ */
405
+ whenFormulaSatisfied(formulaString: string): ConditionalFormatHighlightRuleBuilder;
406
+ /**
407
+ * Sets the conditional formatting rule to fire when a number is between two specified values or equal to one of them.
408
+ * @param {number} start
409
+ * @param {number} end
410
+ * @memberof ConditionalFormatRuleBuilder
411
+ */
412
+ whenNumberBetween(start: number, end: number): ConditionalFormatHighlightRuleBuilder;
413
+ /**
414
+ * Sets the conditional formatting rule to fire when the number equals the given value
415
+ *
416
+ * @param {number} value
417
+ * @memberof ConditionalFormatRuleBuilder
418
+ */
419
+ whenNumberEqualTo(value: number): ConditionalFormatHighlightRuleBuilder;
420
+ /**
421
+ * Sets the conditional formatting rule to fire when the number is greater than the given value
422
+ * @param {number} value
423
+ * @memberof ConditionalFormatRuleBuilder
424
+ */
425
+ whenNumberGreaterThan(value: number): ConditionalFormatHighlightRuleBuilder;
426
+ /**
427
+ * Sets a conditional formatting rule to fire when a number is greater than or equal to a given value.
428
+ * @param {number} value
429
+ * @memberof ConditionalFormatRuleBuilder
430
+ */
431
+ whenNumberGreaterThanOrEqualTo(value: number): ConditionalFormatHighlightRuleBuilder;
432
+ /**
433
+ * Sets a conditional formatting rule to fire when the number is less than the given value.
434
+ * @param {number} value
435
+ * @memberof ConditionalFormatRuleBuilder
436
+ */
437
+ whenNumberLessThan(value: number): ConditionalFormatHighlightRuleBuilder;
438
+ /**
439
+ * Sets the conditional formatting rule to fire when the value is less than or equal to the given value.
440
+ * @param {number} value
441
+ * @memberof ConditionalFormatRuleBuilder
442
+ */
443
+ whenNumberLessThanOrEqualTo(value: number): ConditionalFormatHighlightRuleBuilder;
444
+ /**
445
+ * Sets a conditional formatting rule to fire when a number is not between two specified values and is not equal to them.
446
+ * @param {number} start
447
+ * @param {number} end
448
+ * @memberof ConditionalFormatRuleBuilder
449
+ */
450
+ whenNumberNotBetween(start: number, end: number): ConditionalFormatHighlightRuleBuilder;
451
+ /**
452
+ * Sets the conditional formatting rule to fire when a number does not equal a given value.
453
+ * @memberof ConditionalFormatRuleBuilder
454
+ */
455
+ whenNumberNotEqualTo(value: number): ConditionalFormatHighlightRuleBuilder;
456
+ /**
457
+ * Sets the conditional formatting rule to fire when the input contains the given value.
458
+ * @param {string} text
459
+ * @memberof ConditionalFormatRuleBuilder
460
+ */
461
+ whenTextContains(text: string): ConditionalFormatHighlightRuleBuilder;
462
+ /**
463
+ * Sets a conditional formatting rule to fire when the input does not contain the given value.
464
+ * @param {string} text
465
+ * @memberof ConditionalFormatRuleBuilder
466
+ */
467
+ whenTextDoesNotContain(text: string): ConditionalFormatHighlightRuleBuilder;
468
+ /**
469
+ * Sets a conditional formatting rule to fire when input ends with a specified value.
470
+ * @param {string} text
471
+ * @memberof ConditionalFormatRuleBuilder
472
+ */
473
+ whenTextEndsWith(text: string): ConditionalFormatHighlightRuleBuilder;
474
+ /**
475
+ * Sets the conditional formatting rule to fire when the input equals the given value.
476
+ * @param {string} text
477
+ * @memberof ConditionalFormatRuleBuilder
478
+ */
479
+ whenTextEqualTo(text: string): ConditionalFormatHighlightRuleBuilder;
480
+ /**
481
+ * Sets the conditional formatting rule to fire when the input value begins with the given value.
482
+ * @param {string} text
483
+ * @memberof ConditionalFormatRuleBuilder
484
+ */
485
+ whenTextStartsWith(text: string): ConditionalFormatHighlightRuleBuilder;
486
+ }
487
+ export {};
@@ -0,0 +1,106 @@
1
+ import { IAnchor, IConditionFormattingRule } from '@univerjs/sheets-conditional-formatting';
2
+ import { FRange } from '@univerjs/sheets/facade';
3
+ import { FConditionalFormattingBuilder } from './conditional-formatting-builder';
4
+ export interface IFRangeConditionalFormattingMixin {
5
+ /**
6
+ * Gets all the conditional formatting for the current range
7
+ * @return {*} {IConditionFormattingRule[]}
8
+ * @memberof IFWorksheetConditionalFormattingMixin
9
+ * @example
10
+ * ```ts
11
+ * const workbook = univerAPI.getActiveWorkbook();
12
+ * const worksheet = workbook?.getActiveSheet();
13
+ * workbook?.setActiveRange(worksheet?.getRange(5, 5, 3, 3)!);
14
+ * const rules = univerAPI.getActiveWorkbook()?.getActiveRange()?.getConditionalFormattingRules();
15
+ * ```
16
+ */
17
+ getConditionalFormattingRules(): IConditionFormattingRule[];
18
+ /**
19
+ * Creates a constructor for conditional formatting
20
+ * @return {*} {ConditionalFormatRuleBuilder}
21
+ * @memberof IFWorksheetConditionalFormattingMixin
22
+ * @example
23
+ * ```ts
24
+ * const workbook = univerAPI.getActiveWorkbook();
25
+ * const worksheet = workbook?.getActiveSheet();
26
+ * const rule = worksheet?.createConditionalFormattingRule()
27
+ * .whenCellNotEmpty()
28
+ * .setRanges([{ startRow: 0, endRow: 100, startColumn: 0, endColumn: 100 }])
29
+ * .setItalic(true)
30
+ * .setItalic(true)
31
+ * .setBackground('red')
32
+ * .setFontColor('green')
33
+ * .build();
34
+ * worksheet?.addConditionalFormattingRule(rule!);
35
+ * ```
36
+ */
37
+ createConditionalFormattingRule(): FConditionalFormattingBuilder;
38
+ /**
39
+ * Add a new conditional format
40
+ * @param {IConditionFormattingRule} rule
41
+ * @return {*} {Promise<boolean>}
42
+ * @memberof IFWorksheetConditionalFormattingMixin
43
+ */
44
+ addConditionalFormattingRule(rule: IConditionFormattingRule): Promise<boolean>;
45
+ /**
46
+ * Delete conditional format according to `cfId`
47
+ *
48
+ * @param {string} cfId
49
+ * @return {*} {Promise<boolean>}
50
+ * @memberof IFWorksheetConditionalFormattingMixin
51
+ * @example
52
+ * ```ts
53
+ * const workbook = univerAPI.getActiveWorkbook();
54
+ * const worksheet = workbook?.getActiveSheet();
55
+ * const rules = worksheet?.getConditionalFormattingRules();
56
+ * worksheet?.deleteConditionalFormattingRule(rules![0].cfId);
57
+ * ```
58
+ */
59
+ deleteConditionalFormattingRule(cfId: string): Promise<boolean>;
60
+ /**
61
+ * Modify the priority of the conditional format
62
+ * @param {string} cfId Rules that need to be moved
63
+ * @param {string} toCfId Target rule
64
+ * @param {IAnchor['type']} [type] After the default move to the destination rule, if type = before moves to the front, the default value is after
65
+ * @memberof FWorksheetConditionalFormattingMixin
66
+ * @example
67
+ * ```ts
68
+ * const workbook = univerAPI.getActiveWorkbook();
69
+ * const worksheet = workbook?.getActiveSheet();
70
+ * const rules = worksheet?.getConditionalFormattingRules()!;
71
+ * const rule = rules[2];
72
+ * const targetRule = rules[0];
73
+ * worksheet?.moveConditionalFormattingRule(rule.cfId, targetRule.cfId, 'before');
74
+ * ```
75
+ */
76
+ moveConditionalFormattingRule(cfId: string, toCfId: string, type?: IAnchor['type']): Promise<boolean>;
77
+ /**
78
+ * Set the conditional format according to `cfId`
79
+ * @param {string} cfId
80
+ * @param {IConditionFormattingRule} rule
81
+ * @return {*} {Promise<boolean>}
82
+ * @memberof IFWorksheetConditionalFormattingMixin
83
+ * @example
84
+ * ```ts
85
+ * const workbook = univerAPI.getActiveWorkbook();
86
+ * const worksheet = workbook?.getActiveSheet();
87
+ * const rules = worksheet?.getConditionalFormattingRules()!;
88
+ * const rule = rules[0];
89
+ * worksheet?.setConditionalFormattingRule(rule.cfId, { ...rule, ranges: [] });
90
+ * ```
91
+ */
92
+ setConditionalFormattingRule(cfId: string, rule: IConditionFormattingRule): Promise<boolean>;
93
+ }
94
+ export declare class FRangeConditionalFormattingMixin extends FRange implements IFRangeConditionalFormattingMixin {
95
+ private _getConditionalFormattingRuleModel;
96
+ getConditionalFormattingRules(): IConditionFormattingRule[];
97
+ createConditionalFormattingRule(): FConditionalFormattingBuilder;
98
+ addConditionalFormattingRule(rule: IConditionFormattingRule): Promise<boolean>;
99
+ deleteConditionalFormattingRule(cfId: string): Promise<boolean>;
100
+ moveConditionalFormattingRule(cfId: string, toCfId: string, type?: IAnchor['type']): Promise<boolean>;
101
+ setConditionalFormattingRule(cfId: string, rule: IConditionFormattingRule): Promise<boolean>;
102
+ }
103
+ declare module '@univerjs/sheets/facade' {
104
+ interface FRange extends IFRangeConditionalFormattingMixin {
105
+ }
106
+ }
@@ -0,0 +1,12 @@
1
+ import { ColorBuilder } from '@univerjs/core';
2
+ import { FWorkbook } from '@univerjs/sheets/facade';
3
+ export interface IFWorkbookConditionalFormattingMixin {
4
+ newColor(): ColorBuilder;
5
+ }
6
+ export declare class FWorkbookConditionalFormattingMixin extends FWorkbook implements IFWorkbookConditionalFormattingMixin {
7
+ newColor(): ColorBuilder;
8
+ }
9
+ declare module '@univerjs/sheets/facade' {
10
+ interface FWorkbook extends IFWorkbookConditionalFormattingMixin {
11
+ }
12
+ }