@univerjs/sheets-data-validation 0.5.3-nightly.202501121605 → 0.5.4-experimental.20250114-7c09c35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/es/facade.js CHANGED
@@ -18,7 +18,6 @@ class D {
18
18
  }
19
19
  /**
20
20
  * Builds an FDataValidation instance based on the _rule property of the current class
21
- *
22
21
  * @returns {FDataValidation} A new instance of the FDataValidation class
23
22
  */
24
23
  build() {
@@ -26,8 +25,7 @@ class D {
26
25
  }
27
26
  /**
28
27
  * Creates a duplicate of the current DataValidationBuilder object
29
- *
30
- * @return {FDataValidationBuilder} A new instance of the DataValidationBuilder class
28
+ * @returns {FDataValidationBuilder} A new instance of the DataValidationBuilder class
31
29
  */
32
30
  copy() {
33
31
  return new D({
@@ -37,7 +35,6 @@ class D {
37
35
  }
38
36
  /**
39
37
  * Determines whether invalid data is allowed
40
- *
41
38
  * @returns {boolean} True if invalid data is allowed, False otherwise
42
39
  */
43
40
  getAllowInvalid() {
@@ -45,7 +42,6 @@ class D {
45
42
  }
46
43
  /**
47
44
  * Gets the data validation type of the rule
48
- *
49
45
  * @returns {DataValidationType} The data validation type
50
46
  */
51
47
  getCriteriaType() {
@@ -53,7 +49,6 @@ class D {
53
49
  }
54
50
  /**
55
51
  * Gets the values used for criteria evaluation
56
- *
57
52
  * @returns {[string, string, string]} An array containing the operator, formula1, and formula2 values
58
53
  */
59
54
  getCriteriaValues() {
@@ -61,7 +56,6 @@ class D {
61
56
  }
62
57
  /**
63
58
  * Gets the help text information, which is used to provide users with guidance and support
64
- *
65
59
  * @returns {string | undefined} Returns the help text information. If there is no error message, it returns an undefined value.
66
60
  */
67
61
  getHelpText() {
@@ -69,7 +63,6 @@ class D {
69
63
  }
70
64
  /**
71
65
  * Sets the data validation type to CHECKBOX and sets the checked and unchecked values
72
- *
73
66
  * @param checkedValue The value when the checkbox is checked (Optional)
74
67
  * @param uncheckedValue The value when the checkbox is unchecked (Optional)
75
68
  * @returns The current instance of the FDataValidationBuilder class to allow for method chaining
@@ -79,65 +72,58 @@ class D {
79
72
  }
80
73
  /**
81
74
  * Set the data validation type to DATE and configure the validation rules to be after a specific date
82
- *
83
75
  * @param date The date to compare against. The formatted date string will be set as formula1
84
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining
76
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining
85
77
  */
86
78
  requireDateAfter(e) {
87
79
  return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.operator = d.GREATER_THAN, this;
88
80
  }
89
81
  /**
90
82
  * Set the data validation type to DATE and configure the validation rules to be before a specific date
91
- *
92
83
  * @param date The date to compare against. The formatted date string will be set as formula1
93
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining
84
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining
94
85
  */
95
86
  requireDateBefore(e) {
96
87
  return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = d.LESS_THAN, this;
97
88
  }
98
89
  /**
99
90
  * Set the data validation type to DATE and configure the validation rules to be within a specific date range
100
- *
101
91
  * @param start The starting date of the range. The formatted date string will be set as formula1
102
92
  * @param end The ending date of the range. The formatted date string will be set as formula2
103
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining
93
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining
104
94
  */
105
95
  requireDateBetween(e, t) {
106
96
  return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = t.toLocaleDateString(), this._rule.operator = d.BETWEEN, this;
107
97
  }
108
98
  /**
109
99
  * Set the data validation type to DATE and configure the validation rules to be equal to a specific date
110
- *
111
100
  * @param date The date to compare against. The formatted date string will be set as formula1
112
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining
101
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining
113
102
  */
114
103
  requireDateEqualTo(e) {
115
104
  return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = d.EQUAL, this;
116
105
  }
117
106
  /**
118
107
  * Set the data validation type to DATE and configure the validation rules to be not within a specific date range
119
- *
120
108
  * @param start The starting date of the date range
121
109
  * @param end The ending date of the date range
122
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining
110
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining
123
111
  */
124
112
  requireDateNotBetween(e, t) {
125
113
  return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = t.toLocaleDateString(), this._rule.operator = d.NOT_BETWEEN, this;
126
114
  }
127
115
  /**
128
116
  * Set the data validation type to DATE and configure the validation rules to be on or after a specific date
129
- *
130
117
  * @param date The date to compare against. The formatted date string will be set as formula1
131
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining
118
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining
132
119
  */
133
120
  requireDateOnOrAfter(e) {
134
121
  return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = d.GREATER_THAN_OR_EQUAL, this;
135
122
  }
136
123
  /**
137
124
  * Set the data validation type to DATE and configure the validation rules to be on or before a specific date
138
- *
139
125
  * @param date The date to compare against. The formatted date string will be set as formula1
140
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining
126
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining
141
127
  */
142
128
  requireDateOnOrBefore(e) {
143
129
  return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = d.LESS_THAN_OR_EQUAL, this;
@@ -145,9 +131,8 @@ class D {
145
131
  /**
146
132
  * Requires that a custom formula be satisfied.
147
133
  * Sets the data validation type to CUSTOM and configures the validation rule based on the provided formula string.
148
- *
149
134
  * @param formula The formula string that needs to be satisfied.
150
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining.
135
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
151
136
  */
152
137
  requireFormulaSatisfied(e) {
153
138
  return this._rule.type = o.CUSTOM, this._rule.formula1 = e, this._rule.formula2 = void 0, this;
@@ -155,11 +140,10 @@ class D {
155
140
  /**
156
141
  * Requires the user to enter a number within a specific range, which can be integer or decimal.
157
142
  * Sets the data validation type based on the isInteger parameter and configures the validation rules for the specified number range.
158
- *
159
143
  * @param start The starting value of the number range.
160
144
  * @param end The ending value of the number range.
161
145
  * @param isInteger Indicates whether the required number is an integer. Default is undefined, meaning it can be an integer or decimal.
162
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining.
146
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
163
147
  */
164
148
  requireNumberBetween(e, t, r) {
165
149
  return this._rule.formula1 = `${e}`, this._rule.formula2 = `${t}`, this._rule.operator = d.BETWEEN, this._rule.type = r ? o.WHOLE : o.DECIMAL, this;
@@ -167,10 +151,9 @@ class D {
167
151
  /**
168
152
  * Requires the user to enter a number that is equal to a specific value, which can be an integer or a decimal.
169
153
  * Sets the data validation type based on the isInteger parameter and configures the validation rules for the specified number.
170
- *
171
154
  * @param num The number to which the entered number should be equal.
172
155
  * @param isInteger Indicates whether the required number is an integer. Default is undefined, meaning it can be an integer or a decimal.
173
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining.
156
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
174
157
  */
175
158
  requireNumberEqualTo(e, t) {
176
159
  return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = d.EQUAL, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
@@ -178,10 +161,9 @@ class D {
178
161
  /**
179
162
  * Requires the user to enter a number that is greater than a specific value, which can be an integer or a decimal.
180
163
  * Sets the data validation type based on the isInteger parameter and configures the validation rules for the specified number.
181
- *
182
164
  * @param num The number to which the entered number should be greater.
183
165
  * @param isInteger Indicates whether the required number is an integer. Default is undefined, meaning it can be an integer or a decimal.
184
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining.
166
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
185
167
  */
186
168
  requireNumberGreaterThan(e, t) {
187
169
  return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = d.GREATER_THAN, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
@@ -189,10 +171,9 @@ class D {
189
171
  /**
190
172
  * 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.
191
173
  * Sets the data validation type based on the isInteger parameter and configures the validation rules for the specified number.
192
- *
193
174
  * @param num The number to which the entered number should be greater than or equal.
194
175
  * @param isInteger Indicates whether the required number is an integer. Default is undefined, meaning it can be an integer or a decimal.
195
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining.
176
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
196
177
  */
197
178
  requireNumberGreaterThanOrEqualTo(e, t) {
198
179
  return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = d.GREATER_THAN_OR_EQUAL, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
@@ -200,10 +181,9 @@ class D {
200
181
  /**
201
182
  * Requires the user to enter a number that is less than a specific value, which can be an integer or a decimal.
202
183
  * Sets the data validation type based on the isInteger parameter and configures the validation rules for the specified number.
203
- *
204
184
  * @param num The number to which the entered number should be less.
205
185
  * @param isInteger Indicates whether the required number is an integer. Default is undefined, meaning it can be an integer or a decimal.
206
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining.
186
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
207
187
  */
208
188
  requireNumberLessThan(e, t) {
209
189
  return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = d.LESS_THAN, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
@@ -211,10 +191,9 @@ class D {
211
191
  /**
212
192
  * Sets the data validation rule to require a number less than or equal to a specified value
213
193
  * The specified value can be an integer or a decimal
214
- *
215
194
  * @param num The number to which the entered number should be less than or equal
216
195
  * @param isInteger Indicates whether the required number is an integer
217
- * @return The current instance of the DataValidationBuilder class, allowing for method chaining
196
+ * @returns The current instance of the DataValidationBuilder class, allowing for method chaining
218
197
  */
219
198
  requireNumberLessThanOrEqualTo(e, t) {
220
199
  return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = d.LESS_THAN_OR_EQUAL, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
@@ -222,11 +201,10 @@ class D {
222
201
  /**
223
202
  * Sets a data validation rule that requires the user to enter a number outside a specified range
224
203
  * The specified range includes all integers and decimals
225
- *
226
204
  * @param start The starting point of the specified range
227
205
  * @param end The end point of the specified range
228
206
  * @param isInteger Optional parameter, indicating whether the number to be verified is an integer. Default value is false
229
- * @return An instance of the FDataValidationBuilder class, allowing for method chaining
207
+ * @returns An instance of the FDataValidationBuilder class, allowing for method chaining
230
208
  */
231
209
  requireNumberNotBetween(e, t, r) {
232
210
  return this._rule.formula1 = `${e}`, this._rule.formula2 = `${t}`, this._rule.operator = d.NOT_BETWEEN, this._rule.type = r ? o.WHOLE : o.DECIMAL, this;
@@ -234,10 +212,9 @@ class D {
234
212
  /**
235
213
  * Creates a data validation rule that requires the user to enter a number that is not equal to a specific value
236
214
  * The specific value can be an integer or a decimal
237
- *
238
215
  * @param num The number to which the entered number should not be equal
239
216
  * @param isInteger Indicates whether the required number is an integer. Default is undefined, meaning it can be an integer or a decimal
240
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining
217
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining
241
218
  */
242
219
  requireNumberNotEqualTo(e, t) {
243
220
  return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = d.NOT_EQUAL, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
@@ -245,11 +222,10 @@ class D {
245
222
  /**
246
223
  * Sets a data validation rule that requires the user to enter a value from a list of specific values.
247
224
  * The list can be displayed in a dropdown, and the user can choose multiple values according to the settings.
248
- *
249
225
  * @param values An array containing the specific values that the user can enter.
250
226
  * @param multiple Optional parameter indicating whether the user can select multiple values. Default is false, meaning only one value can be selected.
251
227
  * @param showDropdown Optional parameter indicating whether to display the list in a dropdown. Default is true, meaning the list will be displayed as a dropdown.
252
- * @return An instance of the FDataValidationBuilder class, allowing for method chaining.
228
+ * @returns An instance of the FDataValidationBuilder class, allowing for method chaining.
253
229
  */
254
230
  requireValueInList(e, t, r) {
255
231
  return this._rule.type = t ? o.LIST_MULTIPLE : o.LIST, this._rule.formula1 = e.join(","), this._rule.formula2 = void 0, this._rule.showDropDown = r != null ? r : !0, this;
@@ -257,11 +233,10 @@ class D {
257
233
  /**
258
234
  * Sets a data validation rule that requires the user to enter a value within a specific range.
259
235
  * The range is defined by an FRange object, which contains the unit ID, sheet name, and cell range.
260
- *
261
236
  * @param range An FRange object representing the range of values that the user can enter.
262
237
  * @param multiple Optional parameter indicating whether the user can select multiple values. Default is false, meaning only one value can be selected.
263
238
  * @param showDropdown Optional parameter indicating whether to display the list in a dropdown. Default is true, meaning the list will be displayed as a dropdown.
264
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining.
239
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
265
240
  */
266
241
  requireValueInRange(e, t, r) {
267
242
  return this._rule.type = t ? o.LIST_MULTIPLE : o.LIST, this._rule.formula1 = `=${P({
@@ -274,9 +249,8 @@ class D {
274
249
  * Sets whether to allow invalid data and configures the error style for data validation.
275
250
  * If invalid data is not allowed, the error style will be set to STOP, indicating that data entry must stop upon encountering an error.
276
251
  * 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.
277
- *
278
252
  * @param allowInvalidData A boolean value indicating whether to allow invalid data.
279
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining.
253
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
280
254
  */
281
255
  setAllowInvalid(e) {
282
256
  return this._rule.errorStyle = e ? w.WARNING : w.STOP, this;
@@ -284,9 +258,8 @@ class D {
284
258
  /**
285
259
  * Sets the help text and enables the display of error messages for data validation.
286
260
  * This method allows you to set a custom help text that will be displayed when the user enters invalid data.
287
- *
288
261
  * @param helpText The text to display as help information.
289
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining.
262
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
290
263
  */
291
264
  setHelpText(e) {
292
265
  return this._rule.error = e, this._rule.showErrorMessage = !0, this;
@@ -294,12 +267,11 @@ class D {
294
267
  /**
295
268
  * Sets the criteria values for data validation.
296
269
  * This method is used to configure the validation rules based on specific criteria values.
297
- *
298
270
  * @param type The type of data validation.
299
271
  * @param values An array containing the criteria values.
300
272
  * The array should have three elements: [operator, formula1, formula2].
301
273
  * operator is a DataValidationOperator enum value, formula1 is the first formula, and formula2 is the second formula.
302
- * @return The current instance of the FDataValidationBuilder class, allowing for method chaining.
274
+ * @returns The current instance of the FDataValidationBuilder class, allowing for method chaining.
303
275
  */
304
276
  withCriteriaValues(e, t) {
305
277
  return this._rule.type = e, this._rule.operator = t[0], this._rule.formula1 = t[1], this._rule.formula2 = t[2], this;
@@ -310,7 +282,6 @@ class D {
310
282
  /**
311
283
  * Sets the options for the data validation rule.
312
284
  * For details of options, please refer to https://univer.ai/typedoc/@univerjs/core/interfaces/IDataValidationRuleOptions
313
- *
314
285
  * @param options The options to set for the data validation rule.
315
286
  * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
316
287
  */
@@ -327,15 +298,13 @@ class m {
327
298
  }
328
299
  /**
329
300
  * Gets whether invalid data is allowed based on the error style value.
330
- *
331
- * @return true if invalid data is allowed, false otherwise.
301
+ * @returns true if invalid data is allowed, false otherwise.
332
302
  */
333
303
  getAllowInvalid() {
334
304
  return this.rule.errorStyle !== w.STOP;
335
305
  }
336
306
  /**
337
307
  * Gets the data validation type of the rule
338
- *
339
308
  * @returns The data validation type
340
309
  */
341
310
  getCriteriaType() {
@@ -343,7 +312,6 @@ class m {
343
312
  }
344
313
  /**
345
314
  * Gets the values used for criteria evaluation
346
- *
347
315
  * @returns An array containing the operator, formula1, and formula2 values
348
316
  */
349
317
  getCriteriaValues() {
@@ -351,7 +319,6 @@ class m {
351
319
  }
352
320
  /**
353
321
  * Gets the help text information, which is used to provide users with guidance and support
354
- *
355
322
  * @returns Returns the help text information. If there is no error message, it returns an undefined value.
356
323
  */
357
324
  getHelpText() {
@@ -360,15 +327,13 @@ class m {
360
327
  /**
361
328
  * Creates a new instance of FDataValidationBuilder using the current rule object.
362
329
  * This method is useful for copying an existing data validation rule configuration.
363
- *
364
- * @return A new FDataValidationBuilder instance with the same rule configuration.
330
+ * @returns A new FDataValidationBuilder instance with the same rule configuration.
365
331
  */
366
332
  copy() {
367
333
  return new D(this.rule);
368
334
  }
369
335
  /**
370
336
  * Gets whether the data validation rule is applied to the worksheet.
371
- *
372
337
  * @returns true if the rule is applied, false otherwise.
373
338
  */
374
339
  getApplied() {
@@ -379,7 +344,6 @@ class m {
379
344
  }
380
345
  /**
381
346
  * Gets the ranges to which the data validation rule is applied.
382
- *
383
347
  * @returns An array of IRange objects representing the ranges to which the data validation rule is applied.
384
348
  */
385
349
  getRanges() {
@@ -390,7 +354,6 @@ class m {
390
354
  }
391
355
  /**
392
356
  * Gets the title of the error message dialog box.
393
- *
394
357
  * @returns The title of the error message dialog box.
395
358
  */
396
359
  getUnitId() {
@@ -399,7 +362,6 @@ class m {
399
362
  }
400
363
  /**
401
364
  * Gets the sheetId of the worksheet.
402
- *
403
365
  * @returns The sheetId of the worksheet.
404
366
  */
405
367
  getSheetId() {
@@ -410,6 +372,7 @@ class m {
410
372
  * Set Criteria for the data validation rule.
411
373
  * @param type The type of data validation criteria.
412
374
  * @param values An array containing the operator, formula1, and formula2 values.
375
+ * @param allowBlank
413
376
  * @returns true if the criteria is set successfully, false otherwise.
414
377
  */
415
378
  setCriteria(e, t, r = !0) {