@univerjs/sheets-data-validation 0.6.0 → 0.6.1
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/es/facade.js +469 -145
- package/lib/types/facade/f-data-validation-builder.d.ts +365 -64
- package/lib/types/facade/f-data-validation.d.ts +121 -83
- package/lib/types/facade/f-event.d.ts +58 -24
- package/lib/types/facade/f-range.d.ts +68 -11
- package/lib/types/facade/f-workbook.d.ts +5 -3
- package/lib/types/facade/f-worksheet.d.ts +13 -10
- package/package.json +9 -9
package/lib/es/facade.js
CHANGED
|
@@ -22,8 +22,18 @@ class E {
|
|
|
22
22
|
* @returns {FDataValidation} A new instance of the FDataValidation class
|
|
23
23
|
* @example
|
|
24
24
|
* ```typescript
|
|
25
|
-
* const
|
|
26
|
-
* const
|
|
25
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
26
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
27
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
28
|
+
* const rule = univerAPI.newDataValidation()
|
|
29
|
+
* .requireNumberBetween(1, 10)
|
|
30
|
+
* .setOptions({
|
|
31
|
+
* allowBlank: true,
|
|
32
|
+
* showErrorMessage: true,
|
|
33
|
+
* error: 'Please enter a number between 1 and 10'
|
|
34
|
+
* })
|
|
35
|
+
* .build();
|
|
36
|
+
* fRange.setDataValidation(rule);
|
|
27
37
|
* ```
|
|
28
38
|
*/
|
|
29
39
|
build() {
|
|
@@ -34,8 +44,9 @@ class E {
|
|
|
34
44
|
* @returns {FDataValidationBuilder} A new instance of the DataValidationBuilder class
|
|
35
45
|
* @example
|
|
36
46
|
* ```typescript
|
|
37
|
-
* const builder = univerAPI.newDataValidation();
|
|
38
|
-
* const
|
|
47
|
+
* const builder = univerAPI.newDataValidation().requireNumberBetween(1, 10);
|
|
48
|
+
* const copyBuilder = builder.copy();
|
|
49
|
+
* console.log(copyBuilder);
|
|
39
50
|
* ```
|
|
40
51
|
*/
|
|
41
52
|
copy() {
|
|
@@ -49,8 +60,8 @@ class E {
|
|
|
49
60
|
* @returns {boolean} True if invalid data is allowed, False otherwise
|
|
50
61
|
* @example
|
|
51
62
|
* ```typescript
|
|
52
|
-
* const builder = univerAPI.newDataValidation();
|
|
53
|
-
*
|
|
63
|
+
* const builder = univerAPI.newDataValidation().requireNumberBetween(1, 10);
|
|
64
|
+
* console.log(builder.getAllowInvalid());
|
|
54
65
|
* ```
|
|
55
66
|
*/
|
|
56
67
|
getAllowInvalid() {
|
|
@@ -62,7 +73,13 @@ class E {
|
|
|
62
73
|
* @example
|
|
63
74
|
* ```typescript
|
|
64
75
|
* const builder = univerAPI.newDataValidation();
|
|
65
|
-
*
|
|
76
|
+
* console.log(builder.getCriteriaType());
|
|
77
|
+
*
|
|
78
|
+
* builder.requireNumberBetween(1, 10);
|
|
79
|
+
* console.log(builder.getCriteriaType());
|
|
80
|
+
*
|
|
81
|
+
* builder.requireValueInList(['Yes', 'No']);
|
|
82
|
+
* console.log(builder.getCriteriaType());
|
|
66
83
|
* ```
|
|
67
84
|
*/
|
|
68
85
|
getCriteriaType() {
|
|
@@ -73,8 +90,12 @@ class E {
|
|
|
73
90
|
* @returns {[string | undefined, string | undefined, string | undefined]} An array containing the operator, formula1, and formula2 values
|
|
74
91
|
* @example
|
|
75
92
|
* ```typescript
|
|
76
|
-
* const builder = univerAPI.newDataValidation();
|
|
93
|
+
* const builder = univerAPI.newDataValidation().requireNumberBetween(1, 10);
|
|
77
94
|
* const [operator, formula1, formula2] = builder.getCriteriaValues();
|
|
95
|
+
* console.log(operator, formula1, formula2);
|
|
96
|
+
*
|
|
97
|
+
* builder.requireValueInList(['Yes', 'No']);
|
|
98
|
+
* console.log(builder.getCriteriaValues());
|
|
78
99
|
* ```
|
|
79
100
|
*/
|
|
80
101
|
getCriteriaValues() {
|
|
@@ -85,8 +106,11 @@ class E {
|
|
|
85
106
|
* @returns {string | undefined} Returns the help text information. If there is no error message, it returns an undefined value
|
|
86
107
|
* @example
|
|
87
108
|
* ```typescript
|
|
88
|
-
* const builder = univerAPI.newDataValidation()
|
|
89
|
-
*
|
|
109
|
+
* const builder = univerAPI.newDataValidation().setOptions({
|
|
110
|
+
* showErrorMessage: true,
|
|
111
|
+
* error: 'Please enter a valid value'
|
|
112
|
+
* });
|
|
113
|
+
* console.log(builder.getHelpText()); // 'Please enter a valid value'
|
|
90
114
|
* ```
|
|
91
115
|
*/
|
|
92
116
|
getHelpText() {
|
|
@@ -99,8 +123,22 @@ class E {
|
|
|
99
123
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
100
124
|
* @example
|
|
101
125
|
* ```typescript
|
|
102
|
-
* const
|
|
103
|
-
* const
|
|
126
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
127
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
128
|
+
*
|
|
129
|
+
* // Set the data validation for cell A1:A10 to require a checkbox with default 1 and 0 values
|
|
130
|
+
* const fRange = fWorksheet.getRange('A1:A10');
|
|
131
|
+
* const rule = univerAPI.newDataValidation()
|
|
132
|
+
* .requireCheckbox()
|
|
133
|
+
* .build();
|
|
134
|
+
* fRange.setDataValidation(rule);
|
|
135
|
+
*
|
|
136
|
+
* // Set the data validation for cell B1:B10 to require a checkbox with 'Yes' and 'No' values
|
|
137
|
+
* const fRange2 = fWorksheet.getRange('B1:B10');
|
|
138
|
+
* const rule2 = univerAPI.newDataValidation()
|
|
139
|
+
* .requireCheckbox('Yes', 'No')
|
|
140
|
+
* .build();
|
|
141
|
+
* fRange2.setDataValidation(rule2);
|
|
104
142
|
* ```
|
|
105
143
|
*/
|
|
106
144
|
requireCheckbox(e, t) {
|
|
@@ -112,8 +150,20 @@ class E {
|
|
|
112
150
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
113
151
|
* @example
|
|
114
152
|
* ```typescript
|
|
115
|
-
* const
|
|
116
|
-
* const
|
|
153
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
154
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
155
|
+
* const fRange = fWorksheet.getRange('A1:B2');
|
|
156
|
+
* fRange.setValues([
|
|
157
|
+
* ['2024-01-01', '2024-12-31'],
|
|
158
|
+
* ['2025-01-01', '2025-12-31']
|
|
159
|
+
* ]);
|
|
160
|
+
* const rule = univerAPI.newDataValidation()
|
|
161
|
+
* .requireDateAfter(new Date('2025-01-01'))
|
|
162
|
+
* .build();
|
|
163
|
+
* fRange.setDataValidation(rule);
|
|
164
|
+
*
|
|
165
|
+
* const status = await fRange.getValidatorStatus();
|
|
166
|
+
* console.log(status); // [['invalid', 'invalid', 'invalid', 'valid']]
|
|
117
167
|
* ```
|
|
118
168
|
*/
|
|
119
169
|
requireDateAfter(e) {
|
|
@@ -125,8 +175,20 @@ class E {
|
|
|
125
175
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
126
176
|
* @example
|
|
127
177
|
* ```typescript
|
|
128
|
-
* const
|
|
129
|
-
* const
|
|
178
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
179
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
180
|
+
* const fRange = fWorksheet.getRange('A1:B2');
|
|
181
|
+
* fRange.setValues([
|
|
182
|
+
* ['2024-01-01', '2024-12-31'],
|
|
183
|
+
* ['2025-01-01', '2025-12-31']
|
|
184
|
+
* ]);
|
|
185
|
+
* const rule = univerAPI.newDataValidation()
|
|
186
|
+
* .requireDateBefore(new Date('2025-01-01'))
|
|
187
|
+
* .build();
|
|
188
|
+
* fRange.setDataValidation(rule);
|
|
189
|
+
*
|
|
190
|
+
* const status = await fRange.getValidatorStatus();
|
|
191
|
+
* console.log(status); // [['valid', 'valid', 'invalid', 'invalid']]
|
|
130
192
|
* ```
|
|
131
193
|
*/
|
|
132
194
|
requireDateBefore(e) {
|
|
@@ -139,10 +201,20 @@ class E {
|
|
|
139
201
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
140
202
|
* @example
|
|
141
203
|
* ```typescript
|
|
142
|
-
* const
|
|
143
|
-
* const
|
|
144
|
-
*
|
|
204
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
205
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
206
|
+
* const fRange = fWorksheet.getRange('A1:B2');
|
|
207
|
+
* fRange.setValues([
|
|
208
|
+
* ['2024-01-01', '2024-12-31'],
|
|
209
|
+
* ['2025-01-01', '2025-12-31']
|
|
210
|
+
* ]);
|
|
211
|
+
* const rule = univerAPI.newDataValidation()
|
|
212
|
+
* .requireDateBetween(new Date('2024-06-01'), new Date('2025-06-01'))
|
|
145
213
|
* .build();
|
|
214
|
+
* fRange.setDataValidation(rule);
|
|
215
|
+
*
|
|
216
|
+
* const status = await fRange.getValidatorStatus();
|
|
217
|
+
* console.log(status); // [['invalid', 'valid', 'valid', 'invalid']]
|
|
146
218
|
* ```
|
|
147
219
|
*/
|
|
148
220
|
requireDateBetween(e, t) {
|
|
@@ -154,8 +226,23 @@ class E {
|
|
|
154
226
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
155
227
|
* @example
|
|
156
228
|
* ```typescript
|
|
157
|
-
* const
|
|
158
|
-
* const
|
|
229
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
230
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
231
|
+
* const fRange = fWorksheet.getRange('A1:B2');
|
|
232
|
+
* fRange.setValues([
|
|
233
|
+
* ['2024-01-01', '2024-12-31'],
|
|
234
|
+
* ['2025-01-01', '2025-12-31']
|
|
235
|
+
* ]);
|
|
236
|
+
* const rule = univerAPI.newDataValidation()
|
|
237
|
+
* .requireDateEqualTo(new Date('2025-01-01'))
|
|
238
|
+
* .build();
|
|
239
|
+
* fRange.setDataValidation(rule);
|
|
240
|
+
*
|
|
241
|
+
* const status = await fWorksheet.getRange('A2').getValidatorStatus();
|
|
242
|
+
* console.log(status?.[0]?.[0]); // 'valid'
|
|
243
|
+
*
|
|
244
|
+
* const status2 = await fWorksheet.getRange('B2').getValidatorStatus();
|
|
245
|
+
* console.log(status2?.[0]?.[0]); // 'invalid'
|
|
159
246
|
* ```
|
|
160
247
|
*/
|
|
161
248
|
requireDateEqualTo(e) {
|
|
@@ -168,10 +255,20 @@ class E {
|
|
|
168
255
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
169
256
|
* @example
|
|
170
257
|
* ```typescript
|
|
171
|
-
* const
|
|
172
|
-
* const
|
|
173
|
-
*
|
|
258
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
259
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
260
|
+
* const fRange = fWorksheet.getRange('A1:B2');
|
|
261
|
+
* fRange.setValues([
|
|
262
|
+
* ['2024-01-01', '2024-12-31'],
|
|
263
|
+
* ['2025-01-01', '2025-12-31']
|
|
264
|
+
* ]);
|
|
265
|
+
* const rule = univerAPI.newDataValidation()
|
|
266
|
+
* .requireDateNotBetween(new Date('2024-06-01'), new Date('2025-06-01'))
|
|
174
267
|
* .build();
|
|
268
|
+
* fRange.setDataValidation(rule);
|
|
269
|
+
*
|
|
270
|
+
* const status = await fRange.getValidatorStatus();
|
|
271
|
+
* console.log(status); // [['valid', 'invalid', 'invalid', 'valid']]
|
|
175
272
|
* ```
|
|
176
273
|
*/
|
|
177
274
|
requireDateNotBetween(e, t) {
|
|
@@ -183,8 +280,20 @@ class E {
|
|
|
183
280
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
184
281
|
* @example
|
|
185
282
|
* ```typescript
|
|
186
|
-
* const
|
|
187
|
-
* const
|
|
283
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
284
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
285
|
+
* const fRange = fWorksheet.getRange('A1:B2');
|
|
286
|
+
* fRange.setValues([
|
|
287
|
+
* ['2024-01-01', '2024-12-31'],
|
|
288
|
+
* ['2025-01-01', '2025-12-31']
|
|
289
|
+
* ]);
|
|
290
|
+
* const rule = univerAPI.newDataValidation()
|
|
291
|
+
* .requireDateOnOrAfter(new Date('2025-01-01'))
|
|
292
|
+
* .build();
|
|
293
|
+
* fRange.setDataValidation(rule);
|
|
294
|
+
*
|
|
295
|
+
* const status = await fRange.getValidatorStatus();
|
|
296
|
+
* console.log(status); // [['invalid', 'invalid', 'valid', 'valid']]
|
|
188
297
|
* ```
|
|
189
298
|
*/
|
|
190
299
|
requireDateOnOrAfter(e) {
|
|
@@ -196,8 +305,20 @@ class E {
|
|
|
196
305
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
197
306
|
* @example
|
|
198
307
|
* ```typescript
|
|
199
|
-
* const
|
|
200
|
-
* const
|
|
308
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
309
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
310
|
+
* const fRange = fWorksheet.getRange('A1:B2');
|
|
311
|
+
* fRange.setValues([
|
|
312
|
+
* ['2024-01-01', '2024-12-31'],
|
|
313
|
+
* ['2025-01-01', '2025-12-31']
|
|
314
|
+
* ]);
|
|
315
|
+
* const rule = univerAPI.newDataValidation()
|
|
316
|
+
* .requireDateOnOrBefore(new Date('2025-01-01'))
|
|
317
|
+
* .build();
|
|
318
|
+
* fRange.setDataValidation(rule);
|
|
319
|
+
*
|
|
320
|
+
* const status = await fRange.getValidatorStatus();
|
|
321
|
+
* console.log(status); // [['valid', 'valid', 'valid', 'invalid']]
|
|
201
322
|
* ```
|
|
202
323
|
*/
|
|
203
324
|
requireDateOnOrBefore(e) {
|
|
@@ -205,12 +326,33 @@ class E {
|
|
|
205
326
|
}
|
|
206
327
|
/**
|
|
207
328
|
* Requires that a custom formula be satisfied
|
|
208
|
-
* @param {string} formula - The formula string that needs to be satisfied
|
|
329
|
+
* @param {string} formula - The formula string that needs to be satisfied, formula result should be TRUE or FALSE, and references range will relative offset
|
|
209
330
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
210
331
|
* @example
|
|
211
332
|
* ```typescript
|
|
212
|
-
* const
|
|
213
|
-
* const
|
|
333
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
334
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
335
|
+
* const cell = fWorksheet.getRange('A1:B2');
|
|
336
|
+
* cell.setValues([
|
|
337
|
+
* [4, 3],
|
|
338
|
+
* [2, 1]
|
|
339
|
+
* ]);
|
|
340
|
+
* const fRange = fWorksheet.getRange('C1:D2');
|
|
341
|
+
* fRange.setValues([
|
|
342
|
+
* [1, 2],
|
|
343
|
+
* [3, 4]
|
|
344
|
+
* ]);
|
|
345
|
+
* const rule = univerAPI.newDataValidation()
|
|
346
|
+
* .requireFormulaSatisfied('=A1>2')
|
|
347
|
+
* .setOptions({
|
|
348
|
+
* showErrorMessage: true,
|
|
349
|
+
* error: 'Please enter a value equal to A1'
|
|
350
|
+
* })
|
|
351
|
+
* .build();
|
|
352
|
+
* fRange.setDataValidation(rule);
|
|
353
|
+
*
|
|
354
|
+
* const status = await fRange.getValidatorStatus();
|
|
355
|
+
* console.log(status); // [['valid', 'valid', 'invalid', 'invalid']]
|
|
214
356
|
* ```
|
|
215
357
|
*/
|
|
216
358
|
requireFormulaSatisfied(e) {
|
|
@@ -224,8 +366,18 @@ class E {
|
|
|
224
366
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
225
367
|
* @example
|
|
226
368
|
* ```typescript
|
|
227
|
-
* const
|
|
228
|
-
* const
|
|
369
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
370
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
371
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
372
|
+
* const rule = univerAPI.newDataValidation()
|
|
373
|
+
* .requireNumberBetween(1, 10)
|
|
374
|
+
* .setOptions({
|
|
375
|
+
* allowBlank: false,
|
|
376
|
+
* showErrorMessage: true,
|
|
377
|
+
* error: 'Please enter a number between 1 and 10'
|
|
378
|
+
* })
|
|
379
|
+
* .build();
|
|
380
|
+
* fRange.setDataValidation(rule);
|
|
229
381
|
* ```
|
|
230
382
|
*/
|
|
231
383
|
requireNumberBetween(e, t, i) {
|
|
@@ -238,8 +390,18 @@ class E {
|
|
|
238
390
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
239
391
|
* @example
|
|
240
392
|
* ```typescript
|
|
241
|
-
* const
|
|
242
|
-
* const
|
|
393
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
394
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
395
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
396
|
+
* const rule = univerAPI.newDataValidation()
|
|
397
|
+
* .requireNumberEqualTo(10)
|
|
398
|
+
* .setOptions({
|
|
399
|
+
* allowBlank: false,
|
|
400
|
+
* showErrorMessage: true,
|
|
401
|
+
* error: 'Please enter a number equal to 10'
|
|
402
|
+
* })
|
|
403
|
+
* .build();
|
|
404
|
+
* fRange.setDataValidation(rule);
|
|
243
405
|
* ```
|
|
244
406
|
*/
|
|
245
407
|
requireNumberEqualTo(e, t) {
|
|
@@ -252,8 +414,18 @@ class E {
|
|
|
252
414
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
253
415
|
* @example
|
|
254
416
|
* ```typescript
|
|
255
|
-
* const
|
|
256
|
-
* const
|
|
417
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
418
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
419
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
420
|
+
* const rule = univerAPI.newDataValidation()
|
|
421
|
+
* .requireNumberGreaterThan(10)
|
|
422
|
+
* .setOptions({
|
|
423
|
+
* allowBlank: false,
|
|
424
|
+
* showErrorMessage: true,
|
|
425
|
+
* error: 'Please enter a number greater than 10'
|
|
426
|
+
* })
|
|
427
|
+
* .build();
|
|
428
|
+
* fRange.setDataValidation(rule);
|
|
257
429
|
* ```
|
|
258
430
|
*/
|
|
259
431
|
requireNumberGreaterThan(e, t) {
|
|
@@ -266,8 +438,18 @@ class E {
|
|
|
266
438
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
267
439
|
* @example
|
|
268
440
|
* ```typescript
|
|
269
|
-
* const
|
|
270
|
-
* const
|
|
441
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
442
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
443
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
444
|
+
* const rule = univerAPI.newDataValidation()
|
|
445
|
+
* .requireNumberGreaterThanOrEqualTo(10)
|
|
446
|
+
* .setOptions({
|
|
447
|
+
* allowBlank: false,
|
|
448
|
+
* showErrorMessage: true,
|
|
449
|
+
* error: 'Please enter a number greater than 10 or equal to 10'
|
|
450
|
+
* })
|
|
451
|
+
* .build();
|
|
452
|
+
* fRange.setDataValidation(rule);
|
|
271
453
|
* ```
|
|
272
454
|
*/
|
|
273
455
|
requireNumberGreaterThanOrEqualTo(e, t) {
|
|
@@ -280,8 +462,18 @@ class E {
|
|
|
280
462
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
281
463
|
* @example
|
|
282
464
|
* ```typescript
|
|
283
|
-
* const
|
|
284
|
-
* const
|
|
465
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
466
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
467
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
468
|
+
* const rule = univerAPI.newDataValidation()
|
|
469
|
+
* .requireNumberLessThan(10)
|
|
470
|
+
* .setOptions({
|
|
471
|
+
* allowBlank: false,
|
|
472
|
+
* showErrorMessage: true,
|
|
473
|
+
* error: 'Please enter a number less than 10'
|
|
474
|
+
* })
|
|
475
|
+
* .build();
|
|
476
|
+
* fRange.setDataValidation(rule);
|
|
285
477
|
* ```
|
|
286
478
|
*/
|
|
287
479
|
requireNumberLessThan(e, t) {
|
|
@@ -295,8 +487,18 @@ class E {
|
|
|
295
487
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
296
488
|
* @example
|
|
297
489
|
* ```typescript
|
|
298
|
-
* const
|
|
299
|
-
* const
|
|
490
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
491
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
492
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
493
|
+
* const rule = univerAPI.newDataValidation()
|
|
494
|
+
* .requireNumberLessThanOrEqualTo(10)
|
|
495
|
+
* .setOptions({
|
|
496
|
+
* allowBlank: false,
|
|
497
|
+
* showErrorMessage: true,
|
|
498
|
+
* error: 'Please enter a number less than 10 or equal to 10'
|
|
499
|
+
* })
|
|
500
|
+
* .build();
|
|
501
|
+
* fRange.setDataValidation(rule);
|
|
300
502
|
* ```
|
|
301
503
|
*/
|
|
302
504
|
requireNumberLessThanOrEqualTo(e, t) {
|
|
@@ -311,8 +513,18 @@ class E {
|
|
|
311
513
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
312
514
|
* @example
|
|
313
515
|
* ```typescript
|
|
314
|
-
* const
|
|
315
|
-
* const
|
|
516
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
517
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
518
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
519
|
+
* const rule = univerAPI.newDataValidation()
|
|
520
|
+
* .requireNumberNotBetween(1, 10)
|
|
521
|
+
* .setOptions({
|
|
522
|
+
* allowBlank: false,
|
|
523
|
+
* showErrorMessage: true,
|
|
524
|
+
* error: 'Please enter a number not between 1 and 10'
|
|
525
|
+
* })
|
|
526
|
+
* .build();
|
|
527
|
+
* fRange.setDataValidation(rule);
|
|
316
528
|
* ```
|
|
317
529
|
*/
|
|
318
530
|
requireNumberNotBetween(e, t, i) {
|
|
@@ -326,8 +538,18 @@ class E {
|
|
|
326
538
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
327
539
|
* @example
|
|
328
540
|
* ```typescript
|
|
329
|
-
* const
|
|
330
|
-
* const
|
|
541
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
542
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
543
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
544
|
+
* const rule = univerAPI.newDataValidation()
|
|
545
|
+
* .requireNumberNotEqualTo(10)
|
|
546
|
+
* .setOptions({
|
|
547
|
+
* allowBlank: false,
|
|
548
|
+
* showErrorMessage: true,
|
|
549
|
+
* error: 'Please enter a number not equal to 10'
|
|
550
|
+
* })
|
|
551
|
+
* .build();
|
|
552
|
+
* fRange.setDataValidation(rule);
|
|
331
553
|
* ```
|
|
332
554
|
*/
|
|
333
555
|
requireNumberNotEqualTo(e, t) {
|
|
@@ -342,8 +564,18 @@ class E {
|
|
|
342
564
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
343
565
|
* @example
|
|
344
566
|
* ```typescript
|
|
345
|
-
* const
|
|
346
|
-
* const
|
|
567
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
568
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
569
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
570
|
+
* const rule = univerAPI.newDataValidation()
|
|
571
|
+
* .requireValueInList(['Yes', 'No'])
|
|
572
|
+
* .setOptions({
|
|
573
|
+
* allowBlank: true,
|
|
574
|
+
* showErrorMessage: true,
|
|
575
|
+
* error: 'Please enter a value from the list'
|
|
576
|
+
* })
|
|
577
|
+
* .build();
|
|
578
|
+
* fRange.setDataValidation(rule);
|
|
347
579
|
* ```
|
|
348
580
|
*/
|
|
349
581
|
requireValueInList(e, t, i) {
|
|
@@ -358,9 +590,24 @@ class E {
|
|
|
358
590
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
359
591
|
* @example
|
|
360
592
|
* ```typescript
|
|
361
|
-
* const
|
|
362
|
-
* const
|
|
363
|
-
* const
|
|
593
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
594
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
595
|
+
* const fRange = fWorksheet.getRange('B1:B2');
|
|
596
|
+
* fRange.setValues([
|
|
597
|
+
* ['Yes'],
|
|
598
|
+
* ['No']
|
|
599
|
+
* ]);
|
|
600
|
+
*
|
|
601
|
+
* const rule = univerAPI.newDataValidation()
|
|
602
|
+
* .requireValueInRange(fRange)
|
|
603
|
+
* .setOptions({
|
|
604
|
+
* allowBlank: false,
|
|
605
|
+
* showErrorMessage: true,
|
|
606
|
+
* error: 'Please enter a value from the list'
|
|
607
|
+
* })
|
|
608
|
+
* .build();
|
|
609
|
+
* const cell = fWorksheet.getRange('A1');
|
|
610
|
+
* cell.setDataValidation(rule);
|
|
364
611
|
* ```
|
|
365
612
|
*/
|
|
366
613
|
requireValueInRange(e, t, i) {
|
|
@@ -378,8 +625,24 @@ class E {
|
|
|
378
625
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
379
626
|
* @example
|
|
380
627
|
* ```typescript
|
|
381
|
-
* const
|
|
382
|
-
* const
|
|
628
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
629
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
630
|
+
*
|
|
631
|
+
* // Set the data validation for cell A1:B2 to allow invalid data, so A1:B2 will display a warning when invalid data is entered
|
|
632
|
+
* const fRange = fWorksheet.getRange('A1:B2');
|
|
633
|
+
* const rule = univerAPI.newDataValidation()
|
|
634
|
+
* .requireValueInList(['Yes', 'No'])
|
|
635
|
+
* .setAllowInvalid(true)
|
|
636
|
+
* .build();
|
|
637
|
+
* fRange.setDataValidation(rule);
|
|
638
|
+
*
|
|
639
|
+
* // Set the data validation for cell C1:D2 to not allow invalid data, so C1:D2 will stop data entry when invalid data is entered
|
|
640
|
+
* const fRange2 = fWorksheet.getRange('C1:D2');
|
|
641
|
+
* const rule2 = univerAPI.newDataValidation()
|
|
642
|
+
* .requireValueInList(['Yes', 'No'])
|
|
643
|
+
* .setAllowInvalid(false)
|
|
644
|
+
* .build();
|
|
645
|
+
* fRange2.setDataValidation(rule2);
|
|
383
646
|
* ```
|
|
384
647
|
*/
|
|
385
648
|
setAllowInvalid(e) {
|
|
@@ -391,8 +654,25 @@ class E {
|
|
|
391
654
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
392
655
|
* @example
|
|
393
656
|
* ```typescript
|
|
394
|
-
*
|
|
395
|
-
* const
|
|
657
|
+
* // Assume current sheet is empty data
|
|
658
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
659
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
660
|
+
*
|
|
661
|
+
* // Set the data validation for cell A1:B2 to allow blank values
|
|
662
|
+
* const fRange = fWorksheet.getRange('A1:B2');
|
|
663
|
+
* const rule = univerAPI.newDataValidation()
|
|
664
|
+
* .requireValueInList(['Yes', 'No'])
|
|
665
|
+
* .setAllowBlank(true)
|
|
666
|
+
* .build();
|
|
667
|
+
* fRange.setDataValidation(rule);
|
|
668
|
+
*
|
|
669
|
+
* // Set the data validation for cell C1:D2 to not allow blank values
|
|
670
|
+
* const fRange2 = fWorksheet.getRange('C1:D2');
|
|
671
|
+
* const rule2 = univerAPI.newDataValidation()
|
|
672
|
+
* .requireValueInList(['Yes', 'No'])
|
|
673
|
+
* .setAllowBlank(false)
|
|
674
|
+
* .build();
|
|
675
|
+
* fRange2.setDataValidation(rule2);
|
|
396
676
|
* ```
|
|
397
677
|
*/
|
|
398
678
|
setAllowBlank(e) {
|
|
@@ -404,12 +684,18 @@ class E {
|
|
|
404
684
|
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
405
685
|
* @example
|
|
406
686
|
* ```typescript
|
|
407
|
-
* const
|
|
408
|
-
* const
|
|
409
|
-
*
|
|
410
|
-
*
|
|
411
|
-
*
|
|
412
|
-
*
|
|
687
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
688
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
689
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
690
|
+
* const rule = univerAPI.newDataValidation()
|
|
691
|
+
* .requireValueInList(['Yes', 'No'])
|
|
692
|
+
* .setOptions({
|
|
693
|
+
* allowBlank: true,
|
|
694
|
+
* showErrorMessage: true,
|
|
695
|
+
* error: 'Please enter a value from the list'
|
|
696
|
+
* })
|
|
697
|
+
* .build();
|
|
698
|
+
* fRange.setDataValidation(rule);
|
|
413
699
|
* ```
|
|
414
700
|
*/
|
|
415
701
|
setOptions(e) {
|
|
@@ -428,12 +714,12 @@ class _ {
|
|
|
428
714
|
* @returns {boolean} true if invalid data is allowed, false otherwise
|
|
429
715
|
* @example
|
|
430
716
|
* ```typescript
|
|
431
|
-
* const
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
*
|
|
435
|
-
* .
|
|
436
|
-
*
|
|
717
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
718
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
719
|
+
* const rules = fWorksheet.getDataValidations();
|
|
720
|
+
* rules.forEach((rule) => {
|
|
721
|
+
* console.log(rule, rule.getAllowInvalid());
|
|
722
|
+
* });
|
|
437
723
|
* ```
|
|
438
724
|
*/
|
|
439
725
|
getAllowInvalid() {
|
|
@@ -444,12 +730,12 @@ class _ {
|
|
|
444
730
|
* @returns {DataValidationType | string} The data validation type
|
|
445
731
|
* @example
|
|
446
732
|
* ```typescript
|
|
447
|
-
* const
|
|
448
|
-
*
|
|
449
|
-
*
|
|
450
|
-
*
|
|
451
|
-
* .
|
|
452
|
-
*
|
|
733
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
734
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
735
|
+
* const rules = fWorksheet.getDataValidations();
|
|
736
|
+
* rules.forEach((rule) => {
|
|
737
|
+
* console.log(rule, rule.getCriteriaType());
|
|
738
|
+
* });
|
|
453
739
|
* ```
|
|
454
740
|
*/
|
|
455
741
|
getCriteriaType() {
|
|
@@ -460,12 +746,15 @@ class _ {
|
|
|
460
746
|
* @returns {[string | undefined, string | undefined, string | undefined]} An array containing the operator, formula1, and formula2 values
|
|
461
747
|
* @example
|
|
462
748
|
* ```typescript
|
|
463
|
-
* const
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
*
|
|
467
|
-
* .
|
|
468
|
-
*
|
|
749
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
750
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
751
|
+
* const rules = fWorksheet.getDataValidations();
|
|
752
|
+
* rules.forEach((rule) => {
|
|
753
|
+
* console.log(rule);
|
|
754
|
+
* const criteriaValues = rule.getCriteriaValues();
|
|
755
|
+
* const [operator, formula1, formula2] = criteriaValues;
|
|
756
|
+
* console.log(operator, formula1, formula2);
|
|
757
|
+
* });
|
|
469
758
|
* ```
|
|
470
759
|
*/
|
|
471
760
|
getCriteriaValues() {
|
|
@@ -476,12 +765,19 @@ class _ {
|
|
|
476
765
|
* @returns {string | undefined} Returns the help text information. If there is no error message, it returns an undefined value
|
|
477
766
|
* @example
|
|
478
767
|
* ```typescript
|
|
479
|
-
* const
|
|
480
|
-
*
|
|
481
|
-
*
|
|
482
|
-
*
|
|
483
|
-
* .
|
|
484
|
-
*
|
|
768
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
769
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
770
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
771
|
+
* const rule = univerAPI.newDataValidation()
|
|
772
|
+
* .requireNumberBetween(1, 10)
|
|
773
|
+
* .setOptions({
|
|
774
|
+
* allowBlank: true,
|
|
775
|
+
* showErrorMessage: true,
|
|
776
|
+
* error: 'Please enter a number between 1 and 10'
|
|
777
|
+
* })
|
|
778
|
+
* .build();
|
|
779
|
+
* fRange.setDataValidation(rule);
|
|
780
|
+
* console.log(fRange.getDataValidation().getHelpText()); // 'Please enter a number between 1 and 10'
|
|
485
781
|
* ```
|
|
486
782
|
*/
|
|
487
783
|
getHelpText() {
|
|
@@ -492,13 +788,27 @@ class _ {
|
|
|
492
788
|
* @returns {FDataValidationBuilder} A new FDataValidationBuilder instance with the same rule configuration
|
|
493
789
|
* @example
|
|
494
790
|
* ```typescript
|
|
495
|
-
* const
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
* .
|
|
500
|
-
*
|
|
501
|
-
*
|
|
791
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
792
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
793
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
794
|
+
* const rule = univerAPI.newDataValidation()
|
|
795
|
+
* .requireNumberBetween(1, 10)
|
|
796
|
+
* .setOptions({
|
|
797
|
+
* allowBlank: true,
|
|
798
|
+
* showErrorMessage: true,
|
|
799
|
+
* error: 'Please enter a number between 1 and 10'
|
|
800
|
+
* })
|
|
801
|
+
* .build();
|
|
802
|
+
* fRange.setDataValidation(rule);
|
|
803
|
+
*
|
|
804
|
+
* const builder = fRange.getDataValidation().copy();
|
|
805
|
+
* const newRule = builder
|
|
806
|
+
* .requireNumberBetween(1, 5)
|
|
807
|
+
* .setOptions({
|
|
808
|
+
* error: 'Please enter a number between 1 and 5'
|
|
809
|
+
* })
|
|
810
|
+
* .build();
|
|
811
|
+
* fRange.setDataValidation(newRule);
|
|
502
812
|
* ```
|
|
503
813
|
*/
|
|
504
814
|
copy() {
|
|
@@ -509,12 +819,15 @@ class _ {
|
|
|
509
819
|
* @returns {boolean} true if the rule is applied, false otherwise
|
|
510
820
|
* @example
|
|
511
821
|
* ```typescript
|
|
512
|
-
* const
|
|
513
|
-
*
|
|
514
|
-
*
|
|
515
|
-
*
|
|
516
|
-
* .
|
|
517
|
-
*
|
|
822
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
823
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
824
|
+
* const rules = fWorksheet.getDataValidations();
|
|
825
|
+
* rules.forEach((rule) => {
|
|
826
|
+
* console.log(rule, rule.getApplied());
|
|
827
|
+
* });
|
|
828
|
+
*
|
|
829
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
830
|
+
* console.log(fRange.getDataValidation()?.getApplied());
|
|
518
831
|
* ```
|
|
519
832
|
*/
|
|
520
833
|
getApplied() {
|
|
@@ -528,12 +841,16 @@ class _ {
|
|
|
528
841
|
* @returns {FRange[]} An array of FRange objects representing the ranges to which the data validation rule is applied
|
|
529
842
|
* @example
|
|
530
843
|
* ```typescript
|
|
531
|
-
* const
|
|
532
|
-
*
|
|
533
|
-
*
|
|
534
|
-
*
|
|
535
|
-
* .
|
|
536
|
-
*
|
|
844
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
845
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
846
|
+
* const rules = fWorksheet.getDataValidations();
|
|
847
|
+
* rules.forEach((rule) => {
|
|
848
|
+
* console.log(rule);
|
|
849
|
+
* const ranges = rule.getRanges();
|
|
850
|
+
* ranges.forEach((range) => {
|
|
851
|
+
* console.log(range.getA1Notation());
|
|
852
|
+
* });
|
|
853
|
+
* });
|
|
537
854
|
* ```
|
|
538
855
|
*/
|
|
539
856
|
getRanges() {
|
|
@@ -547,12 +864,10 @@ class _ {
|
|
|
547
864
|
* @returns {string | undefined} The unit ID of the worksheet
|
|
548
865
|
* @example
|
|
549
866
|
* ```typescript
|
|
550
|
-
* const
|
|
551
|
-
*
|
|
552
|
-
*
|
|
553
|
-
*
|
|
554
|
-
* .getDataValidation();
|
|
555
|
-
* const unitId = dataValidation.getUnitId();
|
|
867
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
868
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
869
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
870
|
+
* console.log(fRange.getDataValidation().getUnitId());
|
|
556
871
|
* ```
|
|
557
872
|
*/
|
|
558
873
|
getUnitId() {
|
|
@@ -564,12 +879,10 @@ class _ {
|
|
|
564
879
|
* @returns {string | undefined} The sheet ID of the worksheet
|
|
565
880
|
* @example
|
|
566
881
|
* ```typescript
|
|
567
|
-
* const
|
|
568
|
-
*
|
|
569
|
-
*
|
|
570
|
-
*
|
|
571
|
-
* .getDataValidation();
|
|
572
|
-
* const sheetId = dataValidation.getSheetId();
|
|
882
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
883
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
884
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
885
|
+
* console.log(fRange.getDataValidation().getSheetId());
|
|
573
886
|
* ```
|
|
574
887
|
*/
|
|
575
888
|
getSheetId() {
|
|
@@ -584,15 +897,17 @@ class _ {
|
|
|
584
897
|
* @returns {FDataValidation} The current instance for method chaining
|
|
585
898
|
* @example
|
|
586
899
|
* ```typescript
|
|
587
|
-
* const
|
|
588
|
-
*
|
|
589
|
-
*
|
|
590
|
-
*
|
|
591
|
-
* .
|
|
592
|
-
*
|
|
593
|
-
*
|
|
594
|
-
*
|
|
595
|
-
*
|
|
900
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
901
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
902
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
903
|
+
* const rule = univerAPI.newDataValidation()
|
|
904
|
+
* .requireNumberEqualTo(20)
|
|
905
|
+
* .build();
|
|
906
|
+
* fRange.setDataValidation(rule);
|
|
907
|
+
*
|
|
908
|
+
* fRange.getDataValidation().setCriteria(
|
|
909
|
+
* univerAPI.Enum.DataValidationType.DECIMAL,
|
|
910
|
+
* [univerAPI.Enum.DataValidationOperator.BETWEEN, '1', '10']
|
|
596
911
|
* );
|
|
597
912
|
* ```
|
|
598
913
|
*/
|
|
@@ -618,12 +933,15 @@ class _ {
|
|
|
618
933
|
* @returns {FDataValidation} The current instance for method chaining
|
|
619
934
|
* @example
|
|
620
935
|
* ```typescript
|
|
621
|
-
* const
|
|
622
|
-
*
|
|
623
|
-
*
|
|
624
|
-
*
|
|
625
|
-
* .
|
|
626
|
-
*
|
|
936
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
937
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
938
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
939
|
+
* const rule = univerAPI.newDataValidation()
|
|
940
|
+
* .requireNumberEqualTo(20)
|
|
941
|
+
* .build();
|
|
942
|
+
* fRange.setDataValidation(rule);
|
|
943
|
+
*
|
|
944
|
+
* fRange.getDataValidation().setOptions({
|
|
627
945
|
* allowBlank: true,
|
|
628
946
|
* showErrorMessage: true,
|
|
629
947
|
* error: 'Please enter a valid value'
|
|
@@ -649,13 +967,16 @@ class _ {
|
|
|
649
967
|
* @returns {FDataValidation} The current instance for method chaining
|
|
650
968
|
* @example
|
|
651
969
|
* ```typescript
|
|
652
|
-
* const
|
|
653
|
-
*
|
|
654
|
-
*
|
|
655
|
-
*
|
|
656
|
-
* .
|
|
657
|
-
*
|
|
658
|
-
*
|
|
970
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
971
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
972
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
973
|
+
* const rule = univerAPI.newDataValidation()
|
|
974
|
+
* .requireNumberEqualTo(20)
|
|
975
|
+
* .build();
|
|
976
|
+
* fRange.setDataValidation(rule);
|
|
977
|
+
*
|
|
978
|
+
* const newRuleRange = fWorksheet.getRange('C1:D10');
|
|
979
|
+
* fRange.getDataValidation().setRanges([newRuleRange]);
|
|
659
980
|
* ```
|
|
660
981
|
*/
|
|
661
982
|
setRanges(e) {
|
|
@@ -673,12 +994,15 @@ class _ {
|
|
|
673
994
|
* @returns {boolean} true if the rule is deleted successfully, false otherwise
|
|
674
995
|
* @example
|
|
675
996
|
* ```typescript
|
|
676
|
-
* const
|
|
677
|
-
*
|
|
678
|
-
*
|
|
679
|
-
*
|
|
680
|
-
* .
|
|
681
|
-
*
|
|
997
|
+
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
998
|
+
* const fWorksheet = fWorkbook.getActiveSheet();
|
|
999
|
+
* const fRange = fWorksheet.getRange('A1:B10');
|
|
1000
|
+
* const rule = univerAPI.newDataValidation()
|
|
1001
|
+
* .requireNumberEqualTo(20)
|
|
1002
|
+
* .build();
|
|
1003
|
+
* fRange.setDataValidation(rule);
|
|
1004
|
+
*
|
|
1005
|
+
* fRange.getDataValidation().delete();
|
|
682
1006
|
* ```
|
|
683
1007
|
*/
|
|
684
1008
|
delete() {
|