@univerjs/sheets-conditional-formatting 0.6.1 → 0.6.2-nightly.202503031606
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 +1405 -317
- package/lib/es/index.js +975 -862
- package/lib/types/base/const.d.ts +1 -1
- package/lib/types/commands/commands/add-cf.command.d.ts +9 -0
- package/lib/types/commands/commands/clear-range-cf.command.d.ts +7 -0
- package/lib/types/commands/commands/clear-worksheet-cf.command.d.ts +6 -0
- package/lib/types/commands/commands/delete-cf.command.d.ts +7 -0
- package/lib/types/commands/commands/move-cf.command.d.ts +9 -0
- package/lib/types/commands/commands/set-cf.command.d.ts +9 -0
- package/lib/types/facade/f-conditional-formatting-builder.d.ts +1566 -0
- package/lib/types/facade/f-enum.d.ts +22 -0
- package/lib/types/facade/f-range.d.ts +27 -25
- package/lib/types/facade/f-worksheet.d.ts +24 -15
- package/lib/types/facade/index.d.ts +2 -1
- package/lib/types/index.d.ts +6 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +9 -9
- package/LICENSE +0 -176
- package/lib/types/facade/conditional-formatting-builder.d.ts +0 -506
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { CFNumberOperator, CFTimePeriodOperator } from '@univerjs/sheets-conditional-formatting';
|
|
2
|
+
/**
|
|
3
|
+
* @ignore
|
|
4
|
+
*/
|
|
5
|
+
export interface IFSheetsConditionalFormattingEnum {
|
|
6
|
+
/**
|
|
7
|
+
* Conditional formatting number operator
|
|
8
|
+
*/
|
|
9
|
+
ConditionFormatNumberOperatorEnum: typeof CFNumberOperator;
|
|
10
|
+
/**
|
|
11
|
+
* Conditional formatting time period operator
|
|
12
|
+
*/
|
|
13
|
+
ConditionFormatTimePeriodOperatorEnum: typeof CFTimePeriodOperator;
|
|
14
|
+
}
|
|
15
|
+
export declare class FSheetsConditionalFormattingEnum implements IFSheetsConditionalFormattingEnum {
|
|
16
|
+
get ConditionFormatNumberOperatorEnum(): typeof CFNumberOperator;
|
|
17
|
+
get ConditionFormatTimePeriodOperatorEnum(): typeof CFTimePeriodOperator;
|
|
18
|
+
}
|
|
19
|
+
declare module '@univerjs/core/facade' {
|
|
20
|
+
interface FEnum extends IFSheetsConditionalFormattingEnum {
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { IAnchor, IConditionFormattingRule } from '@univerjs/sheets-conditional-formatting';
|
|
2
2
|
import { FRange } from '@univerjs/sheets/facade';
|
|
3
|
-
import { FConditionalFormattingBuilder } from './conditional-formatting-builder';
|
|
3
|
+
import { FConditionalFormattingBuilder } from './f-conditional-formatting-builder';
|
|
4
4
|
/**
|
|
5
5
|
* @ignore
|
|
6
6
|
*/
|
|
7
7
|
export interface IFRangeConditionalFormattingMixin {
|
|
8
8
|
/**
|
|
9
|
-
* Gets all the conditional formatting for the current range
|
|
10
|
-
* @returns {IConditionFormattingRule[]} conditional formatting rules for the current range
|
|
9
|
+
* Gets all the conditional formatting for the current range.
|
|
10
|
+
* @returns {IConditionFormattingRule[]} conditional formatting rules for the current range.
|
|
11
11
|
* @example
|
|
12
12
|
* ```ts
|
|
13
13
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
14
14
|
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
15
|
+
*
|
|
16
|
+
* // Create a conditional formatting rule that bolds the text for cells with not empty content in the range A1:T100.
|
|
15
17
|
* const fRange = fWorksheet.getRange('A1:T100');
|
|
16
18
|
* const rule = fWorksheet.newConditionalFormattingRule()
|
|
17
19
|
* .whenCellNotEmpty()
|
|
@@ -22,6 +24,7 @@ export interface IFRangeConditionalFormattingMixin {
|
|
|
22
24
|
* .build();
|
|
23
25
|
* fWorksheet.addConditionalFormattingRule(rule);
|
|
24
26
|
*
|
|
27
|
+
* // Get all the conditional formatting rules for the range F6:H8.
|
|
25
28
|
* const targetRange = fWorksheet.getRange('F6:H8');
|
|
26
29
|
* const rules = targetRange.getConditionalFormattingRules();
|
|
27
30
|
* console.log(rules);
|
|
@@ -35,6 +38,8 @@ export interface IFRangeConditionalFormattingMixin {
|
|
|
35
38
|
* ```ts
|
|
36
39
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
37
40
|
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
41
|
+
*
|
|
42
|
+
* // Create a conditional formatting rule that bolds the text for cells with not empty content in the range A1:T100.
|
|
38
43
|
* const fRange = fWorksheet.getRange('A1:T100');
|
|
39
44
|
* const rule = fRange.createConditionalFormattingRule()
|
|
40
45
|
* .whenCellNotEmpty()
|
|
@@ -49,6 +54,7 @@ export interface IFRangeConditionalFormattingMixin {
|
|
|
49
54
|
createConditionalFormattingRule(): FConditionalFormattingBuilder;
|
|
50
55
|
/**
|
|
51
56
|
* Add a new conditional format
|
|
57
|
+
* @deprecated use same API in FWorkSheet.
|
|
52
58
|
* @param {IConditionFormattingRule} rule
|
|
53
59
|
* @returns {FRange} Returns the current range instance for method chaining
|
|
54
60
|
* @memberof IFRangeConditionalFormattingMixin
|
|
@@ -56,52 +62,47 @@ export interface IFRangeConditionalFormattingMixin {
|
|
|
56
62
|
addConditionalFormattingRule(rule: IConditionFormattingRule): FRange;
|
|
57
63
|
/**
|
|
58
64
|
* Delete conditional format according to `cfId`
|
|
65
|
+
* @deprecated use same API in FWorkSheet.
|
|
59
66
|
* @param {string} cfId
|
|
60
67
|
* @returns {FRange} Returns the current range instance for method chaining
|
|
61
68
|
* @memberof IFRangeConditionalFormattingMixin
|
|
62
|
-
* @example
|
|
63
|
-
* ```ts
|
|
64
|
-
* const workbook = univerAPI.getActiveWorkbook();
|
|
65
|
-
* const worksheet = workbook?.getActiveSheet();
|
|
66
|
-
* const rules = worksheet?.getConditionalFormattingRules();
|
|
67
|
-
* worksheet?.deleteConditionalFormattingRule(rules![0].cfId);
|
|
68
|
-
* ```
|
|
69
69
|
*/
|
|
70
70
|
deleteConditionalFormattingRule(cfId: string): FRange;
|
|
71
71
|
/**
|
|
72
72
|
* Modify the priority of the conditional format
|
|
73
|
+
* @deprecated use same API in FWorkSheet.
|
|
73
74
|
* @param {string} cfId Rules that need to be moved
|
|
74
75
|
* @param {string} toCfId Target rule
|
|
75
76
|
* @param {IAnchor['type']} [type] After the default move to the destination rule, if type = before moves to the front, the default value is after
|
|
76
77
|
* @returns {FRange} Returns the current range instance for method chaining
|
|
77
78
|
* @memberof FRangeConditionalFormattingMixin
|
|
78
|
-
* @example
|
|
79
|
-
* ```ts
|
|
80
|
-
* const workbook = univerAPI.getActiveWorkbook();
|
|
81
|
-
* const worksheet = workbook?.getActiveSheet();
|
|
82
|
-
* const rules = worksheet?.getConditionalFormattingRules()!;
|
|
83
|
-
* const rule = rules[2];
|
|
84
|
-
* const targetRule = rules[0];
|
|
85
|
-
* worksheet?.moveConditionalFormattingRule(rule.cfId, targetRule.cfId, 'before');
|
|
86
|
-
* ```
|
|
87
79
|
*/
|
|
88
80
|
moveConditionalFormattingRule(cfId: string, toCfId: string, type?: IAnchor['type']): FRange;
|
|
89
81
|
/**
|
|
90
82
|
* Set the conditional format according to `cfId`
|
|
83
|
+
* @deprecated use same API in FWorkSheet.
|
|
91
84
|
* @param {string} cfId
|
|
92
85
|
* @param {IConditionFormattingRule} rule
|
|
93
86
|
* @returns {FRange} Returns the current range instance for method chaining
|
|
94
87
|
* @memberof IFRangeConditionalFormattingMixin
|
|
88
|
+
*/
|
|
89
|
+
setConditionalFormattingRule(cfId: string, rule: IConditionFormattingRule): FRange;
|
|
90
|
+
/**
|
|
91
|
+
* Clear the conditional rules for the range.
|
|
92
|
+
* @returns {FRange} Returns the current range instance for method chaining
|
|
93
|
+
* @memberof IFRangeConditionalFormattingMixin
|
|
95
94
|
* @example
|
|
96
95
|
* ```ts
|
|
97
|
-
*
|
|
98
|
-
*
|
|
99
|
-
*
|
|
100
|
-
*
|
|
101
|
-
*
|
|
96
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
97
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
98
|
+
* const fRange = fWorksheet.getRange('A1:T100');
|
|
99
|
+
*
|
|
100
|
+
* // Clear all conditional format rules for the range
|
|
101
|
+
* fRange.clearConditionalFormatRules();
|
|
102
|
+
* console.log(fRange.getConditionalFormattingRules()); // []
|
|
102
103
|
* ```
|
|
103
104
|
*/
|
|
104
|
-
|
|
105
|
+
clearConditionalFormatRules(): FRange;
|
|
105
106
|
}
|
|
106
107
|
export declare class FRangeConditionalFormattingMixin extends FRange implements IFRangeConditionalFormattingMixin {
|
|
107
108
|
private _getConditionalFormattingRuleModel;
|
|
@@ -111,6 +112,7 @@ export declare class FRangeConditionalFormattingMixin extends FRange implements
|
|
|
111
112
|
deleteConditionalFormattingRule(cfId: string): FRange;
|
|
112
113
|
moveConditionalFormattingRule(cfId: string, toCfId: string, type?: IAnchor['type']): FRange;
|
|
113
114
|
setConditionalFormattingRule(cfId: string, rule: IConditionFormattingRule): FRange;
|
|
115
|
+
clearConditionalFormatRules(): FRange;
|
|
114
116
|
}
|
|
115
117
|
declare module '@univerjs/sheets/facade' {
|
|
116
118
|
interface FRange extends IFRangeConditionalFormattingMixin {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { IAnchor, IConditionFormattingRule } from '@univerjs/sheets-conditional-formatting';
|
|
2
2
|
import { FWorksheet } from '@univerjs/sheets/facade';
|
|
3
|
-
import { FConditionalFormattingBuilder } from './conditional-formatting-builder';
|
|
3
|
+
import { FConditionalFormattingBuilder } from './f-conditional-formatting-builder';
|
|
4
4
|
/**
|
|
5
5
|
* @ignore
|
|
6
6
|
*/
|
|
@@ -23,20 +23,6 @@ export interface IFWorksheetConditionalFormattingMixin {
|
|
|
23
23
|
* Creates a constructor for conditional formatting
|
|
24
24
|
* @returns {FConditionalFormattingBuilder} The conditional formatting builder
|
|
25
25
|
* @memberof IFWorksheetConditionalFormattingMixin
|
|
26
|
-
* @example
|
|
27
|
-
* ```ts
|
|
28
|
-
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
29
|
-
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
30
|
-
* const fRange = fWorksheet.getRange('A1:T100');
|
|
31
|
-
* const rule = fWorksheet.createConditionalFormattingRule()
|
|
32
|
-
* .whenCellNotEmpty()
|
|
33
|
-
* .setRanges([fRange.getRange()])
|
|
34
|
-
* .setItalic(true)
|
|
35
|
-
* .setBackground('red')
|
|
36
|
-
* .setFontColor('green')
|
|
37
|
-
* .build();
|
|
38
|
-
* fWorksheet.addConditionalFormattingRule(rule);
|
|
39
|
-
* ```
|
|
40
26
|
*/
|
|
41
27
|
createConditionalFormattingRule(): FConditionalFormattingBuilder;
|
|
42
28
|
/**
|
|
@@ -47,6 +33,8 @@ export interface IFWorksheetConditionalFormattingMixin {
|
|
|
47
33
|
* ```ts
|
|
48
34
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
49
35
|
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
36
|
+
*
|
|
37
|
+
* // Create a conditional formatting rule that bolds the text for cells with not empty content in the range A1:T100.
|
|
50
38
|
* const fRange = fWorksheet.getRange('A1:T100');
|
|
51
39
|
* const rule = fWorksheet.newConditionalFormattingRule()
|
|
52
40
|
* .whenCellNotEmpty()
|
|
@@ -68,6 +56,8 @@ export interface IFWorksheetConditionalFormattingMixin {
|
|
|
68
56
|
* ```ts
|
|
69
57
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
70
58
|
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
59
|
+
*
|
|
60
|
+
* // Create a conditional formatting rule that bolds the text for cells with not empty content in the range A1:T100.
|
|
71
61
|
* const fRange = fWorksheet.getRange('A1:T100');
|
|
72
62
|
* const rule = fWorksheet.newConditionalFormattingRule()
|
|
73
63
|
* .whenCellNotEmpty()
|
|
@@ -90,6 +80,8 @@ export interface IFWorksheetConditionalFormattingMixin {
|
|
|
90
80
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
91
81
|
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
92
82
|
* const rules = fWorksheet.getConditionalFormattingRules();
|
|
83
|
+
*
|
|
84
|
+
* // Delete the first rule
|
|
93
85
|
* fWorksheet.deleteConditionalFormattingRule(rules[0]?.cfId);
|
|
94
86
|
* ```
|
|
95
87
|
*/
|
|
@@ -106,6 +98,8 @@ export interface IFWorksheetConditionalFormattingMixin {
|
|
|
106
98
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
107
99
|
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
108
100
|
* const rules = fWorksheet.getConditionalFormattingRules();
|
|
101
|
+
*
|
|
102
|
+
* // Move the third rule before the first rule
|
|
109
103
|
* const rule = rules[2];
|
|
110
104
|
* const targetRule = rules[0];
|
|
111
105
|
* fWorksheet.moveConditionalFormattingRule(rule?.cfId, targetRule?.cfId, 'before');
|
|
@@ -132,12 +126,26 @@ export interface IFWorksheetConditionalFormattingMixin {
|
|
|
132
126
|
* .build();
|
|
133
127
|
* fWorksheet.addConditionalFormattingRule(rule);
|
|
134
128
|
*
|
|
129
|
+
* // Modify the first rule to apply to a new range
|
|
135
130
|
* const rules = fWorksheet.getConditionalFormattingRules();
|
|
136
131
|
* const newRuleRange = fWorksheet.getRange('A1:D10');
|
|
137
132
|
* fWorksheet.setConditionalFormattingRule(rules[0]?.cfId, { ...rules[0], ranges: [newRuleRange.getRange()] });
|
|
138
133
|
* ```
|
|
139
134
|
*/
|
|
140
135
|
setConditionalFormattingRule(cfId: string, rule: IConditionFormattingRule): FWorksheet;
|
|
136
|
+
/**
|
|
137
|
+
* Removes all conditional format rules from the sheet.
|
|
138
|
+
* @returns {FWorksheet} Returns the current worksheet instance for method chaining
|
|
139
|
+
* @memberof IFWorksheetConditionalFormattingMixin
|
|
140
|
+
* @example
|
|
141
|
+
* ```ts
|
|
142
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
143
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
144
|
+
* fWorksheet.clearConditionalFormatRules();
|
|
145
|
+
* console.log(fWorksheet.getConditionalFormattingRules()); // []
|
|
146
|
+
* ```
|
|
147
|
+
*/
|
|
148
|
+
clearConditionalFormatRules(): FWorksheet;
|
|
141
149
|
}
|
|
142
150
|
export declare class FWorksheetConditionalFormattingMixin extends FWorksheet implements IFWorksheetConditionalFormattingMixin {
|
|
143
151
|
private _getConditionalFormattingRuleModel;
|
|
@@ -148,6 +156,7 @@ export declare class FWorksheetConditionalFormattingMixin extends FWorksheet imp
|
|
|
148
156
|
deleteConditionalFormattingRule(cfId: string): FWorksheet;
|
|
149
157
|
moveConditionalFormattingRule(cfId: string, toCfId: string, type?: IAnchor['type']): FWorksheet;
|
|
150
158
|
setConditionalFormattingRule(cfId: string, rule: IConditionFormattingRule): FWorksheet;
|
|
159
|
+
clearConditionalFormatRules(): FWorksheet;
|
|
151
160
|
}
|
|
152
161
|
declare module '@univerjs/sheets/facade' {
|
|
153
162
|
interface FWorksheet extends IFWorksheetConditionalFormattingMixin {
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
import './f-range';
|
|
17
17
|
import './f-workbook';
|
|
18
18
|
import './f-worksheet';
|
|
19
|
-
|
|
19
|
+
import './f-enum';
|
|
20
|
+
export { FConditionalFormattingBuilder } from './f-conditional-formatting-builder';
|
|
20
21
|
export type { IFRangeConditionalFormattingMixin } from './f-range';
|
|
21
22
|
export type { FWorkbookConditionalFormattingMixin } from './f-workbook';
|
|
22
23
|
export type { IFWorksheetConditionalFormattingMixin } from './f-worksheet';
|
package/lib/types/index.d.ts
CHANGED
|
@@ -30,6 +30,12 @@ export * from './utils/create-cf-id';
|
|
|
30
30
|
export * from './utils/is-ranges-equal';
|
|
31
31
|
export * from './utils/remove-undefined-attr';
|
|
32
32
|
export * from './utils/type';
|
|
33
|
+
export { AddCfCommand, type IAddCfCommandParams, } from './commands/commands/add-cf.command';
|
|
34
|
+
export { ClearRangeCfCommand, type IClearRangeCfParams, } from './commands/commands/clear-range-cf.command';
|
|
35
|
+
export { ClearWorksheetCfCommand, type IClearWorksheetCfParams, } from './commands/commands/clear-worksheet-cf.command';
|
|
36
|
+
export { DeleteCfCommand, type IDeleteCfCommandParams, } from './commands/commands/delete-cf.command';
|
|
37
|
+
export { type IMoveCfCommandParams, MoveCfCommand, } from './commands/commands/move-cf.command';
|
|
38
|
+
export { type ISetCfCommandParams, SetCfCommand, } from './commands/commands/set-cf.command';
|
|
33
39
|
export { AddConditionalRuleMutation, AddConditionalRuleMutationUndoFactory, type IAddConditionalRuleMutationParams, } from './commands/mutations/add-conditional-rule.mutation';
|
|
34
40
|
export { DeleteConditionalRuleMutation, DeleteConditionalRuleMutationUndoFactory, type IDeleteConditionalRuleMutationParams, } from './commands/mutations/delete-conditional-rule.mutation';
|
|
35
41
|
export { ConditionalFormattingFormulaMarkDirty } from './commands/mutations/formula-mark-dirty.mutation';
|
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 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"})});
|
|
1
|
+
(function(l,u){typeof exports=="object"&&typeof module<"u"?u(exports,require("@univerjs/core"),require("@univerjs/sheets-conditional-formatting"),require("@univerjs/sheets/facade"),require("@univerjs/core/facade")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-conditional-formatting","@univerjs/sheets/facade","@univerjs/core/facade"],u):(l=typeof globalThis<"u"?globalThis:l||self,u(l.UniverSheetsConditionalFormattingFacade={},l.UniverCore,l.UniverSheetsConditionalFormatting,l.UniverSheetsFacade,l.UniverCoreFacade))})(this,function(l,u,t,C,y){"use strict";var R=Object.defineProperty;var m=(l,u,t)=>u in l?R(l,u,{enumerable:!0,configurable:!0,writable:!0,value:t}):l[u]=t;var T=(l,u,t)=>m(l,typeof u!="symbol"?u+"":u,t);class o{constructor(e={}){T(this,"_rule",{});this._rule=e,this._ensureAttr(this._rule,["rule"])}get _ruleConfig(){return this._rule.rule||null}_getDefaultConfig(e=t.CFRuleType.highlightCell){switch(e){case t.CFRuleType.colorScale:return{type:e,config:[{index:0,color:new u.ColorKit("").toRgbString(),value:{type:t.CFValueType.min}},{index:0,color:new u.ColorKit("green").toRgbString(),value:{type:t.CFValueType.max}}]};case t.CFRuleType.dataBar:return{type:e,isShowValue:!0,config:{min:{type:t.CFValueType.min},max:{type:t.CFValueType.max},positiveColor:new u.ColorKit("green").toRgbString(),nativeColor:new u.ColorKit("").toRgbString(),isGradient:!1}};case t.CFRuleType.highlightCell:return{type:e,subType:t.CFSubRuleType.text,operator:t.CFTextOperator.containsText,value:"abc",style:{}};case t.CFRuleType.iconSet:return{type:e,isShowValue:!0,config:[{operator:t.CFNumberOperator.greaterThanOrEqual,value:{type:t.CFValueType.min},iconType:t.EMPTY_ICON_TYPE,iconId:""},{operator:t.CFNumberOperator.greaterThanOrEqual,value:{type:t.CFValueType.percentile,value:.5},iconType:t.EMPTY_ICON_TYPE,iconId:""},{operator:t.CFNumberOperator.lessThanOrEqual,value:{type:t.CFValueType.max},iconType:t.EMPTY_ICON_TYPE,iconId:""}]}}}_ensureAttr(e,r){return r.reduce((i,s)=>(i[s]||(i[s]={}),i[s]),e),e}build(){var i;this._rule.cfId||(this._rule.cfId=t.createCfId()),this._rule.ranges||(this._rule.ranges=[]),this._rule.stopIfTrue===void 0&&(this._rule.stopIfTrue=!1),(i=this._rule.rule)!=null&&i.type||(this._rule.rule.type=t.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(){const e=u.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=t.createCfId()),new o(e)}getRanges(){return this._rule.ranges||[]}getIconMap(){return t.iconMap}createCfId(){return t.createCfId()}setRanges(e){return this._rule.ranges=e,this}}class n extends o{constructor(e={}){super(e),this._ensureAttr(this._rule,["rule","style"])}copy(){const e=u.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=t.createCfId()),new n(e)}setAverage(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.average,r.operator=e,this}setUniqueValues(){const e=this._ruleConfig;return e.type=t.CFRuleType.highlightCell,e.subType=t.CFSubRuleType.uniqueValues,this}setDuplicateValues(){const e=this._ruleConfig;return e.type=t.CFRuleType.highlightCell,e.subType=t.CFSubRuleType.duplicateValues,this}setRank(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.rank,r.isBottom=e.isBottom,r.isPercent=e.isPercent,r.value=e.value,this}setBackground(e){var r;if(((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell)if(e){this._ensureAttr(this._ruleConfig,["style","bg"]);const i=new u.ColorKit(e);this._ruleConfig.style.bg.rgb=i.toRgbString()}else delete this._ruleConfig.style.bg;return this}setBold(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style"]),this._ruleConfig.style.bl=e?u.BooleanNumber.TRUE:u.BooleanNumber.FALSE),this}setFontColor(e){var r;if(((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell)if(e){const i=new u.ColorKit(e);this._ensureAttr(this._ruleConfig,["style","cl"]),this._ruleConfig.style.cl.rgb=i.toRgbString()}else delete this._ruleConfig.style.cl;return this}setItalic(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style"]),this._ruleConfig.style.it=e?u.BooleanNumber.TRUE:u.BooleanNumber.FALSE),this}setStrikethrough(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style","st"]),this._ruleConfig.style.st.s=e?u.BooleanNumber.TRUE:u.BooleanNumber.FALSE),this}setUnderline(e){var r;return((r=this._ruleConfig)==null?void 0:r.type)===t.CFRuleType.highlightCell&&(this._ensureAttr(this._ruleConfig,["style","ul"]),this._ruleConfig.style.ul.s=e?u.BooleanNumber.TRUE:u.BooleanNumber.FALSE),this}whenCellEmpty(){const e=this._ruleConfig;return e.type=t.CFRuleType.highlightCell,e.subType=t.CFSubRuleType.text,e.value="",e.operator=t.CFTextOperator.equal,this}whenCellNotEmpty(){const e=this._ruleConfig;return e.type=t.CFRuleType.highlightCell,e.subType=t.CFSubRuleType.text,e.value="",e.operator=t.CFTextOperator.notEqual,this}whenDate(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.timePeriod,r.operator=e,this}whenFormulaSatisfied(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.formula,r.value=e,this}whenNumberBetween(e,r){const i=Math.min(e,r),s=Math.max(e,r),h=this._ruleConfig;return h.type=t.CFRuleType.highlightCell,h.subType=t.CFSubRuleType.number,h.value=[i,s],h.operator=t.CFNumberOperator.between,this}whenNumberEqualTo(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.number,r.value=e,r.operator=t.CFNumberOperator.equal,this}whenNumberGreaterThan(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.number,r.value=e,r.operator=t.CFNumberOperator.greaterThan,this}whenNumberGreaterThanOrEqualTo(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.number,r.value=e,r.operator=t.CFNumberOperator.greaterThanOrEqual,this}whenNumberLessThan(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.number,r.value=e,r.operator=t.CFNumberOperator.lessThan,this}whenNumberLessThanOrEqualTo(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.number,r.value=e,r.operator=t.CFNumberOperator.lessThanOrEqual,this}whenNumberNotBetween(e,r){const i=Math.min(e,r),s=Math.max(e,r),h=this._ruleConfig;return h.type=t.CFRuleType.highlightCell,h.subType=t.CFSubRuleType.number,h.value=[i,s],h.operator=t.CFNumberOperator.notBetween,this}whenNumberNotEqualTo(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.number,r.value=e,r.operator=t.CFNumberOperator.notEqual,this}whenTextContains(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.text,r.value=e,r.operator=t.CFTextOperator.containsText,this}whenTextDoesNotContain(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.text,r.value=e,r.operator=t.CFTextOperator.notContainsText,this}whenTextEndsWith(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.text,r.value=e,r.operator=t.CFTextOperator.endsWith,this}whenTextEqualTo(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.text,r.value=e,r.operator=t.CFTextOperator.equal,this}whenTextStartsWith(e){const r=this._ruleConfig;return r.type=t.CFRuleType.highlightCell,r.subType=t.CFSubRuleType.text,r.value=e,r.operator=t.CFTextOperator.beginsWith,this}}class f extends o{copy(){const e=u.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=t.createCfId()),new f(e)}setDataBar(e){const r=this._ruleConfig;return r.type=t.CFRuleType.dataBar,r.isShowValue=!!e.isShowValue,r.config={min:e.min,max:e.max,positiveColor:e.positiveColor,nativeColor:e.nativeColor,isGradient:!!e.isGradient},this}}class c extends o{copy(){const e=u.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=t.createCfId()),new c(e)}setColorScale(e){const r=this._ruleConfig;return r.type=t.CFRuleType.colorScale,r.config=e,this}}class g extends o{copy(){const e=u.Tools.deepClone(this._rule);return e.cfId&&(e.cfId=t.createCfId()),new g(e)}setIconSet(e){const r=this._ruleConfig;return r.type=t.CFRuleType.iconSet,r.config=e.iconConfigs,r.isShowValue=e.isShowValue,this}}class p{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)}getIconMap(){return t.iconMap}setIconSet(e){return new g(this._initConfig).setIconSet(e)}setColorScale(e){return new c(this._initConfig).setColorScale(e)}setDataBar(e){return new f(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,r){return new n(this._initConfig).whenNumberBetween(e,r)}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,r){return new n(this._initConfig).whenNumberNotBetween(e,r)}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 _ extends C.FRange{_getConditionalFormattingRuleModel(){return this._injector.get(t.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]].filter(r=>r.ranges.some(i=>u.Rectangle.intersects(i,this._range)))}createConditionalFormattingRule(){return new p({ranges:[this._range]})}addConditionalFormattingRule(e){const r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:e};return this._commandService.syncExecuteCommand(t.AddCfCommand.id,r),this}deleteConditionalFormattingRule(e){const r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(t.DeleteCfCommand.id,r),this}moveConditionalFormattingRule(e,r,i="after"){const s={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:"self"},end:{id:r,type:i}};return this._commandService.syncExecuteCommand(t.MoveCfCommand.id,s),this}setConditionalFormattingRule(e,r){const i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:r,cfId:e};return this._commandService.syncExecuteCommand(t.SetCfCommand.id,i),this}clearConditionalFormatRules(){const e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]};return this._commandService.syncExecuteCommand(t.ClearRangeCfCommand.id,e),this}}C.FRange.extend(_);class w extends C.FWorkbook{newColor(){return new u.ColorBuilder}}C.FWorkbook.extend(w);class b extends C.FWorksheet{_getConditionalFormattingRuleModel(){return this._injector.get(t.ConditionalFormattingRuleModel)}getConditionalFormattingRules(){return[...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(),this._worksheet.getSheetId())||[]]}createConditionalFormattingRule(){return new p}newConditionalFormattingRule(){return new p}addConditionalFormattingRule(e){const r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:e};return this._commandService.syncExecuteCommand(t.AddCfCommand.id,r),this}deleteConditionalFormattingRule(e){const r={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e};return this._commandService.syncExecuteCommand(t.DeleteCfCommand.id,r),this}moveConditionalFormattingRule(e,r,i="after"){const s={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),start:{id:e,type:"self"},end:{id:r,type:i}};return this._commandService.syncExecuteCommand(t.MoveCfCommand.id,s),this}setConditionalFormattingRule(e,r){const i={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),cfId:e,rule:r};return this._commandService.syncExecuteCommand(t.SetCfCommand.id,i),this}clearConditionalFormatRules(){const e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId()};return this._commandService.syncExecuteCommand(t.ClearWorksheetCfCommand.id,e),this}}C.FWorksheet.extend(b);class d{get ConditionFormatNumberOperatorEnum(){return t.CFNumberOperator}get ConditionFormatTimePeriodOperatorEnum(){return t.CFTimePeriodOperator}}y.FEnum.extend(d),l.FConditionalFormattingBuilder=p,Object.defineProperty(l,Symbol.toStringTag,{value:"Module"})});
|