@univerjs/sheets-data-validation 0.6.0-nightly.202502141606 → 0.6.0-nightly.202502161605

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,16 +1,16 @@
1
1
  var H = Object.defineProperty;
2
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 f = (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 k, RemoveSheetAllDataValidationCommand as O } from "@univerjs/sheets-data-validation";
3
+ var _ = (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
5
  import { FRange as y, FWorkbook as x, FWorksheet as N } from "@univerjs/sheets/facade";
6
- import { DataValidationType as o, generateRandomId as L, DataValidationErrorStyle as V, DataValidationOperator as h, IUniverInstanceService as W, ICommandService as p, CanceledError as m, toDisposable as c } from "@univerjs/core";
7
- import { DataValidationModel as w, getRuleOptions as $ } from "@univerjs/data-validation";
6
+ import { generateRandomId as L, DataValidationType as o, DataValidationErrorStyle as k, DataValidationOperator as h, IUniverInstanceService as W, ICommandService as p, CanceledError as f, toDisposable as c } from "@univerjs/core";
7
+ import { DataValidationModel as v, getRuleOptions as $ } from "@univerjs/data-validation";
8
8
  import { serializeRangeToRefString as F } from "@univerjs/engine-formula";
9
9
  import { FUniver as M, FEventName as P } from "@univerjs/core/facade";
10
10
  import { filter as R } from "rxjs";
11
11
  class E {
12
12
  constructor(e) {
13
- f(this, "_rule");
13
+ _(this, "_rule");
14
14
  this._rule = e != null ? e : {
15
15
  uid: L(),
16
16
  ranges: void 0,
@@ -27,7 +27,7 @@ class E {
27
27
  * ```
28
28
  */
29
29
  build() {
30
- return new _(this._rule);
30
+ return new m(this._rule);
31
31
  }
32
32
  /**
33
33
  * Creates a duplicate of the current DataValidationBuilder object
@@ -54,7 +54,7 @@ class E {
54
54
  * ```
55
55
  */
56
56
  getAllowInvalid() {
57
- return this._rule.errorStyle !== V.STOP;
57
+ return this._rule.errorStyle !== k.STOP;
58
58
  }
59
59
  /**
60
60
  * Gets the data validation type of the rule
@@ -383,7 +383,7 @@ class E {
383
383
  * ```
384
384
  */
385
385
  setAllowInvalid(e) {
386
- return this._rule.errorStyle = e ? V.WARNING : V.STOP, this;
386
+ return this._rule.errorStyle = e ? k.WARNING : k.STOP, this;
387
387
  }
388
388
  /**
389
389
  * Sets whether to allow blank values
@@ -416,11 +416,11 @@ class E {
416
416
  return Object.assign(this._rule, e), this;
417
417
  }
418
418
  }
419
- class _ {
419
+ class m {
420
420
  constructor(e, t, i) {
421
- f(this, "rule");
422
- f(this, "_worksheet");
423
- f(this, "_injector");
421
+ _(this, "rule");
422
+ _(this, "_worksheet");
423
+ _(this, "_injector");
424
424
  this._injector = i, this.rule = e, this._worksheet = t;
425
425
  }
426
426
  /**
@@ -437,7 +437,7 @@ class _ {
437
437
  * ```
438
438
  */
439
439
  getAllowInvalid() {
440
- return this.rule.errorStyle !== V.STOP;
440
+ return this.rule.errorStyle !== k.STOP;
441
441
  }
442
442
  /**
443
443
  * Gets the data validation type of the rule
@@ -520,7 +520,7 @@ class _ {
520
520
  getApplied() {
521
521
  if (!this._worksheet)
522
522
  return !1;
523
- const t = this._injector.get(w).getRuleById(this._worksheet.getUnitId(), this._worksheet.getSheetId(), this.rule.uid);
523
+ const t = this._injector.get(v).getRuleById(this._worksheet.getUnitId(), this._worksheet.getSheetId(), this.rule.uid);
524
524
  return !!(t && t.ranges.length);
525
525
  }
526
526
  /**
@@ -713,14 +713,14 @@ class G extends y {
713
713
  this._worksheet.getSheetId(),
714
714
  [this._range]
715
715
  );
716
- return t && new _(t, this._worksheet, this._injector);
716
+ return t && new m(t, this._worksheet, this._injector);
717
717
  }
718
718
  getDataValidations() {
719
719
  return this._injector.get(S).getDataValidations(
720
720
  this._workbook.getUnitId(),
721
721
  this._worksheet.getSheetId(),
722
722
  [this._range]
723
- ).map((t) => new _(t, this._worksheet, this._injector));
723
+ ).map((t) => new m(t, this._worksheet, this._injector));
724
724
  }
725
725
  async getValidatorStatus() {
726
726
  return this._injector.get(S).validatorRanges(
@@ -747,22 +747,22 @@ class Q extends M {
747
747
  */
748
748
  // eslint-disable-next-line max-lines-per-function
749
749
  _initialize(e) {
750
- if (!e.has(k)) return;
751
- const t = e.get(k), i = e.get(p);
750
+ if (!e.has(w)) return;
751
+ const t = e.get(w), i = e.get(p);
752
752
  this.registerEventHandler(
753
753
  this.Event.SheetDataValidationChanged,
754
754
  () => t.ruleChange$.subscribe((r) => {
755
755
  const { unitId: a, subUnitId: n, rule: u, oldRule: l, type: s } = r, d = this.getSheetTarget(a, n);
756
756
  if (!d)
757
757
  return;
758
- const { workbook: D, worksheet: I } = d, v = new _(u, I.getSheet(), this._injector);
758
+ const { workbook: D, worksheet: I } = d, V = new m(u, I.getSheet(), this._injector);
759
759
  this.fireEvent(this.Event.SheetDataValidationChanged, {
760
760
  origin: r,
761
761
  worksheet: I,
762
762
  workbook: D,
763
763
  changeType: s,
764
764
  oldRule: l,
765
- rule: v
765
+ rule: V
766
766
  });
767
767
  })
768
768
  ), this.registerEventHandler(
@@ -771,10 +771,10 @@ class Q extends M {
771
771
  const { unitId: a, subUnitId: n, ruleId: u, status: l, row: s, col: d } = r, D = this.getSheetTarget(a, n);
772
772
  if (!D)
773
773
  return;
774
- const { workbook: I, worksheet: v } = D, B = v.getDataValidation(u);
774
+ const { workbook: I, worksheet: V } = D, B = V.getDataValidation(u);
775
775
  B && this.fireEvent(this.Event.SheetDataValidatorStatusChanged, {
776
776
  workbook: I,
777
- worksheet: v,
777
+ worksheet: V,
778
778
  row: s,
779
779
  column: d,
780
780
  rule: B,
@@ -794,7 +794,7 @@ class Q extends M {
794
794
  rule: a.rule
795
795
  };
796
796
  if (this.fireEvent(this.Event.BeforeSheetDataValidationAdd, s), s.cancel)
797
- throw new m();
797
+ throw new f();
798
798
  }
799
799
  })
800
800
  ), this.registerEventHandler(
@@ -815,7 +815,7 @@ class Q extends M {
815
815
  newCriteria: a.setting
816
816
  };
817
817
  if (this.fireEvent(this.Event.BeforeSheetDataValidationCriteriaUpdate, d), d.cancel)
818
- throw new m();
818
+ throw new f();
819
819
  }
820
820
  })
821
821
  ), this.registerEventHandler(
@@ -836,7 +836,7 @@ class Q extends M {
836
836
  newRanges: a.ranges
837
837
  };
838
838
  if (this.fireEvent(this.Event.BeforeSheetDataValidationRangeUpdate, d), d.cancel)
839
- throw new m();
839
+ throw new f();
840
840
  }
841
841
  })
842
842
  ), this.registerEventHandler(
@@ -857,7 +857,7 @@ class Q extends M {
857
857
  newOptions: a.options
858
858
  };
859
859
  if (this.fireEvent(this.Event.BeforeSheetDataValidationOptionsUpdate, d), d.cancel)
860
- throw new m();
860
+ throw new f();
861
861
  }
862
862
  })
863
863
  ), this.registerEventHandler(
@@ -877,7 +877,7 @@ class Q extends M {
877
877
  ruleId: a.ruleId
878
878
  };
879
879
  if (this.fireEvent(this.Event.BeforeSheetDataValidationDelete, d), d.cancel)
880
- throw new m();
880
+ throw new f();
881
881
  }
882
882
  })
883
883
  ), this.registerEventHandler(
@@ -893,7 +893,7 @@ class Q extends M {
893
893
  rules: l.getDataValidations()
894
894
  };
895
895
  if (this.fireEvent(this.Event.BeforeSheetDataValidationDeleteAll, s), s.cancel)
896
- throw new m();
896
+ throw new f();
897
897
  }
898
898
  })
899
899
  );
@@ -904,7 +904,7 @@ class z extends x {
904
904
  _initialize() {
905
905
  Object.defineProperty(this, "_dataValidationModel", {
906
906
  get() {
907
- return this._injector.get(k);
907
+ return this._injector.get(w);
908
908
  }
909
909
  });
910
910
  }
@@ -988,7 +988,7 @@ class z extends x {
988
988
  x.extend(z);
989
989
  class K extends N {
990
990
  getDataValidations() {
991
- return this._injector.get(w).getRules(this._workbook.getUnitId(), this._worksheet.getSheetId()).map((t) => new _(t, this._worksheet, this._injector));
991
+ return this._injector.get(v).getRules(this._workbook.getUnitId(), this._worksheet.getSheetId()).map((t) => new m(t, this._worksheet, this._injector));
992
992
  }
993
993
  getValidatorStatus() {
994
994
  return this._injector.get(S).validatorWorksheet(
@@ -1000,8 +1000,8 @@ class K extends N {
1000
1000
  return this.getValidatorStatus();
1001
1001
  }
1002
1002
  getDataValidation(e) {
1003
- const i = this._injector.get(w).getRuleById(this._workbook.getUnitId(), this._worksheet.getSheetId(), e);
1004
- return i ? new _(i, this._worksheet, this._injector) : null;
1003
+ const i = this._injector.get(v).getRuleById(this._workbook.getUnitId(), this._worksheet.getSheetId(), e);
1004
+ return i ? new m(i, this._worksheet, this._injector) : null;
1005
1005
  }
1006
1006
  }
1007
1007
  N.extend(K);
@@ -1033,6 +1033,6 @@ class X {
1033
1033
  }
1034
1034
  P.extend(X);
1035
1035
  export {
1036
- _ as FDataValidation,
1036
+ m as FDataValidation,
1037
1037
  E as FDataValidationBuilder
1038
1038
  };