@univerjs/sheets-data-validation 0.5.5-experimental.20250122-3362a4a → 0.5.5-nightly.202501201606

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,67 +681,63 @@ 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
  // eslint-disable-next-line jsdoc/require-returns
742
735
  /**
743
736
  /**
744
737
  * @deprecated use `univerAPI.newDataValidation()` as instead.
745
738
  */
746
739
  static newDataValidation() {
747
- return new FDataValidationBuilder();
740
+ return new D();
748
741
  }
749
742
  /**
750
743
  * Creates a new instance of FDataValidationBuilder
@@ -756,241 +749,234 @@ const _FUnvierDataValidationMixin = class _FUnvierDataValidationMixin extends FU
756
749
  * ```
757
750
  */
758
751
  newDataValidation() {
759
- return new FDataValidationBuilder();
752
+ return new D();
760
753
  }
761
- /**
762
- * @ignore
763
- */
764
754
  // eslint-disable-next-line max-lines-per-function
765
- _initialize(injector) {
766
- if (!injector.has(SheetDataValidationModel)) return;
767
- const sheetDataValidationModel = injector.get(SheetDataValidationModel), commadnService = injector.get(ICommandService);
768
- this.disposeWithMe(sheetDataValidationModel.ruleChange$.subscribe((ruleChange) => {
769
- const { unitId, subUnitId, rule, oldRule, type } = ruleChange, target = this.getSheetTarget(unitId, subUnitId);
770
- if (!target)
755
+ _initialize(e) {
756
+ if (!e.has(V)) return;
757
+ const t = e.get(V), r = e.get(p);
758
+ this.disposeWithMe(t.ruleChange$.subscribe((a) => {
759
+ const { unitId: i, subUnitId: n, rule: d, oldRule: u, type: s } = a, l = this.getSheetTarget(i, n);
760
+ if (!l)
771
761
  return;
772
- const { workbook, worksheet } = target, fRule = new FDataValidation(rule, worksheet.getSheet(), this._injector);
762
+ const { workbook: I, worksheet: k } = l, E = new m(d, k.getSheet(), this._injector);
773
763
  this.fireEvent(this.Event.SheetDataValidationChanged, {
774
- origin: ruleChange,
775
- worksheet,
776
- workbook,
777
- changeType: type,
778
- oldRule,
779
- rule: fRule
764
+ origin: a,
765
+ worksheet: k,
766
+ workbook: I,
767
+ changeType: s,
768
+ oldRule: u,
769
+ rule: E
780
770
  });
781
- })), this.disposeWithMe(sheetDataValidationModel.validStatusChange$.subscribe((statusChange) => {
782
- const { unitId, subUnitId, ruleId, status, row, col } = statusChange, target = this.getSheetTarget(unitId, subUnitId);
783
- if (!target)
771
+ })), this.disposeWithMe(t.validStatusChange$.subscribe((a) => {
772
+ const { unitId: i, subUnitId: n, ruleId: d, status: u, row: s, col: l } = a, I = this.getSheetTarget(i, n);
773
+ if (!I)
784
774
  return;
785
- const { workbook, worksheet } = target, rule = worksheet.getDataValidation(ruleId);
786
- rule && this.fireEvent(this.Event.SheetDataValidatorStatusChanged, {
787
- workbook,
788
- worksheet,
789
- row,
790
- column: col,
791
- rule,
792
- status
775
+ const { workbook: k, worksheet: E } = I, L = E.getDataValidation(d);
776
+ L && this.fireEvent(this.Event.SheetDataValidatorStatusChanged, {
777
+ workbook: k,
778
+ worksheet: E,
779
+ row: s,
780
+ column: l,
781
+ rule: L,
782
+ status: u
793
783
  });
794
- })), this.disposeWithMe(commadnService.beforeCommandExecuted((commandInfo) => {
795
- switch (commandInfo.id) {
796
- case AddSheetDataValidationCommand.id: {
797
- const params = commandInfo.params, target = this.getSheetTarget(params.unitId, params.subUnitId);
798
- if (!target)
784
+ })), this.disposeWithMe(r.beforeCommandExecuted((a) => {
785
+ switch (a.id) {
786
+ case A.id: {
787
+ const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
788
+ if (!n)
799
789
  return;
800
- const { workbook, worksheet } = target, eventParams = {
801
- worksheet,
802
- workbook,
803
- rule: params.rule
790
+ const { workbook: d, worksheet: u } = n, s = {
791
+ worksheet: u,
792
+ workbook: d,
793
+ rule: i.rule
804
794
  };
805
- if (this.fireEvent(this.Event.BeforeSheetDataValidationAdd, eventParams), eventParams.cancel)
806
- throw new CanceledError();
795
+ if (this.fireEvent(this.Event.BeforeSheetDataValidationAdd, s), s.cancel)
796
+ throw new _();
807
797
  break;
808
798
  }
809
- case UpdateSheetDataValidationSettingCommand.id: {
810
- const params = commandInfo.params, target = this.getSheetTarget(params.unitId, params.subUnitId);
811
- if (!target)
799
+ case U.id: {
800
+ const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
801
+ if (!n)
812
802
  return;
813
- const { workbook, worksheet } = target, rule = worksheet.getDataValidation(params.ruleId);
814
- if (!rule)
803
+ const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
804
+ if (!s)
815
805
  return;
816
- const eventParams = {
817
- worksheet,
818
- workbook,
819
- rule,
820
- ruleId: params.ruleId,
821
- newCriteria: params.setting
806
+ const l = {
807
+ worksheet: u,
808
+ workbook: d,
809
+ rule: s,
810
+ ruleId: i.ruleId,
811
+ newCriteria: i.setting
822
812
  };
823
- if (this.fireEvent(this.Event.BeforeSheetDataValidationCriteriaUpdate, eventParams), eventParams.cancel)
824
- throw new CanceledError();
813
+ if (this.fireEvent(this.Event.BeforeSheetDataValidationCriteriaUpdate, l), l.cancel)
814
+ throw new _();
825
815
  break;
826
816
  }
827
- case UpdateSheetDataValidationRangeCommand.id: {
828
- const params = commandInfo.params, target = this.getSheetTarget(params.unitId, params.subUnitId);
829
- if (!target)
817
+ case C.id: {
818
+ const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
819
+ if (!n)
830
820
  return;
831
- const { workbook, worksheet } = target, rule = worksheet.getDataValidation(params.ruleId);
832
- if (!rule)
821
+ const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
822
+ if (!s)
833
823
  return;
834
- const eventParams = {
835
- worksheet,
836
- workbook,
837
- rule,
838
- ruleId: params.ruleId,
839
- newRanges: params.ranges
824
+ const l = {
825
+ worksheet: u,
826
+ workbook: d,
827
+ rule: s,
828
+ ruleId: i.ruleId,
829
+ newRanges: i.ranges
840
830
  };
841
- if (this.fireEvent(this.Event.BeforeSheetDataValidationRangeUpdate, eventParams), eventParams.cancel)
842
- throw new CanceledError();
831
+ if (this.fireEvent(this.Event.BeforeSheetDataValidationRangeUpdate, l), l.cancel)
832
+ throw new _();
843
833
  break;
844
834
  }
845
- case UpdateSheetDataValidationOptionsCommand.id: {
846
- const params = commandInfo.params, target = this.getSheetTarget(params.unitId, params.subUnitId);
847
- if (!target)
835
+ case v.id: {
836
+ const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
837
+ if (!n)
848
838
  return;
849
- const { workbook, worksheet } = target, rule = worksheet.getDataValidation(params.ruleId);
850
- if (!rule)
839
+ const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
840
+ if (!s)
851
841
  return;
852
- const eventParams = {
853
- worksheet,
854
- workbook,
855
- rule,
856
- ruleId: params.ruleId,
857
- newOptions: params.options
842
+ const l = {
843
+ worksheet: u,
844
+ workbook: d,
845
+ rule: s,
846
+ ruleId: i.ruleId,
847
+ newOptions: i.options
858
848
  };
859
- if (this.fireEvent(this.Event.BeforeSheetDataValidationOptionsUpdate, eventParams), eventParams.cancel)
860
- throw new CanceledError();
849
+ if (this.fireEvent(this.Event.BeforeSheetDataValidationOptionsUpdate, l), l.cancel)
850
+ throw new _();
861
851
  break;
862
852
  }
863
- case RemoveSheetDataValidationCommand.id: {
864
- const params = commandInfo.params, target = this.getSheetTarget(params.unitId, params.subUnitId);
865
- if (!target)
853
+ case T.id: {
854
+ const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
855
+ if (!n)
866
856
  return;
867
- const { workbook, worksheet } = target, rule = worksheet.getDataValidation(params.ruleId);
868
- if (!rule)
857
+ const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
858
+ if (!s)
869
859
  return;
870
- const eventParams = {
871
- worksheet,
872
- workbook,
873
- rule,
874
- ruleId: params.ruleId
860
+ const l = {
861
+ worksheet: u,
862
+ workbook: d,
863
+ rule: s,
864
+ ruleId: i.ruleId
875
865
  };
876
- if (this.fireEvent(this.Event.BeforeSheetDataValidationDelete, eventParams), eventParams.cancel)
877
- throw new CanceledError();
866
+ if (this.fireEvent(this.Event.BeforeSheetDataValidationDelete, l), l.cancel)
867
+ throw new _();
878
868
  break;
879
869
  }
880
- case RemoveSheetAllDataValidationCommand.id: {
881
- const params = commandInfo.params, target = this.getSheetTarget(params.unitId, params.subUnitId);
882
- if (!target)
870
+ case O.id: {
871
+ const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
872
+ if (!n)
883
873
  return;
884
- const { workbook, worksheet } = target, eventParams = {
885
- worksheet,
886
- workbook,
887
- rules: worksheet.getDataValidations()
874
+ const { workbook: d, worksheet: u } = n, s = {
875
+ worksheet: u,
876
+ workbook: d,
877
+ rules: u.getDataValidations()
888
878
  };
889
- if (this.fireEvent(this.Event.BeforeSheetDataValidationDeleteAll, eventParams), eventParams.cancel)
890
- throw new CanceledError();
879
+ if (this.fireEvent(this.Event.BeforeSheetDataValidationDeleteAll, s), s.cancel)
880
+ throw new _();
891
881
  break;
892
882
  }
893
883
  }
894
884
  }));
895
885
  }
896
- };
897
- __name(_FUnvierDataValidationMixin, "FUnvierDataValidationMixin");
898
- let FUnvierDataValidationMixin = _FUnvierDataValidationMixin;
899
- FUniver.extend(FUnvierDataValidationMixin);
900
- const _FWorkbookDataValidationMixin = class _FWorkbookDataValidationMixin extends FWorkbook {
886
+ }
887
+ x.extend(Q);
888
+ class z extends M {
901
889
  _initialize() {
902
890
  Object.defineProperty(this, "_dataValidationModel", {
903
891
  get() {
904
- return this._injector.get(SheetDataValidationModel);
892
+ return this._injector.get(V);
905
893
  }
906
894
  });
907
895
  }
908
896
  getValidatorStatus() {
909
- return this._injector.get(SheetsDataValidationValidatorService).validatorWorkbook(this._workbook.getUnitId());
897
+ return this._injector.get(S).validatorWorkbook(this._workbook.getUnitId());
910
898
  }
911
899
  // region DataValidationHooks
912
- onDataValidationChange(callback) {
913
- return toDisposable(this._dataValidationModel.ruleChange$.pipe(filter((change) => change.unitId === this._workbook.getUnitId())).subscribe(callback));
900
+ onDataValidationChange(e) {
901
+ return g(this._dataValidationModel.ruleChange$.pipe(R((t) => t.unitId === this._workbook.getUnitId())).subscribe(e));
914
902
  }
915
- onDataValidationStatusChange(callback) {
916
- return toDisposable(this._dataValidationModel.validStatusChange$.pipe(filter((change) => change.unitId === this._workbook.getUnitId())).subscribe(callback));
903
+ onDataValidationStatusChange(e) {
904
+ return g(this._dataValidationModel.validStatusChange$.pipe(R((t) => t.unitId === this._workbook.getUnitId())).subscribe(e));
917
905
  }
918
- onBeforeAddDataValidation(callback) {
919
- return toDisposable(this._commandService.beforeCommandExecuted((commandInfo, options) => {
920
- const params = commandInfo.params;
921
- if (commandInfo.id === AddSheetDataValidationCommand.id) {
922
- if (params.unitId !== this._workbook.getUnitId())
906
+ onBeforeAddDataValidation(e) {
907
+ return g(this._commandService.beforeCommandExecuted((t, r) => {
908
+ const a = t.params;
909
+ if (t.id === A.id) {
910
+ if (a.unitId !== this._workbook.getUnitId())
923
911
  return;
924
- if (callback(params, options) === !1)
912
+ if (e(a, r) === !1)
925
913
  throw new Error("Command is stopped by the hook onBeforeAddDataValidation");
926
914
  }
927
915
  }));
928
916
  }
929
- onBeforeUpdateDataValidationCriteria(callback) {
930
- return toDisposable(this._commandService.beforeCommandExecuted((commandInfo, options) => {
931
- const params = commandInfo.params;
932
- if (commandInfo.id === UpdateSheetDataValidationSettingCommand.id) {
933
- if (params.unitId !== this._workbook.getUnitId())
917
+ onBeforeUpdateDataValidationCriteria(e) {
918
+ return g(this._commandService.beforeCommandExecuted((t, r) => {
919
+ const a = t.params;
920
+ if (t.id === U.id) {
921
+ if (a.unitId !== this._workbook.getUnitId())
934
922
  return;
935
- if (callback(params, options) === !1)
923
+ if (e(a, r) === !1)
936
924
  throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationCriteria");
937
925
  }
938
926
  }));
939
927
  }
940
- onBeforeUpdateDataValidationRange(callback) {
941
- return toDisposable(this._commandService.beforeCommandExecuted((commandInfo, options) => {
942
- const params = commandInfo.params;
943
- if (commandInfo.id === UpdateSheetDataValidationRangeCommand.id) {
944
- if (params.unitId !== this._workbook.getUnitId())
928
+ onBeforeUpdateDataValidationRange(e) {
929
+ return g(this._commandService.beforeCommandExecuted((t, r) => {
930
+ const a = t.params;
931
+ if (t.id === C.id) {
932
+ if (a.unitId !== this._workbook.getUnitId())
945
933
  return;
946
- if (callback(params, options) === !1)
934
+ if (e(a, r) === !1)
947
935
  throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationRange");
948
936
  }
949
937
  }));
950
938
  }
951
- onBeforeUpdateDataValidationOptions(callback) {
952
- return toDisposable(this._commandService.beforeCommandExecuted((commandInfo, options) => {
953
- const params = commandInfo.params;
954
- if (commandInfo.id === UpdateSheetDataValidationOptionsCommand.id) {
955
- if (params.unitId !== this._workbook.getUnitId())
939
+ onBeforeUpdateDataValidationOptions(e) {
940
+ return g(this._commandService.beforeCommandExecuted((t, r) => {
941
+ const a = t.params;
942
+ if (t.id === v.id) {
943
+ if (a.unitId !== this._workbook.getUnitId())
956
944
  return;
957
- if (callback(params, options) === !1)
945
+ if (e(a, r) === !1)
958
946
  throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationOptions");
959
947
  }
960
948
  }));
961
949
  }
962
- onBeforeDeleteDataValidation(callback) {
963
- return toDisposable(this._commandService.beforeCommandExecuted((commandInfo, options) => {
964
- const params = commandInfo.params;
965
- if (commandInfo.id === RemoveSheetDataValidationCommand.id) {
966
- if (params.unitId !== this._workbook.getUnitId())
950
+ onBeforeDeleteDataValidation(e) {
951
+ return g(this._commandService.beforeCommandExecuted((t, r) => {
952
+ const a = t.params;
953
+ if (t.id === T.id) {
954
+ if (a.unitId !== this._workbook.getUnitId())
967
955
  return;
968
- if (callback(params, options) === !1)
956
+ if (e(a, r) === !1)
969
957
  throw new Error("Command is stopped by the hook onBeforeDeleteDataValidation");
970
958
  }
971
959
  }));
972
960
  }
973
- onBeforeDeleteAllDataValidation(callback) {
974
- return toDisposable(this._commandService.beforeCommandExecuted((commandInfo, options) => {
975
- const params = commandInfo.params;
976
- if (commandInfo.id === RemoveSheetAllDataValidationCommand.id) {
977
- if (params.unitId !== this._workbook.getUnitId())
961
+ onBeforeDeleteAllDataValidation(e) {
962
+ return g(this._commandService.beforeCommandExecuted((t, r) => {
963
+ const a = t.params;
964
+ if (t.id === O.id) {
965
+ if (a.unitId !== this._workbook.getUnitId())
978
966
  return;
979
- if (callback(params, options) === !1)
967
+ if (e(a, r) === !1)
980
968
  throw new Error("Command is stopped by the hook onBeforeDeleteAllDataValidation");
981
969
  }
982
970
  }));
983
971
  }
984
- };
985
- __name(_FWorkbookDataValidationMixin, "FWorkbookDataValidationMixin");
986
- let FWorkbookDataValidationMixin = _FWorkbookDataValidationMixin;
987
- FWorkbook.extend(FWorkbookDataValidationMixin);
988
- const _FWorksheetDataValidationMixin = class _FWorksheetDataValidationMixin extends FWorksheet {
972
+ }
973
+ M.extend(z);
974
+ class K extends N {
989
975
  getDataValidations() {
990
- return this._injector.get(DataValidationModel).getRules(this._workbook.getUnitId(), this._worksheet.getSheetId()).map((rule) => new FDataValidation(rule, this._worksheet, this._injector));
976
+ return this._injector.get(b).getRules(this._workbook.getUnitId(), this._worksheet.getSheetId()).map((t) => new m(t, this._worksheet, this._injector));
991
977
  }
992
978
  getValidatorStatus() {
993
- return this._injector.get(SheetsDataValidationValidatorService).validatorWorksheet(
979
+ return this._injector.get(S).validatorWorksheet(
994
980
  this._workbook.getUnitId(),
995
981
  this._worksheet.getSheetId()
996
982
  );
@@ -998,15 +984,13 @@ const _FWorksheetDataValidationMixin = class _FWorksheetDataValidationMixin exte
998
984
  getValidatorStatusAsync() {
999
985
  return this.getValidatorStatus();
1000
986
  }
1001
- getDataValidation(ruleId) {
1002
- const rule = this._injector.get(DataValidationModel).getRuleById(this._workbook.getUnitId(), this._worksheet.getSheetId(), ruleId);
1003
- return rule ? new FDataValidation(rule, this._worksheet, this._injector) : null;
987
+ getDataValidation(e) {
988
+ const r = this._injector.get(b).getRuleById(this._workbook.getUnitId(), this._worksheet.getSheetId(), e);
989
+ return r ? new m(r, this._worksheet, this._injector) : null;
1004
990
  }
1005
- };
1006
- __name(_FWorksheetDataValidationMixin, "FWorksheetDataValidationMixin");
1007
- let FWorksheetDataValidationMixin = _FWorksheetDataValidationMixin;
1008
- FWorksheet.extend(FWorksheetDataValidationMixin);
1009
- const _FDataValidationEvent = class _FDataValidationEvent {
991
+ }
992
+ N.extend(K);
993
+ class X {
1010
994
  get SheetDataValidationChanged() {
1011
995
  return "SheetDataValidationChanged";
1012
996
  }
@@ -1031,11 +1015,9 @@ const _FDataValidationEvent = class _FDataValidationEvent {
1031
1015
  get BeforeSheetDataValidationOptionsUpdate() {
1032
1016
  return "BeforeSheetDataValidationOptionsUpdate";
1033
1017
  }
1034
- };
1035
- __name(_FDataValidationEvent, "FDataValidationEvent");
1036
- let FDataValidationEvent = _FDataValidationEvent;
1037
- FEventName.extend(FDataValidationEvent);
1018
+ }
1019
+ $.extend(X);
1038
1020
  export {
1039
- FDataValidation,
1040
- FDataValidationBuilder
1021
+ m as FDataValidation,
1022
+ D as FDataValidationBuilder
1041
1023
  };