@univerjs/sheets-conditional-formatting 0.5.5-nightly.202501211606 → 0.5.5
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/LICENSE +176 -0
- package/lib/es/facade.js +271 -290
- package/lib/es/index.js +1199 -1217
- package/lib/types/facade/conditional-formatting-builder.d.ts +0 -9
- package/package.json +5 -5
package/lib/es/facade.js
CHANGED
|
@@ -1,63 +1,62 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
this._rule = initRule, this._ensureAttr(this._rule, ["rule"]);
|
|
1
|
+
var N = Object.defineProperty;
|
|
2
|
+
var q = (u, e, t) => e in u ? N(u, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : u[e] = t;
|
|
3
|
+
var b = (u, e, t) => q(u, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { ColorKit as c, Tools as _, BooleanNumber as a, Rectangle as U, ColorBuilder as B } from "@univerjs/core";
|
|
5
|
+
import { CFRuleType as n, CFNumberOperator as l, CFValueType as C, EMPTY_ICON_TYPE as f, CFSubRuleType as o, CFTextOperator as g, createCfId as T, iconMap as M, ConditionalFormattingRuleModel as x, AddConditionalRuleMutation as S, DeleteConditionalRuleMutation as I, MoveConditionalRuleMutation as E, SetConditionalRuleMutation as k } from "@univerjs/sheets-conditional-formatting";
|
|
6
|
+
import { FRange as v, FWorkbook as F, FWorksheet as R } from "@univerjs/sheets/facade";
|
|
7
|
+
class d {
|
|
8
|
+
constructor(e = {}) {
|
|
9
|
+
b(this, "_rule", {});
|
|
10
|
+
this._rule = e, this._ensureAttr(this._rule, ["rule"]);
|
|
12
11
|
}
|
|
13
12
|
get _ruleConfig() {
|
|
14
13
|
return this._rule.rule || null;
|
|
15
14
|
}
|
|
16
|
-
_getDefaultConfig(
|
|
17
|
-
switch (
|
|
18
|
-
case
|
|
15
|
+
_getDefaultConfig(e = n.highlightCell) {
|
|
16
|
+
switch (e) {
|
|
17
|
+
case n.colorScale:
|
|
19
18
|
return {
|
|
20
|
-
type,
|
|
19
|
+
type: e,
|
|
21
20
|
config: [
|
|
22
|
-
{ index: 0, color: new
|
|
23
|
-
{ index: 0, color: new
|
|
21
|
+
{ index: 0, color: new c("").toRgbString(), value: { type: C.min } },
|
|
22
|
+
{ index: 0, color: new c("green").toRgbString(), value: { type: C.max } }
|
|
24
23
|
]
|
|
25
24
|
};
|
|
26
|
-
case
|
|
25
|
+
case n.dataBar:
|
|
27
26
|
return {
|
|
28
|
-
type,
|
|
27
|
+
type: e,
|
|
29
28
|
isShowValue: !0,
|
|
30
|
-
config: { min: { type:
|
|
29
|
+
config: { min: { type: C.min }, max: { type: C.max }, positiveColor: new c("green").toRgbString(), nativeColor: new c("").toRgbString(), isGradient: !1 }
|
|
31
30
|
};
|
|
32
|
-
case
|
|
31
|
+
case n.highlightCell:
|
|
33
32
|
return {
|
|
34
|
-
type,
|
|
35
|
-
subType:
|
|
36
|
-
operator:
|
|
33
|
+
type: e,
|
|
34
|
+
subType: o.text,
|
|
35
|
+
operator: g.containsText,
|
|
37
36
|
value: "abc",
|
|
38
37
|
style: {}
|
|
39
38
|
};
|
|
40
|
-
case
|
|
39
|
+
case n.iconSet:
|
|
41
40
|
return {
|
|
42
|
-
type,
|
|
41
|
+
type: e,
|
|
43
42
|
isShowValue: !0,
|
|
44
43
|
config: [
|
|
45
44
|
{
|
|
46
|
-
operator:
|
|
47
|
-
value: { type:
|
|
48
|
-
iconType:
|
|
45
|
+
operator: l.greaterThanOrEqual,
|
|
46
|
+
value: { type: C.min },
|
|
47
|
+
iconType: f,
|
|
49
48
|
iconId: ""
|
|
50
49
|
},
|
|
51
50
|
{
|
|
52
|
-
operator:
|
|
53
|
-
value: { type:
|
|
54
|
-
iconType:
|
|
51
|
+
operator: l.greaterThanOrEqual,
|
|
52
|
+
value: { type: C.percentile, value: 0.5 },
|
|
53
|
+
iconType: f,
|
|
55
54
|
iconId: ""
|
|
56
55
|
},
|
|
57
56
|
{
|
|
58
|
-
operator:
|
|
59
|
-
value: { type:
|
|
60
|
-
iconType:
|
|
57
|
+
operator: l.lessThanOrEqual,
|
|
58
|
+
value: { type: C.max },
|
|
59
|
+
iconType: f,
|
|
61
60
|
iconId: ""
|
|
62
61
|
}
|
|
63
62
|
]
|
|
@@ -65,14 +64,14 @@ const _ConditionalFormatRuleBaseBuilder = class _ConditionalFormatRuleBaseBuilde
|
|
|
65
64
|
}
|
|
66
65
|
}
|
|
67
66
|
// eslint-disable-next-line ts/no-explicit-any
|
|
68
|
-
_ensureAttr(
|
|
69
|
-
return
|
|
67
|
+
_ensureAttr(e, t) {
|
|
68
|
+
return t.reduce((r, s) => (r[s] || (r[s] = {}), r[s]), e), e;
|
|
70
69
|
}
|
|
71
70
|
build() {
|
|
72
|
-
var
|
|
73
|
-
this._rule.cfId || (this._rule.cfId =
|
|
74
|
-
const
|
|
75
|
-
return { ...this._rule, rule: { ...
|
|
71
|
+
var r;
|
|
72
|
+
this._rule.cfId || (this._rule.cfId = T()), this._rule.ranges || (this._rule.ranges = []), this._rule.stopIfTrue === void 0 && (this._rule.stopIfTrue = !1), (r = this._rule.rule) != null && r.type || (this._rule.rule.type = n.highlightCell, this._ensureAttr(this._rule, ["rule", "style"]));
|
|
73
|
+
const e = this._getDefaultConfig(this._rule.rule.type);
|
|
74
|
+
return { ...this._rule, rule: { ...e, ...this._rule.rule } };
|
|
76
75
|
}
|
|
77
76
|
/**
|
|
78
77
|
* Deep clone a current builder.
|
|
@@ -80,7 +79,7 @@ const _ConditionalFormatRuleBaseBuilder = class _ConditionalFormatRuleBaseBuilde
|
|
|
80
79
|
* @memberof ConditionalFormatRuleBuilder
|
|
81
80
|
*/
|
|
82
81
|
copy() {
|
|
83
|
-
return new
|
|
82
|
+
return new d(_.deepClone(this._rule));
|
|
84
83
|
}
|
|
85
84
|
/**
|
|
86
85
|
* Gets the scope of the current conditional format
|
|
@@ -94,7 +93,7 @@ const _ConditionalFormatRuleBaseBuilder = class _ConditionalFormatRuleBaseBuilde
|
|
|
94
93
|
* Get the icon set mapping dictionary
|
|
95
94
|
*/
|
|
96
95
|
getIconMap() {
|
|
97
|
-
return
|
|
96
|
+
return M;
|
|
98
97
|
}
|
|
99
98
|
/**
|
|
100
99
|
* Create a conditional format ID.
|
|
@@ -102,7 +101,7 @@ const _ConditionalFormatRuleBaseBuilder = class _ConditionalFormatRuleBaseBuilde
|
|
|
102
101
|
* @memberof ConditionalFormatRuleBuilder
|
|
103
102
|
*/
|
|
104
103
|
createCfId() {
|
|
105
|
-
return
|
|
104
|
+
return T();
|
|
106
105
|
}
|
|
107
106
|
/**
|
|
108
107
|
* Sets the scope for conditional formatting
|
|
@@ -110,43 +109,41 @@ const _ConditionalFormatRuleBaseBuilder = class _ConditionalFormatRuleBaseBuilde
|
|
|
110
109
|
* @returns {*}
|
|
111
110
|
* @memberof ConditionalFormatRuleBuilder
|
|
112
111
|
*/
|
|
113
|
-
setRanges(
|
|
114
|
-
return this._rule.ranges =
|
|
112
|
+
setRanges(e) {
|
|
113
|
+
return this._rule.ranges = e, this;
|
|
115
114
|
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
constructor(initConfig = {}) {
|
|
121
|
-
super(initConfig), this._ensureAttr(this._rule, ["rule", "style"]);
|
|
115
|
+
}
|
|
116
|
+
class i extends d {
|
|
117
|
+
constructor(e = {}) {
|
|
118
|
+
super(e), this._ensureAttr(this._rule, ["rule", "style"]);
|
|
122
119
|
}
|
|
123
120
|
copy() {
|
|
124
|
-
return new
|
|
121
|
+
return new i(_.deepClone(this._rule));
|
|
125
122
|
}
|
|
126
123
|
/**
|
|
127
124
|
* Set average rule
|
|
128
125
|
* @param {IAverageHighlightCell['operator']} operator
|
|
129
126
|
* @memberof ConditionalFormatHighlightRuleBuilder
|
|
130
127
|
*/
|
|
131
|
-
setAverage(
|
|
132
|
-
const
|
|
133
|
-
return
|
|
128
|
+
setAverage(e) {
|
|
129
|
+
const t = this._ruleConfig;
|
|
130
|
+
return t.type = n.highlightCell, t.subType = o.average, t.operator = e, this;
|
|
134
131
|
}
|
|
135
132
|
/**
|
|
136
133
|
* Set uniqueValues rule
|
|
137
134
|
* @memberof ConditionalFormatHighlightRuleBuilder
|
|
138
135
|
*/
|
|
139
136
|
setUniqueValues() {
|
|
140
|
-
const
|
|
141
|
-
return
|
|
137
|
+
const e = this._ruleConfig;
|
|
138
|
+
return e.type = n.highlightCell, e.subType = o.uniqueValues, this;
|
|
142
139
|
}
|
|
143
140
|
/**
|
|
144
141
|
* Set duplicateValues rule
|
|
145
142
|
* @memberof ConditionalFormatHighlightRuleBuilder
|
|
146
143
|
*/
|
|
147
144
|
setDuplicateValues() {
|
|
148
|
-
const
|
|
149
|
-
return
|
|
145
|
+
const e = this._ruleConfig;
|
|
146
|
+
return e.type = n.highlightCell, e.subType = o.duplicateValues, this;
|
|
150
147
|
}
|
|
151
148
|
/**
|
|
152
149
|
* Set rank rule
|
|
@@ -156,9 +153,9 @@ const _ConditionalFormatHighlightRuleBuilder = class _ConditionalFormatHighlight
|
|
|
156
153
|
* @param config.value
|
|
157
154
|
* @memberof ConditionalFormatHighlightRuleBuilder
|
|
158
155
|
*/
|
|
159
|
-
setRank(
|
|
160
|
-
const
|
|
161
|
-
return
|
|
156
|
+
setRank(e) {
|
|
157
|
+
const t = this._ruleConfig;
|
|
158
|
+
return t.type = n.highlightCell, t.subType = o.rank, t.isBottom = e.isBottom, t.isPercent = e.isPercent, t.value = e.value, this;
|
|
162
159
|
}
|
|
163
160
|
/**
|
|
164
161
|
* Sets the background color
|
|
@@ -166,13 +163,13 @@ const _ConditionalFormatHighlightRuleBuilder = class _ConditionalFormatHighlight
|
|
|
166
163
|
* @returns {*}
|
|
167
164
|
* @memberof ConditionalFormatRuleBuilder
|
|
168
165
|
*/
|
|
169
|
-
setBackground(
|
|
170
|
-
var
|
|
171
|
-
if (((
|
|
172
|
-
if (
|
|
166
|
+
setBackground(e) {
|
|
167
|
+
var t;
|
|
168
|
+
if (((t = this._ruleConfig) == null ? void 0 : t.type) === n.highlightCell)
|
|
169
|
+
if (e) {
|
|
173
170
|
this._ensureAttr(this._ruleConfig, ["style", "bg"]);
|
|
174
|
-
const
|
|
175
|
-
this._ruleConfig.style.bg.rgb =
|
|
171
|
+
const r = new c(e);
|
|
172
|
+
this._ruleConfig.style.bg.rgb = r.toRgbString();
|
|
176
173
|
} else
|
|
177
174
|
delete this._ruleConfig.style.bg;
|
|
178
175
|
return this;
|
|
@@ -183,9 +180,9 @@ const _ConditionalFormatHighlightRuleBuilder = class _ConditionalFormatHighlight
|
|
|
183
180
|
* @returns {*}
|
|
184
181
|
* @memberof ConditionalFormatRuleBuilder
|
|
185
182
|
*/
|
|
186
|
-
setBold(
|
|
187
|
-
var
|
|
188
|
-
return ((
|
|
183
|
+
setBold(e) {
|
|
184
|
+
var t;
|
|
185
|
+
return ((t = this._ruleConfig) == null ? void 0 : t.type) === n.highlightCell && (this._ensureAttr(this._ruleConfig, ["style"]), this._ruleConfig.style.bl = e ? a.TRUE : a.FALSE), this;
|
|
189
186
|
}
|
|
190
187
|
/**
|
|
191
188
|
* Sets the font color
|
|
@@ -193,12 +190,12 @@ const _ConditionalFormatHighlightRuleBuilder = class _ConditionalFormatHighlight
|
|
|
193
190
|
* @returns {*}
|
|
194
191
|
* @memberof ConditionalFormatRuleBuilder
|
|
195
192
|
*/
|
|
196
|
-
setFontColor(
|
|
197
|
-
var
|
|
198
|
-
if (((
|
|
199
|
-
if (
|
|
200
|
-
const
|
|
201
|
-
this._ensureAttr(this._ruleConfig, ["style", "cl"]), this._ruleConfig.style.cl.rgb =
|
|
193
|
+
setFontColor(e) {
|
|
194
|
+
var t;
|
|
195
|
+
if (((t = this._ruleConfig) == null ? void 0 : t.type) === n.highlightCell)
|
|
196
|
+
if (e) {
|
|
197
|
+
const r = new c(e);
|
|
198
|
+
this._ensureAttr(this._ruleConfig, ["style", "cl"]), this._ruleConfig.style.cl.rgb = r.toRgbString();
|
|
202
199
|
} else
|
|
203
200
|
delete this._ruleConfig.style.cl;
|
|
204
201
|
return this;
|
|
@@ -209,9 +206,9 @@ const _ConditionalFormatHighlightRuleBuilder = class _ConditionalFormatHighlight
|
|
|
209
206
|
* @returns {*}
|
|
210
207
|
* @memberof ConditionalFormatRuleBuilder
|
|
211
208
|
*/
|
|
212
|
-
setItalic(
|
|
213
|
-
var
|
|
214
|
-
return ((
|
|
209
|
+
setItalic(e) {
|
|
210
|
+
var t;
|
|
211
|
+
return ((t = this._ruleConfig) == null ? void 0 : t.type) === n.highlightCell && (this._ensureAttr(this._ruleConfig, ["style"]), this._ruleConfig.style.it = e ? a.TRUE : a.FALSE), this;
|
|
215
212
|
}
|
|
216
213
|
/**
|
|
217
214
|
* Set the strikethrough
|
|
@@ -219,9 +216,9 @@ const _ConditionalFormatHighlightRuleBuilder = class _ConditionalFormatHighlight
|
|
|
219
216
|
* @returns {*}
|
|
220
217
|
* @memberof ConditionalFormatRuleBuilder
|
|
221
218
|
*/
|
|
222
|
-
setStrikethrough(
|
|
223
|
-
var
|
|
224
|
-
return ((
|
|
219
|
+
setStrikethrough(e) {
|
|
220
|
+
var t;
|
|
221
|
+
return ((t = this._ruleConfig) == null ? void 0 : t.type) === n.highlightCell && (this._ensureAttr(this._ruleConfig, ["style", "st"]), this._ruleConfig.style.st.s = e ? a.TRUE : a.FALSE), this;
|
|
225
222
|
}
|
|
226
223
|
/**
|
|
227
224
|
* Set the underscore
|
|
@@ -229,16 +226,16 @@ const _ConditionalFormatHighlightRuleBuilder = class _ConditionalFormatHighlight
|
|
|
229
226
|
* @returns {*}
|
|
230
227
|
* @memberof ConditionalFormatRuleBuilder
|
|
231
228
|
*/
|
|
232
|
-
setUnderline(
|
|
233
|
-
var
|
|
234
|
-
return ((
|
|
229
|
+
setUnderline(e) {
|
|
230
|
+
var t;
|
|
231
|
+
return ((t = this._ruleConfig) == null ? void 0 : t.type) === n.highlightCell && (this._ensureAttr(this._ruleConfig, ["style", "ul"]), this._ruleConfig.style.ul.s = e ? a.TRUE : a.FALSE), this;
|
|
235
232
|
}
|
|
236
233
|
/**
|
|
237
234
|
* Sets the conditional formatting rule to fire when the cell is empty.
|
|
238
235
|
*/
|
|
239
236
|
whenCellEmpty() {
|
|
240
|
-
const
|
|
241
|
-
return
|
|
237
|
+
const e = this._ruleConfig;
|
|
238
|
+
return e.type = n.highlightCell, e.subType = o.text, e.value = "", e.operator = g.equal, this;
|
|
242
239
|
}
|
|
243
240
|
/**
|
|
244
241
|
* Sets the conditional formatting rule to fire when the cell is not empty
|
|
@@ -246,8 +243,8 @@ const _ConditionalFormatHighlightRuleBuilder = class _ConditionalFormatHighlight
|
|
|
246
243
|
* @memberof ConditionalFormatRuleBuilder
|
|
247
244
|
*/
|
|
248
245
|
whenCellNotEmpty() {
|
|
249
|
-
const
|
|
250
|
-
return
|
|
246
|
+
const e = this._ruleConfig;
|
|
247
|
+
return e.type = n.highlightCell, e.subType = o.text, e.value = "", e.operator = g.notEqual, this;
|
|
251
248
|
}
|
|
252
249
|
/**
|
|
253
250
|
* Highlight when the date is in a time period, custom time is not supported.
|
|
@@ -255,18 +252,18 @@ const _ConditionalFormatHighlightRuleBuilder = class _ConditionalFormatHighlight
|
|
|
255
252
|
* @returns {*}
|
|
256
253
|
* @memberof ConditionalFormatRuleBuilder
|
|
257
254
|
*/
|
|
258
|
-
whenDate(
|
|
259
|
-
const
|
|
260
|
-
return
|
|
255
|
+
whenDate(e) {
|
|
256
|
+
const t = this._ruleConfig;
|
|
257
|
+
return t.type = n.highlightCell, t.subType = o.timePeriod, t.operator = e, this;
|
|
261
258
|
}
|
|
262
259
|
/**
|
|
263
260
|
* Sets a conditional formatting rule to fire when a given formula evaluates to true.
|
|
264
261
|
* @param {string} formulaString formulaString start with' = '
|
|
265
262
|
* @memberof ConditionalFormatRuleBuilder
|
|
266
263
|
*/
|
|
267
|
-
whenFormulaSatisfied(
|
|
268
|
-
const
|
|
269
|
-
return
|
|
264
|
+
whenFormulaSatisfied(e) {
|
|
265
|
+
const t = this._ruleConfig;
|
|
266
|
+
return t.type = n.highlightCell, t.subType = o.formula, t.value = e, this;
|
|
270
267
|
}
|
|
271
268
|
/**
|
|
272
269
|
* Sets the conditional formatting rule to fire when a number is between two specified values or equal to one of them.
|
|
@@ -274,54 +271,54 @@ const _ConditionalFormatHighlightRuleBuilder = class _ConditionalFormatHighlight
|
|
|
274
271
|
* @param {number} end
|
|
275
272
|
* @memberof ConditionalFormatRuleBuilder
|
|
276
273
|
*/
|
|
277
|
-
whenNumberBetween(
|
|
278
|
-
const
|
|
279
|
-
return
|
|
274
|
+
whenNumberBetween(e, t) {
|
|
275
|
+
const r = Math.min(e, t), s = Math.max(e, t), h = this._ruleConfig;
|
|
276
|
+
return h.type = n.highlightCell, h.subType = o.number, h.value = [r, s], h.operator = l.between, this;
|
|
280
277
|
}
|
|
281
278
|
/**
|
|
282
279
|
* Sets the conditional formatting rule to fire when the number equals the given value
|
|
283
280
|
* @param {number} value
|
|
284
281
|
* @memberof ConditionalFormatRuleBuilder
|
|
285
282
|
*/
|
|
286
|
-
whenNumberEqualTo(
|
|
287
|
-
const
|
|
288
|
-
return
|
|
283
|
+
whenNumberEqualTo(e) {
|
|
284
|
+
const t = this._ruleConfig;
|
|
285
|
+
return t.type = n.highlightCell, t.subType = o.number, t.value = e, t.operator = l.equal, this;
|
|
289
286
|
}
|
|
290
287
|
/**
|
|
291
288
|
* Sets the conditional formatting rule to fire when the number is greater than the given value
|
|
292
289
|
* @param {number} value
|
|
293
290
|
* @memberof ConditionalFormatRuleBuilder
|
|
294
291
|
*/
|
|
295
|
-
whenNumberGreaterThan(
|
|
296
|
-
const
|
|
297
|
-
return
|
|
292
|
+
whenNumberGreaterThan(e) {
|
|
293
|
+
const t = this._ruleConfig;
|
|
294
|
+
return t.type = n.highlightCell, t.subType = o.number, t.value = e, t.operator = l.greaterThan, this;
|
|
298
295
|
}
|
|
299
296
|
/**
|
|
300
297
|
* Sets a conditional formatting rule to fire when a number is greater than or equal to a given value.
|
|
301
298
|
* @param {number} value
|
|
302
299
|
* @memberof ConditionalFormatRuleBuilder
|
|
303
300
|
*/
|
|
304
|
-
whenNumberGreaterThanOrEqualTo(
|
|
305
|
-
const
|
|
306
|
-
return
|
|
301
|
+
whenNumberGreaterThanOrEqualTo(e) {
|
|
302
|
+
const t = this._ruleConfig;
|
|
303
|
+
return t.type = n.highlightCell, t.subType = o.number, t.value = e, t.operator = l.greaterThanOrEqual, this;
|
|
307
304
|
}
|
|
308
305
|
/**
|
|
309
306
|
* Sets a conditional formatting rule to fire when the number is less than the given value.
|
|
310
307
|
* @param {number} value
|
|
311
308
|
* @memberof ConditionalFormatRuleBuilder
|
|
312
309
|
*/
|
|
313
|
-
whenNumberLessThan(
|
|
314
|
-
const
|
|
315
|
-
return
|
|
310
|
+
whenNumberLessThan(e) {
|
|
311
|
+
const t = this._ruleConfig;
|
|
312
|
+
return t.type = n.highlightCell, t.subType = o.number, t.value = e, t.operator = l.lessThan, this;
|
|
316
313
|
}
|
|
317
314
|
/**
|
|
318
315
|
* Sets the conditional formatting rule to fire when the value is less than or equal to the given value.
|
|
319
316
|
* @param {number} value
|
|
320
317
|
* @memberof ConditionalFormatRuleBuilder
|
|
321
318
|
*/
|
|
322
|
-
whenNumberLessThanOrEqualTo(
|
|
323
|
-
const
|
|
324
|
-
return
|
|
319
|
+
whenNumberLessThanOrEqualTo(e) {
|
|
320
|
+
const t = this._ruleConfig;
|
|
321
|
+
return t.type = n.highlightCell, t.subType = o.number, t.value = e, t.operator = l.lessThanOrEqual, this;
|
|
325
322
|
}
|
|
326
323
|
/**
|
|
327
324
|
* Sets a conditional formatting rule to fire when a number is not between two specified values and is not equal to them.
|
|
@@ -329,70 +326,68 @@ const _ConditionalFormatHighlightRuleBuilder = class _ConditionalFormatHighlight
|
|
|
329
326
|
* @param {number} end
|
|
330
327
|
* @memberof ConditionalFormatRuleBuilder
|
|
331
328
|
*/
|
|
332
|
-
whenNumberNotBetween(
|
|
333
|
-
const
|
|
334
|
-
return
|
|
329
|
+
whenNumberNotBetween(e, t) {
|
|
330
|
+
const r = Math.min(e, t), s = Math.max(e, t), h = this._ruleConfig;
|
|
331
|
+
return h.type = n.highlightCell, h.subType = o.number, h.value = [r, s], h.operator = l.notBetween, this;
|
|
335
332
|
}
|
|
336
333
|
/**
|
|
337
334
|
* Sets the conditional formatting rule to fire when a number does not equal a given value.
|
|
338
335
|
* @param value
|
|
339
336
|
* @memberof ConditionalFormatRuleBuilder
|
|
340
337
|
*/
|
|
341
|
-
whenNumberNotEqualTo(
|
|
342
|
-
const
|
|
343
|
-
return
|
|
338
|
+
whenNumberNotEqualTo(e) {
|
|
339
|
+
const t = this._ruleConfig;
|
|
340
|
+
return t.type = n.highlightCell, t.subType = o.number, t.value = e, t.operator = l.notEqual, this;
|
|
344
341
|
}
|
|
345
342
|
/**
|
|
346
343
|
* Sets the conditional formatting rule to fire when the input contains the given value.
|
|
347
344
|
* @param {string} text
|
|
348
345
|
* @memberof ConditionalFormatRuleBuilder
|
|
349
346
|
*/
|
|
350
|
-
whenTextContains(
|
|
351
|
-
const
|
|
352
|
-
return
|
|
347
|
+
whenTextContains(e) {
|
|
348
|
+
const t = this._ruleConfig;
|
|
349
|
+
return t.type = n.highlightCell, t.subType = o.text, t.value = e, t.operator = g.containsText, this;
|
|
353
350
|
}
|
|
354
351
|
/**
|
|
355
352
|
* Sets a conditional formatting rule to fire when the input does not contain the given value.
|
|
356
353
|
* @param {string} text
|
|
357
354
|
* @memberof ConditionalFormatRuleBuilder
|
|
358
355
|
*/
|
|
359
|
-
whenTextDoesNotContain(
|
|
360
|
-
const
|
|
361
|
-
return
|
|
356
|
+
whenTextDoesNotContain(e) {
|
|
357
|
+
const t = this._ruleConfig;
|
|
358
|
+
return t.type = n.highlightCell, t.subType = o.text, t.value = e, t.operator = g.notContainsText, this;
|
|
362
359
|
}
|
|
363
360
|
/**
|
|
364
361
|
* Sets a conditional formatting rule to fire when input ends with a specified value.
|
|
365
362
|
* @param {string} text
|
|
366
363
|
* @memberof ConditionalFormatRuleBuilder
|
|
367
364
|
*/
|
|
368
|
-
whenTextEndsWith(
|
|
369
|
-
const
|
|
370
|
-
return
|
|
365
|
+
whenTextEndsWith(e) {
|
|
366
|
+
const t = this._ruleConfig;
|
|
367
|
+
return t.type = n.highlightCell, t.subType = o.text, t.value = e, t.operator = g.endsWith, this;
|
|
371
368
|
}
|
|
372
369
|
/**
|
|
373
370
|
* Sets the conditional formatting rule to fire when the input equals the given value.
|
|
374
371
|
* @param {string} text
|
|
375
372
|
* @memberof ConditionalFormatRuleBuilder
|
|
376
373
|
*/
|
|
377
|
-
whenTextEqualTo(
|
|
378
|
-
const
|
|
379
|
-
return
|
|
374
|
+
whenTextEqualTo(e) {
|
|
375
|
+
const t = this._ruleConfig;
|
|
376
|
+
return t.type = n.highlightCell, t.subType = o.text, t.value = e, t.operator = g.equal, this;
|
|
380
377
|
}
|
|
381
378
|
/**
|
|
382
379
|
* Sets the conditional formatting rule to fire when the input value begins with the given value.
|
|
383
380
|
* @param {string} text
|
|
384
381
|
* @memberof ConditionalFormatRuleBuilder
|
|
385
382
|
*/
|
|
386
|
-
whenTextStartsWith(
|
|
387
|
-
const
|
|
388
|
-
return
|
|
383
|
+
whenTextStartsWith(e) {
|
|
384
|
+
const t = this._ruleConfig;
|
|
385
|
+
return t.type = n.highlightCell, t.subType = o.text, t.value = e, t.operator = g.beginsWith, this;
|
|
389
386
|
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
let ConditionalFormatHighlightRuleBuilder = _ConditionalFormatHighlightRuleBuilder;
|
|
393
|
-
const _ConditionalFormatDataBarRuleBuilder = class _ConditionalFormatDataBarRuleBuilder extends ConditionalFormatRuleBaseBuilder {
|
|
387
|
+
}
|
|
388
|
+
class w extends d {
|
|
394
389
|
copy() {
|
|
395
|
-
return new
|
|
390
|
+
return new w(_.deepClone(this._rule));
|
|
396
391
|
}
|
|
397
392
|
/**
|
|
398
393
|
* Data bar settings
|
|
@@ -412,38 +407,34 @@ const _ConditionalFormatDataBarRuleBuilder = class _ConditionalFormatDataBarRule
|
|
|
412
407
|
* @param config.isShowValue
|
|
413
408
|
* @memberof ConditionalFormatRuleBuilder
|
|
414
409
|
*/
|
|
415
|
-
setDataBar(
|
|
416
|
-
const
|
|
417
|
-
return
|
|
418
|
-
min:
|
|
419
|
-
max:
|
|
420
|
-
positiveColor:
|
|
421
|
-
nativeColor:
|
|
422
|
-
isGradient: !!
|
|
410
|
+
setDataBar(e) {
|
|
411
|
+
const t = this._ruleConfig;
|
|
412
|
+
return t.type = n.dataBar, t.isShowValue = !!e.isShowValue, t.config = {
|
|
413
|
+
min: e.min,
|
|
414
|
+
max: e.max,
|
|
415
|
+
positiveColor: e.positiveColor,
|
|
416
|
+
nativeColor: e.nativeColor,
|
|
417
|
+
isGradient: !!e.isGradient
|
|
423
418
|
}, this;
|
|
424
419
|
}
|
|
425
|
-
}
|
|
426
|
-
|
|
427
|
-
let ConditionalFormatDataBarRuleBuilder = _ConditionalFormatDataBarRuleBuilder;
|
|
428
|
-
const _ConditionalFormatColorScaleRuleBuilder = class _ConditionalFormatColorScaleRuleBuilder extends ConditionalFormatRuleBaseBuilder {
|
|
420
|
+
}
|
|
421
|
+
class p extends d {
|
|
429
422
|
copy() {
|
|
430
|
-
return new
|
|
423
|
+
return new p(_.deepClone(this._rule));
|
|
431
424
|
}
|
|
432
425
|
/**
|
|
433
426
|
* Color scale set
|
|
434
427
|
* @param {{ index: number; color: string; value: IValueConfig }[]} config
|
|
435
428
|
* @memberof ConditionalFormatRuleBuilder
|
|
436
429
|
*/
|
|
437
|
-
setColorScale(
|
|
438
|
-
const
|
|
439
|
-
return
|
|
430
|
+
setColorScale(e) {
|
|
431
|
+
const t = this._ruleConfig;
|
|
432
|
+
return t.type = n.colorScale, t.config = e, this;
|
|
440
433
|
}
|
|
441
|
-
}
|
|
442
|
-
|
|
443
|
-
let ConditionalFormatColorScaleRuleBuilder = _ConditionalFormatColorScaleRuleBuilder;
|
|
444
|
-
const _ConditionalFormatIconSetRuleBuilder = class _ConditionalFormatIconSetRuleBuilder extends ConditionalFormatRuleBaseBuilder {
|
|
434
|
+
}
|
|
435
|
+
class y extends d {
|
|
445
436
|
copy() {
|
|
446
|
-
return new
|
|
437
|
+
return new y(_.deepClone(this._rule));
|
|
447
438
|
}
|
|
448
439
|
/**
|
|
449
440
|
*
|
|
@@ -453,41 +444,39 @@ const _ConditionalFormatIconSetRuleBuilder = class _ConditionalFormatIconSetRule
|
|
|
453
444
|
* @param config.isShowValue
|
|
454
445
|
* @memberof ConditionalFormatRuleBuilder
|
|
455
446
|
*/
|
|
456
|
-
setIconSet(
|
|
457
|
-
const
|
|
458
|
-
return
|
|
447
|
+
setIconSet(e) {
|
|
448
|
+
const t = this._ruleConfig;
|
|
449
|
+
return t.type = n.iconSet, t.config = e.iconConfigs, t.isShowValue = e.isShowValue, this;
|
|
459
450
|
}
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
constructor(_initConfig = {}) {
|
|
465
|
-
this._initConfig = _initConfig;
|
|
451
|
+
}
|
|
452
|
+
class m {
|
|
453
|
+
constructor(e = {}) {
|
|
454
|
+
this._initConfig = e;
|
|
466
455
|
}
|
|
467
456
|
build() {
|
|
468
|
-
return new
|
|
457
|
+
return new d(this._initConfig).build();
|
|
469
458
|
}
|
|
470
459
|
/**
|
|
471
460
|
* Set average rule
|
|
472
461
|
* @param {IAverageHighlightCell['operator']} operator
|
|
473
462
|
* @memberof ConditionalFormatHighlightRuleBuilder
|
|
474
463
|
*/
|
|
475
|
-
setAverage(
|
|
476
|
-
return new
|
|
464
|
+
setAverage(e) {
|
|
465
|
+
return new i(this._initConfig).setAverage(e);
|
|
477
466
|
}
|
|
478
467
|
/**
|
|
479
468
|
* Set uniqueValues rule
|
|
480
469
|
* @memberof ConditionalFormatHighlightRuleBuilder
|
|
481
470
|
*/
|
|
482
471
|
setUniqueValues() {
|
|
483
|
-
return new
|
|
472
|
+
return new i(this._initConfig).setUniqueValues();
|
|
484
473
|
}
|
|
485
474
|
/**
|
|
486
475
|
* Set duplicateValues rule
|
|
487
476
|
* @memberof ConditionalFormatHighlightRuleBuilder
|
|
488
477
|
*/
|
|
489
478
|
setDuplicateValues() {
|
|
490
|
-
return new
|
|
479
|
+
return new i(this._initConfig).setDuplicateValues();
|
|
491
480
|
}
|
|
492
481
|
/**
|
|
493
482
|
* Set rank rule
|
|
@@ -497,8 +486,8 @@ const _FConditionalFormattingBuilder = class _FConditionalFormattingBuilder {
|
|
|
497
486
|
* @param config.value
|
|
498
487
|
* @memberof ConditionalFormatHighlightRuleBuilder
|
|
499
488
|
*/
|
|
500
|
-
setRank(
|
|
501
|
-
return new
|
|
489
|
+
setRank(e) {
|
|
490
|
+
return new i(this._initConfig).setRank(e);
|
|
502
491
|
}
|
|
503
492
|
/**
|
|
504
493
|
*
|
|
@@ -508,16 +497,16 @@ const _FConditionalFormattingBuilder = class _FConditionalFormattingBuilder {
|
|
|
508
497
|
* @param config.isShowValue
|
|
509
498
|
* @memberof ConditionalFormatRuleBuilder
|
|
510
499
|
*/
|
|
511
|
-
setIconSet(
|
|
512
|
-
return new
|
|
500
|
+
setIconSet(e) {
|
|
501
|
+
return new y(this._initConfig).setIconSet(e);
|
|
513
502
|
}
|
|
514
503
|
/**
|
|
515
504
|
* Set colorScale rule
|
|
516
505
|
* @param {{ index: number; color: string; value: IValueConfig }[]} config
|
|
517
506
|
* @memberof ConditionalFormatRuleBuilder
|
|
518
507
|
*/
|
|
519
|
-
setColorScale(
|
|
520
|
-
return new
|
|
508
|
+
setColorScale(e) {
|
|
509
|
+
return new p(this._initConfig).setColorScale(e);
|
|
521
510
|
}
|
|
522
511
|
/**
|
|
523
512
|
* Set dataBar rule
|
|
@@ -537,8 +526,8 @@ const _FConditionalFormattingBuilder = class _FConditionalFormattingBuilder {
|
|
|
537
526
|
* @param config.isShowValue
|
|
538
527
|
* @memberof ConditionalFormatRuleBuilder
|
|
539
528
|
*/
|
|
540
|
-
setDataBar(
|
|
541
|
-
return new
|
|
529
|
+
setDataBar(e) {
|
|
530
|
+
return new w(this._initConfig).setDataBar(e);
|
|
542
531
|
}
|
|
543
532
|
/**
|
|
544
533
|
* Sets the background color
|
|
@@ -546,8 +535,8 @@ const _FConditionalFormattingBuilder = class _FConditionalFormattingBuilder {
|
|
|
546
535
|
* @returns {*}
|
|
547
536
|
* @memberof ConditionalFormatRuleBuilder
|
|
548
537
|
*/
|
|
549
|
-
setBackground(
|
|
550
|
-
return new
|
|
538
|
+
setBackground(e) {
|
|
539
|
+
return new i(this._initConfig).setBackground(e);
|
|
551
540
|
}
|
|
552
541
|
/**
|
|
553
542
|
* Set Bold
|
|
@@ -555,8 +544,8 @@ const _FConditionalFormattingBuilder = class _FConditionalFormattingBuilder {
|
|
|
555
544
|
* @returns {*}
|
|
556
545
|
* @memberof ConditionalFormatRuleBuilder
|
|
557
546
|
*/
|
|
558
|
-
setBold(
|
|
559
|
-
return new
|
|
547
|
+
setBold(e) {
|
|
548
|
+
return new i(this._initConfig).setBold(e);
|
|
560
549
|
}
|
|
561
550
|
/**
|
|
562
551
|
* Sets the font color
|
|
@@ -564,8 +553,8 @@ const _FConditionalFormattingBuilder = class _FConditionalFormattingBuilder {
|
|
|
564
553
|
* @returns {*}
|
|
565
554
|
* @memberof ConditionalFormatRuleBuilder
|
|
566
555
|
*/
|
|
567
|
-
setFontColor(
|
|
568
|
-
return new
|
|
556
|
+
setFontColor(e) {
|
|
557
|
+
return new i(this._initConfig).setFontColor(e);
|
|
569
558
|
}
|
|
570
559
|
/**
|
|
571
560
|
* Set the text to italic
|
|
@@ -573,8 +562,8 @@ const _FConditionalFormattingBuilder = class _FConditionalFormattingBuilder {
|
|
|
573
562
|
* @returns {*}
|
|
574
563
|
* @memberof ConditionalFormatRuleBuilder
|
|
575
564
|
*/
|
|
576
|
-
setItalic(
|
|
577
|
-
return new
|
|
565
|
+
setItalic(e) {
|
|
566
|
+
return new i(this._initConfig).setItalic(e);
|
|
578
567
|
}
|
|
579
568
|
/**
|
|
580
569
|
* Set the strikethrough
|
|
@@ -582,8 +571,8 @@ const _FConditionalFormattingBuilder = class _FConditionalFormattingBuilder {
|
|
|
582
571
|
* @returns {*}
|
|
583
572
|
* @memberof ConditionalFormatRuleBuilder
|
|
584
573
|
*/
|
|
585
|
-
setStrikethrough(
|
|
586
|
-
return new
|
|
574
|
+
setStrikethrough(e) {
|
|
575
|
+
return new i(this._initConfig).setStrikethrough(e);
|
|
587
576
|
}
|
|
588
577
|
/**
|
|
589
578
|
* Set the underscore
|
|
@@ -591,14 +580,14 @@ const _FConditionalFormattingBuilder = class _FConditionalFormattingBuilder {
|
|
|
591
580
|
* @returns {*}
|
|
592
581
|
* @memberof ConditionalFormatRuleBuilder
|
|
593
582
|
*/
|
|
594
|
-
setUnderline(
|
|
595
|
-
return new
|
|
583
|
+
setUnderline(e) {
|
|
584
|
+
return new i(this._initConfig).setUnderline(e);
|
|
596
585
|
}
|
|
597
586
|
/**
|
|
598
587
|
* Sets the conditional formatting rule to fire when the cell is empty.
|
|
599
588
|
*/
|
|
600
589
|
whenCellEmpty() {
|
|
601
|
-
return new
|
|
590
|
+
return new i(this._initConfig).whenCellEmpty();
|
|
602
591
|
}
|
|
603
592
|
/**
|
|
604
593
|
* Sets the conditional formatting rule to fire when the cell is not empty
|
|
@@ -606,7 +595,7 @@ const _FConditionalFormattingBuilder = class _FConditionalFormattingBuilder {
|
|
|
606
595
|
* @memberof ConditionalFormatRuleBuilder
|
|
607
596
|
*/
|
|
608
597
|
whenCellNotEmpty() {
|
|
609
|
-
return new
|
|
598
|
+
return new i(this._initConfig).whenCellNotEmpty();
|
|
610
599
|
}
|
|
611
600
|
/**
|
|
612
601
|
* Highlight when the date is in a time period, custom time is not supported.
|
|
@@ -614,16 +603,16 @@ const _FConditionalFormattingBuilder = class _FConditionalFormattingBuilder {
|
|
|
614
603
|
* @returns {*}
|
|
615
604
|
* @memberof ConditionalFormatRuleBuilder
|
|
616
605
|
*/
|
|
617
|
-
whenDate(
|
|
618
|
-
return new
|
|
606
|
+
whenDate(e) {
|
|
607
|
+
return new i(this._initConfig).whenDate(e);
|
|
619
608
|
}
|
|
620
609
|
/**
|
|
621
610
|
* Sets a conditional formatting rule to fire when a given formula evaluates to true.
|
|
622
611
|
* @param {string} formulaString formulaString start with' = '
|
|
623
612
|
* @memberof ConditionalFormatRuleBuilder
|
|
624
613
|
*/
|
|
625
|
-
whenFormulaSatisfied(
|
|
626
|
-
return new
|
|
614
|
+
whenFormulaSatisfied(e) {
|
|
615
|
+
return new i(this._initConfig).whenFormulaSatisfied(e);
|
|
627
616
|
}
|
|
628
617
|
/**
|
|
629
618
|
* Sets the conditional formatting rule to fire when a number is between two specified values or equal to one of them.
|
|
@@ -631,48 +620,48 @@ const _FConditionalFormattingBuilder = class _FConditionalFormattingBuilder {
|
|
|
631
620
|
* @param {number} end
|
|
632
621
|
* @memberof ConditionalFormatRuleBuilder
|
|
633
622
|
*/
|
|
634
|
-
whenNumberBetween(
|
|
635
|
-
return new
|
|
623
|
+
whenNumberBetween(e, t) {
|
|
624
|
+
return new i(this._initConfig).whenNumberBetween(e, t);
|
|
636
625
|
}
|
|
637
626
|
/**
|
|
638
627
|
* Sets the conditional formatting rule to fire when the number equals the given value
|
|
639
628
|
* @param {number} value
|
|
640
629
|
* @memberof ConditionalFormatRuleBuilder
|
|
641
630
|
*/
|
|
642
|
-
whenNumberEqualTo(
|
|
643
|
-
return new
|
|
631
|
+
whenNumberEqualTo(e) {
|
|
632
|
+
return new i(this._initConfig).whenNumberEqualTo(e);
|
|
644
633
|
}
|
|
645
634
|
/**
|
|
646
635
|
* Sets the conditional formatting rule to fire when the number is greater than the given value
|
|
647
636
|
* @param {number} value
|
|
648
637
|
* @memberof ConditionalFormatRuleBuilder
|
|
649
638
|
*/
|
|
650
|
-
whenNumberGreaterThan(
|
|
651
|
-
return new
|
|
639
|
+
whenNumberGreaterThan(e) {
|
|
640
|
+
return new i(this._initConfig).whenNumberGreaterThan(e);
|
|
652
641
|
}
|
|
653
642
|
/**
|
|
654
643
|
* Sets a conditional formatting rule to fire when a number is greater than or equal to a given value.
|
|
655
644
|
* @param {number} value
|
|
656
645
|
* @memberof ConditionalFormatRuleBuilder
|
|
657
646
|
*/
|
|
658
|
-
whenNumberGreaterThanOrEqualTo(
|
|
659
|
-
return new
|
|
647
|
+
whenNumberGreaterThanOrEqualTo(e) {
|
|
648
|
+
return new i(this._initConfig).whenNumberGreaterThanOrEqualTo(e);
|
|
660
649
|
}
|
|
661
650
|
/**
|
|
662
651
|
* Sets a conditional formatting rule to fire when the number is less than the given value.
|
|
663
652
|
* @param {number} value
|
|
664
653
|
* @memberof ConditionalFormatRuleBuilder
|
|
665
654
|
*/
|
|
666
|
-
whenNumberLessThan(
|
|
667
|
-
return new
|
|
655
|
+
whenNumberLessThan(e) {
|
|
656
|
+
return new i(this._initConfig).whenNumberLessThan(e);
|
|
668
657
|
}
|
|
669
658
|
/**
|
|
670
659
|
* Sets the conditional formatting rule to fire when the value is less than or equal to the given value.
|
|
671
660
|
* @param {number} value
|
|
672
661
|
* @memberof ConditionalFormatRuleBuilder
|
|
673
662
|
*/
|
|
674
|
-
whenNumberLessThanOrEqualTo(
|
|
675
|
-
return new
|
|
663
|
+
whenNumberLessThanOrEqualTo(e) {
|
|
664
|
+
return new i(this._initConfig).whenNumberLessThanOrEqualTo(e);
|
|
676
665
|
}
|
|
677
666
|
/**
|
|
678
667
|
* Sets a conditional formatting rule to fire when a number is not between two specified values and is not equal to them.
|
|
@@ -680,167 +669,159 @@ const _FConditionalFormattingBuilder = class _FConditionalFormattingBuilder {
|
|
|
680
669
|
* @param {number} end
|
|
681
670
|
* @memberof ConditionalFormatRuleBuilder
|
|
682
671
|
*/
|
|
683
|
-
whenNumberNotBetween(
|
|
684
|
-
return new
|
|
672
|
+
whenNumberNotBetween(e, t) {
|
|
673
|
+
return new i(this._initConfig).whenNumberNotBetween(e, t);
|
|
685
674
|
}
|
|
686
675
|
/**
|
|
687
676
|
* Sets the conditional formatting rule to fire when a number does not equal a given value.
|
|
688
677
|
* @param value
|
|
689
678
|
* @memberof ConditionalFormatRuleBuilder
|
|
690
679
|
*/
|
|
691
|
-
whenNumberNotEqualTo(
|
|
692
|
-
return new
|
|
680
|
+
whenNumberNotEqualTo(e) {
|
|
681
|
+
return new i(this._initConfig).whenNumberNotEqualTo(e);
|
|
693
682
|
}
|
|
694
683
|
/**
|
|
695
684
|
* Sets the conditional formatting rule to fire when the input contains the given value.
|
|
696
685
|
* @param {string} text
|
|
697
686
|
* @memberof ConditionalFormatRuleBuilder
|
|
698
687
|
*/
|
|
699
|
-
whenTextContains(
|
|
700
|
-
return new
|
|
688
|
+
whenTextContains(e) {
|
|
689
|
+
return new i(this._initConfig).whenTextContains(e);
|
|
701
690
|
}
|
|
702
691
|
/**
|
|
703
692
|
* Sets a conditional formatting rule to fire when the input does not contain the given value.
|
|
704
693
|
* @param {string} text
|
|
705
694
|
* @memberof ConditionalFormatRuleBuilder
|
|
706
695
|
*/
|
|
707
|
-
whenTextDoesNotContain(
|
|
708
|
-
return new
|
|
696
|
+
whenTextDoesNotContain(e) {
|
|
697
|
+
return new i(this._initConfig).whenTextDoesNotContain(e);
|
|
709
698
|
}
|
|
710
699
|
/**
|
|
711
700
|
* Sets a conditional formatting rule to fire when input ends with a specified value.
|
|
712
701
|
* @param {string} text
|
|
713
702
|
* @memberof ConditionalFormatRuleBuilder
|
|
714
703
|
*/
|
|
715
|
-
whenTextEndsWith(
|
|
716
|
-
return new
|
|
704
|
+
whenTextEndsWith(e) {
|
|
705
|
+
return new i(this._initConfig).whenTextEndsWith(e);
|
|
717
706
|
}
|
|
718
707
|
/**
|
|
719
708
|
* Sets the conditional formatting rule to fire when the input equals the given value.
|
|
720
709
|
* @param {string} text
|
|
721
710
|
* @memberof ConditionalFormatRuleBuilder
|
|
722
711
|
*/
|
|
723
|
-
whenTextEqualTo(
|
|
724
|
-
return new
|
|
712
|
+
whenTextEqualTo(e) {
|
|
713
|
+
return new i(this._initConfig).whenTextEqualTo(e);
|
|
725
714
|
}
|
|
726
715
|
/**
|
|
727
716
|
* Sets the conditional formatting rule to fire when the input value begins with the given value.
|
|
728
717
|
* @param {string} text
|
|
729
718
|
* @memberof ConditionalFormatRuleBuilder
|
|
730
719
|
*/
|
|
731
|
-
whenTextStartsWith(
|
|
732
|
-
return new
|
|
720
|
+
whenTextStartsWith(e) {
|
|
721
|
+
return new i(this._initConfig).whenTextStartsWith(e);
|
|
733
722
|
}
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
let FConditionalFormattingBuilder = _FConditionalFormattingBuilder;
|
|
737
|
-
const _FRangeConditionalFormattingMixin = class _FRangeConditionalFormattingMixin extends FRange {
|
|
723
|
+
}
|
|
724
|
+
class A extends v {
|
|
738
725
|
_getConditionalFormattingRuleModel() {
|
|
739
|
-
return this._injector.get(
|
|
726
|
+
return this._injector.get(x);
|
|
740
727
|
}
|
|
741
728
|
getConditionalFormattingRules() {
|
|
742
|
-
return [...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(), this._worksheet.getSheetId()) || []].filter((
|
|
729
|
+
return [...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(), this._worksheet.getSheetId()) || []].filter((t) => t.ranges.some((r) => U.intersects(r, this._range)));
|
|
743
730
|
}
|
|
744
731
|
createConditionalFormattingRule() {
|
|
745
|
-
return new
|
|
732
|
+
return new m({ ranges: [this._range] });
|
|
746
733
|
}
|
|
747
|
-
addConditionalFormattingRule(
|
|
748
|
-
const
|
|
749
|
-
rule,
|
|
734
|
+
addConditionalFormattingRule(e) {
|
|
735
|
+
const t = {
|
|
736
|
+
rule: e,
|
|
750
737
|
unitId: this._workbook.getUnitId(),
|
|
751
738
|
subUnitId: this._worksheet.getSheetId()
|
|
752
739
|
};
|
|
753
|
-
return this._commandService.syncExecuteCommand(
|
|
740
|
+
return this._commandService.syncExecuteCommand(S.id, t), this;
|
|
754
741
|
}
|
|
755
|
-
deleteConditionalFormattingRule(
|
|
756
|
-
const
|
|
742
|
+
deleteConditionalFormattingRule(e) {
|
|
743
|
+
const t = {
|
|
757
744
|
unitId: this._workbook.getUnitId(),
|
|
758
745
|
subUnitId: this._worksheet.getSheetId(),
|
|
759
|
-
cfId
|
|
746
|
+
cfId: e
|
|
760
747
|
};
|
|
761
|
-
return this._commandService.syncExecuteCommand(
|
|
748
|
+
return this._commandService.syncExecuteCommand(I.id, t), this;
|
|
762
749
|
}
|
|
763
|
-
moveConditionalFormattingRule(
|
|
764
|
-
const
|
|
750
|
+
moveConditionalFormattingRule(e, t, r = "after") {
|
|
751
|
+
const s = {
|
|
765
752
|
unitId: this._workbook.getUnitId(),
|
|
766
753
|
subUnitId: this._worksheet.getSheetId(),
|
|
767
|
-
start: { id:
|
|
768
|
-
end: { id:
|
|
754
|
+
start: { id: e, type: "self" },
|
|
755
|
+
end: { id: t, type: r }
|
|
769
756
|
};
|
|
770
|
-
return this._commandService.syncExecuteCommand(
|
|
757
|
+
return this._commandService.syncExecuteCommand(E.id, s), this;
|
|
771
758
|
}
|
|
772
|
-
setConditionalFormattingRule(
|
|
773
|
-
const
|
|
759
|
+
setConditionalFormattingRule(e, t) {
|
|
760
|
+
const r = {
|
|
774
761
|
unitId: this._workbook.getUnitId(),
|
|
775
762
|
subUnitId: this._worksheet.getSheetId(),
|
|
776
|
-
rule,
|
|
777
|
-
cfId
|
|
763
|
+
rule: t,
|
|
764
|
+
cfId: e
|
|
778
765
|
};
|
|
779
|
-
return this._commandService.syncExecuteCommand(
|
|
766
|
+
return this._commandService.syncExecuteCommand(k.id, r), this;
|
|
780
767
|
}
|
|
781
|
-
}
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
FRange.extend(FRangeConditionalFormattingMixin);
|
|
785
|
-
const _FWorkbookConditionalFormattingMixin = class _FWorkbookConditionalFormattingMixin extends FWorkbook {
|
|
768
|
+
}
|
|
769
|
+
v.extend(A);
|
|
770
|
+
class D extends F {
|
|
786
771
|
newColor() {
|
|
787
|
-
return new
|
|
772
|
+
return new B();
|
|
788
773
|
}
|
|
789
|
-
}
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
FWorkbook.extend(FWorkbookConditionalFormattingMixin);
|
|
793
|
-
const _FWorksheetConditionalFormattingMixin = class _FWorksheetConditionalFormattingMixin extends FWorksheet {
|
|
774
|
+
}
|
|
775
|
+
F.extend(D);
|
|
776
|
+
class V extends R {
|
|
794
777
|
_getConditionalFormattingRuleModel() {
|
|
795
|
-
return this._injector.get(
|
|
778
|
+
return this._injector.get(x);
|
|
796
779
|
}
|
|
797
780
|
getConditionalFormattingRules() {
|
|
798
781
|
return [...this._getConditionalFormattingRuleModel().getSubunitRules(this._workbook.getUnitId(), this._worksheet.getSheetId()) || []];
|
|
799
782
|
}
|
|
800
783
|
createConditionalFormattingRule() {
|
|
801
|
-
return new
|
|
784
|
+
return new m();
|
|
802
785
|
}
|
|
803
786
|
newConditionalFormattingRule() {
|
|
804
|
-
return new
|
|
787
|
+
return new m();
|
|
805
788
|
}
|
|
806
|
-
addConditionalFormattingRule(
|
|
807
|
-
const
|
|
808
|
-
rule,
|
|
789
|
+
addConditionalFormattingRule(e) {
|
|
790
|
+
const t = {
|
|
791
|
+
rule: e,
|
|
809
792
|
unitId: this._workbook.getUnitId(),
|
|
810
793
|
subUnitId: this._worksheet.getSheetId()
|
|
811
794
|
};
|
|
812
|
-
return this._commandService.syncExecuteCommand(
|
|
795
|
+
return this._commandService.syncExecuteCommand(S.id, t), this;
|
|
813
796
|
}
|
|
814
|
-
deleteConditionalFormattingRule(
|
|
815
|
-
const
|
|
797
|
+
deleteConditionalFormattingRule(e) {
|
|
798
|
+
const t = {
|
|
816
799
|
unitId: this._workbook.getUnitId(),
|
|
817
800
|
subUnitId: this._worksheet.getSheetId(),
|
|
818
|
-
cfId
|
|
801
|
+
cfId: e
|
|
819
802
|
};
|
|
820
|
-
return this._commandService.syncExecuteCommand(
|
|
803
|
+
return this._commandService.syncExecuteCommand(I.id, t), this;
|
|
821
804
|
}
|
|
822
|
-
moveConditionalFormattingRule(
|
|
823
|
-
const
|
|
805
|
+
moveConditionalFormattingRule(e, t, r = "after") {
|
|
806
|
+
const s = {
|
|
824
807
|
unitId: this._workbook.getUnitId(),
|
|
825
808
|
subUnitId: this._worksheet.getSheetId(),
|
|
826
|
-
start: { id:
|
|
827
|
-
end: { id:
|
|
809
|
+
start: { id: e, type: "self" },
|
|
810
|
+
end: { id: t, type: r }
|
|
828
811
|
};
|
|
829
|
-
return this._commandService.syncExecuteCommand(
|
|
812
|
+
return this._commandService.syncExecuteCommand(E.id, s), this;
|
|
830
813
|
}
|
|
831
|
-
setConditionalFormattingRule(
|
|
832
|
-
const
|
|
814
|
+
setConditionalFormattingRule(e, t) {
|
|
815
|
+
const r = {
|
|
833
816
|
unitId: this._workbook.getUnitId(),
|
|
834
817
|
subUnitId: this._worksheet.getSheetId(),
|
|
835
|
-
rule,
|
|
836
|
-
cfId
|
|
818
|
+
rule: t,
|
|
819
|
+
cfId: e
|
|
837
820
|
};
|
|
838
|
-
return this._commandService.syncExecuteCommand(
|
|
821
|
+
return this._commandService.syncExecuteCommand(k.id, r), this;
|
|
839
822
|
}
|
|
840
|
-
}
|
|
841
|
-
|
|
842
|
-
let FWorksheetConditionalFormattingMixin = _FWorksheetConditionalFormattingMixin;
|
|
843
|
-
FWorksheet.extend(FWorksheetConditionalFormattingMixin);
|
|
823
|
+
}
|
|
824
|
+
R.extend(V);
|
|
844
825
|
export {
|
|
845
|
-
FConditionalFormattingBuilder
|
|
826
|
+
m as FConditionalFormattingBuilder
|
|
846
827
|
};
|