@univerjs/sheets-data-validation 0.6.2 → 0.6.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -37,6 +37,8 @@ export declare class FDataValidationBuilder {
37
37
  * ```typescript
38
38
  * const fWorkbook = univerAPI.getActiveWorkbook();
39
39
  * const fWorksheet = fWorkbook.getActiveSheet();
40
+ *
41
+ * // Create a new data validation rule that requires a number between 1 and 10 for the range A1:B10
40
42
  * const fRange = fWorksheet.getRange('A1:B10');
41
43
  * const rule = univerAPI.newDataValidation()
42
44
  * .requireNumberBetween(1, 10)
@@ -55,9 +57,24 @@ export declare class FDataValidationBuilder {
55
57
  * @returns {FDataValidationBuilder} A new instance of the DataValidationBuilder class
56
58
  * @example
57
59
  * ```typescript
58
- * const builder = univerAPI.newDataValidation().requireNumberBetween(1, 10);
60
+ * const fWorkbook = univerAPI.getActiveWorkbook();
61
+ * const fWorksheet = fWorkbook.getActiveSheet();
62
+ *
63
+ * // Create a new data validation rule that requires a number between 1 and 10 for the range A1:B10
64
+ * const fRange = fWorksheet.getRange('A1:B10');
65
+ * const builder = univerAPI.newDataValidation()
66
+ * .requireNumberBetween(1, 10)
67
+ * .setOptions({
68
+ * allowBlank: true,
69
+ * showErrorMessage: true,
70
+ * error: 'Please enter a number between 1 and 10'
71
+ * });
72
+ * fRange.setDataValidation(builder.build());
73
+ *
74
+ * // Copy the builder applied to the new range F1:G10
75
+ * const newRange = fWorksheet.getRange('F1:G10');
59
76
  * const copyBuilder = builder.copy();
60
- * console.log(copyBuilder);
77
+ * newRange.setDataValidation(copyBuilder.build());
61
78
  * ```
62
79
  */
63
80
  copy(): FDataValidationBuilder;
@@ -77,13 +94,13 @@ export declare class FDataValidationBuilder {
77
94
  * @example
78
95
  * ```typescript
79
96
  * const builder = univerAPI.newDataValidation();
80
- * console.log(builder.getCriteriaType());
97
+ * console.log(builder.getCriteriaType()); // custom
81
98
  *
82
99
  * builder.requireNumberBetween(1, 10);
83
- * console.log(builder.getCriteriaType());
100
+ * console.log(builder.getCriteriaType()); // decimal
84
101
  *
85
102
  * builder.requireValueInList(['Yes', 'No']);
86
- * console.log(builder.getCriteriaType());
103
+ * console.log(builder.getCriteriaType()); // list
87
104
  * ```
88
105
  */
89
106
  getCriteriaType(): DataValidationType | string;
@@ -94,10 +111,10 @@ export declare class FDataValidationBuilder {
94
111
  * ```typescript
95
112
  * const builder = univerAPI.newDataValidation().requireNumberBetween(1, 10);
96
113
  * const [operator, formula1, formula2] = builder.getCriteriaValues();
97
- * console.log(operator, formula1, formula2);
114
+ * console.log(operator, formula1, formula2); // between 1 10
98
115
  *
99
116
  * builder.requireValueInList(['Yes', 'No']);
100
- * console.log(builder.getCriteriaValues());
117
+ * console.log(builder.getCriteriaValues()); // undefined Yes,No undefined
101
118
  * ```
102
119
  */
103
120
  getCriteriaValues(): [string | undefined, string | undefined, string | undefined];
@@ -115,10 +132,10 @@ export declare class FDataValidationBuilder {
115
132
  */
116
133
  getHelpText(): string | undefined;
117
134
  /**
118
- * Sets the data validation type to CHECKBOX and sets the checked and unchecked values
119
- * @param {string} [checkedValue] - The value when the checkbox is checked
120
- * @param {string} [uncheckedValue] - The value when the checkbox is unchecked
121
- * @returns {FDataValidationBuilder} The current instance for method chaining
135
+ * Sets the data validation rule to require that the input is a boolean value; this value is rendered as a checkbox.
136
+ * @param {string} [checkedValue] - The value assigned to a checked box.
137
+ * @param {string} [uncheckedValue] - The value assigned to an unchecked box.
138
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
122
139
  * @example
123
140
  * ```typescript
124
141
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -141,179 +158,217 @@ export declare class FDataValidationBuilder {
141
158
  */
142
159
  requireCheckbox(checkedValue?: string, uncheckedValue?: string): FDataValidationBuilder;
143
160
  /**
144
- * Set the data validation type to DATE and configure the validation rules to be after a specific date
145
- * @param {Date} date - The date to compare against
146
- * @returns {FDataValidationBuilder} The current instance for method chaining
161
+ * Set the data validation type to DATE and configure the validation rules to be after a specific date.
162
+ * @param {Date} date - The latest unacceptable date.
163
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
147
164
  * @example
148
165
  * ```typescript
149
166
  * const fWorkbook = univerAPI.getActiveWorkbook();
150
167
  * const fWorksheet = fWorkbook.getActiveSheet();
168
+ *
169
+ * // Set some date values in the range A1:B2
151
170
  * const fRange = fWorksheet.getRange('A1:B2');
152
171
  * fRange.setValues([
153
172
  * ['2024-01-01', '2024-12-31'],
154
173
  * ['2025-01-01', '2025-12-31']
155
174
  * ]);
175
+ *
176
+ * // Create a data validation rule that requires a date after 2025-01-01
156
177
  * const rule = univerAPI.newDataValidation()
157
178
  * .requireDateAfter(new Date('2025-01-01'))
158
179
  * .build();
159
180
  * fRange.setDataValidation(rule);
160
181
  *
182
+ * // Get the validation status of the range
161
183
  * const status = await fRange.getValidatorStatus();
162
184
  * console.log(status); // [['invalid', 'invalid', 'invalid', 'valid']]
163
185
  * ```
164
186
  */
165
187
  requireDateAfter(date: Date): FDataValidationBuilder;
166
188
  /**
167
- * Set the data validation type to DATE and configure the validation rules to be before a specific date
168
- * @param {Date} date - The date to compare against
169
- * @returns {FDataValidationBuilder} The current instance for method chaining
189
+ * Set the data validation type to DATE and configure the validation rules to be before a specific date.
190
+ * @param {Date} date - The earliest unacceptable date.
191
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
170
192
  * @example
171
193
  * ```typescript
172
194
  * const fWorkbook = univerAPI.getActiveWorkbook();
173
195
  * const fWorksheet = fWorkbook.getActiveSheet();
196
+ *
197
+ * // Set some date values in the range A1:B2
174
198
  * const fRange = fWorksheet.getRange('A1:B2');
175
199
  * fRange.setValues([
176
200
  * ['2024-01-01', '2024-12-31'],
177
201
  * ['2025-01-01', '2025-12-31']
178
202
  * ]);
203
+ *
204
+ * // Create a data validation rule that requires a date before 2025-01-01
179
205
  * const rule = univerAPI.newDataValidation()
180
206
  * .requireDateBefore(new Date('2025-01-01'))
181
207
  * .build();
182
208
  * fRange.setDataValidation(rule);
183
209
  *
210
+ * // Get the validation status of the range
184
211
  * const status = await fRange.getValidatorStatus();
185
212
  * console.log(status); // [['valid', 'valid', 'invalid', 'invalid']]
186
213
  * ```
187
214
  */
188
215
  requireDateBefore(date: Date): FDataValidationBuilder;
189
216
  /**
190
- * Set the data validation type to DATE and configure the validation rules to be within a specific date range
191
- * @param {Date} start - The starting date of the range
192
- * @param {Date} end - The ending date of the range
193
- * @returns {FDataValidationBuilder} The current instance for method chaining
217
+ * Set the data validation type to DATE and configure the validation rules to be within a specific date range.
218
+ * @param {Date} start - The earliest acceptable date.
219
+ * @param {Date} end - The latest acceptable date.
220
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
194
221
  * @example
195
222
  * ```typescript
196
223
  * const fWorkbook = univerAPI.getActiveWorkbook();
197
224
  * const fWorksheet = fWorkbook.getActiveSheet();
225
+ *
226
+ * // Set some date values in the range A1:B2
198
227
  * const fRange = fWorksheet.getRange('A1:B2');
199
228
  * fRange.setValues([
200
229
  * ['2024-01-01', '2024-12-31'],
201
230
  * ['2025-01-01', '2025-12-31']
202
231
  * ]);
232
+ *
233
+ * // Create a data validation rule that requires a date between 2024-06-01 and 2025-06-01
203
234
  * const rule = univerAPI.newDataValidation()
204
235
  * .requireDateBetween(new Date('2024-06-01'), new Date('2025-06-01'))
205
236
  * .build();
206
237
  * fRange.setDataValidation(rule);
207
238
  *
239
+ * // Get the validation status of the range
208
240
  * const status = await fRange.getValidatorStatus();
209
241
  * console.log(status); // [['invalid', 'valid', 'valid', 'invalid']]
210
242
  * ```
211
243
  */
212
244
  requireDateBetween(start: Date, end: Date): FDataValidationBuilder;
213
245
  /**
214
- * Set the data validation type to DATE and configure the validation rules to be equal to a specific date
215
- * @param {Date} date - The date to compare against
216
- * @returns {FDataValidationBuilder} The current instance for method chaining
246
+ * Set the data validation type to DATE and configure the validation rules to be equal to a specific date.
247
+ * @param {Date} date - The sole acceptable date.
248
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
217
249
  * @example
218
250
  * ```typescript
219
251
  * const fWorkbook = univerAPI.getActiveWorkbook();
220
252
  * const fWorksheet = fWorkbook.getActiveSheet();
253
+ *
254
+ * // Set some date values in the range A1:B2
221
255
  * const fRange = fWorksheet.getRange('A1:B2');
222
256
  * fRange.setValues([
223
257
  * ['2024-01-01', '2024-12-31'],
224
258
  * ['2025-01-01', '2025-12-31']
225
259
  * ]);
260
+ *
261
+ * // Create a data validation rule that requires a date equal to 2025-01-01
226
262
  * const rule = univerAPI.newDataValidation()
227
263
  * .requireDateEqualTo(new Date('2025-01-01'))
228
264
  * .build();
229
265
  * fRange.setDataValidation(rule);
230
266
  *
267
+ * // Get the validation status of the cell A2
231
268
  * const status = await fWorksheet.getRange('A2').getValidatorStatus();
232
269
  * console.log(status?.[0]?.[0]); // 'valid'
233
270
  *
271
+ * // Get the validation status of the cell B2
234
272
  * const status2 = await fWorksheet.getRange('B2').getValidatorStatus();
235
273
  * console.log(status2?.[0]?.[0]); // 'invalid'
236
274
  * ```
237
275
  */
238
276
  requireDateEqualTo(date: Date): FDataValidationBuilder;
239
277
  /**
240
- * Set the data validation type to DATE and configure the validation rules to be not within a specific date range
241
- * @param {Date} start - The starting date of the date range
242
- * @param {Date} end - The ending date of the date range
243
- * @returns {FDataValidationBuilder} The current instance for method chaining
278
+ * Set the data validation type to DATE and configure the validation rules to be not within a specific date range.
279
+ * @param {Date} start - The earliest unacceptable date.
280
+ * @param {Date} end - The latest unacceptable date.
281
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
244
282
  * @example
245
283
  * ```typescript
246
284
  * const fWorkbook = univerAPI.getActiveWorkbook();
247
285
  * const fWorksheet = fWorkbook.getActiveSheet();
286
+ *
287
+ * // Set some date values in the range A1:B2
248
288
  * const fRange = fWorksheet.getRange('A1:B2');
249
289
  * fRange.setValues([
250
290
  * ['2024-01-01', '2024-12-31'],
251
291
  * ['2025-01-01', '2025-12-31']
252
292
  * ]);
293
+ *
294
+ * // Create a data validation rule that requires a date not between 2024-06-01 and 2025-06-01
253
295
  * const rule = univerAPI.newDataValidation()
254
296
  * .requireDateNotBetween(new Date('2024-06-01'), new Date('2025-06-01'))
255
297
  * .build();
256
298
  * fRange.setDataValidation(rule);
257
299
  *
300
+ * // Get the validation status of the range
258
301
  * const status = await fRange.getValidatorStatus();
259
302
  * console.log(status); // [['valid', 'invalid', 'invalid', 'valid']]
260
303
  * ```
261
304
  */
262
305
  requireDateNotBetween(start: Date, end: Date): FDataValidationBuilder;
263
306
  /**
264
- * Set the data validation type to DATE and configure the validation rules to be on or after a specific date
265
- * @param {Date} date - The date to compare against
266
- * @returns {FDataValidationBuilder} The current instance for method chaining
307
+ * Set the data validation type to DATE and configure the validation rules to be on or after a specific date.
308
+ * @param {Date} date - The earliest acceptable date.
309
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
267
310
  * @example
268
311
  * ```typescript
269
312
  * const fWorkbook = univerAPI.getActiveWorkbook();
270
313
  * const fWorksheet = fWorkbook.getActiveSheet();
314
+ *
315
+ * // Set some date values in the range A1:B2
271
316
  * const fRange = fWorksheet.getRange('A1:B2');
272
317
  * fRange.setValues([
273
318
  * ['2024-01-01', '2024-12-31'],
274
319
  * ['2025-01-01', '2025-12-31']
275
320
  * ]);
321
+ *
322
+ * // Create a data validation rule that requires a date on or after 2025-01-01
276
323
  * const rule = univerAPI.newDataValidation()
277
324
  * .requireDateOnOrAfter(new Date('2025-01-01'))
278
325
  * .build();
279
326
  * fRange.setDataValidation(rule);
280
327
  *
328
+ * // Get the validation status of the range
281
329
  * const status = await fRange.getValidatorStatus();
282
330
  * console.log(status); // [['invalid', 'invalid', 'valid', 'valid']]
283
331
  * ```
284
332
  */
285
333
  requireDateOnOrAfter(date: Date): FDataValidationBuilder;
286
334
  /**
287
- * Set the data validation type to DATE and configure the validation rules to be on or before a specific date
288
- * @param {Date} date - The date to compare against
289
- * @returns {FDataValidationBuilder} The current instance for method chaining
335
+ * Set the data validation type to DATE and configure the validation rules to be on or before a specific date.
336
+ * @param {Date} date - The latest acceptable date.
337
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
290
338
  * @example
291
339
  * ```typescript
292
340
  * const fWorkbook = univerAPI.getActiveWorkbook();
293
341
  * const fWorksheet = fWorkbook.getActiveSheet();
342
+ *
343
+ * // Set some date values in the range A1:B2
294
344
  * const fRange = fWorksheet.getRange('A1:B2');
295
345
  * fRange.setValues([
296
346
  * ['2024-01-01', '2024-12-31'],
297
347
  * ['2025-01-01', '2025-12-31']
298
348
  * ]);
349
+ *
350
+ * // Create a data validation rule that requires a date on or before 2025-01-01
299
351
  * const rule = univerAPI.newDataValidation()
300
352
  * .requireDateOnOrBefore(new Date('2025-01-01'))
301
353
  * .build();
302
354
  * fRange.setDataValidation(rule);
303
355
  *
356
+ * // Get the validation status of the range
304
357
  * const status = await fRange.getValidatorStatus();
305
358
  * console.log(status); // [['valid', 'valid', 'valid', 'invalid']]
306
359
  * ```
307
360
  */
308
361
  requireDateOnOrBefore(date: Date): FDataValidationBuilder;
309
362
  /**
310
- * Requires that a custom formula be satisfied
311
- * @param {string} formula - The formula string that needs to be satisfied, formula result should be TRUE or FALSE, and references range will relative offset
312
- * @returns {FDataValidationBuilder} The current instance for method chaining
363
+ * Sets the data validation rule to require that the given formula evaluates to `true`.
364
+ * @param {string} formula - The formula string that needs to be satisfied, formula result should be TRUE or FALSE, and references range will relative offset.
365
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
313
366
  * @example
314
367
  * ```typescript
315
368
  * const fWorkbook = univerAPI.getActiveWorkbook();
316
369
  * const fWorksheet = fWorkbook.getActiveSheet();
370
+ *
371
+ * // Set some values in the range A1:B2 and C1:D2
317
372
  * const cell = fWorksheet.getRange('A1:B2');
318
373
  * cell.setValues([
319
374
  * [4, 3],
@@ -324,6 +379,8 @@ export declare class FDataValidationBuilder {
324
379
  * [1, 2],
325
380
  * [3, 4]
326
381
  * ]);
382
+ *
383
+ * // Create a data validation rule that requires the formula '=A1>2' to be satisfied
327
384
  * const rule = univerAPI.newDataValidation()
328
385
  * .requireFormulaSatisfied('=A1>2')
329
386
  * .setOptions({
@@ -333,21 +390,24 @@ export declare class FDataValidationBuilder {
333
390
  * .build();
334
391
  * fRange.setDataValidation(rule);
335
392
  *
393
+ * // Get the validation status of the range
336
394
  * const status = await fRange.getValidatorStatus();
337
395
  * console.log(status); // [['valid', 'valid', 'invalid', 'invalid']]
338
396
  * ```
339
397
  */
340
398
  requireFormulaSatisfied(formula: string): FDataValidationBuilder;
341
399
  /**
342
- * Requires the user to enter a number within a specific range, which can be integer or decimal
343
- * @param {number} start - The starting value of the number range
344
- * @param {number} end - The ending value of the number range
345
- * @param {boolean} [isInteger] - Indicates whether the required number is an integer
346
- * @returns {FDataValidationBuilder} The current instance for method chaining
400
+ * Sets the data validation rule to require a number that falls between, or is either of, two specified numbers.
401
+ * @param {number} start - The lowest acceptable value.
402
+ * @param {number} end - The highest acceptable value.
403
+ * @param {boolean} [isInteger] - Indicates whether the required number is an integer.
404
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
347
405
  * @example
348
406
  * ```typescript
349
407
  * const fWorkbook = univerAPI.getActiveWorkbook();
350
408
  * const fWorksheet = fWorkbook.getActiveSheet();
409
+ *
410
+ * // Create a new data validation rule that requires a number between 1 and 10 for the range A1:B10
351
411
  * const fRange = fWorksheet.getRange('A1:B10');
352
412
  * const rule = univerAPI.newDataValidation()
353
413
  * .requireNumberBetween(1, 10)
@@ -362,14 +422,16 @@ export declare class FDataValidationBuilder {
362
422
  */
363
423
  requireNumberBetween(start: number, end: number, isInteger?: boolean): FDataValidationBuilder;
364
424
  /**
365
- * Requires the user to enter a number that is equal to a specific value, which can be an integer or a decimal
366
- * @param {number} num - The number to which the entered number should be equal
367
- * @param {boolean} [isInteger] - Indicates whether the required number is an integer
368
- * @returns {FDataValidationBuilder} The current instance for method chaining
425
+ * Sets the data validation rule to require a number equal to the given value.
426
+ * @param {number} num - The sole acceptable value.
427
+ * @param {boolean} [isInteger] - Indicates whether the required number is an integer.
428
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
369
429
  * @example
370
430
  * ```typescript
371
431
  * const fWorkbook = univerAPI.getActiveWorkbook();
372
432
  * const fWorksheet = fWorkbook.getActiveSheet();
433
+ *
434
+ * // Create a new data validation rule that requires a number equal to 10 for the range A1:B10
373
435
  * const fRange = fWorksheet.getRange('A1:B10');
374
436
  * const rule = univerAPI.newDataValidation()
375
437
  * .requireNumberEqualTo(10)
@@ -384,14 +446,16 @@ export declare class FDataValidationBuilder {
384
446
  */
385
447
  requireNumberEqualTo(num: number, isInteger?: boolean): FDataValidationBuilder;
386
448
  /**
387
- * Requires the user to enter a number that is greater than a specific value, which can be an integer or a decimal
388
- * @param {number} num - The number to which the entered number should be greater
389
- * @param {boolean} [isInteger] - Indicates whether the required number is an integer
390
- * @returns {FDataValidationBuilder} The current instance for method chaining
449
+ * Sets the data validation rule to require a number greater than the given value.
450
+ * @param {number} num - The highest unacceptable value.
451
+ * @param {boolean} [isInteger] - Indicates whether the required number is an integer.
452
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
391
453
  * @example
392
454
  * ```typescript
393
455
  * const fWorkbook = univerAPI.getActiveWorkbook();
394
456
  * const fWorksheet = fWorkbook.getActiveSheet();
457
+ *
458
+ * // Create a new data validation rule that requires a number greater than 10 for the range A1:B10
395
459
  * const fRange = fWorksheet.getRange('A1:B10');
396
460
  * const rule = univerAPI.newDataValidation()
397
461
  * .requireNumberGreaterThan(10)
@@ -406,14 +470,16 @@ export declare class FDataValidationBuilder {
406
470
  */
407
471
  requireNumberGreaterThan(num: number, isInteger?: boolean): FDataValidationBuilder;
408
472
  /**
409
- * Requires the user to enter a number that is greater than or equal to a specific value, which can be an integer or a decimal
410
- * @param {number} num - The number to which the entered number should be greater than or equal
411
- * @param {boolean} [isInteger] - Indicates whether the required number is an integer
412
- * @returns {FDataValidationBuilder} The current instance for method chaining
473
+ * Sets the data validation rule to require a number greater than or equal to the given value.
474
+ * @param {number} num - The lowest acceptable value.
475
+ * @param {boolean} [isInteger] - Indicates whether the required number is an integer.
476
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
413
477
  * @example
414
478
  * ```typescript
415
479
  * const fWorkbook = univerAPI.getActiveWorkbook();
416
480
  * const fWorksheet = fWorkbook.getActiveSheet();
481
+ *
482
+ * // Create a new data validation rule that requires a number greater than 10 or equal to 10 for the range A1:B10
417
483
  * const fRange = fWorksheet.getRange('A1:B10');
418
484
  * const rule = univerAPI.newDataValidation()
419
485
  * .requireNumberGreaterThanOrEqualTo(10)
@@ -428,14 +494,16 @@ export declare class FDataValidationBuilder {
428
494
  */
429
495
  requireNumberGreaterThanOrEqualTo(num: number, isInteger?: boolean): FDataValidationBuilder;
430
496
  /**
431
- * Requires the user to enter a number that is less than a specific value, which can be an integer or a decimal
432
- * @param {number} num - The number to which the entered number should be less
433
- * @param {boolean} [isInteger] - Indicates whether the required number is an integer
434
- * @returns {FDataValidationBuilder} The current instance for method chaining
497
+ * Sets the data validation rule to require a number less than the given value.
498
+ * @param {number} num - The lowest unacceptable value.
499
+ * @param {boolean} [isInteger] - Indicates whether the required number is an integer.
500
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
435
501
  * @example
436
502
  * ```typescript
437
503
  * const fWorkbook = univerAPI.getActiveWorkbook();
438
504
  * const fWorksheet = fWorkbook.getActiveSheet();
505
+ *
506
+ * // Create a new data validation rule that requires a number less than 10 for the range A1:B10
439
507
  * const fRange = fWorksheet.getRange('A1:B10');
440
508
  * const rule = univerAPI.newDataValidation()
441
509
  * .requireNumberLessThan(10)
@@ -450,15 +518,16 @@ export declare class FDataValidationBuilder {
450
518
  */
451
519
  requireNumberLessThan(num: number, isInteger?: boolean): FDataValidationBuilder;
452
520
  /**
453
- * Sets the data validation rule to require a number less than or equal to a specified value
454
- * The specified value can be an integer or a decimal
455
- * @param {number} num - The number to which the entered number should be less than or equal
456
- * @param {boolean} [isInteger] - Indicates whether the required number is an integer
457
- * @returns {FDataValidationBuilder} The current instance for method chaining
521
+ * Sets the data validation rule to require a number less than or equal to the given value.
522
+ * @param {number} num - The highest acceptable value.
523
+ * @param {boolean} [isInteger] - Indicates whether the required number is an integer.
524
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
458
525
  * @example
459
526
  * ```typescript
460
527
  * const fWorkbook = univerAPI.getActiveWorkbook();
461
528
  * const fWorksheet = fWorkbook.getActiveSheet();
529
+ *
530
+ * // Create a new data validation rule that requires a number less than 10 or equal to 10 for the range A1:B10
462
531
  * const fRange = fWorksheet.getRange('A1:B10');
463
532
  * const rule = univerAPI.newDataValidation()
464
533
  * .requireNumberLessThanOrEqualTo(10)
@@ -473,16 +542,17 @@ export declare class FDataValidationBuilder {
473
542
  */
474
543
  requireNumberLessThanOrEqualTo(num: number, isInteger?: boolean): FDataValidationBuilder;
475
544
  /**
476
- * Sets a data validation rule that requires the user to enter a number outside a specified range
477
- * The specified range includes all integers and decimals
478
- * @param {number} start - The starting point of the specified range
479
- * @param {number} end - The end point of the specified range
480
- * @param {boolean} [isInteger] - Optional parameter, indicating whether the number to be verified is an integer
481
- * @returns {FDataValidationBuilder} The current instance for method chaining
545
+ * Sets the data validation rule to require a number that does not fall between, and is neither of, two specified numbers.
546
+ * @param {number} start - The lowest unacceptable value.
547
+ * @param {number} end - The highest unacceptable value.
548
+ * @param {boolean} [isInteger] - Optional parameter, indicating whether the number to be verified is an integer.
549
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
482
550
  * @example
483
551
  * ```typescript
484
552
  * const fWorkbook = univerAPI.getActiveWorkbook();
485
553
  * const fWorksheet = fWorkbook.getActiveSheet();
554
+ *
555
+ * // Create a new data validation rule that requires a number not between 1 and 10 for the range A1:B10
486
556
  * const fRange = fWorksheet.getRange('A1:B10');
487
557
  * const rule = univerAPI.newDataValidation()
488
558
  * .requireNumberNotBetween(1, 10)
@@ -497,15 +567,16 @@ export declare class FDataValidationBuilder {
497
567
  */
498
568
  requireNumberNotBetween(start: number, end: number, isInteger?: boolean): FDataValidationBuilder;
499
569
  /**
500
- * Creates a data validation rule that requires the user to enter a number that is not equal to a specific value
501
- * The specific value can be an integer or a decimal
502
- * @param {number} num - The number to which the entered number should not be equal
503
- * @param {boolean} [isInteger] - Indicates whether the required number is an integer
504
- * @returns {FDataValidationBuilder} The current instance for method chaining
570
+ * Sets the data validation rule to require a number not equal to the given value.
571
+ * @param {number} num - The sole unacceptable value.
572
+ * @param {boolean} [isInteger] - Indicates whether the required number is an integer.
573
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
505
574
  * @example
506
575
  * ```typescript
507
576
  * const fWorkbook = univerAPI.getActiveWorkbook();
508
577
  * const fWorksheet = fWorkbook.getActiveSheet();
578
+ *
579
+ * // Create a new data validation rule that requires a number not equal to 10 for the range A1:B10
509
580
  * const fRange = fWorksheet.getRange('A1:B10');
510
581
  * const rule = univerAPI.newDataValidation()
511
582
  * .requireNumberNotEqualTo(10)
@@ -520,16 +591,18 @@ export declare class FDataValidationBuilder {
520
591
  */
521
592
  requireNumberNotEqualTo(num: number, isInteger?: boolean): FDataValidationBuilder;
522
593
  /**
523
- * Sets a data validation rule that requires the user to enter a value from a list of specific values
524
- * The list can be displayed in a dropdown, and the user can choose multiple values according to the settings
525
- * @param {string[]} values - An array containing the specific values that the user can enter
526
- * @param {boolean} [multiple] - Optional parameter indicating whether the user can select multiple values
527
- * @param {boolean} [showDropdown] - Optional parameter indicating whether to display the list in a dropdown
528
- * @returns {FDataValidationBuilder} The current instance for method chaining
594
+ * Sets a data validation rule that requires the user to enter a value from a list of specific values.
595
+ * The list can be displayed in a dropdown, and the user can choose multiple values according to the settings.
596
+ * @param {string[]} values - An array of acceptable values.
597
+ * @param {boolean} [multiple] - Optional parameter indicating whether the user can select multiple values.
598
+ * @param {boolean} [showDropdown] - Optional parameter indicating whether to display the list in a dropdown.
599
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
529
600
  * @example
530
601
  * ```typescript
531
602
  * const fWorkbook = univerAPI.getActiveWorkbook();
532
603
  * const fWorksheet = fWorkbook.getActiveSheet();
604
+ *
605
+ * // Create a new data validation rule that requires the user to enter a value from the list ['Yes', 'No'] for the range A1:B10
533
606
  * const fRange = fWorksheet.getRange('A1:B10');
534
607
  * const rule = univerAPI.newDataValidation()
535
608
  * .requireValueInList(['Yes', 'No'])
@@ -544,22 +617,25 @@ export declare class FDataValidationBuilder {
544
617
  */
545
618
  requireValueInList(values: string[], multiple?: boolean, showDropdown?: boolean): FDataValidationBuilder;
546
619
  /**
547
- * Sets a data validation rule that requires the user to enter a value within a specific range
548
- * The range is defined by an FRange object, which contains the unit ID, sheet name, and cell range
549
- * @param {FRange} range - An FRange object representing the range of values that the user can enter
550
- * @param {boolean} [multiple] - Optional parameter indicating whether the user can select multiple values
551
- * @param {boolean} [showDropdown] - Optional parameter indicating whether to display the list in a dropdown
552
- * @returns {FDataValidationBuilder} The current instance for method chaining
620
+ * Sets a data validation rule that requires the user to enter a value within a specific range.
621
+ * The range is defined by an FRange object, which contains the unit ID, sheet name, and cell range.
622
+ * @param {FRange} range - An FRange object representing the range of values that the user can enter.
623
+ * @param {boolean} [multiple] - Optional parameter indicating whether the user can select multiple values.
624
+ * @param {boolean} [showDropdown] - Optional parameter indicating whether to display the list in a dropdown.
625
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
553
626
  * @example
554
627
  * ```typescript
555
628
  * const fWorkbook = univerAPI.getActiveWorkbook();
556
629
  * const fWorksheet = fWorkbook.getActiveSheet();
630
+ *
631
+ * // Set the values in the range B1:B2
557
632
  * const fRange = fWorksheet.getRange('B1:B2');
558
633
  * fRange.setValues([
559
634
  * ['Yes'],
560
635
  * ['No']
561
636
  * ]);
562
637
  *
638
+ * // Create a new data validation rule that requires the user to enter a value from the range B1:B2 for the range A1:A10
563
639
  * const rule = univerAPI.newDataValidation()
564
640
  * .requireValueInRange(fRange)
565
641
  * .setOptions({
@@ -574,11 +650,11 @@ export declare class FDataValidationBuilder {
574
650
  */
575
651
  requireValueInRange(range: FRange, multiple?: boolean, showDropdown?: boolean): FDataValidationBuilder;
576
652
  /**
577
- * Sets whether to allow invalid data and configures the error style
578
- * If invalid data is not allowed, the error style will be set to STOP, indicating that data entry must stop upon encountering an error
579
- * If invalid data is allowed, the error style will be set to WARNING, indicating that a warning will be displayed when invalid data is entered, but data entry can continue
580
- * @param {boolean} allowInvalidData - Whether to allow invalid data
581
- * @returns {FDataValidationBuilder} The current instance for method chaining
653
+ * Sets whether to allow invalid data and configures the error style.
654
+ * If invalid data is not allowed, the error style will be set to STOP, indicating that data entry must stop upon encountering an error.
655
+ * If invalid data is allowed, the error style will be set to WARNING, indicating that a warning will be displayed when invalid data is entered, but data entry can continue.
656
+ * @param {boolean} allowInvalidData - Whether to allow invalid data.
657
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
582
658
  * @example
583
659
  * ```typescript
584
660
  * const fWorkbook = univerAPI.getActiveWorkbook();
@@ -603,9 +679,9 @@ export declare class FDataValidationBuilder {
603
679
  */
604
680
  setAllowInvalid(allowInvalidData: boolean): FDataValidationBuilder;
605
681
  /**
606
- * Sets whether to allow blank values
607
- * @param {boolean} allowBlank - Whether to allow blank values
608
- * @returns {FDataValidationBuilder} The current instance for method chaining
682
+ * Sets whether to allow blank values.
683
+ * @param {boolean} allowBlank - Whether to allow blank values.
684
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
609
685
  * @example
610
686
  * ```typescript
611
687
  * // Assume current sheet is empty data
@@ -631,13 +707,15 @@ export declare class FDataValidationBuilder {
631
707
  */
632
708
  setAllowBlank(allowBlank: boolean): FDataValidationBuilder;
633
709
  /**
634
- * Sets the options for the data validation rule
635
- * @param {Partial<IDataValidationRuleOptions>} options - The options to set for the data validation rule
636
- * @returns {FDataValidationBuilder} The current instance for method chaining
710
+ * Sets the options for the data validation rule.
711
+ * @param {Partial<IDataValidationRuleOptions>} options - The options to set for the data validation rule.
712
+ * @returns {FDataValidationBuilder} The current instance for method chaining.
637
713
  * @example
638
714
  * ```typescript
639
715
  * const fWorkbook = univerAPI.getActiveWorkbook();
640
716
  * const fWorksheet = fWorkbook.getActiveSheet();
717
+ *
718
+ * // Create a new data validation rule that requires the user to enter a value from the list ['Yes', 'No'] for the range A1:B10
641
719
  * const fRange = fWorksheet.getRange('A1:B10');
642
720
  * const rule = univerAPI.newDataValidation()
643
721
  * .requireValueInList(['Yes', 'No'])