@univerjs/sheets-data-validation 0.5.4-nightly.202501151606 → 0.5.4-nightly.202501160704
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -1
- package/lib/es/facade.js +434 -170
- package/lib/types/facade/f-data-validation-builder.d.ts +236 -103
- package/lib/types/facade/f-data-validation.d.ts +155 -30
- package/lib/types/facade/f-range.d.ts +34 -7
- package/lib/types/facade/f-univer.d.ts +10 -1
- package/lib/types/facade/f-workbook.d.ts +8 -24
- package/lib/types/facade/f-worksheet.d.ts +9 -4
- package/lib/umd/facade.js +1 -1
- package/package.json +6 -6
|
@@ -1,12 +1,15 @@
|
|
|
1
|
-
import { IDataValidationRule, IDataValidationRuleOptions,
|
|
1
|
+
import { IDataValidationRule, IDataValidationRuleOptions, DataValidationType } from '@univerjs/core';
|
|
2
2
|
import { FRange } from '@univerjs/sheets/facade';
|
|
3
3
|
import { FDataValidation } from './f-data-validation';
|
|
4
4
|
/**
|
|
5
5
|
* Builder for data validation rules.
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
6
|
+
* @example
|
|
7
|
+
* ```typescript
|
|
8
|
+
* // Set the data validation for cell A1 to require a value from B1:B10
|
|
9
|
+
* const range = FRange.create('Sheet1', 'B1:B10');
|
|
10
|
+
* const rule = FUniver.newDataValidation().requireValueInRange(range).build();
|
|
11
|
+
* cell.setDataValidation(rule);
|
|
12
|
+
* ```
|
|
10
13
|
*/
|
|
11
14
|
export declare class FDataValidationBuilder {
|
|
12
15
|
private _rule;
|
|
@@ -14,206 +17,336 @@ export declare class FDataValidationBuilder {
|
|
|
14
17
|
/**
|
|
15
18
|
* Builds an FDataValidation instance based on the _rule property of the current class
|
|
16
19
|
* @returns {FDataValidation} A new instance of the FDataValidation class
|
|
20
|
+
* @example
|
|
21
|
+
* ```typescript
|
|
22
|
+
* const builder = univerAPI.newDataValidation();
|
|
23
|
+
* const validation = builder.requireNumberBetween(1, 10).build();
|
|
24
|
+
* ```
|
|
17
25
|
*/
|
|
18
26
|
build(): FDataValidation;
|
|
19
27
|
/**
|
|
20
28
|
* Creates a duplicate of the current DataValidationBuilder object
|
|
21
29
|
* @returns {FDataValidationBuilder} A new instance of the DataValidationBuilder class
|
|
30
|
+
* @example
|
|
31
|
+
* ```typescript
|
|
32
|
+
* const builder = univerAPI.newDataValidation();
|
|
33
|
+
* const copy = builder.requireNumberBetween(1, 10).copy();
|
|
34
|
+
* ```
|
|
22
35
|
*/
|
|
23
36
|
copy(): FDataValidationBuilder;
|
|
24
37
|
/**
|
|
25
38
|
* Determines whether invalid data is allowed
|
|
26
39
|
* @returns {boolean} True if invalid data is allowed, False otherwise
|
|
40
|
+
* @example
|
|
41
|
+
* ```typescript
|
|
42
|
+
* const builder = univerAPI.newDataValidation();
|
|
43
|
+
* const allowsInvalid = builder.getAllowInvalid();
|
|
44
|
+
* ```
|
|
27
45
|
*/
|
|
28
46
|
getAllowInvalid(): boolean;
|
|
29
47
|
/**
|
|
30
48
|
* Gets the data validation type of the rule
|
|
31
|
-
* @returns {DataValidationType} The data validation type
|
|
49
|
+
* @returns {DataValidationType | string} The data validation type
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const builder = univerAPI.newDataValidation();
|
|
53
|
+
* const type = builder.getCriteriaType();
|
|
54
|
+
* ```
|
|
32
55
|
*/
|
|
33
56
|
getCriteriaType(): DataValidationType | string;
|
|
34
57
|
/**
|
|
35
58
|
* Gets the values used for criteria evaluation
|
|
36
|
-
* @returns {[string, string, string]} An array containing the operator, formula1, and formula2 values
|
|
59
|
+
* @returns {[string | undefined, string | undefined, string | undefined]} An array containing the operator, formula1, and formula2 values
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const builder = univerAPI.newDataValidation();
|
|
63
|
+
* const [operator, formula1, formula2] = builder.getCriteriaValues();
|
|
64
|
+
* ```
|
|
37
65
|
*/
|
|
38
66
|
getCriteriaValues(): [string | undefined, string | undefined, string | undefined];
|
|
39
67
|
/**
|
|
40
68
|
* Gets the help text information, which is used to provide users with guidance and support
|
|
41
|
-
* @returns {string | undefined} Returns the help text information. If there is no error message, it returns an undefined value
|
|
69
|
+
* @returns {string | undefined} Returns the help text information. If there is no error message, it returns an undefined value
|
|
70
|
+
* @example
|
|
71
|
+
* ```typescript
|
|
72
|
+
* const builder = univerAPI.newDataValidation();
|
|
73
|
+
* const helpText = builder.getHelpText();
|
|
74
|
+
* ```
|
|
42
75
|
*/
|
|
43
76
|
getHelpText(): string | undefined;
|
|
44
77
|
/**
|
|
45
78
|
* Sets the data validation type to CHECKBOX and sets the checked and unchecked values
|
|
46
|
-
* @param checkedValue The value when the checkbox is checked
|
|
47
|
-
* @param uncheckedValue The value when the checkbox is unchecked
|
|
48
|
-
* @returns The current instance
|
|
79
|
+
* @param {string} [checkedValue] - The value when the checkbox is checked
|
|
80
|
+
* @param {string} [uncheckedValue] - The value when the checkbox is unchecked
|
|
81
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
82
|
+
* @example
|
|
83
|
+
* ```typescript
|
|
84
|
+
* const builder = univerAPI.newDataValidation();
|
|
85
|
+
* const rule = builder.requireCheckbox('Yes', 'No').build();
|
|
86
|
+
* ```
|
|
49
87
|
*/
|
|
50
88
|
requireCheckbox(checkedValue?: string, uncheckedValue?: string): FDataValidationBuilder;
|
|
51
89
|
/**
|
|
52
90
|
* Set the data validation type to DATE and configure the validation rules to be after a specific date
|
|
53
|
-
* @param date The date to compare against
|
|
54
|
-
* @returns The current instance
|
|
91
|
+
* @param {Date} date - The date to compare against
|
|
92
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
93
|
+
* @example
|
|
94
|
+
* ```typescript
|
|
95
|
+
* const builder = univerAPI.newDataValidation();
|
|
96
|
+
* const rule = builder.requireDateAfter(new Date('2024-01-01')).build();
|
|
97
|
+
* ```
|
|
55
98
|
*/
|
|
56
99
|
requireDateAfter(date: Date): FDataValidationBuilder;
|
|
57
100
|
/**
|
|
58
101
|
* Set the data validation type to DATE and configure the validation rules to be before a specific date
|
|
59
|
-
* @param date The date to compare against
|
|
60
|
-
* @returns The current instance
|
|
102
|
+
* @param {Date} date - The date to compare against
|
|
103
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
104
|
+
* @example
|
|
105
|
+
* ```typescript
|
|
106
|
+
* const builder = univerAPI.newDataValidation();
|
|
107
|
+
* const rule = builder.requireDateBefore(new Date('2024-12-31')).build();
|
|
108
|
+
* ```
|
|
61
109
|
*/
|
|
62
110
|
requireDateBefore(date: Date): FDataValidationBuilder;
|
|
63
111
|
/**
|
|
64
112
|
* Set the data validation type to DATE and configure the validation rules to be within a specific date range
|
|
65
|
-
* @param start The starting date of the range
|
|
66
|
-
* @param end The ending date of the range
|
|
67
|
-
* @returns The current instance
|
|
113
|
+
* @param {Date} start - The starting date of the range
|
|
114
|
+
* @param {Date} end - The ending date of the range
|
|
115
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
116
|
+
* @example
|
|
117
|
+
* ```typescript
|
|
118
|
+
* const builder = univerAPI.newDataValidation();
|
|
119
|
+
* const rule = builder
|
|
120
|
+
* .requireDateBetween(new Date('2024-01-01'), new Date('2024-12-31'))
|
|
121
|
+
* .build();
|
|
122
|
+
* ```
|
|
68
123
|
*/
|
|
69
124
|
requireDateBetween(start: Date, end: Date): FDataValidationBuilder;
|
|
70
125
|
/**
|
|
71
126
|
* Set the data validation type to DATE and configure the validation rules to be equal to a specific date
|
|
72
|
-
* @param date The date to compare against
|
|
73
|
-
* @returns The current instance
|
|
127
|
+
* @param {Date} date - The date to compare against
|
|
128
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
129
|
+
* @example
|
|
130
|
+
* ```typescript
|
|
131
|
+
* const builder = univerAPI.newDataValidation();
|
|
132
|
+
* const rule = builder.requireDateEqualTo(new Date('2024-01-01')).build();
|
|
133
|
+
* ```
|
|
74
134
|
*/
|
|
75
135
|
requireDateEqualTo(date: Date): FDataValidationBuilder;
|
|
76
136
|
/**
|
|
77
137
|
* Set the data validation type to DATE and configure the validation rules to be not within a specific date range
|
|
78
|
-
* @param start The starting date of the date range
|
|
79
|
-
* @param end The ending date of the date range
|
|
80
|
-
* @returns The current instance
|
|
138
|
+
* @param {Date} start - The starting date of the date range
|
|
139
|
+
* @param {Date} end - The ending date of the date range
|
|
140
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
141
|
+
* @example
|
|
142
|
+
* ```typescript
|
|
143
|
+
* const builder = univerAPI.newDataValidation();
|
|
144
|
+
* const rule = builder
|
|
145
|
+
* .requireDateNotBetween(new Date('2024-01-01'), new Date('2024-12-31'))
|
|
146
|
+
* .build();
|
|
147
|
+
* ```
|
|
81
148
|
*/
|
|
82
149
|
requireDateNotBetween(start: Date, end: Date): FDataValidationBuilder;
|
|
83
150
|
/**
|
|
84
151
|
* Set the data validation type to DATE and configure the validation rules to be on or after a specific date
|
|
85
|
-
* @param date The date to compare against
|
|
86
|
-
* @returns The current instance
|
|
152
|
+
* @param {Date} date - The date to compare against
|
|
153
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
154
|
+
* @example
|
|
155
|
+
* ```typescript
|
|
156
|
+
* const builder = univerAPI.newDataValidation();
|
|
157
|
+
* const rule = builder.requireDateOnOrAfter(new Date('2024-01-01')).build();
|
|
158
|
+
* ```
|
|
87
159
|
*/
|
|
88
160
|
requireDateOnOrAfter(date: Date): FDataValidationBuilder;
|
|
89
161
|
/**
|
|
90
162
|
* Set the data validation type to DATE and configure the validation rules to be on or before a specific date
|
|
91
|
-
* @param date The date to compare against
|
|
92
|
-
* @returns The current instance
|
|
163
|
+
* @param {Date} date - The date to compare against
|
|
164
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
165
|
+
* @example
|
|
166
|
+
* ```typescript
|
|
167
|
+
* const builder = univerAPI.newDataValidation();
|
|
168
|
+
* const rule = builder.requireDateOnOrBefore(new Date('2024-12-31')).build();
|
|
169
|
+
* ```
|
|
93
170
|
*/
|
|
94
171
|
requireDateOnOrBefore(date: Date): FDataValidationBuilder;
|
|
95
172
|
/**
|
|
96
|
-
* Requires that a custom formula be satisfied
|
|
97
|
-
*
|
|
98
|
-
* @
|
|
99
|
-
* @
|
|
173
|
+
* Requires that a custom formula be satisfied
|
|
174
|
+
* @param {string} formula - The formula string that needs to be satisfied
|
|
175
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
176
|
+
* @example
|
|
177
|
+
* ```typescript
|
|
178
|
+
* const builder = univerAPI.newDataValidation();
|
|
179
|
+
* const rule = builder.requireFormulaSatisfied('=A1>0').build();
|
|
180
|
+
* ```
|
|
100
181
|
*/
|
|
101
182
|
requireFormulaSatisfied(formula: string): FDataValidationBuilder;
|
|
102
183
|
/**
|
|
103
|
-
* Requires the user to enter a number within a specific range, which can be integer or decimal
|
|
104
|
-
*
|
|
105
|
-
* @param
|
|
106
|
-
* @param
|
|
107
|
-
* @
|
|
108
|
-
* @
|
|
184
|
+
* Requires the user to enter a number within a specific range, which can be integer or decimal
|
|
185
|
+
* @param {number} start - The starting value of the number range
|
|
186
|
+
* @param {number} end - The ending value of the number range
|
|
187
|
+
* @param {boolean} [isInteger] - Indicates whether the required number is an integer
|
|
188
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
189
|
+
* @example
|
|
190
|
+
* ```typescript
|
|
191
|
+
* const builder = univerAPI.newDataValidation();
|
|
192
|
+
* const rule = builder.requireNumberBetween(1, 10).build();
|
|
193
|
+
* ```
|
|
109
194
|
*/
|
|
110
195
|
requireNumberBetween(start: number, end: number, isInteger?: boolean): FDataValidationBuilder;
|
|
111
196
|
/**
|
|
112
|
-
* Requires the user to enter a number that is equal to a specific value, which can be an integer or a decimal
|
|
113
|
-
*
|
|
114
|
-
* @param
|
|
115
|
-
* @
|
|
116
|
-
* @
|
|
197
|
+
* Requires the user to enter a number that is equal to a specific value, which can be an integer or a decimal
|
|
198
|
+
* @param {number} num - The number to which the entered number should be equal
|
|
199
|
+
* @param {boolean} [isInteger] - Indicates whether the required number is an integer
|
|
200
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
201
|
+
* @example
|
|
202
|
+
* ```typescript
|
|
203
|
+
* const builder = univerAPI.newDataValidation();
|
|
204
|
+
* const rule = builder.requireNumberEqualTo(10).build();
|
|
205
|
+
* ```
|
|
117
206
|
*/
|
|
118
207
|
requireNumberEqualTo(num: number, isInteger?: boolean): FDataValidationBuilder;
|
|
119
208
|
/**
|
|
120
|
-
* Requires the user to enter a number that is greater than a specific value, which can be an integer or a decimal
|
|
121
|
-
*
|
|
122
|
-
* @param
|
|
123
|
-
* @
|
|
124
|
-
* @
|
|
209
|
+
* Requires the user to enter a number that is greater than a specific value, which can be an integer or a decimal
|
|
210
|
+
* @param {number} num - The number to which the entered number should be greater
|
|
211
|
+
* @param {boolean} [isInteger] - Indicates whether the required number is an integer
|
|
212
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
213
|
+
* @example
|
|
214
|
+
* ```typescript
|
|
215
|
+
* const builder = univerAPI.newDataValidation();
|
|
216
|
+
* const rule = builder.requireNumberGreaterThan(10).build();
|
|
217
|
+
* ```
|
|
125
218
|
*/
|
|
126
219
|
requireNumberGreaterThan(num: number, isInteger?: boolean): FDataValidationBuilder;
|
|
127
220
|
/**
|
|
128
|
-
* 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
|
|
129
|
-
*
|
|
130
|
-
* @param
|
|
131
|
-
* @
|
|
132
|
-
* @
|
|
221
|
+
* 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
|
|
222
|
+
* @param {number} num - The number to which the entered number should be greater than or equal
|
|
223
|
+
* @param {boolean} [isInteger] - Indicates whether the required number is an integer
|
|
224
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
225
|
+
* @example
|
|
226
|
+
* ```typescript
|
|
227
|
+
* const builder = univerAPI.newDataValidation();
|
|
228
|
+
* const rule = builder.requireNumberGreaterThanOrEqualTo(10).build();
|
|
229
|
+
* ```
|
|
133
230
|
*/
|
|
134
231
|
requireNumberGreaterThanOrEqualTo(num: number, isInteger?: boolean): FDataValidationBuilder;
|
|
135
232
|
/**
|
|
136
|
-
* Requires the user to enter a number that is less than a specific value, which can be an integer or a decimal
|
|
137
|
-
*
|
|
138
|
-
* @param
|
|
139
|
-
* @
|
|
140
|
-
* @
|
|
233
|
+
* Requires the user to enter a number that is less than a specific value, which can be an integer or a decimal
|
|
234
|
+
* @param {number} num - The number to which the entered number should be less
|
|
235
|
+
* @param {boolean} [isInteger] - Indicates whether the required number is an integer
|
|
236
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
237
|
+
* @example
|
|
238
|
+
* ```typescript
|
|
239
|
+
* const builder = univerAPI.newDataValidation();
|
|
240
|
+
* const rule = builder.requireNumberLessThan(10).build();
|
|
241
|
+
* ```
|
|
141
242
|
*/
|
|
142
243
|
requireNumberLessThan(num: number, isInteger?: boolean): FDataValidationBuilder;
|
|
143
244
|
/**
|
|
144
245
|
* Sets the data validation rule to require a number less than or equal to a specified value
|
|
145
246
|
* The specified value can be an integer or a decimal
|
|
146
|
-
* @param num The number to which the entered number should be less than or equal
|
|
147
|
-
* @param isInteger Indicates whether the required number is an integer
|
|
148
|
-
* @returns The current instance
|
|
247
|
+
* @param {number} num - The number to which the entered number should be less than or equal
|
|
248
|
+
* @param {boolean} [isInteger] - Indicates whether the required number is an integer
|
|
249
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
250
|
+
* @example
|
|
251
|
+
* ```typescript
|
|
252
|
+
* const builder = univerAPI.newDataValidation();
|
|
253
|
+
* const rule = builder.requireNumberLessThanOrEqualTo(10).build();
|
|
254
|
+
* ```
|
|
149
255
|
*/
|
|
150
256
|
requireNumberLessThanOrEqualTo(num: number, isInteger?: boolean): FDataValidationBuilder;
|
|
151
257
|
/**
|
|
152
258
|
* Sets a data validation rule that requires the user to enter a number outside a specified range
|
|
153
259
|
* The specified range includes all integers and decimals
|
|
154
|
-
* @param start The starting point of the specified range
|
|
155
|
-
* @param end The end point of the specified range
|
|
156
|
-
* @param isInteger Optional parameter, indicating whether the number to be verified is an integer
|
|
157
|
-
* @returns
|
|
260
|
+
* @param {number} start - The starting point of the specified range
|
|
261
|
+
* @param {number} end - The end point of the specified range
|
|
262
|
+
* @param {boolean} [isInteger] - Optional parameter, indicating whether the number to be verified is an integer
|
|
263
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
264
|
+
* @example
|
|
265
|
+
* ```typescript
|
|
266
|
+
* const builder = univerAPI.newDataValidation();
|
|
267
|
+
* const rule = builder.requireNumberNotBetween(1, 10).build();
|
|
268
|
+
* ```
|
|
158
269
|
*/
|
|
159
270
|
requireNumberNotBetween(start: number, end: number, isInteger?: boolean): FDataValidationBuilder;
|
|
160
271
|
/**
|
|
161
272
|
* Creates a data validation rule that requires the user to enter a number that is not equal to a specific value
|
|
162
273
|
* The specific value can be an integer or a decimal
|
|
163
|
-
* @param num The number to which the entered number should not be equal
|
|
164
|
-
* @param isInteger Indicates whether the required number is an integer
|
|
165
|
-
* @returns The current instance
|
|
274
|
+
* @param {number} num - The number to which the entered number should not be equal
|
|
275
|
+
* @param {boolean} [isInteger] - Indicates whether the required number is an integer
|
|
276
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
277
|
+
* @example
|
|
278
|
+
* ```typescript
|
|
279
|
+
* const builder = univerAPI.newDataValidation();
|
|
280
|
+
* const rule = builder.requireNumberNotEqualTo(10).build();
|
|
281
|
+
* ```
|
|
166
282
|
*/
|
|
167
283
|
requireNumberNotEqualTo(num: number, isInteger?: boolean): FDataValidationBuilder;
|
|
168
284
|
/**
|
|
169
|
-
* Sets a data validation rule that requires the user to enter a value from a list of specific values
|
|
170
|
-
* The list can be displayed in a dropdown, and the user can choose multiple values according to the settings
|
|
171
|
-
* @param values An array containing the specific values that the user can enter
|
|
172
|
-
* @param multiple Optional parameter indicating whether the user can select multiple values
|
|
173
|
-
* @param showDropdown Optional parameter indicating whether to display the list in a dropdown
|
|
174
|
-
* @returns
|
|
285
|
+
* Sets a data validation rule that requires the user to enter a value from a list of specific values
|
|
286
|
+
* The list can be displayed in a dropdown, and the user can choose multiple values according to the settings
|
|
287
|
+
* @param {string[]} values - An array containing the specific values that the user can enter
|
|
288
|
+
* @param {boolean} [multiple] - Optional parameter indicating whether the user can select multiple values
|
|
289
|
+
* @param {boolean} [showDropdown] - Optional parameter indicating whether to display the list in a dropdown
|
|
290
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
291
|
+
* @example
|
|
292
|
+
* ```typescript
|
|
293
|
+
* const builder = univerAPI.newDataValidation();
|
|
294
|
+
* const rule = builder.requireValueInList(['Yes', 'No']).build();
|
|
295
|
+
* ```
|
|
175
296
|
*/
|
|
176
297
|
requireValueInList(values: string[], multiple?: boolean, showDropdown?: boolean): FDataValidationBuilder;
|
|
177
298
|
/**
|
|
178
|
-
* Sets a data validation rule that requires the user to enter a value within a specific range
|
|
179
|
-
* The range is defined by an FRange object, which contains the unit ID, sheet name, and cell range
|
|
180
|
-
* @param range An FRange object representing the range of values that the user can enter
|
|
181
|
-
* @param multiple Optional parameter indicating whether the user can select multiple values
|
|
182
|
-
* @param showDropdown Optional parameter indicating whether to display the list in a dropdown
|
|
183
|
-
* @returns The current instance
|
|
299
|
+
* Sets a data validation rule that requires the user to enter a value within a specific range
|
|
300
|
+
* The range is defined by an FRange object, which contains the unit ID, sheet name, and cell range
|
|
301
|
+
* @param {FRange} range - An FRange object representing the range of values that the user can enter
|
|
302
|
+
* @param {boolean} [multiple] - Optional parameter indicating whether the user can select multiple values
|
|
303
|
+
* @param {boolean} [showDropdown] - Optional parameter indicating whether to display the list in a dropdown
|
|
304
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
305
|
+
* @example
|
|
306
|
+
* ```typescript
|
|
307
|
+
* const builder = univerAPI.newDataValidation();
|
|
308
|
+
* const range = FRange.create('Sheet1', 'B1:B10');
|
|
309
|
+
* const rule = builder.requireValueInRange(range).build();
|
|
310
|
+
* ```
|
|
184
311
|
*/
|
|
185
312
|
requireValueInRange(range: FRange, multiple?: boolean, showDropdown?: boolean): FDataValidationBuilder;
|
|
186
313
|
/**
|
|
187
|
-
* Sets whether to allow invalid data and configures the error style
|
|
188
|
-
* If invalid data is not allowed, the error style will be set to STOP, indicating that data entry must stop upon encountering an error
|
|
189
|
-
* 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
|
|
190
|
-
* @param
|
|
191
|
-
* @returns The current instance
|
|
314
|
+
* Sets whether to allow invalid data and configures the error style
|
|
315
|
+
* If invalid data is not allowed, the error style will be set to STOP, indicating that data entry must stop upon encountering an error
|
|
316
|
+
* 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
|
|
317
|
+
* @param {boolean} allowInvalidData - Whether to allow invalid data
|
|
318
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
319
|
+
* @example
|
|
320
|
+
* ```typescript
|
|
321
|
+
* const builder = univerAPI.newDataValidation();
|
|
322
|
+
* const rule = builder.setAllowInvalid(true).build();
|
|
323
|
+
* ```
|
|
192
324
|
*/
|
|
193
325
|
setAllowInvalid(allowInvalidData: boolean): FDataValidationBuilder;
|
|
194
326
|
/**
|
|
195
|
-
* Sets
|
|
196
|
-
*
|
|
197
|
-
* @
|
|
198
|
-
* @
|
|
327
|
+
* Sets whether to allow blank values
|
|
328
|
+
* @param {boolean} allowBlank - Whether to allow blank values
|
|
329
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
330
|
+
* @example
|
|
331
|
+
* ```typescript
|
|
332
|
+
* const builder = univerAPI.newDataValidation();
|
|
333
|
+
* const rule = builder.setAllowBlank(true).build();
|
|
334
|
+
* ```
|
|
199
335
|
*/
|
|
200
|
-
setHelpText(helpText: string): FDataValidationBuilder;
|
|
201
|
-
/**
|
|
202
|
-
* Sets the criteria values for data validation.
|
|
203
|
-
* This method is used to configure the validation rules based on specific criteria values.
|
|
204
|
-
* @param type The type of data validation.
|
|
205
|
-
* @param values An array containing the criteria values.
|
|
206
|
-
* The array should have three elements: [operator, formula1, formula2].
|
|
207
|
-
* operator is a DataValidationOperator enum value, formula1 is the first formula, and formula2 is the second formula.
|
|
208
|
-
* @returns The current instance of the FDataValidationBuilder class, allowing for method chaining.
|
|
209
|
-
*/
|
|
210
|
-
withCriteriaValues(type: DataValidationType | string, values: [DataValidationOperator, string, string]): this;
|
|
211
336
|
setAllowBlank(allowBlank: boolean): FDataValidationBuilder;
|
|
212
337
|
/**
|
|
213
|
-
* Sets the options for the data validation rule
|
|
214
|
-
*
|
|
215
|
-
* @
|
|
216
|
-
* @
|
|
338
|
+
* Sets the options for the data validation rule
|
|
339
|
+
* @param {Partial<IDataValidationRuleOptions>} options - The options to set for the data validation rule
|
|
340
|
+
* @returns {FDataValidationBuilder} The current instance for method chaining
|
|
341
|
+
* @example
|
|
342
|
+
* ```typescript
|
|
343
|
+
* const builder = univerAPI.newDataValidation();
|
|
344
|
+
* const rule = builder.setOptions({
|
|
345
|
+
* allowBlank: true,
|
|
346
|
+
* showErrorMessage: true,
|
|
347
|
+
* error: 'Please enter a valid value'
|
|
348
|
+
* }).build();
|
|
349
|
+
* ```
|
|
217
350
|
*/
|
|
218
351
|
setOptions(options: Partial<IDataValidationRuleOptions>): this;
|
|
219
352
|
}
|