@univerjs/sheets-conditional-formatting 0.5.3 → 0.5.4
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/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/es/facade.js +82 -70
- package/lib/es/index.js +469 -469
- package/lib/types/facade/conditional-formatting-builder.d.ts +46 -37
- package/lib/types/facade/f-worksheet.d.ts +23 -3
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +8 -8
|
@@ -8,15 +8,14 @@ declare class ConditionalFormatRuleBaseBuilder {
|
|
|
8
8
|
protected _ensureAttr(obj: Record<string, any>, keys: string[]): Record<string, any>;
|
|
9
9
|
build(): IConditionFormattingRule<IConditionalFormattingRuleConfig>;
|
|
10
10
|
/**
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
* @return {*}
|
|
11
|
+
* Deep clone a current builder.
|
|
12
|
+
* @returns {*}
|
|
14
13
|
* @memberof ConditionalFormatRuleBuilder
|
|
15
14
|
*/
|
|
16
15
|
copy(): ConditionalFormatRuleBaseBuilder;
|
|
17
16
|
/**
|
|
18
17
|
* Gets the scope of the current conditional format
|
|
19
|
-
* @
|
|
18
|
+
* @returns {*}
|
|
20
19
|
* @memberof ConditionalFormatRuleBuilder
|
|
21
20
|
*/
|
|
22
21
|
getRanges(): IRange[];
|
|
@@ -25,15 +24,15 @@ declare class ConditionalFormatRuleBaseBuilder {
|
|
|
25
24
|
*/
|
|
26
25
|
getIconMap(): Record<string, string[]>;
|
|
27
26
|
/**
|
|
28
|
-
*
|
|
29
|
-
* @
|
|
27
|
+
* Create a conditional format ID.
|
|
28
|
+
* @returns {*}
|
|
30
29
|
* @memberof ConditionalFormatRuleBuilder
|
|
31
30
|
*/
|
|
32
31
|
createCfId(): string;
|
|
33
32
|
/**
|
|
34
33
|
* Sets the scope for conditional formatting
|
|
35
34
|
* @param {IRange[]} ranges
|
|
36
|
-
* @
|
|
35
|
+
* @returns {*}
|
|
37
36
|
* @memberof ConditionalFormatRuleBuilder
|
|
38
37
|
*/
|
|
39
38
|
setRanges(ranges: IRange[]): this;
|
|
@@ -43,27 +42,26 @@ declare class ConditionalFormatHighlightRuleBuilder extends ConditionalFormatRul
|
|
|
43
42
|
copy(): ConditionalFormatHighlightRuleBuilder;
|
|
44
43
|
/**
|
|
45
44
|
* Set average rule
|
|
46
|
-
*
|
|
47
45
|
* @param {IAverageHighlightCell['operator']} operator
|
|
48
46
|
* @memberof ConditionalFormatHighlightRuleBuilder
|
|
49
47
|
*/
|
|
50
48
|
setAverage(operator: IAverageHighlightCell['operator']): this;
|
|
51
49
|
/**
|
|
52
50
|
* Set uniqueValues rule
|
|
53
|
-
*
|
|
54
51
|
* @memberof ConditionalFormatHighlightRuleBuilder
|
|
55
52
|
*/
|
|
56
53
|
setUniqueValues(): this;
|
|
57
54
|
/**
|
|
58
55
|
* Set duplicateValues rule
|
|
59
|
-
*
|
|
60
56
|
* @memberof ConditionalFormatHighlightRuleBuilder
|
|
61
57
|
*/
|
|
62
58
|
setDuplicateValues(): this;
|
|
63
59
|
/**
|
|
64
60
|
* Set rank rule
|
|
65
|
-
*
|
|
66
61
|
* @param {{ isBottom: boolean, isPercent: boolean, value: number }} config
|
|
62
|
+
* @param config.isBottom
|
|
63
|
+
* @param config.isPercent
|
|
64
|
+
* @param config.value
|
|
67
65
|
* @memberof ConditionalFormatHighlightRuleBuilder
|
|
68
66
|
*/
|
|
69
67
|
setRank(config: {
|
|
@@ -74,42 +72,42 @@ declare class ConditionalFormatHighlightRuleBuilder extends ConditionalFormatRul
|
|
|
74
72
|
/**
|
|
75
73
|
* Sets the background color
|
|
76
74
|
* @param {string} [color]
|
|
77
|
-
* @
|
|
75
|
+
* @returns {*}
|
|
78
76
|
* @memberof ConditionalFormatRuleBuilder
|
|
79
77
|
*/
|
|
80
78
|
setBackground(color?: string): this;
|
|
81
79
|
/**
|
|
82
80
|
* Set Bold
|
|
83
81
|
* @param {boolean} isBold
|
|
84
|
-
* @
|
|
82
|
+
* @returns {*}
|
|
85
83
|
* @memberof ConditionalFormatRuleBuilder
|
|
86
84
|
*/
|
|
87
85
|
setBold(isBold: boolean): this;
|
|
88
86
|
/**
|
|
89
87
|
* Sets the font color
|
|
90
88
|
* @param {string} [color]
|
|
91
|
-
* @
|
|
89
|
+
* @returns {*}
|
|
92
90
|
* @memberof ConditionalFormatRuleBuilder
|
|
93
91
|
*/
|
|
94
92
|
setFontColor(color?: string): this;
|
|
95
93
|
/**
|
|
96
94
|
* Set the text to italic
|
|
97
95
|
* @param {boolean} isItalic
|
|
98
|
-
* @
|
|
96
|
+
* @returns {*}
|
|
99
97
|
* @memberof ConditionalFormatRuleBuilder
|
|
100
98
|
*/
|
|
101
99
|
setItalic(isItalic: boolean): this;
|
|
102
100
|
/**
|
|
103
101
|
* Set the strikethrough
|
|
104
102
|
* @param {boolean} isStrikethrough
|
|
105
|
-
* @
|
|
103
|
+
* @returns {*}
|
|
106
104
|
* @memberof ConditionalFormatRuleBuilder
|
|
107
105
|
*/
|
|
108
106
|
setStrikethrough(isStrikethrough: boolean): this;
|
|
109
107
|
/**
|
|
110
108
|
* Set the underscore
|
|
111
109
|
* @param {boolean} isUnderline
|
|
112
|
-
* @
|
|
110
|
+
* @returns {*}
|
|
113
111
|
* @memberof ConditionalFormatRuleBuilder
|
|
114
112
|
*/
|
|
115
113
|
setUnderline(isUnderline: boolean): this;
|
|
@@ -119,15 +117,14 @@ declare class ConditionalFormatHighlightRuleBuilder extends ConditionalFormatRul
|
|
|
119
117
|
whenCellEmpty(): this;
|
|
120
118
|
/**
|
|
121
119
|
* Sets the conditional formatting rule to fire when the cell is not empty
|
|
122
|
-
* @
|
|
120
|
+
* @returns {*}
|
|
123
121
|
* @memberof ConditionalFormatRuleBuilder
|
|
124
122
|
*/
|
|
125
123
|
whenCellNotEmpty(): this;
|
|
126
124
|
/**
|
|
127
125
|
* Highlight when the date is in a time period, custom time is not supported.
|
|
128
|
-
*
|
|
129
126
|
* @param {CFTimePeriodOperator} date
|
|
130
|
-
* @
|
|
127
|
+
* @returns {*}
|
|
131
128
|
* @memberof ConditionalFormatRuleBuilder
|
|
132
129
|
*/
|
|
133
130
|
whenDate(date: CFTimePeriodOperator): this;
|
|
@@ -146,7 +143,6 @@ declare class ConditionalFormatHighlightRuleBuilder extends ConditionalFormatRul
|
|
|
146
143
|
whenNumberBetween(start: number, end: number): this;
|
|
147
144
|
/**
|
|
148
145
|
* Sets the conditional formatting rule to fire when the number equals the given value
|
|
149
|
-
*
|
|
150
146
|
* @param {number} value
|
|
151
147
|
* @memberof ConditionalFormatRuleBuilder
|
|
152
148
|
*/
|
|
@@ -184,6 +180,7 @@ declare class ConditionalFormatHighlightRuleBuilder extends ConditionalFormatRul
|
|
|
184
180
|
whenNumberNotBetween(start: number, end: number): this;
|
|
185
181
|
/**
|
|
186
182
|
* Sets the conditional formatting rule to fire when a number does not equal a given value.
|
|
183
|
+
* @param value
|
|
187
184
|
* @memberof ConditionalFormatRuleBuilder
|
|
188
185
|
*/
|
|
189
186
|
whenNumberNotEqualTo(value: number): this;
|
|
@@ -222,7 +219,6 @@ declare class ConditionalFormatDataBarRuleBuilder extends ConditionalFormatRuleB
|
|
|
222
219
|
copy(): ConditionalFormatDataBarRuleBuilder;
|
|
223
220
|
/**
|
|
224
221
|
* Data bar settings
|
|
225
|
-
*
|
|
226
222
|
* @param {{
|
|
227
223
|
* min: IValueConfig;
|
|
228
224
|
* max: IValueConfig;
|
|
@@ -231,6 +227,12 @@ declare class ConditionalFormatDataBarRuleBuilder extends ConditionalFormatRuleB
|
|
|
231
227
|
* nativeColor: string;
|
|
232
228
|
* isShowValue?: boolean;
|
|
233
229
|
* }} config
|
|
230
|
+
* @param config.min
|
|
231
|
+
* @param config.max
|
|
232
|
+
* @param config.isGradient
|
|
233
|
+
* @param config.positiveColor
|
|
234
|
+
* @param config.nativeColor
|
|
235
|
+
* @param config.isShowValue
|
|
234
236
|
* @memberof ConditionalFormatRuleBuilder
|
|
235
237
|
*/
|
|
236
238
|
setDataBar(config: {
|
|
@@ -257,6 +259,8 @@ declare class ConditionalFormatIconSetRuleBuilder extends ConditionalFormatRuleB
|
|
|
257
259
|
*
|
|
258
260
|
* Icon Set
|
|
259
261
|
* @param {{ iconConfigs: IIconSet['config'], isShowValue: boolean }} config
|
|
262
|
+
* @param config.iconConfigs
|
|
263
|
+
* @param config.isShowValue
|
|
260
264
|
* @memberof ConditionalFormatRuleBuilder
|
|
261
265
|
*/
|
|
262
266
|
setIconSet(config: {
|
|
@@ -272,27 +276,26 @@ export declare class FConditionalFormattingBuilder {
|
|
|
272
276
|
build(): IConditionFormattingRule<IConditionalFormattingRuleConfig>;
|
|
273
277
|
/**
|
|
274
278
|
* Set average rule
|
|
275
|
-
*
|
|
276
279
|
* @param {IAverageHighlightCell['operator']} operator
|
|
277
280
|
* @memberof ConditionalFormatHighlightRuleBuilder
|
|
278
281
|
*/
|
|
279
282
|
setAverage(operator: IAverageHighlightCell['operator']): ConditionalFormatHighlightRuleBuilder;
|
|
280
283
|
/**
|
|
281
284
|
* Set uniqueValues rule
|
|
282
|
-
*
|
|
283
285
|
* @memberof ConditionalFormatHighlightRuleBuilder
|
|
284
286
|
*/
|
|
285
287
|
setUniqueValues(): ConditionalFormatHighlightRuleBuilder;
|
|
286
288
|
/**
|
|
287
289
|
* Set duplicateValues rule
|
|
288
|
-
*
|
|
289
290
|
* @memberof ConditionalFormatHighlightRuleBuilder
|
|
290
291
|
*/
|
|
291
292
|
setDuplicateValues(): ConditionalFormatHighlightRuleBuilder;
|
|
292
293
|
/**
|
|
293
294
|
* Set rank rule
|
|
294
|
-
*
|
|
295
295
|
* @param {{ isBottom: boolean, isPercent: boolean, value: number }} config
|
|
296
|
+
* @param config.isBottom
|
|
297
|
+
* @param config.isPercent
|
|
298
|
+
* @param config.value
|
|
296
299
|
* @memberof ConditionalFormatHighlightRuleBuilder
|
|
297
300
|
*/
|
|
298
301
|
setRank(config: {
|
|
@@ -304,6 +307,8 @@ export declare class FConditionalFormattingBuilder {
|
|
|
304
307
|
*
|
|
305
308
|
* Set iconSet rule
|
|
306
309
|
* @param {{ iconConfigs: IIconSet['config'], isShowValue: boolean }} config
|
|
310
|
+
* @param config.iconConfigs
|
|
311
|
+
* @param config.isShowValue
|
|
307
312
|
* @memberof ConditionalFormatRuleBuilder
|
|
308
313
|
*/
|
|
309
314
|
setIconSet(config: {
|
|
@@ -318,7 +323,6 @@ export declare class FConditionalFormattingBuilder {
|
|
|
318
323
|
setColorScale(config: IColorScale['config']): ConditionalFormatColorScaleRuleBuilder;
|
|
319
324
|
/**
|
|
320
325
|
* Set dataBar rule
|
|
321
|
-
*
|
|
322
326
|
* @param {{
|
|
323
327
|
* min: IValueConfig;
|
|
324
328
|
* max: IValueConfig;
|
|
@@ -327,6 +331,12 @@ export declare class FConditionalFormattingBuilder {
|
|
|
327
331
|
* nativeColor: string;
|
|
328
332
|
* isShowValue?: boolean;
|
|
329
333
|
* }} config
|
|
334
|
+
* @param config.min
|
|
335
|
+
* @param config.max
|
|
336
|
+
* @param config.isGradient
|
|
337
|
+
* @param config.positiveColor
|
|
338
|
+
* @param config.nativeColor
|
|
339
|
+
* @param config.isShowValue
|
|
330
340
|
* @memberof ConditionalFormatRuleBuilder
|
|
331
341
|
*/
|
|
332
342
|
setDataBar(config: {
|
|
@@ -340,42 +350,42 @@ export declare class FConditionalFormattingBuilder {
|
|
|
340
350
|
/**
|
|
341
351
|
* Sets the background color
|
|
342
352
|
* @param {string} [color]
|
|
343
|
-
* @
|
|
353
|
+
* @returns {*}
|
|
344
354
|
* @memberof ConditionalFormatRuleBuilder
|
|
345
355
|
*/
|
|
346
356
|
setBackground(color?: string): ConditionalFormatHighlightRuleBuilder;
|
|
347
357
|
/**
|
|
348
358
|
* Set Bold
|
|
349
359
|
* @param {boolean} isBold
|
|
350
|
-
* @
|
|
360
|
+
* @returns {*}
|
|
351
361
|
* @memberof ConditionalFormatRuleBuilder
|
|
352
362
|
*/
|
|
353
363
|
setBold(isBold: boolean): ConditionalFormatHighlightRuleBuilder;
|
|
354
364
|
/**
|
|
355
365
|
* Sets the font color
|
|
356
366
|
* @param {string} [color]
|
|
357
|
-
* @
|
|
367
|
+
* @returns {*}
|
|
358
368
|
* @memberof ConditionalFormatRuleBuilder
|
|
359
369
|
*/
|
|
360
370
|
setFontColor(color?: string): ConditionalFormatHighlightRuleBuilder;
|
|
361
371
|
/**
|
|
362
372
|
* Set the text to italic
|
|
363
373
|
* @param {boolean} isItalic
|
|
364
|
-
* @
|
|
374
|
+
* @returns {*}
|
|
365
375
|
* @memberof ConditionalFormatRuleBuilder
|
|
366
376
|
*/
|
|
367
377
|
setItalic(isItalic: boolean): ConditionalFormatHighlightRuleBuilder;
|
|
368
378
|
/**
|
|
369
379
|
* Set the strikethrough
|
|
370
380
|
* @param {boolean} isStrikethrough
|
|
371
|
-
* @
|
|
381
|
+
* @returns {*}
|
|
372
382
|
* @memberof ConditionalFormatRuleBuilder
|
|
373
383
|
*/
|
|
374
384
|
setStrikethrough(isStrikethrough: boolean): ConditionalFormatHighlightRuleBuilder;
|
|
375
385
|
/**
|
|
376
386
|
* Set the underscore
|
|
377
387
|
* @param {boolean} isUnderline
|
|
378
|
-
* @
|
|
388
|
+
* @returns {*}
|
|
379
389
|
* @memberof ConditionalFormatRuleBuilder
|
|
380
390
|
*/
|
|
381
391
|
setUnderline(isUnderline: boolean): ConditionalFormatHighlightRuleBuilder;
|
|
@@ -385,15 +395,14 @@ export declare class FConditionalFormattingBuilder {
|
|
|
385
395
|
whenCellEmpty(): ConditionalFormatHighlightRuleBuilder;
|
|
386
396
|
/**
|
|
387
397
|
* Sets the conditional formatting rule to fire when the cell is not empty
|
|
388
|
-
* @
|
|
398
|
+
* @returns {*}
|
|
389
399
|
* @memberof ConditionalFormatRuleBuilder
|
|
390
400
|
*/
|
|
391
401
|
whenCellNotEmpty(): ConditionalFormatHighlightRuleBuilder;
|
|
392
402
|
/**
|
|
393
403
|
* Highlight when the date is in a time period, custom time is not supported.
|
|
394
|
-
*
|
|
395
404
|
* @param {CFTimePeriodOperator} date
|
|
396
|
-
* @
|
|
405
|
+
* @returns {*}
|
|
397
406
|
* @memberof ConditionalFormatRuleBuilder
|
|
398
407
|
*/
|
|
399
408
|
whenDate(date: CFTimePeriodOperator): ConditionalFormatHighlightRuleBuilder;
|
|
@@ -412,7 +421,6 @@ export declare class FConditionalFormattingBuilder {
|
|
|
412
421
|
whenNumberBetween(start: number, end: number): ConditionalFormatHighlightRuleBuilder;
|
|
413
422
|
/**
|
|
414
423
|
* Sets the conditional formatting rule to fire when the number equals the given value
|
|
415
|
-
*
|
|
416
424
|
* @param {number} value
|
|
417
425
|
* @memberof ConditionalFormatRuleBuilder
|
|
418
426
|
*/
|
|
@@ -450,6 +458,7 @@ export declare class FConditionalFormattingBuilder {
|
|
|
450
458
|
whenNumberNotBetween(start: number, end: number): ConditionalFormatHighlightRuleBuilder;
|
|
451
459
|
/**
|
|
452
460
|
* Sets the conditional formatting rule to fire when a number does not equal a given value.
|
|
461
|
+
* @param value
|
|
453
462
|
* @memberof ConditionalFormatRuleBuilder
|
|
454
463
|
*/
|
|
455
464
|
whenNumberNotEqualTo(value: number): ConditionalFormatHighlightRuleBuilder;
|
|
@@ -4,7 +4,7 @@ import { FConditionalFormattingBuilder } from './conditional-formatting-builder'
|
|
|
4
4
|
export interface IFWorksheetConditionalFormattingMixin {
|
|
5
5
|
/**
|
|
6
6
|
* Gets all the conditional formatting for the current sheet
|
|
7
|
-
* @
|
|
7
|
+
* @returns {*} {IConditionFormattingRule[]}
|
|
8
8
|
* @memberof IFWorksheetConditionalFormattingMixin
|
|
9
9
|
* @example
|
|
10
10
|
* ```ts
|
|
@@ -13,8 +13,9 @@ export interface IFWorksheetConditionalFormattingMixin {
|
|
|
13
13
|
*/
|
|
14
14
|
getConditionalFormattingRules(): IConditionFormattingRule[];
|
|
15
15
|
/**
|
|
16
|
+
* @deprecated use newConditionalFormattingRule instead.
|
|
16
17
|
* Creates a constructor for conditional formatting
|
|
17
|
-
* @
|
|
18
|
+
* @returns {ConditionalFormatRuleBuilder}
|
|
18
19
|
* @memberof IFWorksheetConditionalFormattingMixin
|
|
19
20
|
* @example
|
|
20
21
|
* ```ts
|
|
@@ -31,6 +32,25 @@ export interface IFWorksheetConditionalFormattingMixin {
|
|
|
31
32
|
* ```
|
|
32
33
|
*/
|
|
33
34
|
createConditionalFormattingRule(): FConditionalFormattingBuilder;
|
|
35
|
+
/**
|
|
36
|
+
* Creates a constructor for conditional formatting
|
|
37
|
+
* @returns {ConditionalFormatRuleBuilder}@example
|
|
38
|
+
* @memberof IFWorksheetConditionalFormattingMixin
|
|
39
|
+
* @example
|
|
40
|
+
* ```ts
|
|
41
|
+
* const workbook = univerAPI.getActiveWorkbook();
|
|
42
|
+
* const worksheet = workbook?.getActiveSheet();
|
|
43
|
+
* const rule = worksheet?.createConditionalFormattingRule()
|
|
44
|
+
* .whenCellNotEmpty()
|
|
45
|
+
* .setRanges([{ startRow: 0, endRow: 100, startColumn: 0, endColumn: 100 }])
|
|
46
|
+
* .setItalic(true)
|
|
47
|
+
* .setItalic(true)
|
|
48
|
+
* .setBackground('red')
|
|
49
|
+
* .setFontColor('green')
|
|
50
|
+
* .build();
|
|
51
|
+
* ```
|
|
52
|
+
*/
|
|
53
|
+
newConditionalFormattingRule(): FConditionalFormattingBuilder;
|
|
34
54
|
/**
|
|
35
55
|
* Add a new conditional format
|
|
36
56
|
* @param {IConditionFormattingRule} rule
|
|
@@ -54,7 +74,6 @@ export interface IFWorksheetConditionalFormattingMixin {
|
|
|
54
74
|
addConditionalFormattingRule(rule: IConditionFormattingRule): FWorksheet;
|
|
55
75
|
/**
|
|
56
76
|
* Delete conditional format according to `cfId`
|
|
57
|
-
*
|
|
58
77
|
* @param {string} cfId
|
|
59
78
|
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
60
79
|
* @memberof IFWorksheetConditionalFormattingMixin
|
|
@@ -106,6 +125,7 @@ export declare class FWorksheetConditionalFormattingMixin extends FWorksheet imp
|
|
|
106
125
|
private _getConditionalFormattingRuleModel;
|
|
107
126
|
getConditionalFormattingRules(): IConditionFormattingRule[];
|
|
108
127
|
createConditionalFormattingRule(): FConditionalFormattingBuilder;
|
|
128
|
+
newConditionalFormattingRule(): FConditionalFormattingBuilder;
|
|
109
129
|
addConditionalFormattingRule(rule: IConditionFormattingRule): FWorksheet;
|
|
110
130
|
deleteConditionalFormattingRule(cfId: string): FWorksheet;
|
|
111
131
|
moveConditionalFormattingRule(cfId: string, toCfId: string, type?: IAnchor['type']): FWorksheet;
|
package/lib/umd/facade.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(i,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("@univerjs/core"),require("@univerjs/sheets-conditional-formatting"),require("@univerjs/sheets/facade")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-conditional-formatting","@univerjs/sheets/facade"],r):(i=typeof globalThis<"u"?globalThis:i||self,r(i.UniverSheetsConditionalFormattingFacade={},i.UniverCore,i.UniverSheetsConditionalFormatting,i.UniverSheetsFacade))})(this,function(i,r,u,p){"use strict";var w=Object.defineProperty;var R=(i,r,u)=>r in i?w(i,r,{enumerable:!0,configurable:!0,writable:!0,value:u}):i[r]=u;var _=(i,r,u)=>R(i,typeof r!="symbol"?r+"":r,u);class o{constructor(e={}){_(this,"_rule",{});this._rule=e,this._ensureAttr(this._rule,["rule"])}get _ruleConfig(){return this._rule.rule||null}_getDefaultConfig(e=u.CFRuleType.highlightCell){switch(e){case u.CFRuleType.colorScale:return{type:e,config:[{index:0,color:new r.ColorKit("").toRgbString(),value:{type:u.CFValueType.min}},{index:0,color:new r.ColorKit("green").toRgbString(),value:{type:u.CFValueType.max}}]};case u.CFRuleType.dataBar:return{type:e,isShowValue:!0,config:{min:{type:u.CFValueType.min},max:{type:u.CFValueType.max},positiveColor:new r.ColorKit("green").toRgbString(),nativeColor:new r.ColorKit("").toRgbString(),isGradient:!1}};case u.CFRuleType.highlightCell:return{type:e,subType:u.CFSubRuleType.text,operator:u.CFTextOperator.containsText,value:"abc",style:{}};case u.CFRuleType.iconSet:return{type:e,isShowValue:!0,config:[{operator:u.CFNumberOperator.greaterThanOrEqual,value:{type:u.CFValueType.min},iconType:u.EMPTY_ICON_TYPE,iconId:""},{operator:u.CFNumberOperator.greaterThanOrEqual,value:{type:u.CFValueType.percentile,value:.5},iconType:u.EMPTY_ICON_TYPE,iconId:""},{operator:u.CFNumberOperator.lessThanOrEqual,value:{type:u.CFValueType.max},iconType:u.EMPTY_ICON_TYPE,iconId:""}]}}}_ensureAttr(e,t){return t.reduce((l,s)=>(l[s]||(l[s]={}),l[s]),e),e}build(){var l;this._rule.cfId||(this._rule.cfId=u.createCfId()),this._rule.ranges||(this._rule.ranges=[]),this._rule.stopIfTrue===void 0&&(this._rule.stopIfTrue=!1),(l=this._rule.rule)!=null&&l.type||(this._rule.rule.type=u.CFRuleType.highlightCell,this._ensureAttr(this._rule,["rule","style"]));const e=this._getDefaultConfig(this._rule.rule.type);return{...this._rule,rule:{...e,...this._rule.rule}}}copy(){return new o(r.Tools.deepClone(this._rule))}getRanges(){return this._rule.ranges||[]}getIconMap(){return u.iconMap}createCfId(){return u.createCfId()}setRanges(e){return this._rule.ranges=e,this}}class n extends o{constructor(e={}){super(e),this._ensureAttr(this._rule,["rule","style"])}copy(){return new n(r.Tools.deepClone(this._rule))}setAverage(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.average,t.operator=e,this}setUniqueValues(){const e=this._ruleConfig;return e.type=u.CFRuleType.highlightCell,e.subType=u.CFSubRuleType.uniqueValues,this}setDuplicateValues(){const e=this._ruleConfig;return e.type=u.CFRuleType.highlightCell,e.subType=u.CFSubRuleType.duplicateValues,this}setRank(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.rank,t.isBottom=e.isBottom,t.isPercent=e.isPercent,t.value=e.value,this}setBackground(e){var t;if(((t=this._ruleConfig)==null?void 0:t.type)===u.CFRuleType.highlightCell)if(e){this._ensureAttr(this._ruleConfig,["style","bg"]);const l=new r.ColorKit(e);this._ruleConfig.style.bg.rgb=l.toRgbString()}else delete this._ruleConfig.style.bg;return this}setBold(e){var t;return((t=this._ruleConfig)==null?void 0:t.type)===u.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style"]),this._ruleConfig.style.bl=e?r.BooleanNumber.TRUE:r.BooleanNumber.FALSE),this}setFontColor(e){var t;if(((t=this._ruleConfig)==null?void 0:t.type)===u.CFRuleType.highlightCell)if(e){const l=new r.ColorKit(e);this._ensureAttr(this._ruleConfig,["style","cl"]),this._ruleConfig.style.cl.rgb=l.toRgbString()}else delete this._ruleConfig.style.cl;return this}setItalic(e){var t;return((t=this._ruleConfig)==null?void 0:t.type)===u.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style"]),this._ruleConfig.style.it=e?r.BooleanNumber.TRUE:r.BooleanNumber.FALSE),this}setStrikethrough(e){var t;return((t=this._ruleConfig)==null?void 0:t.type)===u.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style","st"]),this._ruleConfig.style.st.s=e?r.BooleanNumber.TRUE:r.BooleanNumber.FALSE),this}setUnderline(e){var t;return((t=this._ruleConfig)==null?void 0:t.type)===u.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style","ul"]),this._ruleConfig.style.ul.s=e?r.BooleanNumber.TRUE:r.BooleanNumber.FALSE),this}whenCellEmpty(){const e=this._ruleConfig;return e.type=u.CFRuleType.highlightCell,e.subType=u.CFSubRuleType.text,e.value="",e.operator=u.CFTextOperator.equal,this}whenCellNotEmpty(){const e=this._ruleConfig;return e.type=u.CFRuleType.highlightCell,e.subType=u.CFSubRuleType.text,e.value="",e.operator=u.CFTextOperator.notEqual,this}whenDate(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.timePeriod,t.operator=e,this}whenFormulaSatisfied(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.formula,t.value=e,this}whenNumberBetween(e,t){const l=Math.min(e,t),s=Math.max(e,t),h=this._ruleConfig;return h.type=u.CFRuleType.highlightCell,h.subType=u.CFSubRuleType.number,h.value=[l,s],h.operator=u.CFNumberOperator.between,this}whenNumberEqualTo(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.number,t.value=e,t.operator=u.CFNumberOperator.equal,this}whenNumberGreaterThan(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.number,t.value=e,t.operator=u.CFNumberOperator.greaterThan,this}whenNumberGreaterThanOrEqualTo(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.number,t.value=e,t.operator=u.CFNumberOperator.greaterThanOrEqual,this}whenNumberLessThan(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.number,t.value=e,t.operator=u.CFNumberOperator.lessThan,this}whenNumberLessThanOrEqualTo(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.number,t.value=e,t.operator=u.CFNumberOperator.lessThanOrEqual,this}whenNumberNotBetween(e,t){const l=Math.min(e,t),s=Math.max(e,t),h=this._ruleConfig;return h.type=u.CFRuleType.highlightCell,h.subType=u.CFSubRuleType.number,h.value=[l,s],h.operator=u.CFNumberOperator.notBetween,this}whenNumberNotEqualTo(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.number,t.value=e,t.operator=u.CFNumberOperator.notEqual,this}whenTextContains(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.text,t.value=e,t.operator=u.CFTextOperator.containsText,this}whenTextDoesNotContain(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.text,t.value=e,t.operator=u.CFTextOperator.notContainsText,this}whenTextEndsWith(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.text,t.value=e,t.operator=u.CFTextOperator.endsWith,this}whenTextEqualTo(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.text,t.value=e,t.operator=u.CFTextOperator.equal,this}whenTextStartsWith(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.text,t.value=e,t.operator=u.CFTextOperator.beginsWith,this}}class C extends o{copy(){return new C(r.Tools.deepClone(this._rule))}setDataBar(e){const t=this._ruleConfig;return t.type=u.CFRuleType.dataBar,t.isShowValue=!!e.isShowValue,t.config={min:e.min,max:e.max,positiveColor:e.positiveColor,nativeColor:e.nativeColor,isGradient:!!e.isGradient},this}}class a extends o{copy(){return new a(r.Tools.deepClone(this._rule))}setColorScale(e){const t=this._ruleConfig;return t.type=u.CFRuleType.colorScale,t.config=e,this}}class g extends o{copy(){return new g(r.Tools.deepClone(this._rule))}setIconSet(e){const t=this._ruleConfig;return t.type=u.CFRuleType.iconSet,t.config=e.iconConfigs,t.isShowValue=e.isShowValue,this}}class T{constructor(e={}){this._initConfig=e}build(){return new o(this._initConfig).build()}setAverage(e){return new n(this._initConfig).setAverage(e)}setUniqueValues(){return new n(this._initConfig).setUniqueValues()}setDuplicateValues(){return new n(this._initConfig).setDuplicateValues()}setRank(e){return new n(this._initConfig).setRank(e)}setIconSet(e){return new g(this._initConfig).setIconSet(e)}setColorScale(e){return new a(this._initConfig).setColorScale(e)}setDataBar(e){return new C(this._initConfig).setDataBar(e)}setBackground(e){return new n(this._initConfig).setBackground(e)}setBold(e){return new n(this._initConfig).setBold(e)}setFontColor(e){return new n(this._initConfig).setFontColor(e)}setItalic(e){return new n(this._initConfig).setItalic(e)}setStrikethrough(e){return new n(this._initConfig).setStrikethrough(e)}setUnderline(e){return new n(this._initConfig).setUnderline(e)}whenCellEmpty(){return new n(this._initConfig).whenCellEmpty()}whenCellNotEmpty(){return new n(this._initConfig).whenCellNotEmpty()}whenDate(e){return new n(this._initConfig).whenDate(e)}whenFormulaSatisfied(e){return new n(this._initConfig).whenFormulaSatisfied(e)}whenNumberBetween(e,t){return new n(this._initConfig).whenNumberBetween(e,t)}whenNumberEqualTo(e){return new n(this._initConfig).whenNumberEqualTo(e)}whenNumberGreaterThan(e){return new n(this._initConfig).whenNumberGreaterThan(e)}whenNumberGreaterThanOrEqualTo(e){return new n(this._initConfig).whenNumberGreaterThanOrEqualTo(e)}whenNumberLessThan(e){return new n(this._initConfig).whenNumberLessThan(e)}whenNumberLessThanOrEqualTo(e){return new n(this._initConfig).whenNumberLessThanOrEqualTo(e)}whenNumberNotBetween(e,t){return new n(this._initConfig).whenNumberNotBetween(e,t)}whenNumberNotEqualTo(e){return new n(this._initConfig).whenNumberNotEqualTo(e)}whenTextContains(e){return new n(this._initConfig).whenTextContains(e)}whenTextDoesNotContain(e){return new n(this._initConfig).whenTextDoesNotContain(e)}whenTextEndsWith(e){return new n(this._initConfig).whenTextEndsWith(e)}whenTextEqualTo(e){return new n(this._initConfig).whenTextEqualTo(e)}whenTextStartsWith(e){return new n(this._initConfig).whenTextStartsWith(e)}}class f extends p.FRange{_getConditionalFormattingRuleModel(){return this._injector.get(u.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]].filter(t=>t.ranges.some(l=>r.Rectangle.intersects(l,this._range)))}createConditionalFormattingRule(){return new T({ranges:[this._range]})}addConditionalFormattingRule(e){const t={rule:e,unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()};return this._commandService.syncExecuteCommand(u.AddConditionalRuleMutation.id,t),this}deleteConditionalFormattingRule(e){const t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(u.DeleteConditionalRuleMutation.id,t),this}moveConditionalFormattingRule(e,t,l="after"){const s={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:"self"},end:{id:t,type:l}};return this._commandService.syncExecuteCommand(u.MoveConditionalRuleMutation.id,s),this}setConditionalFormattingRule(e,t){const l={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:t,cfId:e};return this._commandService.syncExecuteCommand(u.SetConditionalRuleMutation.id,l),this}}p.FRange.extend(f);class c extends p.FWorkbook{newColor(){return new r.ColorBuilder}}p.FWorkbook.extend(c);class b extends p.FWorksheet{_getConditionalFormattingRuleModel(){return this._injector.get(u.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]]}createConditionalFormattingRule(){return new T}addConditionalFormattingRule(e){const t={rule:e,unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()};return this._commandService.syncExecuteCommand(u.AddConditionalRuleMutation.id,t),this}deleteConditionalFormattingRule(e){const t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(u.DeleteConditionalRuleMutation.id,t),this}moveConditionalFormattingRule(e,t,l="after"){const s={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:"self"},end:{id:t,type:l}};return this._commandService.syncExecuteCommand(u.MoveConditionalRuleMutation.id,s),this}setConditionalFormattingRule(e,t){const l={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:t,cfId:e};return this._commandService.syncExecuteCommand(u.SetConditionalRuleMutation.id,l),this}}p.FWorksheet.extend(b),i.FConditionalFormattingBuilder=T,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|
|
1
|
+
(function(i,r){typeof exports=="object"&&typeof module<"u"?r(exports,require("@univerjs/core"),require("@univerjs/sheets-conditional-formatting"),require("@univerjs/sheets/facade")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-conditional-formatting","@univerjs/sheets/facade"],r):(i=typeof globalThis<"u"?globalThis:i||self,r(i.UniverSheetsConditionalFormattingFacade={},i.UniverCore,i.UniverSheetsConditionalFormatting,i.UniverSheetsFacade))})(this,function(i,r,u,p){"use strict";var w=Object.defineProperty;var R=(i,r,u)=>r in i?w(i,r,{enumerable:!0,configurable:!0,writable:!0,value:u}):i[r]=u;var _=(i,r,u)=>R(i,typeof r!="symbol"?r+"":r,u);class o{constructor(e={}){_(this,"_rule",{});this._rule=e,this._ensureAttr(this._rule,["rule"])}get _ruleConfig(){return this._rule.rule||null}_getDefaultConfig(e=u.CFRuleType.highlightCell){switch(e){case u.CFRuleType.colorScale:return{type:e,config:[{index:0,color:new r.ColorKit("").toRgbString(),value:{type:u.CFValueType.min}},{index:0,color:new r.ColorKit("green").toRgbString(),value:{type:u.CFValueType.max}}]};case u.CFRuleType.dataBar:return{type:e,isShowValue:!0,config:{min:{type:u.CFValueType.min},max:{type:u.CFValueType.max},positiveColor:new r.ColorKit("green").toRgbString(),nativeColor:new r.ColorKit("").toRgbString(),isGradient:!1}};case u.CFRuleType.highlightCell:return{type:e,subType:u.CFSubRuleType.text,operator:u.CFTextOperator.containsText,value:"abc",style:{}};case u.CFRuleType.iconSet:return{type:e,isShowValue:!0,config:[{operator:u.CFNumberOperator.greaterThanOrEqual,value:{type:u.CFValueType.min},iconType:u.EMPTY_ICON_TYPE,iconId:""},{operator:u.CFNumberOperator.greaterThanOrEqual,value:{type:u.CFValueType.percentile,value:.5},iconType:u.EMPTY_ICON_TYPE,iconId:""},{operator:u.CFNumberOperator.lessThanOrEqual,value:{type:u.CFValueType.max},iconType:u.EMPTY_ICON_TYPE,iconId:""}]}}}_ensureAttr(e,t){return t.reduce((l,s)=>(l[s]||(l[s]={}),l[s]),e),e}build(){var l;this._rule.cfId||(this._rule.cfId=u.createCfId()),this._rule.ranges||(this._rule.ranges=[]),this._rule.stopIfTrue===void 0&&(this._rule.stopIfTrue=!1),(l=this._rule.rule)!=null&&l.type||(this._rule.rule.type=u.CFRuleType.highlightCell,this._ensureAttr(this._rule,["rule","style"]));const e=this._getDefaultConfig(this._rule.rule.type);return{...this._rule,rule:{...e,...this._rule.rule}}}copy(){return new o(r.Tools.deepClone(this._rule))}getRanges(){return this._rule.ranges||[]}getIconMap(){return u.iconMap}createCfId(){return u.createCfId()}setRanges(e){return this._rule.ranges=e,this}}class n extends o{constructor(e={}){super(e),this._ensureAttr(this._rule,["rule","style"])}copy(){return new n(r.Tools.deepClone(this._rule))}setAverage(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.average,t.operator=e,this}setUniqueValues(){const e=this._ruleConfig;return e.type=u.CFRuleType.highlightCell,e.subType=u.CFSubRuleType.uniqueValues,this}setDuplicateValues(){const e=this._ruleConfig;return e.type=u.CFRuleType.highlightCell,e.subType=u.CFSubRuleType.duplicateValues,this}setRank(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.rank,t.isBottom=e.isBottom,t.isPercent=e.isPercent,t.value=e.value,this}setBackground(e){var t;if(((t=this._ruleConfig)==null?void 0:t.type)===u.CFRuleType.highlightCell)if(e){this._ensureAttr(this._ruleConfig,["style","bg"]);const l=new r.ColorKit(e);this._ruleConfig.style.bg.rgb=l.toRgbString()}else delete this._ruleConfig.style.bg;return this}setBold(e){var t;return((t=this._ruleConfig)==null?void 0:t.type)===u.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style"]),this._ruleConfig.style.bl=e?r.BooleanNumber.TRUE:r.BooleanNumber.FALSE),this}setFontColor(e){var t;if(((t=this._ruleConfig)==null?void 0:t.type)===u.CFRuleType.highlightCell)if(e){const l=new r.ColorKit(e);this._ensureAttr(this._ruleConfig,["style","cl"]),this._ruleConfig.style.cl.rgb=l.toRgbString()}else delete this._ruleConfig.style.cl;return this}setItalic(e){var t;return((t=this._ruleConfig)==null?void 0:t.type)===u.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style"]),this._ruleConfig.style.it=e?r.BooleanNumber.TRUE:r.BooleanNumber.FALSE),this}setStrikethrough(e){var t;return((t=this._ruleConfig)==null?void 0:t.type)===u.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style","st"]),this._ruleConfig.style.st.s=e?r.BooleanNumber.TRUE:r.BooleanNumber.FALSE),this}setUnderline(e){var t;return((t=this._ruleConfig)==null?void 0:t.type)===u.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style","ul"]),this._ruleConfig.style.ul.s=e?r.BooleanNumber.TRUE:r.BooleanNumber.FALSE),this}whenCellEmpty(){const e=this._ruleConfig;return e.type=u.CFRuleType.highlightCell,e.subType=u.CFSubRuleType.text,e.value="",e.operator=u.CFTextOperator.equal,this}whenCellNotEmpty(){const e=this._ruleConfig;return e.type=u.CFRuleType.highlightCell,e.subType=u.CFSubRuleType.text,e.value="",e.operator=u.CFTextOperator.notEqual,this}whenDate(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.timePeriod,t.operator=e,this}whenFormulaSatisfied(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.formula,t.value=e,this}whenNumberBetween(e,t){const l=Math.min(e,t),s=Math.max(e,t),h=this._ruleConfig;return h.type=u.CFRuleType.highlightCell,h.subType=u.CFSubRuleType.number,h.value=[l,s],h.operator=u.CFNumberOperator.between,this}whenNumberEqualTo(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.number,t.value=e,t.operator=u.CFNumberOperator.equal,this}whenNumberGreaterThan(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.number,t.value=e,t.operator=u.CFNumberOperator.greaterThan,this}whenNumberGreaterThanOrEqualTo(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.number,t.value=e,t.operator=u.CFNumberOperator.greaterThanOrEqual,this}whenNumberLessThan(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.number,t.value=e,t.operator=u.CFNumberOperator.lessThan,this}whenNumberLessThanOrEqualTo(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.number,t.value=e,t.operator=u.CFNumberOperator.lessThanOrEqual,this}whenNumberNotBetween(e,t){const l=Math.min(e,t),s=Math.max(e,t),h=this._ruleConfig;return h.type=u.CFRuleType.highlightCell,h.subType=u.CFSubRuleType.number,h.value=[l,s],h.operator=u.CFNumberOperator.notBetween,this}whenNumberNotEqualTo(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.number,t.value=e,t.operator=u.CFNumberOperator.notEqual,this}whenTextContains(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.text,t.value=e,t.operator=u.CFTextOperator.containsText,this}whenTextDoesNotContain(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.text,t.value=e,t.operator=u.CFTextOperator.notContainsText,this}whenTextEndsWith(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.text,t.value=e,t.operator=u.CFTextOperator.endsWith,this}whenTextEqualTo(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.text,t.value=e,t.operator=u.CFTextOperator.equal,this}whenTextStartsWith(e){const t=this._ruleConfig;return t.type=u.CFRuleType.highlightCell,t.subType=u.CFSubRuleType.text,t.value=e,t.operator=u.CFTextOperator.beginsWith,this}}class a extends o{copy(){return new a(r.Tools.deepClone(this._rule))}setDataBar(e){const t=this._ruleConfig;return t.type=u.CFRuleType.dataBar,t.isShowValue=!!e.isShowValue,t.config={min:e.min,max:e.max,positiveColor:e.positiveColor,nativeColor:e.nativeColor,isGradient:!!e.isGradient},this}}class g extends o{copy(){return new g(r.Tools.deepClone(this._rule))}setColorScale(e){const t=this._ruleConfig;return t.type=u.CFRuleType.colorScale,t.config=e,this}}class T extends o{copy(){return new T(r.Tools.deepClone(this._rule))}setIconSet(e){const t=this._ruleConfig;return t.type=u.CFRuleType.iconSet,t.config=e.iconConfigs,t.isShowValue=e.isShowValue,this}}class C{constructor(e={}){this._initConfig=e}build(){return new o(this._initConfig).build()}setAverage(e){return new n(this._initConfig).setAverage(e)}setUniqueValues(){return new n(this._initConfig).setUniqueValues()}setDuplicateValues(){return new n(this._initConfig).setDuplicateValues()}setRank(e){return new n(this._initConfig).setRank(e)}setIconSet(e){return new T(this._initConfig).setIconSet(e)}setColorScale(e){return new g(this._initConfig).setColorScale(e)}setDataBar(e){return new a(this._initConfig).setDataBar(e)}setBackground(e){return new n(this._initConfig).setBackground(e)}setBold(e){return new n(this._initConfig).setBold(e)}setFontColor(e){return new n(this._initConfig).setFontColor(e)}setItalic(e){return new n(this._initConfig).setItalic(e)}setStrikethrough(e){return new n(this._initConfig).setStrikethrough(e)}setUnderline(e){return new n(this._initConfig).setUnderline(e)}whenCellEmpty(){return new n(this._initConfig).whenCellEmpty()}whenCellNotEmpty(){return new n(this._initConfig).whenCellNotEmpty()}whenDate(e){return new n(this._initConfig).whenDate(e)}whenFormulaSatisfied(e){return new n(this._initConfig).whenFormulaSatisfied(e)}whenNumberBetween(e,t){return new n(this._initConfig).whenNumberBetween(e,t)}whenNumberEqualTo(e){return new n(this._initConfig).whenNumberEqualTo(e)}whenNumberGreaterThan(e){return new n(this._initConfig).whenNumberGreaterThan(e)}whenNumberGreaterThanOrEqualTo(e){return new n(this._initConfig).whenNumberGreaterThanOrEqualTo(e)}whenNumberLessThan(e){return new n(this._initConfig).whenNumberLessThan(e)}whenNumberLessThanOrEqualTo(e){return new n(this._initConfig).whenNumberLessThanOrEqualTo(e)}whenNumberNotBetween(e,t){return new n(this._initConfig).whenNumberNotBetween(e,t)}whenNumberNotEqualTo(e){return new n(this._initConfig).whenNumberNotEqualTo(e)}whenTextContains(e){return new n(this._initConfig).whenTextContains(e)}whenTextDoesNotContain(e){return new n(this._initConfig).whenTextDoesNotContain(e)}whenTextEndsWith(e){return new n(this._initConfig).whenTextEndsWith(e)}whenTextEqualTo(e){return new n(this._initConfig).whenTextEqualTo(e)}whenTextStartsWith(e){return new n(this._initConfig).whenTextStartsWith(e)}}class f extends p.FRange{_getConditionalFormattingRuleModel(){return this._injector.get(u.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]].filter(t=>t.ranges.some(l=>r.Rectangle.intersects(l,this._range)))}createConditionalFormattingRule(){return new C({ranges:[this._range]})}addConditionalFormattingRule(e){const t={rule:e,unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()};return this._commandService.syncExecuteCommand(u.AddConditionalRuleMutation.id,t),this}deleteConditionalFormattingRule(e){const t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(u.DeleteConditionalRuleMutation.id,t),this}moveConditionalFormattingRule(e,t,l="after"){const s={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:"self"},end:{id:t,type:l}};return this._commandService.syncExecuteCommand(u.MoveConditionalRuleMutation.id,s),this}setConditionalFormattingRule(e,t){const l={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:t,cfId:e};return this._commandService.syncExecuteCommand(u.SetConditionalRuleMutation.id,l),this}}p.FRange.extend(f);class c extends p.FWorkbook{newColor(){return new r.ColorBuilder}}p.FWorkbook.extend(c);class b extends p.FWorksheet{_getConditionalFormattingRuleModel(){return this._injector.get(u.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]]}createConditionalFormattingRule(){return new C}newConditionalFormattingRule(){return new C}addConditionalFormattingRule(e){const t={rule:e,unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()};return this._commandService.syncExecuteCommand(u.AddConditionalRuleMutation.id,t),this}deleteConditionalFormattingRule(e){const t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(u.DeleteConditionalRuleMutation.id,t),this}moveConditionalFormattingRule(e,t,l="after"){const s={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:"self"},end:{id:t,type:l}};return this._commandService.syncExecuteCommand(u.MoveConditionalRuleMutation.id,s),this}setConditionalFormattingRule(e,t){const l={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:t,cfId:e};return this._commandService.syncExecuteCommand(u.SetConditionalRuleMutation.id,l),this}}p.FWorksheet.extend(b),i.FConditionalFormattingBuilder=C,Object.defineProperty(i,Symbol.toStringTag,{value:"Module"})});
|