@univerjs/sheets-data-validation 0.5.3 → 0.5.4-nightly.202501131606

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.
@@ -13,43 +13,36 @@ export declare class FDataValidationBuilder {
13
13
  constructor(rule?: IDataValidationRule);
14
14
  /**
15
15
  * Builds an FDataValidation instance based on the _rule property of the current class
16
- *
17
16
  * @returns {FDataValidation} A new instance of the FDataValidation class
18
17
  */
19
18
  build(): FDataValidation;
20
19
  /**
21
20
  * Creates a duplicate of the current DataValidationBuilder object
22
- *
23
- * @return {FDataValidationBuilder} A new instance of the DataValidationBuilder class
21
+ * @returns {FDataValidationBuilder} A new instance of the DataValidationBuilder class
24
22
  */
25
23
  copy(): FDataValidationBuilder;
26
24
  /**
27
25
  * Determines whether invalid data is allowed
28
- *
29
26
  * @returns {boolean} True if invalid data is allowed, False otherwise
30
27
  */
31
28
  getAllowInvalid(): boolean;
32
29
  /**
33
30
  * Gets the data validation type of the rule
34
- *
35
31
  * @returns {DataValidationType} The data validation type
36
32
  */
37
33
  getCriteriaType(): DataValidationType | string;
38
34
  /**
39
35
  * Gets the values used for criteria evaluation
40
- *
41
36
  * @returns {[string, string, string]} An array containing the operator, formula1, and formula2 values
42
37
  */
43
38
  getCriteriaValues(): [string | undefined, string | undefined, string | undefined];
44
39
  /**
45
40
  * Gets the help text information, which is used to provide users with guidance and support
46
- *
47
41
  * @returns {string | undefined} Returns the help text information. If there is no error message, it returns an undefined value.
48
42
  */
49
43
  getHelpText(): string | undefined;
50
44
  /**
51
45
  * Sets the data validation type to CHECKBOX and sets the checked and unchecked values
52
- *
53
46
  * @param checkedValue The value when the checkbox is checked (Optional)
54
47
  * @param uncheckedValue The value when the checkbox is unchecked (Optional)
55
48
  * @returns The current instance of the FDataValidationBuilder class to allow for method chaining
@@ -57,190 +50,168 @@ export declare class FDataValidationBuilder {
57
50
  requireCheckbox(checkedValue?: string, uncheckedValue?: string): FDataValidationBuilder;
58
51
  /**
59
52
  * Set the data validation type to DATE and configure the validation rules to be after a specific date
60
- *
61
53
  * @param date The date to compare against. The formatted date string will be set as formula1
62
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining
54
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining
63
55
  */
64
56
  requireDateAfter(date: Date): FDataValidationBuilder;
65
57
  /**
66
58
  * Set the data validation type to DATE and configure the validation rules to be before a specific date
67
- *
68
59
  * @param date The date to compare against. The formatted date string will be set as formula1
69
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining
60
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining
70
61
  */
71
62
  requireDateBefore(date: Date): FDataValidationBuilder;
72
63
  /**
73
64
  * Set the data validation type to DATE and configure the validation rules to be within a specific date range
74
- *
75
65
  * @param start The starting date of the range. The formatted date string will be set as formula1
76
66
  * @param end The ending date of the range. The formatted date string will be set as formula2
77
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining
67
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining
78
68
  */
79
69
  requireDateBetween(start: Date, end: Date): FDataValidationBuilder;
80
70
  /**
81
71
  * Set the data validation type to DATE and configure the validation rules to be equal to a specific date
82
- *
83
72
  * @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
73
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining
85
74
  */
86
75
  requireDateEqualTo(date: Date): FDataValidationBuilder;
87
76
  /**
88
77
  * Set the data validation type to DATE and configure the validation rules to be not within a specific date range
89
- *
90
78
  * @param start The starting date of the date range
91
79
  * @param end The ending date of the date range
92
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining
80
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining
93
81
  */
94
82
  requireDateNotBetween(start: Date, end: Date): FDataValidationBuilder;
95
83
  /**
96
84
  * Set the data validation type to DATE and configure the validation rules to be on or after a specific date
97
- *
98
85
  * @param date The date to compare against. The formatted date string will be set as formula1
99
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining
86
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining
100
87
  */
101
88
  requireDateOnOrAfter(date: Date): FDataValidationBuilder;
102
89
  /**
103
90
  * Set the data validation type to DATE and configure the validation rules to be on or before a specific date
104
- *
105
91
  * @param date The date to compare against. The formatted date string will be set as formula1
106
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining
92
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining
107
93
  */
108
94
  requireDateOnOrBefore(date: Date): FDataValidationBuilder;
109
95
  /**
110
96
  * Requires that a custom formula be satisfied.
111
97
  * Sets the data validation type to CUSTOM and configures the validation rule based on the provided formula string.
112
- *
113
98
  * @param formula The formula string that needs to be satisfied.
114
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining.
99
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
115
100
  */
116
101
  requireFormulaSatisfied(formula: string): FDataValidationBuilder;
117
102
  /**
118
103
  * Requires the user to enter a number within a specific range, which can be integer or decimal.
119
104
  * Sets the data validation type based on the isInteger parameter and configures the validation rules for the specified number range.
120
- *
121
105
  * @param start The starting value of the number range.
122
106
  * @param end The ending value of the number range.
123
107
  * @param isInteger Indicates whether the required number is an integer. Default is undefined, meaning it can be an integer or decimal.
124
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining.
108
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
125
109
  */
126
110
  requireNumberBetween(start: number, end: number, isInteger?: boolean): FDataValidationBuilder;
127
111
  /**
128
112
  * Requires the user to enter a number that is equal to a specific value, which can be an integer or a decimal.
129
113
  * Sets the data validation type based on the isInteger parameter and configures the validation rules for the specified number.
130
- *
131
114
  * @param num The number to which the entered number should be equal.
132
115
  * @param isInteger Indicates whether the required number is an integer. Default is undefined, meaning it can be an integer or a decimal.
133
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining.
116
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
134
117
  */
135
118
  requireNumberEqualTo(num: number, isInteger?: boolean): FDataValidationBuilder;
136
119
  /**
137
120
  * Requires the user to enter a number that is greater than a specific value, which can be an integer or a decimal.
138
121
  * Sets the data validation type based on the isInteger parameter and configures the validation rules for the specified number.
139
- *
140
122
  * @param num The number to which the entered number should be greater.
141
123
  * @param isInteger Indicates whether the required number is an integer. Default is undefined, meaning it can be an integer or a decimal.
142
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining.
124
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
143
125
  */
144
126
  requireNumberGreaterThan(num: number, isInteger?: boolean): FDataValidationBuilder;
145
127
  /**
146
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.
147
129
  * Sets the data validation type based on the isInteger parameter and configures the validation rules for the specified number.
148
- *
149
130
  * @param num The number to which the entered number should be greater than or equal.
150
131
  * @param isInteger Indicates whether the required number is an integer. Default is undefined, meaning it can be an integer or a decimal.
151
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining.
132
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
152
133
  */
153
134
  requireNumberGreaterThanOrEqualTo(num: number, isInteger?: boolean): FDataValidationBuilder;
154
135
  /**
155
136
  * Requires the user to enter a number that is less than a specific value, which can be an integer or a decimal.
156
137
  * Sets the data validation type based on the isInteger parameter and configures the validation rules for the specified number.
157
- *
158
138
  * @param num The number to which the entered number should be less.
159
139
  * @param isInteger Indicates whether the required number is an integer. Default is undefined, meaning it can be an integer or a decimal.
160
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining.
140
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
161
141
  */
162
142
  requireNumberLessThan(num: number, isInteger?: boolean): FDataValidationBuilder;
163
143
  /**
164
144
  * Sets the data validation rule to require a number less than or equal to a specified value
165
145
  * The specified value can be an integer or a decimal
166
- *
167
146
  * @param num The number to which the entered number should be less than or equal
168
147
  * @param isInteger Indicates whether the required number is an integer
169
- * @return The current instance of the DataValidationBuilder class, allowing for method chaining
148
+ * @returns The current instance of the DataValidationBuilder class, allowing for method chaining
170
149
  */
171
150
  requireNumberLessThanOrEqualTo(num: number, isInteger?: boolean): FDataValidationBuilder;
172
151
  /**
173
152
  * Sets a data validation rule that requires the user to enter a number outside a specified range
174
153
  * The specified range includes all integers and decimals
175
- *
176
154
  * @param start The starting point of the specified range
177
155
  * @param end The end point of the specified range
178
156
  * @param isInteger Optional parameter, indicating whether the number to be verified is an integer. Default value is false
179
- * @return An instance of the FDataValidationBuilder class, allowing for method chaining
157
+ * @returns An instance of the FDataValidationBuilder class, allowing for method chaining
180
158
  */
181
159
  requireNumberNotBetween(start: number, end: number, isInteger?: boolean): FDataValidationBuilder;
182
160
  /**
183
161
  * Creates a data validation rule that requires the user to enter a number that is not equal to a specific value
184
162
  * The specific value can be an integer or a decimal
185
- *
186
163
  * @param num The number to which the entered number should not be equal
187
164
  * @param isInteger Indicates whether the required number is an integer. Default is undefined, meaning it can be an integer or a decimal
188
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining
165
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining
189
166
  */
190
167
  requireNumberNotEqualTo(num: number, isInteger?: boolean): FDataValidationBuilder;
191
168
  /**
192
169
  * Sets a data validation rule that requires the user to enter a value from a list of specific values.
193
170
  * The list can be displayed in a dropdown, and the user can choose multiple values according to the settings.
194
- *
195
171
  * @param values An array containing the specific values that the user can enter.
196
172
  * @param multiple Optional parameter indicating whether the user can select multiple values. Default is false, meaning only one value can be selected.
197
173
  * @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.
198
- * @return An instance of the FDataValidationBuilder class, allowing for method chaining.
174
+ * @returns An instance of the FDataValidationBuilder class, allowing for method chaining.
199
175
  */
200
176
  requireValueInList(values: string[], multiple?: boolean, showDropdown?: boolean): FDataValidationBuilder;
201
177
  /**
202
178
  * Sets a data validation rule that requires the user to enter a value within a specific range.
203
179
  * The range is defined by an FRange object, which contains the unit ID, sheet name, and cell range.
204
- *
205
180
  * @param range An FRange object representing the range of values that the user can enter.
206
181
  * @param multiple Optional parameter indicating whether the user can select multiple values. Default is false, meaning only one value can be selected.
207
182
  * @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.
208
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining.
183
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
209
184
  */
210
185
  requireValueInRange(range: FRange, multiple?: boolean, showDropdown?: boolean): FDataValidationBuilder;
211
186
  /**
212
187
  * Sets whether to allow invalid data and configures the error style for data validation.
213
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.
214
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.
215
- *
216
190
  * @param allowInvalidData A boolean value indicating whether to allow invalid data.
217
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining.
191
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
218
192
  */
219
193
  setAllowInvalid(allowInvalidData: boolean): FDataValidationBuilder;
220
194
  /**
221
195
  * Sets the help text and enables the display of error messages for data validation.
222
196
  * This method allows you to set a custom help text that will be displayed when the user enters invalid data.
223
- *
224
197
  * @param helpText The text to display as help information.
225
- * @return The current instance of the FDataValidationBuilder class to allow for method chaining.
198
+ * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
226
199
  */
227
200
  setHelpText(helpText: string): FDataValidationBuilder;
228
201
  /**
229
202
  * Sets the criteria values for data validation.
230
203
  * This method is used to configure the validation rules based on specific criteria values.
231
- *
232
204
  * @param type The type of data validation.
233
205
  * @param values An array containing the criteria values.
234
206
  * The array should have three elements: [operator, formula1, formula2].
235
207
  * 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.
208
+ * @returns The current instance of the FDataValidationBuilder class, allowing for method chaining.
237
209
  */
238
210
  withCriteriaValues(type: DataValidationType | string, values: [DataValidationOperator, string, string]): this;
239
211
  setAllowBlank(allowBlank: boolean): FDataValidationBuilder;
240
212
  /**
241
213
  * Sets the options for the data validation rule.
242
214
  * For details of options, please refer to https://univer.ai/typedoc/@univerjs/core/interfaces/IDataValidationRuleOptions
243
- *
244
215
  * @param options The options to set for the data validation rule.
245
216
  * @returns The current instance of the FDataValidationBuilder class to allow for method chaining.
246
217
  */
@@ -8,56 +8,47 @@ export declare class FDataValidation {
8
8
  constructor(rule: IDataValidationRule, worksheet?: Worksheet, _injector?: Injector);
9
9
  /**
10
10
  * Gets whether invalid data is allowed based on the error style value.
11
- *
12
- * @return true if invalid data is allowed, false otherwise.
11
+ * @returns true if invalid data is allowed, false otherwise.
13
12
  */
14
13
  getAllowInvalid(): boolean;
15
14
  /**
16
15
  * Gets the data validation type of the rule
17
- *
18
16
  * @returns The data validation type
19
17
  */
20
18
  getCriteriaType(): DataValidationType | string;
21
19
  /**
22
20
  * Gets the values used for criteria evaluation
23
- *
24
21
  * @returns An array containing the operator, formula1, and formula2 values
25
22
  */
26
23
  getCriteriaValues(): [string | undefined, string | undefined, string | undefined];
27
24
  /**
28
25
  * Gets the help text information, which is used to provide users with guidance and support
29
- *
30
26
  * @returns Returns the help text information. If there is no error message, it returns an undefined value.
31
27
  */
32
28
  getHelpText(): string | undefined;
33
29
  /**
34
30
  * Creates a new instance of FDataValidationBuilder using the current rule object.
35
31
  * This method is useful for copying an existing data validation rule configuration.
36
- *
37
- * @return A new FDataValidationBuilder instance with the same rule configuration.
32
+ * @returns A new FDataValidationBuilder instance with the same rule configuration.
38
33
  */
39
34
  copy(): FDataValidationBuilder;
40
35
  /**
41
36
  * Gets whether the data validation rule is applied to the worksheet.
42
- *
43
37
  * @returns true if the rule is applied, false otherwise.
44
38
  */
45
39
  getApplied(): boolean;
46
40
  /**
47
41
  * Gets the ranges to which the data validation rule is applied.
48
- *
49
42
  * @returns An array of IRange objects representing the ranges to which the data validation rule is applied.
50
43
  */
51
44
  getRanges(): FRange[];
52
45
  /**
53
46
  * Gets the title of the error message dialog box.
54
- *
55
47
  * @returns The title of the error message dialog box.
56
48
  */
57
49
  getUnitId(): string | undefined;
58
50
  /**
59
51
  * Gets the sheetId of the worksheet.
60
- *
61
52
  * @returns The sheetId of the worksheet.
62
53
  */
63
54
  getSheetId(): string | undefined;
@@ -65,6 +56,7 @@ export declare class FDataValidation {
65
56
  * Set Criteria for the data validation rule.
66
57
  * @param type The type of data validation criteria.
67
58
  * @param values An array containing the operator, formula1, and formula2 values.
59
+ * @param allowBlank
68
60
  * @returns true if the criteria is set successfully, false otherwise.
69
61
  */
70
62
  setCriteria(type: DataValidationType, values: [DataValidationOperator, string, string], allowBlank?: boolean): FDataValidation;
@@ -0,0 +1,269 @@
1
+ import { DataValidationStatus, IDataValidationRule, IDataValidationRuleBase, IDataValidationRuleOptions, IEventBase, IRange, ISheetDataValidationRule } from '@univerjs/core';
2
+ import { DataValidationChangeType, IRuleChange } from '@univerjs/data-validation';
3
+ import { FWorkbook, FWorksheet } from '@univerjs/sheets/facade';
4
+ import { FDataValidation } from './f-data-validation';
5
+ /**
6
+ * Event interface triggered when a data validation rule is changed
7
+ * @interface ISheetDataValidationChangedEvent
8
+ * @augments {IEventBase}
9
+ */
10
+ export interface ISheetDataValidationChangedEvent extends IEventBase {
11
+ /** The source of the rule change */
12
+ origin: IRuleChange;
13
+ /** The worksheet containing the validation rule */
14
+ worksheet: FWorksheet;
15
+ /** The workbook instance */
16
+ workbook: FWorkbook;
17
+ /** Type of change made to the validation rule */
18
+ changeType: DataValidationChangeType;
19
+ /** The previous validation rule, if it exists */
20
+ oldRule?: IDataValidationRule;
21
+ /** The new or modified validation rule */
22
+ rule: FDataValidation;
23
+ }
24
+ /**
25
+ * Event interface triggered when a data validation status changes
26
+ * @interface ISheetDataValidatorStatusChangedEvent
27
+ * @augments {IEventBase}
28
+ */
29
+ export interface ISheetDataValidatorStatusChangedEvent extends IEventBase {
30
+ /** The worksheet containing the validation */
31
+ worksheet: FWorksheet;
32
+ /** The workbook instance */
33
+ workbook: FWorkbook;
34
+ /** Row index of the validated cell */
35
+ row: number;
36
+ /** Column index of the validated cell */
37
+ column: number;
38
+ /** Current validation status */
39
+ status: DataValidationStatus;
40
+ /** The validation rule that was checked */
41
+ rule: FDataValidation;
42
+ }
43
+ /**
44
+ * Event interface triggered before adding a new data validation rule
45
+ * @interface IBeforeSheetDataValidationAddEvent
46
+ * @augments {IEventBase}
47
+ */
48
+ export interface IBeforeSheetDataValidationAddEvent extends IEventBase {
49
+ /** The worksheet to add the validation to */
50
+ worksheet: FWorksheet;
51
+ /** The workbook instance */
52
+ workbook: FWorkbook;
53
+ /** The validation rule to be added */
54
+ rule: ISheetDataValidationRule;
55
+ }
56
+ /**
57
+ * Event interface triggered before deleting a data validation rule
58
+ * @interface IBeforeSheetDataValidationDeleteEvent
59
+ * @augments {IEventBase}
60
+ */
61
+ export interface IBeforeSheetDataValidationDeleteEvent extends IEventBase {
62
+ /** The worksheet containing the validation */
63
+ worksheet: FWorksheet;
64
+ /** The workbook instance */
65
+ workbook: FWorkbook;
66
+ /** Unique identifier of the rule to be deleted */
67
+ ruleId: string;
68
+ /** The validation rule to be deleted */
69
+ rule: FDataValidation;
70
+ }
71
+ /**
72
+ * Event interface triggered before updating a data validation rule's criteria
73
+ * @interface IBeforeSheetDataValidationCriteriaUpdateEvent
74
+ * @augments {IEventBase}
75
+ */
76
+ export interface IBeforeSheetDataValidationCriteriaUpdateEvent extends IEventBase {
77
+ /** The worksheet containing the validation */
78
+ worksheet: FWorksheet;
79
+ /** The workbook instance */
80
+ workbook: FWorkbook;
81
+ /** Unique identifier of the rule to be updated */
82
+ ruleId: string;
83
+ /** The current validation rule */
84
+ rule: FDataValidation;
85
+ /** The new criteria to be applied */
86
+ newCriteria: IDataValidationRuleBase;
87
+ }
88
+ /**
89
+ * Event interface triggered before updating a data validation rule's ranges
90
+ * @interface IBeforeSheetDataValidationRangeUpdateEvent
91
+ * @augments {IEventBase}
92
+ */
93
+ export interface IBeforeSheetDataValidationRangeUpdateEvent extends IEventBase {
94
+ /** The worksheet containing the validation */
95
+ worksheet: FWorksheet;
96
+ /** The workbook instance */
97
+ workbook: FWorkbook;
98
+ /** Unique identifier of the rule to be updated */
99
+ ruleId: string;
100
+ /** The current validation rule */
101
+ rule: FDataValidation;
102
+ /** The new ranges to be applied */
103
+ newRanges: IRange[];
104
+ }
105
+ /**
106
+ * Event interface triggered before updating a data validation rule's options
107
+ * @interface IBeforeSheetDataValidationOptionsUpdateEvent
108
+ * @augments {IEventBase}
109
+ */
110
+ export interface IBeforeSheetDataValidationOptionsUpdateEvent extends IEventBase {
111
+ /** The worksheet containing the validation */
112
+ worksheet: FWorksheet;
113
+ /** The workbook instance */
114
+ workbook: FWorkbook;
115
+ /** Unique identifier of the rule to be updated */
116
+ ruleId: string;
117
+ /** The current validation rule */
118
+ rule: FDataValidation;
119
+ /** The new options to be applied */
120
+ newOptions: IDataValidationRuleOptions;
121
+ }
122
+ /**
123
+ * Event interface triggered before deleting all data validation rules
124
+ * @interface IBeforeSheetDataValidationDeleteAllEvent
125
+ * @augments {IEventBase}
126
+ */
127
+ export interface IBeforeSheetDataValidationDeleteAllEvent extends IEventBase {
128
+ /** The worksheet containing the validations */
129
+ worksheet: FWorksheet;
130
+ /** The workbook instance */
131
+ workbook: FWorkbook;
132
+ /** Array of all validation rules to be deleted */
133
+ rules: FDataValidation[];
134
+ }
135
+ export interface IDataValidationEventParamConfig {
136
+ SheetDataValidationChanged: ISheetDataValidationChangedEvent;
137
+ SheetDataValidatorStatusChanged: ISheetDataValidatorStatusChangedEvent;
138
+ BeforeSheetDataValidationAdd: IBeforeSheetDataValidationAddEvent;
139
+ BeforeSheetDataValidationDelete: IBeforeSheetDataValidationDeleteEvent;
140
+ BeforeSheetDataValidationDeleteAll: IBeforeSheetDataValidationDeleteAllEvent;
141
+ BeforeSheetDataValidationCriteriaUpdate: IBeforeSheetDataValidationCriteriaUpdateEvent;
142
+ BeforeSheetDataValidationRangeUpdate: IBeforeSheetDataValidationRangeUpdateEvent;
143
+ BeforeSheetDataValidationOptionsUpdate: IBeforeSheetDataValidationOptionsUpdateEvent;
144
+ }
145
+ interface IDataValidationEvent {
146
+ /**
147
+ * Event fired when a rule is added, deleted, or modified
148
+ * @see {@link ISheetDataValidationChangedEvent}
149
+ * @example
150
+ * ```ts
151
+ * univerAPI.on(univerAPI.Event.SheetDataValidationChanged, (event) => {
152
+ * const { worksheet, workbook, changeType, oldRule, rule } = event;
153
+ * console.log(event);
154
+ * });
155
+ * ```
156
+ */
157
+ readonly SheetDataValidationChanged: 'SheetDataValidationChanged';
158
+ /**
159
+ * Event fired when a cell validator status is changed
160
+ * @see {@link ISheetDataValidatorStatusChangedEvent}
161
+ * @example
162
+ * ```ts
163
+ * univerAPI.on(univerAPI.Event.SheetDataValidatorStatusChanged, (event) => {
164
+ * const { worksheet, workbook, row, column, status, rule } = event;
165
+ * console.log(event);
166
+ * });
167
+ * ```
168
+ */
169
+ readonly SheetDataValidatorStatusChanged: 'SheetDataValidatorStatusChanged';
170
+ /**
171
+ * Event fired before a rule is added
172
+ * @see {@link IBeforeSheetDataValidationAddEvent}
173
+ * @example
174
+ * ```ts
175
+ * univerAPI.on(univerAPI.Event.BeforeSheetDataValidationAdd, (event) => {
176
+ * const { worksheet, workbook, rule } = event;
177
+ * console.log(event);
178
+ * });
179
+ * ```
180
+ */
181
+ readonly BeforeSheetDataValidationAdd: 'BeforeSheetDataValidationAdd';
182
+ /**
183
+ * Event fired before a rule is deleted
184
+ * @see {@link IBeforeSheetDataValidationDeleteEvent}
185
+ * @example
186
+ * ```ts
187
+ * univerAPI.on(univerAPI.Event.BeforeSheetDataValidationDelete, (event) => {
188
+ * const { worksheet, workbook, rule } = event;
189
+ * console.log(event);
190
+ * });
191
+ * ```
192
+ */
193
+ readonly BeforeSheetDataValidationDelete: 'BeforeSheetDataValidationDelete';
194
+ /**
195
+ * Event fired before all rules are deleted
196
+ * @see {@link IBeforeSheetDataValidationDeleteAllEvent}
197
+ * @example
198
+ * ```ts
199
+ * univerAPI.on(univerAPI.Event.BeforeSheetDataValidationDeleteAll, (event) => {
200
+ * const { worksheet, workbook, rules } = event;
201
+ * console.log(event);
202
+ * });
203
+ * ```
204
+ */
205
+ readonly BeforeSheetDataValidationDeleteAll: 'BeforeSheetDataValidationDeleteAll';
206
+ /**
207
+ * Event fired before the criteria of a rule are updated
208
+ * @see {@link IBeforeSheetDataValidationCriteriaUpdateEvent}
209
+ * @example
210
+ * ```ts
211
+ * univerAPI.on(univerAPI.Event.BeforeSheetDataValidationCriteriaUpdate, (event) => {
212
+ * const { worksheet, workbook, rule, newCriteria } = event;
213
+ * console.log(event);
214
+ * });
215
+ * ```
216
+ */
217
+ readonly BeforeSheetDataValidationCriteriaUpdate: 'BeforeSheetDataValidationCriteriaUpdate';
218
+ /**
219
+ * Event fired before the range of a rule is updated
220
+ * @see {@link IBeforeSheetDataValidationRangeUpdateEvent}
221
+ * @example
222
+ * ```ts
223
+ * univerAPI.on(univerAPI.Event.BeforeSheetDataValidationRangeUpdate, (event) => {
224
+ * const { worksheet, workbook, rule, newRanges } = event;
225
+ * console.log(event);
226
+ * });
227
+ * ```
228
+ */
229
+ readonly BeforeSheetDataValidationRangeUpdate: 'BeforeSheetDataValidationRangeUpdate';
230
+ /**
231
+ * Event fired before the options of a rule are updated
232
+ * @see {@link IBeforeSheetDataValidationOptionsUpdateEvent}
233
+ * @example
234
+ * ```ts
235
+ * univerAPI.on(univerAPI.Event.BeforeSheetDataValidationOptionsUpdate, (event) => {
236
+ * const { worksheet, workbook, rule, newOptions } = event;
237
+ * console.log(event);
238
+ * });
239
+ * ```
240
+ */
241
+ readonly BeforeSheetDataValidationOptionsUpdate: 'BeforeSheetDataValidationOptionsUpdate';
242
+ }
243
+ export declare class FDataValidationEvent implements IDataValidationEvent {
244
+ get SheetDataValidationChanged(): 'SheetDataValidationChanged';
245
+ get SheetDataValidatorStatusChanged(): 'SheetDataValidatorStatusChanged';
246
+ get BeforeSheetDataValidationAdd(): 'BeforeSheetDataValidationAdd';
247
+ get BeforeSheetDataValidationDelete(): 'BeforeSheetDataValidationDelete';
248
+ get BeforeSheetDataValidationDeleteAll(): 'BeforeSheetDataValidationDeleteAll';
249
+ get BeforeSheetDataValidationCriteriaUpdate(): 'BeforeSheetDataValidationCriteriaUpdate';
250
+ get BeforeSheetDataValidationRangeUpdate(): 'BeforeSheetDataValidationRangeUpdate';
251
+ get BeforeSheetDataValidationOptionsUpdate(): 'BeforeSheetDataValidationOptionsUpdate';
252
+ }
253
+ export interface IDataValidationEventConfig {
254
+ SheetDataValidationChanged: ISheetDataValidationChangedEvent;
255
+ SheetDataValidatorStatusChanged: ISheetDataValidatorStatusChangedEvent;
256
+ BeforeSheetDataValidationAdd: IBeforeSheetDataValidationAddEvent;
257
+ BeforeSheetDataValidationDelete: IBeforeSheetDataValidationDeleteEvent;
258
+ BeforeSheetDataValidationDeleteAll: IBeforeSheetDataValidationDeleteAllEvent;
259
+ BeforeSheetDataValidationCriteriaUpdate: IBeforeSheetDataValidationCriteriaUpdateEvent;
260
+ BeforeSheetDataValidationRangeUpdate: IBeforeSheetDataValidationRangeUpdateEvent;
261
+ BeforeSheetDataValidationOptionsUpdate: IBeforeSheetDataValidationOptionsUpdateEvent;
262
+ }
263
+ declare module '@univerjs/core' {
264
+ interface FEventName extends IDataValidationEvent {
265
+ }
266
+ interface IEventParamConfig extends IDataValidationEventParamConfig {
267
+ }
268
+ }
269
+ export {};
@@ -3,18 +3,18 @@ import { FRange } from '@univerjs/sheets/facade';
3
3
  import { FDataValidation } from './f-data-validation';
4
4
  export interface IFRangeDataValidationMixin {
5
5
  /**
6
- * set a data validation rule to current range
6
+ * Set a data validation rule to current range.
7
7
  * @param rule data validation rule, build by `FUniver.newDataValidation`
8
8
  * @returns current range
9
9
  */
10
10
  setDataValidation(this: FRange, rule: Nullable<FDataValidation>): FRange;
11
11
  /**
12
- * get first data validation rule in current range
12
+ * Get first data validation rule in current range.
13
13
  * @returns data validation rule
14
14
  */
15
15
  getDataValidation(this: FRange): Nullable<FDataValidation>;
16
16
  /**
17
- * get all data validation rules in current range
17
+ * Get all data validation rules in current range.
18
18
  * @returns all data validation rules
19
19
  */
20
20
  getDataValidations(this: FRange): FDataValidation[];
@@ -1,10 +1,13 @@
1
+ import { Injector, FUniver } from '@univerjs/core';
1
2
  import { FDataValidationBuilder } from './f-data-validation-builder';
2
- export declare class FUnvierDataValidationMixin {
3
+ export declare class FUnvierDataValidationMixin extends FUniver {
4
+ /**
3
5
  /**
4
6
  * @deparecated use `univerAPI.newDataValidation()` as instead.
5
7
  */
6
8
  static newDataValidation(): FDataValidationBuilder;
7
9
  newDataValidation(): FDataValidationBuilder;
10
+ _initialize(injector: Injector): void;
8
11
  }
9
12
  declare module '@univerjs/core' {
10
13
  namespace FUniver {