@univerjs/sheets-data-validation 0.6.0-nightly.202502091605 → 0.6.0-nightly.202502111606

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,19 +1,19 @@
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";
1
+ var H = Object.defineProperty;
2
+ var j = (g, e, t) => e in g ? H(g, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : g[e] = t;
3
+ var m = (g, e, t) => j(g, typeof e != "symbol" ? e + "" : e, t);
4
+ import { UpdateSheetDataValidationSettingCommand as b, UpdateSheetDataValidationOptionsCommand as U, UpdateSheetDataValidationRangeCommand as C, RemoveSheetDataValidationCommand as A, ClearRangeDataValidationCommand as q, AddSheetDataValidationCommand as T, SheetsDataValidationValidatorService as S, SheetDataValidationModel as w, RemoveSheetAllDataValidationCommand as O } from "@univerjs/sheets-data-validation";
5
+ import { FRange as y, FWorkbook as x, FWorksheet as N } from "@univerjs/sheets/facade";
6
+ import { generateRandomId as L, DataValidationType as n, DataValidationErrorStyle as k, DataValidationOperator as h, IUniverInstanceService as W, ICommandService as p, FUniver as M, CanceledError as f, toDisposable as c, FEventName as $ } from "@univerjs/core";
7
+ import { DataValidationModel as v, getRuleOptions as F } from "@univerjs/data-validation";
8
8
  import { serializeRangeToRefString as P } from "@univerjs/engine-formula";
9
9
  import { filter as R } from "rxjs";
10
- class D {
10
+ class E {
11
11
  constructor(e) {
12
- f(this, "_rule");
12
+ m(this, "_rule");
13
13
  this._rule = e != null ? e : {
14
- uid: B(),
14
+ uid: L(),
15
15
  ranges: void 0,
16
- type: o.CUSTOM
16
+ type: n.CUSTOM
17
17
  };
18
18
  }
19
19
  /**
@@ -26,7 +26,7 @@ class D {
26
26
  * ```
27
27
  */
28
28
  build() {
29
- return new m(this._rule);
29
+ return new _(this._rule);
30
30
  }
31
31
  /**
32
32
  * Creates a duplicate of the current DataValidationBuilder object
@@ -38,9 +38,9 @@ class D {
38
38
  * ```
39
39
  */
40
40
  copy() {
41
- return new D({
41
+ return new E({
42
42
  ...this._rule,
43
- uid: B()
43
+ uid: L()
44
44
  });
45
45
  }
46
46
  /**
@@ -53,7 +53,7 @@ class D {
53
53
  * ```
54
54
  */
55
55
  getAllowInvalid() {
56
- return this._rule.errorStyle !== w.STOP;
56
+ return this._rule.errorStyle !== k.STOP;
57
57
  }
58
58
  /**
59
59
  * Gets the data validation type of the rule
@@ -103,7 +103,7 @@ class D {
103
103
  * ```
104
104
  */
105
105
  requireCheckbox(e, t) {
106
- return this._rule.type = o.CHECKBOX, this._rule.formula1 = e, this._rule.formula2 = t, this;
106
+ return this._rule.type = n.CHECKBOX, this._rule.formula1 = e, this._rule.formula2 = t, this;
107
107
  }
108
108
  /**
109
109
  * Set the data validation type to DATE and configure the validation rules to be after a specific date
@@ -116,7 +116,7 @@ class D {
116
116
  * ```
117
117
  */
118
118
  requireDateAfter(e) {
119
- return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.operator = h.GREATER_THAN, this;
119
+ return this._rule.type = n.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.operator = h.GREATER_THAN, this;
120
120
  }
121
121
  /**
122
122
  * Set the data validation type to DATE and configure the validation rules to be before a specific date
@@ -129,7 +129,7 @@ class D {
129
129
  * ```
130
130
  */
131
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;
132
+ return this._rule.type = n.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = h.LESS_THAN, this;
133
133
  }
134
134
  /**
135
135
  * Set the data validation type to DATE and configure the validation rules to be within a specific date range
@@ -145,7 +145,7 @@ class D {
145
145
  * ```
146
146
  */
147
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;
148
+ return this._rule.type = n.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = t.toLocaleDateString(), this._rule.operator = h.BETWEEN, this;
149
149
  }
150
150
  /**
151
151
  * Set the data validation type to DATE and configure the validation rules to be equal to a specific date
@@ -158,7 +158,7 @@ class D {
158
158
  * ```
159
159
  */
160
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;
161
+ return this._rule.type = n.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = h.EQUAL, this;
162
162
  }
163
163
  /**
164
164
  * Set the data validation type to DATE and configure the validation rules to be not within a specific date range
@@ -174,7 +174,7 @@ class D {
174
174
  * ```
175
175
  */
176
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;
177
+ return this._rule.type = n.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = t.toLocaleDateString(), this._rule.operator = h.NOT_BETWEEN, this;
178
178
  }
179
179
  /**
180
180
  * Set the data validation type to DATE and configure the validation rules to be on or after a specific date
@@ -187,7 +187,7 @@ class D {
187
187
  * ```
188
188
  */
189
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;
190
+ return this._rule.type = n.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = h.GREATER_THAN_OR_EQUAL, this;
191
191
  }
192
192
  /**
193
193
  * Set the data validation type to DATE and configure the validation rules to be on or before a specific date
@@ -200,7 +200,7 @@ class D {
200
200
  * ```
201
201
  */
202
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;
203
+ return this._rule.type = n.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = h.LESS_THAN_OR_EQUAL, this;
204
204
  }
205
205
  /**
206
206
  * Requires that a custom formula be satisfied
@@ -213,7 +213,7 @@ class D {
213
213
  * ```
214
214
  */
215
215
  requireFormulaSatisfied(e) {
216
- return this._rule.type = o.CUSTOM, this._rule.formula1 = e, this._rule.formula2 = void 0, this;
216
+ return this._rule.type = n.CUSTOM, this._rule.formula1 = e, this._rule.formula2 = void 0, this;
217
217
  }
218
218
  /**
219
219
  * Requires the user to enter a number within a specific range, which can be integer or decimal
@@ -227,8 +227,8 @@ class D {
227
227
  * const rule = builder.requireNumberBetween(1, 10).build();
228
228
  * ```
229
229
  */
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;
230
+ requireNumberBetween(e, t, i) {
231
+ return this._rule.formula1 = `${e}`, this._rule.formula2 = `${t}`, this._rule.operator = h.BETWEEN, this._rule.type = i ? n.WHOLE : n.DECIMAL, this;
232
232
  }
233
233
  /**
234
234
  * Requires the user to enter a number that is equal to a specific value, which can be an integer or a decimal
@@ -242,7 +242,7 @@ class D {
242
242
  * ```
243
243
  */
244
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;
245
+ return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.EQUAL, this._rule.type = t ? n.WHOLE : n.DECIMAL, this;
246
246
  }
247
247
  /**
248
248
  * Requires the user to enter a number that is greater than a specific value, which can be an integer or a decimal
@@ -256,7 +256,7 @@ class D {
256
256
  * ```
257
257
  */
258
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;
259
+ return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.GREATER_THAN, this._rule.type = t ? n.WHOLE : n.DECIMAL, this;
260
260
  }
261
261
  /**
262
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,7 +270,7 @@ class D {
270
270
  * ```
271
271
  */
272
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;
273
+ return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.GREATER_THAN_OR_EQUAL, this._rule.type = t ? n.WHOLE : n.DECIMAL, this;
274
274
  }
275
275
  /**
276
276
  * Requires the user to enter a number that is less than a specific value, which can be an integer or a decimal
@@ -284,7 +284,7 @@ class D {
284
284
  * ```
285
285
  */
286
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;
287
+ return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.LESS_THAN, this._rule.type = t ? n.WHOLE : n.DECIMAL, this;
288
288
  }
289
289
  /**
290
290
  * Sets the data validation rule to require a number less than or equal to a specified value
@@ -299,7 +299,7 @@ class D {
299
299
  * ```
300
300
  */
301
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;
302
+ return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.LESS_THAN_OR_EQUAL, this._rule.type = t ? n.WHOLE : n.DECIMAL, this;
303
303
  }
304
304
  /**
305
305
  * Sets a data validation rule that requires the user to enter a number outside a specified range
@@ -314,8 +314,8 @@ class D {
314
314
  * const rule = builder.requireNumberNotBetween(1, 10).build();
315
315
  * ```
316
316
  */
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;
317
+ requireNumberNotBetween(e, t, i) {
318
+ return this._rule.formula1 = `${e}`, this._rule.formula2 = `${t}`, this._rule.operator = h.NOT_BETWEEN, this._rule.type = i ? n.WHOLE : n.DECIMAL, this;
319
319
  }
320
320
  /**
321
321
  * Creates a data validation rule that requires the user to enter a number that is not equal to a specific value
@@ -330,7 +330,7 @@ class D {
330
330
  * ```
331
331
  */
332
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;
333
+ return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.NOT_EQUAL, this._rule.type = t ? n.WHOLE : n.DECIMAL, this;
334
334
  }
335
335
  /**
336
336
  * Sets a data validation rule that requires the user to enter a value from a list of specific values
@@ -345,8 +345,8 @@ class D {
345
345
  * const rule = builder.requireValueInList(['Yes', 'No']).build();
346
346
  * ```
347
347
  */
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;
348
+ requireValueInList(e, t, i) {
349
+ return this._rule.type = t ? n.LIST_MULTIPLE : n.LIST, this._rule.formula1 = e.join(","), this._rule.formula2 = void 0, this._rule.showDropDown = i != null ? i : !0, this;
350
350
  }
351
351
  /**
352
352
  * Sets a data validation rule that requires the user to enter a value within a specific range
@@ -362,12 +362,12 @@ class D {
362
362
  * const rule = builder.requireValueInRange(range).build();
363
363
  * ```
364
364
  */
365
- requireValueInRange(e, t, r) {
366
- return this._rule.type = t ? o.LIST_MULTIPLE : o.LIST, this._rule.formula1 = `=${P({
365
+ requireValueInRange(e, t, i) {
366
+ return this._rule.type = t ? n.LIST_MULTIPLE : n.LIST, this._rule.formula1 = `=${P({
367
367
  unitId: e.getUnitId(),
368
368
  sheetName: e.getSheetName(),
369
369
  range: e.getRange()
370
- })}`, this._rule.formula2 = void 0, this._rule.showDropDown = r != null ? r : !0, this;
370
+ })}`, this._rule.formula2 = void 0, this._rule.showDropDown = i != null ? i : !0, this;
371
371
  }
372
372
  /**
373
373
  * Sets whether to allow invalid data and configures the error style
@@ -382,7 +382,7 @@ class D {
382
382
  * ```
383
383
  */
384
384
  setAllowInvalid(e) {
385
- return this._rule.errorStyle = e ? w.WARNING : w.STOP, this;
385
+ return this._rule.errorStyle = e ? k.WARNING : k.STOP, this;
386
386
  }
387
387
  /**
388
388
  * Sets whether to allow blank values
@@ -415,12 +415,12 @@ class D {
415
415
  return Object.assign(this._rule, e), this;
416
416
  }
417
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;
418
+ class _ {
419
+ constructor(e, t, i) {
420
+ m(this, "rule");
421
+ m(this, "_worksheet");
422
+ m(this, "_injector");
423
+ this._injector = i, this.rule = e, this._worksheet = t;
424
424
  }
425
425
  /**
426
426
  * Gets whether invalid data is allowed based on the error style value
@@ -436,7 +436,7 @@ class m {
436
436
  * ```
437
437
  */
438
438
  getAllowInvalid() {
439
- return this.rule.errorStyle !== w.STOP;
439
+ return this.rule.errorStyle !== k.STOP;
440
440
  }
441
441
  /**
442
442
  * Gets the data validation type of the rule
@@ -501,7 +501,7 @@ class m {
501
501
  * ```
502
502
  */
503
503
  copy() {
504
- return new D(this.rule);
504
+ return new E(this.rule);
505
505
  }
506
506
  /**
507
507
  * Gets whether the data validation rule is applied to the worksheet
@@ -519,7 +519,7 @@ class m {
519
519
  getApplied() {
520
520
  if (!this._worksheet)
521
521
  return !1;
522
- const t = this._injector.get(b).getRuleById(this._worksheet.getUnitId(), this._worksheet.getSheetId(), this.rule.uid);
522
+ const t = this._injector.get(v).getRuleById(this._worksheet.getUnitId(), this._worksheet.getSheetId(), this.rule.uid);
523
523
  return !!(t && t.ranges.length);
524
524
  }
525
525
  /**
@@ -538,7 +538,7 @@ class m {
538
538
  getRanges() {
539
539
  if (!this.getApplied())
540
540
  return [];
541
- const e = this._injector.get(H).getUnit(this._worksheet.getUnitId());
541
+ const e = this._injector.get(W).getUnit(this._worksheet.getUnitId());
542
542
  return this.rule.ranges.map((t) => this._injector.createInstance(y, e, this._worksheet, t));
543
543
  }
544
544
  /**
@@ -595,8 +595,8 @@ class m {
595
595
  * );
596
596
  * ```
597
597
  */
598
- setCriteria(e, t, r = !0) {
599
- if (this.getApplied() && !this._injector.get(p).syncExecuteCommand(U.id, {
598
+ setCriteria(e, t, i = !0) {
599
+ if (this.getApplied() && !this._injector.get(p).syncExecuteCommand(b.id, {
600
600
  unitId: this.getUnitId(),
601
601
  subUnitId: this.getSheetId(),
602
602
  ruleId: this.rule.uid,
@@ -605,11 +605,11 @@ class m {
605
605
  formula1: t[1],
606
606
  formula2: t[2],
607
607
  type: this.rule.type,
608
- allowBlank: r
608
+ allowBlank: i
609
609
  }
610
610
  }))
611
611
  throw new Error("setCriteria failed");
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;
612
+ return this.rule.operator = t[0], this.rule.formula1 = t[1], this.rule.formula2 = t[2], this.rule.type = e, this.rule.allowBlank = i, this;
613
613
  }
614
614
  /**
615
615
  * Set the options for the data validation rule
@@ -630,7 +630,7 @@ class m {
630
630
  * ```
631
631
  */
632
632
  setOptions(e) {
633
- if (this.getApplied() && !this._injector.get(p).syncExecuteCommand(v.id, {
633
+ if (this.getApplied() && !this._injector.get(p).syncExecuteCommand(U.id, {
634
634
  unitId: this.getUnitId(),
635
635
  subUnitId: this.getSheetId(),
636
636
  ruleId: this.rule.uid,
@@ -662,7 +662,7 @@ class m {
662
662
  unitId: this.getUnitId(),
663
663
  subUnitId: this.getSheetId(),
664
664
  ruleId: this.rule.uid,
665
- ranges: e.map((a) => a.getRange())
665
+ ranges: e.map((r) => r.getRange())
666
666
  }))
667
667
  throw new Error("setRanges failed");
668
668
  return this.rule.ranges = e.map((t) => t.getRange()), this;
@@ -681,7 +681,7 @@ class m {
681
681
  * ```
682
682
  */
683
683
  delete() {
684
- return this.getApplied() ? this._injector.get(p).syncExecuteCommand(T.id, {
684
+ return this.getApplied() ? this._injector.get(p).syncExecuteCommand(A.id, {
685
685
  unitId: this.getUnitId(),
686
686
  subUnitId: this.getSheetId(),
687
687
  ruleId: this.rule.uid
@@ -691,7 +691,7 @@ class m {
691
691
  class G extends y {
692
692
  setDataValidation(e) {
693
693
  if (!e)
694
- return this._commandService.syncExecuteCommand(W.id, {
694
+ return this._commandService.syncExecuteCommand(q.id, {
695
695
  unitId: this._workbook.getUnitId(),
696
696
  subUnitId: this._worksheet.getSheetId(),
697
697
  ranges: [this._range]
@@ -704,7 +704,7 @@ class G extends y {
704
704
  ranges: [this._range]
705
705
  }
706
706
  };
707
- return this._commandService.syncExecuteCommand(A.id, t), this;
707
+ return this._commandService.syncExecuteCommand(T.id, t), this;
708
708
  }
709
709
  getDataValidation() {
710
710
  const t = this._injector.get(S).getDataValidation(
@@ -712,14 +712,14 @@ class G extends y {
712
712
  this._worksheet.getSheetId(),
713
713
  [this._range]
714
714
  );
715
- return t && new m(t, this._worksheet, this._injector);
715
+ return t && new _(t, this._worksheet, this._injector);
716
716
  }
717
717
  getDataValidations() {
718
718
  return this._injector.get(S).getDataValidations(
719
719
  this._workbook.getUnitId(),
720
720
  this._worksheet.getSheetId(),
721
721
  [this._range]
722
- ).map((t) => new m(t, this._worksheet, this._injector));
722
+ ).map((t) => new _(t, this._worksheet, this._injector));
723
723
  }
724
724
  async getValidatorStatus() {
725
725
  return this._injector.get(S).validatorRanges(
@@ -730,159 +730,180 @@ class G extends y {
730
730
  }
731
731
  }
732
732
  y.extend(G);
733
- class Q extends x {
733
+ class Q extends M {
734
734
  /**
735
735
  * @deprecated use `univerAPI.newDataValidation()` as instead.
736
736
  * @returns {FDataValidationBuilder} A new instance of the FDataValidationBuilder class
737
737
  */
738
738
  static newDataValidation() {
739
- return new D();
739
+ return new E();
740
740
  }
741
741
  newDataValidation() {
742
- return new D();
742
+ return new E();
743
743
  }
744
744
  /**
745
745
  * @ignore
746
746
  */
747
747
  // eslint-disable-next-line max-lines-per-function
748
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)
754
- return;
755
- const { workbook: I, worksheet: k } = l, E = new m(d, k.getSheet(), this._injector);
756
- this.fireEvent(this.Event.SheetDataValidationChanged, {
757
- origin: a,
758
- worksheet: k,
759
- workbook: I,
760
- changeType: s,
761
- oldRule: u,
762
- rule: E
763
- });
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)
767
- return;
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
776
- });
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)
749
+ if (!e.has(w)) return;
750
+ const t = e.get(w), i = e.get(p);
751
+ this.registerEventHandler(
752
+ this.Event.SheetDataValidationChanged,
753
+ () => t.ruleChange$.subscribe((r) => {
754
+ const { unitId: a, subUnitId: o, rule: u, oldRule: l, type: s } = r, d = this.getSheetTarget(a, o);
755
+ if (!d)
756
+ return;
757
+ const { workbook: D, worksheet: I } = d, V = new _(u, I.getSheet(), this._injector);
758
+ this.fireEvent(this.Event.SheetDataValidationChanged, {
759
+ origin: r,
760
+ worksheet: I,
761
+ workbook: D,
762
+ changeType: s,
763
+ oldRule: l,
764
+ rule: V
765
+ });
766
+ })
767
+ ), this.registerEventHandler(
768
+ this.Event.SheetDataValidatorStatusChanged,
769
+ () => t.validStatusChange$.subscribe((r) => {
770
+ const { unitId: a, subUnitId: o, ruleId: u, status: l, row: s, col: d } = r, D = this.getSheetTarget(a, o);
771
+ if (!D)
772
+ return;
773
+ const { workbook: I, worksheet: V } = D, B = V.getDataValidation(u);
774
+ B && this.fireEvent(this.Event.SheetDataValidatorStatusChanged, {
775
+ workbook: I,
776
+ worksheet: V,
777
+ row: s,
778
+ column: d,
779
+ rule: B,
780
+ status: l
781
+ });
782
+ })
783
+ ), this.registerEventHandler(
784
+ this.Event.BeforeSheetDataValidationAdd,
785
+ () => i.beforeCommandExecuted((r) => {
786
+ if (r.id === T.id) {
787
+ const a = r.params, o = this.getSheetTarget(a.unitId, a.subUnitId);
788
+ if (!o)
782
789
  return;
783
- const { workbook: d, worksheet: u } = n, s = {
784
- worksheet: u,
785
- workbook: d,
786
- rule: i.rule
790
+ const { workbook: u, worksheet: l } = o, s = {
791
+ worksheet: l,
792
+ workbook: u,
793
+ rule: a.rule
787
794
  };
788
795
  if (this.fireEvent(this.Event.BeforeSheetDataValidationAdd, s), s.cancel)
789
- throw new _();
790
- break;
796
+ throw new f();
791
797
  }
792
- case U.id: {
793
- const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
794
- if (!n)
798
+ })
799
+ ), this.registerEventHandler(
800
+ this.Event.BeforeSheetDataValidationCriteriaUpdate,
801
+ () => i.beforeCommandExecuted((r) => {
802
+ if (r.id === b.id) {
803
+ const a = r.params, o = this.getSheetTarget(a.unitId, a.subUnitId);
804
+ if (!o)
795
805
  return;
796
- const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
806
+ const { workbook: u, worksheet: l } = o, s = l.getDataValidation(a.ruleId);
797
807
  if (!s)
798
808
  return;
799
- const l = {
800
- worksheet: u,
801
- workbook: d,
809
+ const d = {
810
+ worksheet: l,
811
+ workbook: u,
802
812
  rule: s,
803
- ruleId: i.ruleId,
804
- newCriteria: i.setting
813
+ ruleId: a.ruleId,
814
+ newCriteria: a.setting
805
815
  };
806
- if (this.fireEvent(this.Event.BeforeSheetDataValidationCriteriaUpdate, l), l.cancel)
807
- throw new _();
808
- break;
816
+ if (this.fireEvent(this.Event.BeforeSheetDataValidationCriteriaUpdate, d), d.cancel)
817
+ throw new f();
809
818
  }
810
- case C.id: {
811
- const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
812
- if (!n)
819
+ })
820
+ ), this.registerEventHandler(
821
+ this.Event.BeforeSheetDataValidationRangeUpdate,
822
+ () => i.beforeCommandExecuted((r) => {
823
+ if (r.id === C.id) {
824
+ const a = r.params, o = this.getSheetTarget(a.unitId, a.subUnitId);
825
+ if (!o)
813
826
  return;
814
- const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
827
+ const { workbook: u, worksheet: l } = o, s = l.getDataValidation(a.ruleId);
815
828
  if (!s)
816
829
  return;
817
- const l = {
818
- worksheet: u,
819
- workbook: d,
830
+ const d = {
831
+ worksheet: l,
832
+ workbook: u,
820
833
  rule: s,
821
- ruleId: i.ruleId,
822
- newRanges: i.ranges
834
+ ruleId: a.ruleId,
835
+ newRanges: a.ranges
823
836
  };
824
- if (this.fireEvent(this.Event.BeforeSheetDataValidationRangeUpdate, l), l.cancel)
825
- throw new _();
826
- break;
837
+ if (this.fireEvent(this.Event.BeforeSheetDataValidationRangeUpdate, d), d.cancel)
838
+ throw new f();
827
839
  }
828
- case v.id: {
829
- const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
830
- if (!n)
840
+ })
841
+ ), this.registerEventHandler(
842
+ this.Event.BeforeSheetDataValidationOptionsUpdate,
843
+ () => i.beforeCommandExecuted((r) => {
844
+ if (r.id === U.id) {
845
+ const a = r.params, o = this.getSheetTarget(a.unitId, a.subUnitId);
846
+ if (!o)
831
847
  return;
832
- const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
848
+ const { workbook: u, worksheet: l } = o, s = l.getDataValidation(a.ruleId);
833
849
  if (!s)
834
850
  return;
835
- const l = {
836
- worksheet: u,
837
- workbook: d,
851
+ const d = {
852
+ worksheet: l,
853
+ workbook: u,
838
854
  rule: s,
839
- ruleId: i.ruleId,
840
- newOptions: i.options
855
+ ruleId: a.ruleId,
856
+ newOptions: a.options
841
857
  };
842
- if (this.fireEvent(this.Event.BeforeSheetDataValidationOptionsUpdate, l), l.cancel)
843
- throw new _();
844
- break;
858
+ if (this.fireEvent(this.Event.BeforeSheetDataValidationOptionsUpdate, d), d.cancel)
859
+ throw new f();
845
860
  }
846
- case T.id: {
847
- const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
848
- if (!n)
861
+ })
862
+ ), this.registerEventHandler(
863
+ this.Event.BeforeSheetDataValidationDelete,
864
+ () => i.beforeCommandExecuted((r) => {
865
+ if (r.id === A.id) {
866
+ const a = r.params, o = this.getSheetTarget(a.unitId, a.subUnitId);
867
+ if (!o)
849
868
  return;
850
- const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
869
+ const { workbook: u, worksheet: l } = o, s = l.getDataValidation(a.ruleId);
851
870
  if (!s)
852
871
  return;
853
- const l = {
854
- worksheet: u,
855
- workbook: d,
872
+ const d = {
873
+ worksheet: l,
874
+ workbook: u,
856
875
  rule: s,
857
- ruleId: i.ruleId
876
+ ruleId: a.ruleId
858
877
  };
859
- if (this.fireEvent(this.Event.BeforeSheetDataValidationDelete, l), l.cancel)
860
- throw new _();
861
- break;
878
+ if (this.fireEvent(this.Event.BeforeSheetDataValidationDelete, d), d.cancel)
879
+ throw new f();
862
880
  }
863
- case O.id: {
864
- const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
865
- if (!n)
881
+ })
882
+ ), this.registerEventHandler(
883
+ this.Event.BeforeSheetDataValidationDeleteAll,
884
+ () => i.beforeCommandExecuted((r) => {
885
+ if (r.id === O.id) {
886
+ const a = r.params, o = this.getSheetTarget(a.unitId, a.subUnitId);
887
+ if (!o)
866
888
  return;
867
- const { workbook: d, worksheet: u } = n, s = {
868
- worksheet: u,
869
- workbook: d,
870
- rules: u.getDataValidations()
889
+ const { workbook: u, worksheet: l } = o, s = {
890
+ worksheet: l,
891
+ workbook: u,
892
+ rules: l.getDataValidations()
871
893
  };
872
894
  if (this.fireEvent(this.Event.BeforeSheetDataValidationDeleteAll, s), s.cancel)
873
- throw new _();
874
- break;
895
+ throw new f();
875
896
  }
876
- }
877
- }));
897
+ })
898
+ );
878
899
  }
879
900
  }
880
- x.extend(Q);
881
- class z extends M {
901
+ M.extend(Q);
902
+ class z extends x {
882
903
  _initialize() {
883
904
  Object.defineProperty(this, "_dataValidationModel", {
884
905
  get() {
885
- return this._injector.get(V);
906
+ return this._injector.get(w);
886
907
  }
887
908
  });
888
909
  }
@@ -891,82 +912,82 @@ class z extends M {
891
912
  }
892
913
  // region DataValidationHooks
893
914
  onDataValidationChange(e) {
894
- return g(this._dataValidationModel.ruleChange$.pipe(R((t) => t.unitId === this._workbook.getUnitId())).subscribe(e));
915
+ return c(this._dataValidationModel.ruleChange$.pipe(R((t) => t.unitId === this._workbook.getUnitId())).subscribe(e));
895
916
  }
896
917
  onDataValidationStatusChange(e) {
897
- return g(this._dataValidationModel.validStatusChange$.pipe(R((t) => t.unitId === this._workbook.getUnitId())).subscribe(e));
918
+ return c(this._dataValidationModel.validStatusChange$.pipe(R((t) => t.unitId === this._workbook.getUnitId())).subscribe(e));
898
919
  }
899
920
  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())
921
+ return c(this._commandService.beforeCommandExecuted((t, i) => {
922
+ const r = t.params;
923
+ if (t.id === T.id) {
924
+ if (r.unitId !== this._workbook.getUnitId())
904
925
  return;
905
- if (e(a, r) === !1)
926
+ if (e(r, i) === !1)
906
927
  throw new Error("Command is stopped by the hook onBeforeAddDataValidation");
907
928
  }
908
929
  }));
909
930
  }
910
931
  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())
932
+ return c(this._commandService.beforeCommandExecuted((t, i) => {
933
+ const r = t.params;
934
+ if (t.id === b.id) {
935
+ if (r.unitId !== this._workbook.getUnitId())
915
936
  return;
916
- if (e(a, r) === !1)
937
+ if (e(r, i) === !1)
917
938
  throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationCriteria");
918
939
  }
919
940
  }));
920
941
  }
921
942
  onBeforeUpdateDataValidationRange(e) {
922
- return g(this._commandService.beforeCommandExecuted((t, r) => {
923
- const a = t.params;
943
+ return c(this._commandService.beforeCommandExecuted((t, i) => {
944
+ const r = t.params;
924
945
  if (t.id === C.id) {
925
- if (a.unitId !== this._workbook.getUnitId())
946
+ if (r.unitId !== this._workbook.getUnitId())
926
947
  return;
927
- if (e(a, r) === !1)
948
+ if (e(r, i) === !1)
928
949
  throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationRange");
929
950
  }
930
951
  }));
931
952
  }
932
953
  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())
954
+ return c(this._commandService.beforeCommandExecuted((t, i) => {
955
+ const r = t.params;
956
+ if (t.id === U.id) {
957
+ if (r.unitId !== this._workbook.getUnitId())
937
958
  return;
938
- if (e(a, r) === !1)
959
+ if (e(r, i) === !1)
939
960
  throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationOptions");
940
961
  }
941
962
  }));
942
963
  }
943
964
  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())
965
+ return c(this._commandService.beforeCommandExecuted((t, i) => {
966
+ const r = t.params;
967
+ if (t.id === A.id) {
968
+ if (r.unitId !== this._workbook.getUnitId())
948
969
  return;
949
- if (e(a, r) === !1)
970
+ if (e(r, i) === !1)
950
971
  throw new Error("Command is stopped by the hook onBeforeDeleteDataValidation");
951
972
  }
952
973
  }));
953
974
  }
954
975
  onBeforeDeleteAllDataValidation(e) {
955
- return g(this._commandService.beforeCommandExecuted((t, r) => {
956
- const a = t.params;
976
+ return c(this._commandService.beforeCommandExecuted((t, i) => {
977
+ const r = t.params;
957
978
  if (t.id === O.id) {
958
- if (a.unitId !== this._workbook.getUnitId())
979
+ if (r.unitId !== this._workbook.getUnitId())
959
980
  return;
960
- if (e(a, r) === !1)
981
+ if (e(r, i) === !1)
961
982
  throw new Error("Command is stopped by the hook onBeforeDeleteAllDataValidation");
962
983
  }
963
984
  }));
964
985
  }
965
986
  }
966
- M.extend(z);
987
+ x.extend(z);
967
988
  class K extends N {
968
989
  getDataValidations() {
969
- return this._injector.get(b).getRules(this._workbook.getUnitId(), this._worksheet.getSheetId()).map((t) => new m(t, this._worksheet, this._injector));
990
+ return this._injector.get(v).getRules(this._workbook.getUnitId(), this._worksheet.getSheetId()).map((t) => new _(t, this._worksheet, this._injector));
970
991
  }
971
992
  getValidatorStatus() {
972
993
  return this._injector.get(S).validatorWorksheet(
@@ -978,8 +999,8 @@ class K extends N {
978
999
  return this.getValidatorStatus();
979
1000
  }
980
1001
  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;
1002
+ const i = this._injector.get(v).getRuleById(this._workbook.getUnitId(), this._worksheet.getSheetId(), e);
1003
+ return i ? new _(i, this._worksheet, this._injector) : null;
983
1004
  }
984
1005
  }
985
1006
  N.extend(K);
@@ -1011,6 +1032,6 @@ class X {
1011
1032
  }
1012
1033
  $.extend(X);
1013
1034
  export {
1014
- m as FDataValidation,
1015
- D as FDataValidationBuilder
1035
+ _ as FDataValidation,
1036
+ E as FDataValidationBuilder
1016
1037
  };