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