@univerjs/sheets-data-validation 0.5.5-nightly.202501241606 → 0.6.0-alpha.0

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
@@ -1,20 +1,19 @@
1
- var __defProp = Object.defineProperty;
2
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: !0, configurable: !0, writable: !0, value }) : obj[key] = value;
3
- var __name = (target, value) => __defProp(target, "name", { value, configurable: !0 });
4
- var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key != "symbol" ? key + "" : key, value);
5
- import { UpdateSheetDataValidationSettingCommand, UpdateSheetDataValidationOptionsCommand, UpdateSheetDataValidationRangeCommand, RemoveSheetDataValidationCommand, ClearRangeDataValidationCommand, AddSheetDataValidationCommand, SheetsDataValidationValidatorService, SheetDataValidationModel, RemoveSheetAllDataValidationCommand } from "@univerjs/sheets-data-validation";
6
- import { FRange, FWorkbook, FWorksheet } from "@univerjs/sheets/facade";
7
- import { generateRandomId, DataValidationType, DataValidationErrorStyle, DataValidationOperator, IUniverInstanceService, ICommandService, FUniver, CanceledError, toDisposable, FEventName } from "@univerjs/core";
8
- import { DataValidationModel, getRuleOptions } from "@univerjs/data-validation";
9
- import { serializeRangeToRefString } from "@univerjs/engine-formula";
10
- import { filter } from "rxjs";
11
- const _FDataValidationBuilder = class _FDataValidationBuilder {
12
- constructor(rule) {
13
- __publicField(this, "_rule");
14
- this._rule = rule != null ? rule : {
15
- uid: generateRandomId(),
1
+ var j = Object.defineProperty;
2
+ var q = (c, e, t) => e in c ? j(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t;
3
+ var f = (c, e, t) => q(c, typeof e != "symbol" ? e + "" : e, t);
4
+ import { UpdateSheetDataValidationSettingCommand as U, UpdateSheetDataValidationOptionsCommand as v, UpdateSheetDataValidationRangeCommand as C, RemoveSheetDataValidationCommand as T, ClearRangeDataValidationCommand as W, AddSheetDataValidationCommand as A, SheetsDataValidationValidatorService as S, SheetDataValidationModel as V, RemoveSheetAllDataValidationCommand as O } from "@univerjs/sheets-data-validation";
5
+ import { FRange as y, FWorkbook as M, FWorksheet as N } from "@univerjs/sheets/facade";
6
+ import { generateRandomId as B, DataValidationType as o, DataValidationErrorStyle as w, DataValidationOperator as h, IUniverInstanceService as H, ICommandService as p, FUniver as x, CanceledError as _, toDisposable as g, FEventName as $ } from "@univerjs/core";
7
+ import { DataValidationModel as b, getRuleOptions as F } from "@univerjs/data-validation";
8
+ import { serializeRangeToRefString as P } from "@univerjs/engine-formula";
9
+ import { filter as R } from "rxjs";
10
+ class D {
11
+ constructor(e) {
12
+ f(this, "_rule");
13
+ this._rule = e != null ? e : {
14
+ uid: B(),
16
15
  ranges: void 0,
17
- type: DataValidationType.CUSTOM
16
+ type: o.CUSTOM
18
17
  };
19
18
  }
20
19
  /**
@@ -27,7 +26,7 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
27
26
  * ```
28
27
  */
29
28
  build() {
30
- return new FDataValidation(this._rule);
29
+ return new m(this._rule);
31
30
  }
32
31
  /**
33
32
  * Creates a duplicate of the current DataValidationBuilder object
@@ -39,9 +38,9 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
39
38
  * ```
40
39
  */
41
40
  copy() {
42
- return new _FDataValidationBuilder({
41
+ return new D({
43
42
  ...this._rule,
44
- uid: generateRandomId()
43
+ uid: B()
45
44
  });
46
45
  }
47
46
  /**
@@ -54,7 +53,7 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
54
53
  * ```
55
54
  */
56
55
  getAllowInvalid() {
57
- return this._rule.errorStyle !== DataValidationErrorStyle.STOP;
56
+ return this._rule.errorStyle !== w.STOP;
58
57
  }
59
58
  /**
60
59
  * Gets the data validation type of the rule
@@ -103,8 +102,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
103
102
  * const rule = builder.requireCheckbox('Yes', 'No').build();
104
103
  * ```
105
104
  */
106
- requireCheckbox(checkedValue, uncheckedValue) {
107
- return this._rule.type = DataValidationType.CHECKBOX, this._rule.formula1 = checkedValue, this._rule.formula2 = uncheckedValue, this;
105
+ requireCheckbox(e, t) {
106
+ return this._rule.type = o.CHECKBOX, this._rule.formula1 = e, this._rule.formula2 = t, this;
108
107
  }
109
108
  /**
110
109
  * Set the data validation type to DATE and configure the validation rules to be after a specific date
@@ -116,8 +115,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
116
115
  * const rule = builder.requireDateAfter(new Date('2024-01-01')).build();
117
116
  * ```
118
117
  */
119
- requireDateAfter(date) {
120
- return this._rule.type = DataValidationType.DATE, this._rule.formula1 = date.toLocaleDateString(), this._rule.operator = DataValidationOperator.GREATER_THAN, this;
118
+ requireDateAfter(e) {
119
+ return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.operator = h.GREATER_THAN, this;
121
120
  }
122
121
  /**
123
122
  * Set the data validation type to DATE and configure the validation rules to be before a specific date
@@ -129,8 +128,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
129
128
  * const rule = builder.requireDateBefore(new Date('2024-12-31')).build();
130
129
  * ```
131
130
  */
132
- requireDateBefore(date) {
133
- return this._rule.type = DataValidationType.DATE, this._rule.formula1 = date.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = DataValidationOperator.LESS_THAN, this;
131
+ requireDateBefore(e) {
132
+ return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = h.LESS_THAN, this;
134
133
  }
135
134
  /**
136
135
  * Set the data validation type to DATE and configure the validation rules to be within a specific date range
@@ -145,8 +144,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
145
144
  * .build();
146
145
  * ```
147
146
  */
148
- requireDateBetween(start, end) {
149
- return this._rule.type = DataValidationType.DATE, this._rule.formula1 = start.toLocaleDateString(), this._rule.formula2 = end.toLocaleDateString(), this._rule.operator = DataValidationOperator.BETWEEN, this;
147
+ requireDateBetween(e, t) {
148
+ return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = t.toLocaleDateString(), this._rule.operator = h.BETWEEN, this;
150
149
  }
151
150
  /**
152
151
  * Set the data validation type to DATE and configure the validation rules to be equal to a specific date
@@ -158,8 +157,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
158
157
  * const rule = builder.requireDateEqualTo(new Date('2024-01-01')).build();
159
158
  * ```
160
159
  */
161
- requireDateEqualTo(date) {
162
- return this._rule.type = DataValidationType.DATE, this._rule.formula1 = date.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = DataValidationOperator.EQUAL, this;
160
+ requireDateEqualTo(e) {
161
+ return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = h.EQUAL, this;
163
162
  }
164
163
  /**
165
164
  * Set the data validation type to DATE and configure the validation rules to be not within a specific date range
@@ -174,8 +173,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
174
173
  * .build();
175
174
  * ```
176
175
  */
177
- requireDateNotBetween(start, end) {
178
- return this._rule.type = DataValidationType.DATE, this._rule.formula1 = start.toLocaleDateString(), this._rule.formula2 = end.toLocaleDateString(), this._rule.operator = DataValidationOperator.NOT_BETWEEN, this;
176
+ requireDateNotBetween(e, t) {
177
+ return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = t.toLocaleDateString(), this._rule.operator = h.NOT_BETWEEN, this;
179
178
  }
180
179
  /**
181
180
  * Set the data validation type to DATE and configure the validation rules to be on or after a specific date
@@ -187,8 +186,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
187
186
  * const rule = builder.requireDateOnOrAfter(new Date('2024-01-01')).build();
188
187
  * ```
189
188
  */
190
- requireDateOnOrAfter(date) {
191
- return this._rule.type = DataValidationType.DATE, this._rule.formula1 = date.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = DataValidationOperator.GREATER_THAN_OR_EQUAL, this;
189
+ requireDateOnOrAfter(e) {
190
+ return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = h.GREATER_THAN_OR_EQUAL, this;
192
191
  }
193
192
  /**
194
193
  * Set the data validation type to DATE and configure the validation rules to be on or before a specific date
@@ -200,8 +199,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
200
199
  * const rule = builder.requireDateOnOrBefore(new Date('2024-12-31')).build();
201
200
  * ```
202
201
  */
203
- requireDateOnOrBefore(date) {
204
- return this._rule.type = DataValidationType.DATE, this._rule.formula1 = date.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = DataValidationOperator.LESS_THAN_OR_EQUAL, this;
202
+ requireDateOnOrBefore(e) {
203
+ return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = h.LESS_THAN_OR_EQUAL, this;
205
204
  }
206
205
  /**
207
206
  * Requires that a custom formula be satisfied
@@ -213,8 +212,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
213
212
  * const rule = builder.requireFormulaSatisfied('=A1>0').build();
214
213
  * ```
215
214
  */
216
- requireFormulaSatisfied(formula) {
217
- return this._rule.type = DataValidationType.CUSTOM, this._rule.formula1 = formula, this._rule.formula2 = void 0, this;
215
+ requireFormulaSatisfied(e) {
216
+ return this._rule.type = o.CUSTOM, this._rule.formula1 = e, this._rule.formula2 = void 0, this;
218
217
  }
219
218
  /**
220
219
  * Requires the user to enter a number within a specific range, which can be integer or decimal
@@ -228,8 +227,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
228
227
  * const rule = builder.requireNumberBetween(1, 10).build();
229
228
  * ```
230
229
  */
231
- requireNumberBetween(start, end, isInteger) {
232
- return this._rule.formula1 = `${start}`, this._rule.formula2 = `${end}`, this._rule.operator = DataValidationOperator.BETWEEN, this._rule.type = isInteger ? DataValidationType.WHOLE : DataValidationType.DECIMAL, this;
230
+ requireNumberBetween(e, t, r) {
231
+ return this._rule.formula1 = `${e}`, this._rule.formula2 = `${t}`, this._rule.operator = h.BETWEEN, this._rule.type = r ? o.WHOLE : o.DECIMAL, this;
233
232
  }
234
233
  /**
235
234
  * Requires the user to enter a number that is equal to a specific value, which can be an integer or a decimal
@@ -242,8 +241,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
242
241
  * const rule = builder.requireNumberEqualTo(10).build();
243
242
  * ```
244
243
  */
245
- requireNumberEqualTo(num, isInteger) {
246
- return this._rule.formula1 = `${num}`, this._rule.formula2 = void 0, this._rule.operator = DataValidationOperator.EQUAL, this._rule.type = isInteger ? DataValidationType.WHOLE : DataValidationType.DECIMAL, this;
244
+ requireNumberEqualTo(e, t) {
245
+ return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.EQUAL, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
247
246
  }
248
247
  /**
249
248
  * Requires the user to enter a number that is greater than a specific value, which can be an integer or a decimal
@@ -256,8 +255,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
256
255
  * const rule = builder.requireNumberGreaterThan(10).build();
257
256
  * ```
258
257
  */
259
- requireNumberGreaterThan(num, isInteger) {
260
- return this._rule.formula1 = `${num}`, this._rule.formula2 = void 0, this._rule.operator = DataValidationOperator.GREATER_THAN, this._rule.type = isInteger ? DataValidationType.WHOLE : DataValidationType.DECIMAL, this;
258
+ requireNumberGreaterThan(e, t) {
259
+ return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.GREATER_THAN, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
261
260
  }
262
261
  /**
263
262
  * 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
@@ -270,8 +269,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
270
269
  * const rule = builder.requireNumberGreaterThanOrEqualTo(10).build();
271
270
  * ```
272
271
  */
273
- requireNumberGreaterThanOrEqualTo(num, isInteger) {
274
- return this._rule.formula1 = `${num}`, this._rule.formula2 = void 0, this._rule.operator = DataValidationOperator.GREATER_THAN_OR_EQUAL, this._rule.type = isInteger ? DataValidationType.WHOLE : DataValidationType.DECIMAL, this;
272
+ requireNumberGreaterThanOrEqualTo(e, t) {
273
+ return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.GREATER_THAN_OR_EQUAL, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
275
274
  }
276
275
  /**
277
276
  * Requires the user to enter a number that is less than a specific value, which can be an integer or a decimal
@@ -284,8 +283,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
284
283
  * const rule = builder.requireNumberLessThan(10).build();
285
284
  * ```
286
285
  */
287
- requireNumberLessThan(num, isInteger) {
288
- return this._rule.formula1 = `${num}`, this._rule.formula2 = void 0, this._rule.operator = DataValidationOperator.LESS_THAN, this._rule.type = isInteger ? DataValidationType.WHOLE : DataValidationType.DECIMAL, this;
286
+ requireNumberLessThan(e, t) {
287
+ return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.LESS_THAN, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
289
288
  }
290
289
  /**
291
290
  * Sets the data validation rule to require a number less than or equal to a specified value
@@ -299,8 +298,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
299
298
  * const rule = builder.requireNumberLessThanOrEqualTo(10).build();
300
299
  * ```
301
300
  */
302
- requireNumberLessThanOrEqualTo(num, isInteger) {
303
- return this._rule.formula1 = `${num}`, this._rule.formula2 = void 0, this._rule.operator = DataValidationOperator.LESS_THAN_OR_EQUAL, this._rule.type = isInteger ? DataValidationType.WHOLE : DataValidationType.DECIMAL, this;
301
+ requireNumberLessThanOrEqualTo(e, t) {
302
+ return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.LESS_THAN_OR_EQUAL, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
304
303
  }
305
304
  /**
306
305
  * Sets a data validation rule that requires the user to enter a number outside a specified range
@@ -315,8 +314,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
315
314
  * const rule = builder.requireNumberNotBetween(1, 10).build();
316
315
  * ```
317
316
  */
318
- requireNumberNotBetween(start, end, isInteger) {
319
- return this._rule.formula1 = `${start}`, this._rule.formula2 = `${end}`, this._rule.operator = DataValidationOperator.NOT_BETWEEN, this._rule.type = isInteger ? DataValidationType.WHOLE : DataValidationType.DECIMAL, this;
317
+ requireNumberNotBetween(e, t, r) {
318
+ return this._rule.formula1 = `${e}`, this._rule.formula2 = `${t}`, this._rule.operator = h.NOT_BETWEEN, this._rule.type = r ? o.WHOLE : o.DECIMAL, this;
320
319
  }
321
320
  /**
322
321
  * Creates a data validation rule that requires the user to enter a number that is not equal to a specific value
@@ -330,8 +329,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
330
329
  * const rule = builder.requireNumberNotEqualTo(10).build();
331
330
  * ```
332
331
  */
333
- requireNumberNotEqualTo(num, isInteger) {
334
- return this._rule.formula1 = `${num}`, this._rule.formula2 = void 0, this._rule.operator = DataValidationOperator.NOT_EQUAL, this._rule.type = isInteger ? DataValidationType.WHOLE : DataValidationType.DECIMAL, this;
332
+ requireNumberNotEqualTo(e, t) {
333
+ return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.NOT_EQUAL, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
335
334
  }
336
335
  /**
337
336
  * Sets a data validation rule that requires the user to enter a value from a list of specific values
@@ -346,8 +345,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
346
345
  * const rule = builder.requireValueInList(['Yes', 'No']).build();
347
346
  * ```
348
347
  */
349
- requireValueInList(values, multiple, showDropdown) {
350
- return this._rule.type = multiple ? DataValidationType.LIST_MULTIPLE : DataValidationType.LIST, this._rule.formula1 = values.join(","), this._rule.formula2 = void 0, this._rule.showDropDown = showDropdown != null ? showDropdown : !0, this;
348
+ requireValueInList(e, t, r) {
349
+ 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;
351
350
  }
352
351
  /**
353
352
  * Sets a data validation rule that requires the user to enter a value within a specific range
@@ -363,12 +362,12 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
363
362
  * const rule = builder.requireValueInRange(range).build();
364
363
  * ```
365
364
  */
366
- requireValueInRange(range, multiple, showDropdown) {
367
- return this._rule.type = multiple ? DataValidationType.LIST_MULTIPLE : DataValidationType.LIST, this._rule.formula1 = `=${serializeRangeToRefString({
368
- unitId: range.getUnitId(),
369
- sheetName: range.getSheetName(),
370
- range: range.getRange()
371
- })}`, this._rule.formula2 = void 0, this._rule.showDropDown = showDropdown != null ? showDropdown : !0, this;
365
+ requireValueInRange(e, t, r) {
366
+ return this._rule.type = t ? o.LIST_MULTIPLE : o.LIST, this._rule.formula1 = `=${P({
367
+ unitId: e.getUnitId(),
368
+ sheetName: e.getSheetName(),
369
+ range: e.getRange()
370
+ })}`, this._rule.formula2 = void 0, this._rule.showDropDown = r != null ? r : !0, this;
372
371
  }
373
372
  /**
374
373
  * Sets whether to allow invalid data and configures the error style
@@ -382,8 +381,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
382
381
  * const rule = builder.setAllowInvalid(true).build();
383
382
  * ```
384
383
  */
385
- setAllowInvalid(allowInvalidData) {
386
- return this._rule.errorStyle = allowInvalidData ? DataValidationErrorStyle.WARNING : DataValidationErrorStyle.STOP, this;
384
+ setAllowInvalid(e) {
385
+ return this._rule.errorStyle = e ? w.WARNING : w.STOP, this;
387
386
  }
388
387
  /**
389
388
  * Sets whether to allow blank values
@@ -395,8 +394,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
395
394
  * const rule = builder.setAllowBlank(true).build();
396
395
  * ```
397
396
  */
398
- setAllowBlank(allowBlank) {
399
- return this._rule.allowBlank = allowBlank, this;
397
+ setAllowBlank(e) {
398
+ return this._rule.allowBlank = e, this;
400
399
  }
401
400
  /**
402
401
  * Sets the options for the data validation rule
@@ -412,18 +411,16 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
412
411
  * }).build();
413
412
  * ```
414
413
  */
415
- setOptions(options) {
416
- return Object.assign(this._rule, options), this;
414
+ setOptions(e) {
415
+ return Object.assign(this._rule, e), this;
417
416
  }
418
- };
419
- __name(_FDataValidationBuilder, "FDataValidationBuilder");
420
- let FDataValidationBuilder = _FDataValidationBuilder;
421
- const _FDataValidation = class _FDataValidation {
422
- constructor(rule, worksheet, _injector) {
423
- __publicField(this, "rule");
424
- __publicField(this, "_worksheet");
425
- __publicField(this, "_injector");
426
- this._injector = _injector, this.rule = rule, this._worksheet = worksheet;
417
+ }
418
+ class m {
419
+ constructor(e, t, r) {
420
+ f(this, "rule");
421
+ f(this, "_worksheet");
422
+ f(this, "_injector");
423
+ this._injector = r, this.rule = e, this._worksheet = t;
427
424
  }
428
425
  /**
429
426
  * Gets whether invalid data is allowed based on the error style value
@@ -439,7 +436,7 @@ const _FDataValidation = class _FDataValidation {
439
436
  * ```
440
437
  */
441
438
  getAllowInvalid() {
442
- return this.rule.errorStyle !== DataValidationErrorStyle.STOP;
439
+ return this.rule.errorStyle !== w.STOP;
443
440
  }
444
441
  /**
445
442
  * Gets the data validation type of the rule
@@ -504,7 +501,7 @@ const _FDataValidation = class _FDataValidation {
504
501
  * ```
505
502
  */
506
503
  copy() {
507
- return new FDataValidationBuilder(this.rule);
504
+ return new D(this.rule);
508
505
  }
509
506
  /**
510
507
  * Gets whether the data validation rule is applied to the worksheet
@@ -522,8 +519,8 @@ const _FDataValidation = class _FDataValidation {
522
519
  getApplied() {
523
520
  if (!this._worksheet)
524
521
  return !1;
525
- const currentRule = this._injector.get(DataValidationModel).getRuleById(this._worksheet.getUnitId(), this._worksheet.getSheetId(), this.rule.uid);
526
- return !!(currentRule && currentRule.ranges.length);
522
+ const t = this._injector.get(b).getRuleById(this._worksheet.getUnitId(), this._worksheet.getSheetId(), this.rule.uid);
523
+ return !!(t && t.ranges.length);
527
524
  }
528
525
  /**
529
526
  * Gets the ranges to which the data validation rule is applied
@@ -541,8 +538,8 @@ const _FDataValidation = class _FDataValidation {
541
538
  getRanges() {
542
539
  if (!this.getApplied())
543
540
  return [];
544
- const workbook = this._injector.get(IUniverInstanceService).getUnit(this._worksheet.getUnitId());
545
- return this.rule.ranges.map((range) => this._injector.createInstance(FRange, workbook, this._worksheet, range));
541
+ const e = this._injector.get(H).getUnit(this._worksheet.getUnitId());
542
+ return this.rule.ranges.map((t) => this._injector.createInstance(y, e, this._worksheet, t));
546
543
  }
547
544
  /**
548
545
  * Gets the unit ID of the worksheet
@@ -558,8 +555,8 @@ const _FDataValidation = class _FDataValidation {
558
555
  * ```
559
556
  */
560
557
  getUnitId() {
561
- var _a;
562
- return (_a = this._worksheet) == null ? void 0 : _a.getUnitId();
558
+ var e;
559
+ return (e = this._worksheet) == null ? void 0 : e.getUnitId();
563
560
  }
564
561
  /**
565
562
  * Gets the sheet ID of the worksheet
@@ -575,8 +572,8 @@ const _FDataValidation = class _FDataValidation {
575
572
  * ```
576
573
  */
577
574
  getSheetId() {
578
- var _a;
579
- return (_a = this._worksheet) == null ? void 0 : _a.getSheetId();
575
+ var e;
576
+ return (e = this._worksheet) == null ? void 0 : e.getSheetId();
580
577
  }
581
578
  /**
582
579
  * Set Criteria for the data validation rule
@@ -598,21 +595,21 @@ const _FDataValidation = class _FDataValidation {
598
595
  * );
599
596
  * ```
600
597
  */
601
- setCriteria(type, values, allowBlank = !0) {
602
- if (this.getApplied() && !this._injector.get(ICommandService).syncExecuteCommand(UpdateSheetDataValidationSettingCommand.id, {
598
+ setCriteria(e, t, r = !0) {
599
+ if (this.getApplied() && !this._injector.get(p).syncExecuteCommand(U.id, {
603
600
  unitId: this.getUnitId(),
604
601
  subUnitId: this.getSheetId(),
605
602
  ruleId: this.rule.uid,
606
603
  setting: {
607
- operator: values[0],
608
- formula1: values[1],
609
- formula2: values[2],
604
+ operator: t[0],
605
+ formula1: t[1],
606
+ formula2: t[2],
610
607
  type: this.rule.type,
611
- allowBlank
608
+ allowBlank: r
612
609
  }
613
610
  }))
614
611
  throw new Error("setCriteria failed");
615
- return this.rule.operator = values[0], this.rule.formula1 = values[1], this.rule.formula2 = values[2], this.rule.type = type, this.rule.allowBlank = allowBlank, this;
612
+ return this.rule.operator = t[0], this.rule.formula1 = t[1], this.rule.formula2 = t[2], this.rule.type = e, this.rule.allowBlank = r, this;
616
613
  }
617
614
  /**
618
615
  * Set the options for the data validation rule
@@ -632,18 +629,18 @@ const _FDataValidation = class _FDataValidation {
632
629
  * });
633
630
  * ```
634
631
  */
635
- setOptions(options) {
636
- if (this.getApplied() && !this._injector.get(ICommandService).syncExecuteCommand(UpdateSheetDataValidationOptionsCommand.id, {
632
+ setOptions(e) {
633
+ if (this.getApplied() && !this._injector.get(p).syncExecuteCommand(v.id, {
637
634
  unitId: this.getUnitId(),
638
635
  subUnitId: this.getSheetId(),
639
636
  ruleId: this.rule.uid,
640
637
  options: {
641
- ...getRuleOptions(this.rule),
642
- ...options
638
+ ...F(this.rule),
639
+ ...e
643
640
  }
644
641
  }))
645
642
  throw new Error("setOptions failed");
646
- return Object.assign(this.rule, options), this;
643
+ return Object.assign(this.rule, e), this;
647
644
  }
648
645
  /**
649
646
  * Set the ranges to the data validation rule
@@ -660,15 +657,15 @@ const _FDataValidation = class _FDataValidation {
660
657
  * dataValidation.setRanges([range]);
661
658
  * ```
662
659
  */
663
- setRanges(ranges) {
664
- if (this.getApplied() && !this._injector.get(ICommandService).syncExecuteCommand(UpdateSheetDataValidationRangeCommand.id, {
660
+ setRanges(e) {
661
+ if (this.getApplied() && !this._injector.get(p).syncExecuteCommand(C.id, {
665
662
  unitId: this.getUnitId(),
666
663
  subUnitId: this.getSheetId(),
667
664
  ruleId: this.rule.uid,
668
- ranges: ranges.map((range) => range.getRange())
665
+ ranges: e.map((a) => a.getRange())
669
666
  }))
670
667
  throw new Error("setRanges failed");
671
- return this.rule.ranges = ranges.map((range) => range.getRange()), this;
668
+ return this.rule.ranges = e.map((t) => t.getRange()), this;
672
669
  }
673
670
  /**
674
671
  * Delete the data validation rule from the worksheet
@@ -684,303 +681,295 @@ const _FDataValidation = class _FDataValidation {
684
681
  * ```
685
682
  */
686
683
  delete() {
687
- return this.getApplied() ? this._injector.get(ICommandService).syncExecuteCommand(RemoveSheetDataValidationCommand.id, {
684
+ return this.getApplied() ? this._injector.get(p).syncExecuteCommand(T.id, {
688
685
  unitId: this.getUnitId(),
689
686
  subUnitId: this.getSheetId(),
690
687
  ruleId: this.rule.uid
691
688
  }) : !1;
692
689
  }
693
- };
694
- __name(_FDataValidation, "FDataValidation");
695
- let FDataValidation = _FDataValidation;
696
- const _FRangeDataValidationMixin = class _FRangeDataValidationMixin extends FRange {
697
- setDataValidation(rule) {
698
- if (!rule)
699
- return this._commandService.syncExecuteCommand(ClearRangeDataValidationCommand.id, {
690
+ }
691
+ class G extends y {
692
+ setDataValidation(e) {
693
+ if (!e)
694
+ return this._commandService.syncExecuteCommand(W.id, {
700
695
  unitId: this._workbook.getUnitId(),
701
696
  subUnitId: this._worksheet.getSheetId(),
702
697
  ranges: [this._range]
703
698
  }), this;
704
- const params = {
699
+ const t = {
705
700
  unitId: this._workbook.getUnitId(),
706
701
  subUnitId: this._worksheet.getSheetId(),
707
702
  rule: {
708
- ...rule.rule,
703
+ ...e.rule,
709
704
  ranges: [this._range]
710
705
  }
711
706
  };
712
- return this._commandService.syncExecuteCommand(AddSheetDataValidationCommand.id, params), this;
707
+ return this._commandService.syncExecuteCommand(A.id, t), this;
713
708
  }
714
709
  getDataValidation() {
715
- const rule = this._injector.get(SheetsDataValidationValidatorService).getDataValidation(
710
+ const t = this._injector.get(S).getDataValidation(
716
711
  this._workbook.getUnitId(),
717
712
  this._worksheet.getSheetId(),
718
713
  [this._range]
719
714
  );
720
- return rule && new FDataValidation(rule, this._worksheet, this._injector);
715
+ return t && new m(t, this._worksheet, this._injector);
721
716
  }
722
717
  getDataValidations() {
723
- return this._injector.get(SheetsDataValidationValidatorService).getDataValidations(
718
+ return this._injector.get(S).getDataValidations(
724
719
  this._workbook.getUnitId(),
725
720
  this._worksheet.getSheetId(),
726
721
  [this._range]
727
- ).map((rule) => new FDataValidation(rule, this._worksheet, this._injector));
722
+ ).map((t) => new m(t, this._worksheet, this._injector));
728
723
  }
729
724
  async getValidatorStatus() {
730
- return this._injector.get(SheetsDataValidationValidatorService).validatorRanges(
725
+ return this._injector.get(S).validatorRanges(
731
726
  this._workbook.getUnitId(),
732
727
  this._worksheet.getSheetId(),
733
728
  [this._range]
734
729
  );
735
730
  }
736
- };
737
- __name(_FRangeDataValidationMixin, "FRangeDataValidationMixin");
738
- let FRangeDataValidationMixin = _FRangeDataValidationMixin;
739
- FRange.extend(FRangeDataValidationMixin);
740
- const _FUnvierDataValidationMixin = class _FUnvierDataValidationMixin extends FUniver {
731
+ }
732
+ y.extend(G);
733
+ class Q extends x {
741
734
  /**
742
735
  * @deprecated use `univerAPI.newDataValidation()` as instead.
743
736
  * @returns {FDataValidationBuilder} A new instance of the FDataValidationBuilder class
744
737
  */
745
738
  static newDataValidation() {
746
- return new FDataValidationBuilder();
739
+ return new D();
747
740
  }
748
741
  newDataValidation() {
749
- return new FDataValidationBuilder();
742
+ return new D();
750
743
  }
751
744
  /**
752
745
  * @ignore
753
746
  */
754
747
  // eslint-disable-next-line max-lines-per-function
755
- _initialize(injector) {
756
- if (!injector.has(SheetDataValidationModel)) return;
757
- const sheetDataValidationModel = injector.get(SheetDataValidationModel), commadnService = injector.get(ICommandService);
758
- this.disposeWithMe(sheetDataValidationModel.ruleChange$.subscribe((ruleChange) => {
759
- const { unitId, subUnitId, rule, oldRule, type } = ruleChange, target = this.getSheetTarget(unitId, subUnitId);
760
- if (!target)
748
+ _initialize(e) {
749
+ if (!e.has(V)) return;
750
+ const t = e.get(V), r = e.get(p);
751
+ this.disposeWithMe(t.ruleChange$.subscribe((a) => {
752
+ const { unitId: i, subUnitId: n, rule: d, oldRule: u, type: s } = a, l = this.getSheetTarget(i, n);
753
+ if (!l)
761
754
  return;
762
- const { workbook, worksheet } = target, fRule = new FDataValidation(rule, worksheet.getSheet(), this._injector);
755
+ const { workbook: I, worksheet: k } = l, E = new m(d, k.getSheet(), this._injector);
763
756
  this.fireEvent(this.Event.SheetDataValidationChanged, {
764
- origin: ruleChange,
765
- worksheet,
766
- workbook,
767
- changeType: type,
768
- oldRule,
769
- rule: fRule
757
+ origin: a,
758
+ worksheet: k,
759
+ workbook: I,
760
+ changeType: s,
761
+ oldRule: u,
762
+ rule: E
770
763
  });
771
- })), this.disposeWithMe(sheetDataValidationModel.validStatusChange$.subscribe((statusChange) => {
772
- const { unitId, subUnitId, ruleId, status, row, col } = statusChange, target = this.getSheetTarget(unitId, subUnitId);
773
- if (!target)
764
+ })), this.disposeWithMe(t.validStatusChange$.subscribe((a) => {
765
+ const { unitId: i, subUnitId: n, ruleId: d, status: u, row: s, col: l } = a, I = this.getSheetTarget(i, n);
766
+ if (!I)
774
767
  return;
775
- const { workbook, worksheet } = target, rule = worksheet.getDataValidation(ruleId);
776
- rule && this.fireEvent(this.Event.SheetDataValidatorStatusChanged, {
777
- workbook,
778
- worksheet,
779
- row,
780
- column: col,
781
- rule,
782
- status
768
+ const { workbook: k, worksheet: E } = I, L = E.getDataValidation(d);
769
+ L && this.fireEvent(this.Event.SheetDataValidatorStatusChanged, {
770
+ workbook: k,
771
+ worksheet: E,
772
+ row: s,
773
+ column: l,
774
+ rule: L,
775
+ status: u
783
776
  });
784
- })), this.disposeWithMe(commadnService.beforeCommandExecuted((commandInfo) => {
785
- switch (commandInfo.id) {
786
- case AddSheetDataValidationCommand.id: {
787
- const params = commandInfo.params, target = this.getSheetTarget(params.unitId, params.subUnitId);
788
- if (!target)
777
+ })), this.disposeWithMe(r.beforeCommandExecuted((a) => {
778
+ switch (a.id) {
779
+ case A.id: {
780
+ const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
781
+ if (!n)
789
782
  return;
790
- const { workbook, worksheet } = target, eventParams = {
791
- worksheet,
792
- workbook,
793
- rule: params.rule
783
+ const { workbook: d, worksheet: u } = n, s = {
784
+ worksheet: u,
785
+ workbook: d,
786
+ rule: i.rule
794
787
  };
795
- if (this.fireEvent(this.Event.BeforeSheetDataValidationAdd, eventParams), eventParams.cancel)
796
- throw new CanceledError();
788
+ if (this.fireEvent(this.Event.BeforeSheetDataValidationAdd, s), s.cancel)
789
+ throw new _();
797
790
  break;
798
791
  }
799
- case UpdateSheetDataValidationSettingCommand.id: {
800
- const params = commandInfo.params, target = this.getSheetTarget(params.unitId, params.subUnitId);
801
- if (!target)
792
+ case U.id: {
793
+ const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
794
+ if (!n)
802
795
  return;
803
- const { workbook, worksheet } = target, rule = worksheet.getDataValidation(params.ruleId);
804
- if (!rule)
796
+ const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
797
+ if (!s)
805
798
  return;
806
- const eventParams = {
807
- worksheet,
808
- workbook,
809
- rule,
810
- ruleId: params.ruleId,
811
- newCriteria: params.setting
799
+ const l = {
800
+ worksheet: u,
801
+ workbook: d,
802
+ rule: s,
803
+ ruleId: i.ruleId,
804
+ newCriteria: i.setting
812
805
  };
813
- if (this.fireEvent(this.Event.BeforeSheetDataValidationCriteriaUpdate, eventParams), eventParams.cancel)
814
- throw new CanceledError();
806
+ if (this.fireEvent(this.Event.BeforeSheetDataValidationCriteriaUpdate, l), l.cancel)
807
+ throw new _();
815
808
  break;
816
809
  }
817
- case UpdateSheetDataValidationRangeCommand.id: {
818
- const params = commandInfo.params, target = this.getSheetTarget(params.unitId, params.subUnitId);
819
- if (!target)
810
+ case C.id: {
811
+ const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
812
+ if (!n)
820
813
  return;
821
- const { workbook, worksheet } = target, rule = worksheet.getDataValidation(params.ruleId);
822
- if (!rule)
814
+ const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
815
+ if (!s)
823
816
  return;
824
- const eventParams = {
825
- worksheet,
826
- workbook,
827
- rule,
828
- ruleId: params.ruleId,
829
- newRanges: params.ranges
817
+ const l = {
818
+ worksheet: u,
819
+ workbook: d,
820
+ rule: s,
821
+ ruleId: i.ruleId,
822
+ newRanges: i.ranges
830
823
  };
831
- if (this.fireEvent(this.Event.BeforeSheetDataValidationRangeUpdate, eventParams), eventParams.cancel)
832
- throw new CanceledError();
824
+ if (this.fireEvent(this.Event.BeforeSheetDataValidationRangeUpdate, l), l.cancel)
825
+ throw new _();
833
826
  break;
834
827
  }
835
- case UpdateSheetDataValidationOptionsCommand.id: {
836
- const params = commandInfo.params, target = this.getSheetTarget(params.unitId, params.subUnitId);
837
- if (!target)
828
+ case v.id: {
829
+ const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
830
+ if (!n)
838
831
  return;
839
- const { workbook, worksheet } = target, rule = worksheet.getDataValidation(params.ruleId);
840
- if (!rule)
832
+ const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
833
+ if (!s)
841
834
  return;
842
- const eventParams = {
843
- worksheet,
844
- workbook,
845
- rule,
846
- ruleId: params.ruleId,
847
- newOptions: params.options
835
+ const l = {
836
+ worksheet: u,
837
+ workbook: d,
838
+ rule: s,
839
+ ruleId: i.ruleId,
840
+ newOptions: i.options
848
841
  };
849
- if (this.fireEvent(this.Event.BeforeSheetDataValidationOptionsUpdate, eventParams), eventParams.cancel)
850
- throw new CanceledError();
842
+ if (this.fireEvent(this.Event.BeforeSheetDataValidationOptionsUpdate, l), l.cancel)
843
+ throw new _();
851
844
  break;
852
845
  }
853
- case RemoveSheetDataValidationCommand.id: {
854
- const params = commandInfo.params, target = this.getSheetTarget(params.unitId, params.subUnitId);
855
- if (!target)
846
+ case T.id: {
847
+ const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
848
+ if (!n)
856
849
  return;
857
- const { workbook, worksheet } = target, rule = worksheet.getDataValidation(params.ruleId);
858
- if (!rule)
850
+ const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
851
+ if (!s)
859
852
  return;
860
- const eventParams = {
861
- worksheet,
862
- workbook,
863
- rule,
864
- ruleId: params.ruleId
853
+ const l = {
854
+ worksheet: u,
855
+ workbook: d,
856
+ rule: s,
857
+ ruleId: i.ruleId
865
858
  };
866
- if (this.fireEvent(this.Event.BeforeSheetDataValidationDelete, eventParams), eventParams.cancel)
867
- throw new CanceledError();
859
+ if (this.fireEvent(this.Event.BeforeSheetDataValidationDelete, l), l.cancel)
860
+ throw new _();
868
861
  break;
869
862
  }
870
- case RemoveSheetAllDataValidationCommand.id: {
871
- const params = commandInfo.params, target = this.getSheetTarget(params.unitId, params.subUnitId);
872
- if (!target)
863
+ case O.id: {
864
+ const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
865
+ if (!n)
873
866
  return;
874
- const { workbook, worksheet } = target, eventParams = {
875
- worksheet,
876
- workbook,
877
- rules: worksheet.getDataValidations()
867
+ const { workbook: d, worksheet: u } = n, s = {
868
+ worksheet: u,
869
+ workbook: d,
870
+ rules: u.getDataValidations()
878
871
  };
879
- if (this.fireEvent(this.Event.BeforeSheetDataValidationDeleteAll, eventParams), eventParams.cancel)
880
- throw new CanceledError();
872
+ if (this.fireEvent(this.Event.BeforeSheetDataValidationDeleteAll, s), s.cancel)
873
+ throw new _();
881
874
  break;
882
875
  }
883
876
  }
884
877
  }));
885
878
  }
886
- };
887
- __name(_FUnvierDataValidationMixin, "FUnvierDataValidationMixin");
888
- let FUnvierDataValidationMixin = _FUnvierDataValidationMixin;
889
- FUniver.extend(FUnvierDataValidationMixin);
890
- const _FWorkbookDataValidationMixin = class _FWorkbookDataValidationMixin extends FWorkbook {
879
+ }
880
+ x.extend(Q);
881
+ class z extends M {
891
882
  _initialize() {
892
883
  Object.defineProperty(this, "_dataValidationModel", {
893
884
  get() {
894
- return this._injector.get(SheetDataValidationModel);
885
+ return this._injector.get(V);
895
886
  }
896
887
  });
897
888
  }
898
889
  getValidatorStatus() {
899
- return this._injector.get(SheetsDataValidationValidatorService).validatorWorkbook(this._workbook.getUnitId());
890
+ return this._injector.get(S).validatorWorkbook(this._workbook.getUnitId());
900
891
  }
901
892
  // region DataValidationHooks
902
- onDataValidationChange(callback) {
903
- return toDisposable(this._dataValidationModel.ruleChange$.pipe(filter((change) => change.unitId === this._workbook.getUnitId())).subscribe(callback));
893
+ onDataValidationChange(e) {
894
+ return g(this._dataValidationModel.ruleChange$.pipe(R((t) => t.unitId === this._workbook.getUnitId())).subscribe(e));
904
895
  }
905
- onDataValidationStatusChange(callback) {
906
- return toDisposable(this._dataValidationModel.validStatusChange$.pipe(filter((change) => change.unitId === this._workbook.getUnitId())).subscribe(callback));
896
+ onDataValidationStatusChange(e) {
897
+ return g(this._dataValidationModel.validStatusChange$.pipe(R((t) => t.unitId === this._workbook.getUnitId())).subscribe(e));
907
898
  }
908
- onBeforeAddDataValidation(callback) {
909
- return toDisposable(this._commandService.beforeCommandExecuted((commandInfo, options) => {
910
- const params = commandInfo.params;
911
- if (commandInfo.id === AddSheetDataValidationCommand.id) {
912
- if (params.unitId !== this._workbook.getUnitId())
899
+ onBeforeAddDataValidation(e) {
900
+ return g(this._commandService.beforeCommandExecuted((t, r) => {
901
+ const a = t.params;
902
+ if (t.id === A.id) {
903
+ if (a.unitId !== this._workbook.getUnitId())
913
904
  return;
914
- if (callback(params, options) === !1)
905
+ if (e(a, r) === !1)
915
906
  throw new Error("Command is stopped by the hook onBeforeAddDataValidation");
916
907
  }
917
908
  }));
918
909
  }
919
- onBeforeUpdateDataValidationCriteria(callback) {
920
- return toDisposable(this._commandService.beforeCommandExecuted((commandInfo, options) => {
921
- const params = commandInfo.params;
922
- if (commandInfo.id === UpdateSheetDataValidationSettingCommand.id) {
923
- if (params.unitId !== this._workbook.getUnitId())
910
+ onBeforeUpdateDataValidationCriteria(e) {
911
+ return g(this._commandService.beforeCommandExecuted((t, r) => {
912
+ const a = t.params;
913
+ if (t.id === U.id) {
914
+ if (a.unitId !== this._workbook.getUnitId())
924
915
  return;
925
- if (callback(params, options) === !1)
916
+ if (e(a, r) === !1)
926
917
  throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationCriteria");
927
918
  }
928
919
  }));
929
920
  }
930
- onBeforeUpdateDataValidationRange(callback) {
931
- return toDisposable(this._commandService.beforeCommandExecuted((commandInfo, options) => {
932
- const params = commandInfo.params;
933
- if (commandInfo.id === UpdateSheetDataValidationRangeCommand.id) {
934
- if (params.unitId !== this._workbook.getUnitId())
921
+ onBeforeUpdateDataValidationRange(e) {
922
+ return g(this._commandService.beforeCommandExecuted((t, r) => {
923
+ const a = t.params;
924
+ if (t.id === C.id) {
925
+ if (a.unitId !== this._workbook.getUnitId())
935
926
  return;
936
- if (callback(params, options) === !1)
927
+ if (e(a, r) === !1)
937
928
  throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationRange");
938
929
  }
939
930
  }));
940
931
  }
941
- onBeforeUpdateDataValidationOptions(callback) {
942
- return toDisposable(this._commandService.beforeCommandExecuted((commandInfo, options) => {
943
- const params = commandInfo.params;
944
- if (commandInfo.id === UpdateSheetDataValidationOptionsCommand.id) {
945
- if (params.unitId !== this._workbook.getUnitId())
932
+ onBeforeUpdateDataValidationOptions(e) {
933
+ return g(this._commandService.beforeCommandExecuted((t, r) => {
934
+ const a = t.params;
935
+ if (t.id === v.id) {
936
+ if (a.unitId !== this._workbook.getUnitId())
946
937
  return;
947
- if (callback(params, options) === !1)
938
+ if (e(a, r) === !1)
948
939
  throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationOptions");
949
940
  }
950
941
  }));
951
942
  }
952
- onBeforeDeleteDataValidation(callback) {
953
- return toDisposable(this._commandService.beforeCommandExecuted((commandInfo, options) => {
954
- const params = commandInfo.params;
955
- if (commandInfo.id === RemoveSheetDataValidationCommand.id) {
956
- if (params.unitId !== this._workbook.getUnitId())
943
+ onBeforeDeleteDataValidation(e) {
944
+ return g(this._commandService.beforeCommandExecuted((t, r) => {
945
+ const a = t.params;
946
+ if (t.id === T.id) {
947
+ if (a.unitId !== this._workbook.getUnitId())
957
948
  return;
958
- if (callback(params, options) === !1)
949
+ if (e(a, r) === !1)
959
950
  throw new Error("Command is stopped by the hook onBeforeDeleteDataValidation");
960
951
  }
961
952
  }));
962
953
  }
963
- onBeforeDeleteAllDataValidation(callback) {
964
- return toDisposable(this._commandService.beforeCommandExecuted((commandInfo, options) => {
965
- const params = commandInfo.params;
966
- if (commandInfo.id === RemoveSheetAllDataValidationCommand.id) {
967
- if (params.unitId !== this._workbook.getUnitId())
954
+ onBeforeDeleteAllDataValidation(e) {
955
+ return g(this._commandService.beforeCommandExecuted((t, r) => {
956
+ const a = t.params;
957
+ if (t.id === O.id) {
958
+ if (a.unitId !== this._workbook.getUnitId())
968
959
  return;
969
- if (callback(params, options) === !1)
960
+ if (e(a, r) === !1)
970
961
  throw new Error("Command is stopped by the hook onBeforeDeleteAllDataValidation");
971
962
  }
972
963
  }));
973
964
  }
974
- };
975
- __name(_FWorkbookDataValidationMixin, "FWorkbookDataValidationMixin");
976
- let FWorkbookDataValidationMixin = _FWorkbookDataValidationMixin;
977
- FWorkbook.extend(FWorkbookDataValidationMixin);
978
- const _FWorksheetDataValidationMixin = class _FWorksheetDataValidationMixin extends FWorksheet {
965
+ }
966
+ M.extend(z);
967
+ class K extends N {
979
968
  getDataValidations() {
980
- return this._injector.get(DataValidationModel).getRules(this._workbook.getUnitId(), this._worksheet.getSheetId()).map((rule) => new FDataValidation(rule, this._worksheet, this._injector));
969
+ return this._injector.get(b).getRules(this._workbook.getUnitId(), this._worksheet.getSheetId()).map((t) => new m(t, this._worksheet, this._injector));
981
970
  }
982
971
  getValidatorStatus() {
983
- return this._injector.get(SheetsDataValidationValidatorService).validatorWorksheet(
972
+ return this._injector.get(S).validatorWorksheet(
984
973
  this._workbook.getUnitId(),
985
974
  this._worksheet.getSheetId()
986
975
  );
@@ -988,15 +977,13 @@ const _FWorksheetDataValidationMixin = class _FWorksheetDataValidationMixin exte
988
977
  getValidatorStatusAsync() {
989
978
  return this.getValidatorStatus();
990
979
  }
991
- getDataValidation(ruleId) {
992
- const rule = this._injector.get(DataValidationModel).getRuleById(this._workbook.getUnitId(), this._worksheet.getSheetId(), ruleId);
993
- return rule ? new FDataValidation(rule, this._worksheet, this._injector) : null;
980
+ getDataValidation(e) {
981
+ const r = this._injector.get(b).getRuleById(this._workbook.getUnitId(), this._worksheet.getSheetId(), e);
982
+ return r ? new m(r, this._worksheet, this._injector) : null;
994
983
  }
995
- };
996
- __name(_FWorksheetDataValidationMixin, "FWorksheetDataValidationMixin");
997
- let FWorksheetDataValidationMixin = _FWorksheetDataValidationMixin;
998
- FWorksheet.extend(FWorksheetDataValidationMixin);
999
- const _FDataValidationEvent = class _FDataValidationEvent {
984
+ }
985
+ N.extend(K);
986
+ class X {
1000
987
  get SheetDataValidationChanged() {
1001
988
  return "SheetDataValidationChanged";
1002
989
  }
@@ -1021,11 +1008,9 @@ const _FDataValidationEvent = class _FDataValidationEvent {
1021
1008
  get BeforeSheetDataValidationOptionsUpdate() {
1022
1009
  return "BeforeSheetDataValidationOptionsUpdate";
1023
1010
  }
1024
- };
1025
- __name(_FDataValidationEvent, "FDataValidationEvent");
1026
- let FDataValidationEvent = _FDataValidationEvent;
1027
- FEventName.extend(FDataValidationEvent);
1011
+ }
1012
+ $.extend(X);
1028
1013
  export {
1029
- FDataValidation,
1030
- FDataValidationBuilder
1014
+ m as FDataValidation,
1015
+ D as FDataValidationBuilder
1031
1016
  };