@univerjs/sheets-data-validation 0.5.4 → 0.5.5-nightly.202501201336
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 +435 -208
- package/lib/es/index.js +149 -147
- package/lib/types/facade/f-data-validation-builder.d.ts +237 -133
- package/lib/types/facade/f-data-validation.d.ts +155 -38
- package/lib/types/facade/f-range.d.ts +36 -9
- 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/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,352 @@
|
|
|
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;
|
|
13
16
|
constructor(rule?: IDataValidationRule);
|
|
14
17
|
/**
|
|
15
18
|
* Builds an FDataValidation instance based on the _rule property of the current class
|
|
16
|
-
*
|
|
17
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
|
+
* ```
|
|
18
25
|
*/
|
|
19
26
|
build(): FDataValidation;
|
|
20
27
|
/**
|
|
21
28
|
* Creates a duplicate of the current DataValidationBuilder object
|
|
22
|
-
*
|
|
23
|
-
* @
|
|
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
|
+
* ```
|
|
24
35
|
*/
|
|
25
36
|
copy(): FDataValidationBuilder;
|
|
26
37
|
/**
|
|
27
38
|
* Determines whether invalid data is allowed
|
|
28
|
-
*
|
|
29
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
|
+
* ```
|
|
30
45
|
*/
|
|
31
46
|
getAllowInvalid(): boolean;
|
|
32
47
|
/**
|
|
33
48
|
* Gets the data validation type of the rule
|
|
34
|
-
*
|
|
35
|
-
* @
|
|
49
|
+
* @returns {DataValidationType | string} The data validation type
|
|
50
|
+
* @example
|
|
51
|
+
* ```typescript
|
|
52
|
+
* const builder = univerAPI.newDataValidation();
|
|
53
|
+
* const type = builder.getCriteriaType();
|
|
54
|
+
* ```
|
|
36
55
|
*/
|
|
37
56
|
getCriteriaType(): DataValidationType | string;
|
|
38
57
|
/**
|
|
39
58
|
* Gets the values used for criteria evaluation
|
|
40
|
-
*
|
|
41
|
-
* @
|
|
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
|
+
* ```
|
|
42
65
|
*/
|
|
43
66
|
getCriteriaValues(): [string | undefined, string | undefined, string | undefined];
|
|
44
67
|
/**
|
|
45
68
|
* Gets the help text information, which is used to provide users with guidance and support
|
|
46
|
-
*
|
|
47
|
-
* @
|
|
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
|
+
* ```
|
|
48
75
|
*/
|
|
49
76
|
getHelpText(): string | undefined;
|
|
50
77
|
/**
|
|
51
78
|
* Sets the data validation type to CHECKBOX and sets the checked and unchecked values
|
|
52
|
-
*
|
|
53
|
-
* @param
|
|
54
|
-
* @
|
|
55
|
-
* @
|
|
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
|
+
* ```
|
|
56
87
|
*/
|
|
57
88
|
requireCheckbox(checkedValue?: string, uncheckedValue?: string): FDataValidationBuilder;
|
|
58
89
|
/**
|
|
59
90
|
* Set the data validation type to DATE and configure the validation rules to be after a specific date
|
|
60
|
-
*
|
|
61
|
-
* @
|
|
62
|
-
* @
|
|
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
|
+
* ```
|
|
63
98
|
*/
|
|
64
99
|
requireDateAfter(date: Date): FDataValidationBuilder;
|
|
65
100
|
/**
|
|
66
101
|
* Set the data validation type to DATE and configure the validation rules to be before a specific date
|
|
67
|
-
*
|
|
68
|
-
* @
|
|
69
|
-
* @
|
|
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
|
+
* ```
|
|
70
109
|
*/
|
|
71
110
|
requireDateBefore(date: Date): FDataValidationBuilder;
|
|
72
111
|
/**
|
|
73
112
|
* Set the data validation type to DATE and configure the validation rules to be within a specific date range
|
|
74
|
-
*
|
|
75
|
-
* @param
|
|
76
|
-
* @
|
|
77
|
-
* @
|
|
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
|
+
* ```
|
|
78
123
|
*/
|
|
79
124
|
requireDateBetween(start: Date, end: Date): FDataValidationBuilder;
|
|
80
125
|
/**
|
|
81
126
|
* Set the data validation type to DATE and configure the validation rules to be equal to a specific date
|
|
82
|
-
*
|
|
83
|
-
* @
|
|
84
|
-
* @
|
|
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
|
+
* ```
|
|
85
134
|
*/
|
|
86
135
|
requireDateEqualTo(date: Date): FDataValidationBuilder;
|
|
87
136
|
/**
|
|
88
137
|
* 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
|
-
* @
|
|
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
|
+
* ```
|
|
93
148
|
*/
|
|
94
149
|
requireDateNotBetween(start: Date, end: Date): FDataValidationBuilder;
|
|
95
150
|
/**
|
|
96
151
|
* Set the data validation type to DATE and configure the validation rules to be on or after a specific date
|
|
97
|
-
*
|
|
98
|
-
* @
|
|
99
|
-
* @
|
|
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
|
+
* ```
|
|
100
159
|
*/
|
|
101
160
|
requireDateOnOrAfter(date: Date): FDataValidationBuilder;
|
|
102
161
|
/**
|
|
103
162
|
* Set the data validation type to DATE and configure the validation rules to be on or before a specific date
|
|
104
|
-
*
|
|
105
|
-
* @
|
|
106
|
-
* @
|
|
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
|
+
* ```
|
|
107
170
|
*/
|
|
108
171
|
requireDateOnOrBefore(date: Date): FDataValidationBuilder;
|
|
109
172
|
/**
|
|
110
|
-
* Requires that a custom formula be satisfied
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
* @
|
|
114
|
-
*
|
|
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
|
+
* ```
|
|
115
181
|
*/
|
|
116
182
|
requireFormulaSatisfied(formula: string): FDataValidationBuilder;
|
|
117
183
|
/**
|
|
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
|
-
*
|
|
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
|
+
* ```
|
|
125
194
|
*/
|
|
126
195
|
requireNumberBetween(start: number, end: number, isInteger?: boolean): FDataValidationBuilder;
|
|
127
196
|
/**
|
|
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
|
-
*
|
|
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
|
+
* ```
|
|
134
206
|
*/
|
|
135
207
|
requireNumberEqualTo(num: number, isInteger?: boolean): FDataValidationBuilder;
|
|
136
208
|
/**
|
|
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
|
-
*
|
|
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
|
+
* ```
|
|
143
218
|
*/
|
|
144
219
|
requireNumberGreaterThan(num: number, isInteger?: boolean): FDataValidationBuilder;
|
|
145
220
|
/**
|
|
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
|
-
*
|
|
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
|
+
* ```
|
|
152
230
|
*/
|
|
153
231
|
requireNumberGreaterThanOrEqualTo(num: number, isInteger?: boolean): FDataValidationBuilder;
|
|
154
232
|
/**
|
|
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
|
-
*
|
|
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
|
+
* ```
|
|
161
242
|
*/
|
|
162
243
|
requireNumberLessThan(num: number, isInteger?: boolean): FDataValidationBuilder;
|
|
163
244
|
/**
|
|
164
245
|
* Sets the data validation rule to require a number less than or equal to a specified value
|
|
165
246
|
* The specified value can be an integer or a decimal
|
|
166
|
-
*
|
|
167
|
-
* @param
|
|
168
|
-
* @
|
|
169
|
-
* @
|
|
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
|
+
* ```
|
|
170
255
|
*/
|
|
171
256
|
requireNumberLessThanOrEqualTo(num: number, isInteger?: boolean): FDataValidationBuilder;
|
|
172
257
|
/**
|
|
173
258
|
* Sets a data validation rule that requires the user to enter a number outside a specified range
|
|
174
259
|
* The specified range includes all integers and decimals
|
|
175
|
-
*
|
|
176
|
-
* @param
|
|
177
|
-
* @param
|
|
178
|
-
* @
|
|
179
|
-
* @
|
|
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
|
+
* ```
|
|
180
269
|
*/
|
|
181
270
|
requireNumberNotBetween(start: number, end: number, isInteger?: boolean): FDataValidationBuilder;
|
|
182
271
|
/**
|
|
183
272
|
* Creates a data validation rule that requires the user to enter a number that is not equal to a specific value
|
|
184
273
|
* The specific value can be an integer or a decimal
|
|
185
|
-
*
|
|
186
|
-
* @param
|
|
187
|
-
* @
|
|
188
|
-
* @
|
|
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
|
+
* ```
|
|
189
282
|
*/
|
|
190
283
|
requireNumberNotEqualTo(num: number, isInteger?: boolean): FDataValidationBuilder;
|
|
191
284
|
/**
|
|
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
|
-
* @
|
|
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
|
+
* ```
|
|
199
296
|
*/
|
|
200
297
|
requireValueInList(values: string[], multiple?: boolean, showDropdown?: boolean): FDataValidationBuilder;
|
|
201
298
|
/**
|
|
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
|
-
* @
|
|
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
|
+
* ```
|
|
209
311
|
*/
|
|
210
312
|
requireValueInRange(range: FRange, multiple?: boolean, showDropdown?: boolean): FDataValidationBuilder;
|
|
211
313
|
/**
|
|
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
|
-
* @
|
|
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
|
+
* ```
|
|
218
324
|
*/
|
|
219
325
|
setAllowInvalid(allowInvalidData: boolean): FDataValidationBuilder;
|
|
220
326
|
/**
|
|
221
|
-
* Sets
|
|
222
|
-
*
|
|
223
|
-
*
|
|
224
|
-
* @
|
|
225
|
-
*
|
|
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
|
+
* ```
|
|
226
335
|
*/
|
|
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
336
|
setAllowBlank(allowBlank: boolean): FDataValidationBuilder;
|
|
240
337
|
/**
|
|
241
|
-
* Sets the options for the data validation rule
|
|
242
|
-
*
|
|
243
|
-
*
|
|
244
|
-
* @
|
|
245
|
-
*
|
|
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
|
+
* ```
|
|
246
350
|
*/
|
|
247
351
|
setOptions(options: Partial<IDataValidationRuleOptions>): this;
|
|
248
352
|
}
|