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