@univerjs/sheets-data-validation 0.6.0-nightly.202502191606 → 0.6.0-nightly.202502201606

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 _ = (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";
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";
5
5
  import { FRange as y, FWorkbook as x, FWorksheet as N } from "@univerjs/sheets/facade";
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";
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";
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
- _(this, "_rule");
13
+ f(this, "_rule");
14
14
  this._rule = e != null ? e : {
15
15
  uid: L(),
16
16
  ranges: void 0,
@@ -37,7 +37,7 @@ class E {
37
37
  * ```
38
38
  */
39
39
  build() {
40
- return new m(this._rule);
40
+ return new _(this._rule);
41
41
  }
42
42
  /**
43
43
  * Creates a duplicate of the current DataValidationBuilder object
@@ -65,7 +65,7 @@ class E {
65
65
  * ```
66
66
  */
67
67
  getAllowInvalid() {
68
- return this._rule.errorStyle !== k.STOP;
68
+ return this._rule.errorStyle !== V.STOP;
69
69
  }
70
70
  /**
71
71
  * Gets the data validation type of the rule
@@ -646,7 +646,7 @@ class E {
646
646
  * ```
647
647
  */
648
648
  setAllowInvalid(e) {
649
- return this._rule.errorStyle = e ? k.WARNING : k.STOP, this;
649
+ return this._rule.errorStyle = e ? V.WARNING : V.STOP, this;
650
650
  }
651
651
  /**
652
652
  * Sets whether to allow blank values
@@ -702,11 +702,11 @@ class E {
702
702
  return Object.assign(this._rule, e), this;
703
703
  }
704
704
  }
705
- class m {
705
+ class _ {
706
706
  constructor(e, t, i) {
707
- _(this, "rule");
708
- _(this, "_worksheet");
709
- _(this, "_injector");
707
+ f(this, "rule");
708
+ f(this, "_worksheet");
709
+ f(this, "_injector");
710
710
  this._injector = i, this.rule = e, this._worksheet = t;
711
711
  }
712
712
  /**
@@ -723,7 +723,7 @@ class m {
723
723
  * ```
724
724
  */
725
725
  getAllowInvalid() {
726
- return this.rule.errorStyle !== k.STOP;
726
+ return this.rule.errorStyle !== V.STOP;
727
727
  }
728
728
  /**
729
729
  * Gets the data validation type of the rule
@@ -833,7 +833,7 @@ class m {
833
833
  getApplied() {
834
834
  if (!this._worksheet)
835
835
  return !1;
836
- const t = this._injector.get(v).getRuleById(this._worksheet.getUnitId(), this._worksheet.getSheetId(), this.rule.uid);
836
+ const t = this._injector.get(w).getRuleById(this._worksheet.getUnitId(), this._worksheet.getSheetId(), this.rule.uid);
837
837
  return !!(t && t.ranges.length);
838
838
  }
839
839
  /**
@@ -1037,14 +1037,14 @@ class G extends y {
1037
1037
  this._worksheet.getSheetId(),
1038
1038
  [this._range]
1039
1039
  );
1040
- return t && new m(t, this._worksheet, this._injector);
1040
+ return t && new _(t, this._worksheet, this._injector);
1041
1041
  }
1042
1042
  getDataValidations() {
1043
1043
  return this._injector.get(S).getDataValidations(
1044
1044
  this._workbook.getUnitId(),
1045
1045
  this._worksheet.getSheetId(),
1046
1046
  [this._range]
1047
- ).map((t) => new m(t, this._worksheet, this._injector));
1047
+ ).map((t) => new _(t, this._worksheet, this._injector));
1048
1048
  }
1049
1049
  async getValidatorStatus() {
1050
1050
  return this._injector.get(S).validatorRanges(
@@ -1071,22 +1071,22 @@ class Q extends M {
1071
1071
  */
1072
1072
  // eslint-disable-next-line max-lines-per-function
1073
1073
  _initialize(e) {
1074
- if (!e.has(w)) return;
1075
- const t = e.get(w), i = e.get(p);
1074
+ if (!e.has(k)) return;
1075
+ const t = e.get(k), i = e.get(p);
1076
1076
  this.registerEventHandler(
1077
1077
  this.Event.SheetDataValidationChanged,
1078
1078
  () => t.ruleChange$.subscribe((r) => {
1079
1079
  const { unitId: a, subUnitId: n, rule: u, oldRule: l, type: s } = r, d = this.getSheetTarget(a, n);
1080
1080
  if (!d)
1081
1081
  return;
1082
- const { workbook: D, worksheet: I } = d, V = new m(u, I.getSheet(), this._injector);
1082
+ const { workbook: D, worksheet: I } = d, v = new _(u, I.getSheet(), this._injector);
1083
1083
  this.fireEvent(this.Event.SheetDataValidationChanged, {
1084
1084
  origin: r,
1085
1085
  worksheet: I,
1086
1086
  workbook: D,
1087
1087
  changeType: s,
1088
1088
  oldRule: l,
1089
- rule: V
1089
+ rule: v
1090
1090
  });
1091
1091
  })
1092
1092
  ), this.registerEventHandler(
@@ -1095,10 +1095,10 @@ class Q extends M {
1095
1095
  const { unitId: a, subUnitId: n, ruleId: u, status: l, row: s, col: d } = r, D = this.getSheetTarget(a, n);
1096
1096
  if (!D)
1097
1097
  return;
1098
- const { workbook: I, worksheet: V } = D, B = V.getDataValidation(u);
1098
+ const { workbook: I, worksheet: v } = D, B = v.getDataValidation(u);
1099
1099
  B && this.fireEvent(this.Event.SheetDataValidatorStatusChanged, {
1100
1100
  workbook: I,
1101
- worksheet: V,
1101
+ worksheet: v,
1102
1102
  row: s,
1103
1103
  column: d,
1104
1104
  rule: B,
@@ -1118,7 +1118,7 @@ class Q extends M {
1118
1118
  rule: a.rule
1119
1119
  };
1120
1120
  if (this.fireEvent(this.Event.BeforeSheetDataValidationAdd, s), s.cancel)
1121
- throw new f();
1121
+ throw new m();
1122
1122
  }
1123
1123
  })
1124
1124
  ), this.registerEventHandler(
@@ -1139,7 +1139,7 @@ class Q extends M {
1139
1139
  newCriteria: a.setting
1140
1140
  };
1141
1141
  if (this.fireEvent(this.Event.BeforeSheetDataValidationCriteriaUpdate, d), d.cancel)
1142
- throw new f();
1142
+ throw new m();
1143
1143
  }
1144
1144
  })
1145
1145
  ), this.registerEventHandler(
@@ -1160,7 +1160,7 @@ class Q extends M {
1160
1160
  newRanges: a.ranges
1161
1161
  };
1162
1162
  if (this.fireEvent(this.Event.BeforeSheetDataValidationRangeUpdate, d), d.cancel)
1163
- throw new f();
1163
+ throw new m();
1164
1164
  }
1165
1165
  })
1166
1166
  ), this.registerEventHandler(
@@ -1181,7 +1181,7 @@ class Q extends M {
1181
1181
  newOptions: a.options
1182
1182
  };
1183
1183
  if (this.fireEvent(this.Event.BeforeSheetDataValidationOptionsUpdate, d), d.cancel)
1184
- throw new f();
1184
+ throw new m();
1185
1185
  }
1186
1186
  })
1187
1187
  ), this.registerEventHandler(
@@ -1201,7 +1201,7 @@ class Q extends M {
1201
1201
  ruleId: a.ruleId
1202
1202
  };
1203
1203
  if (this.fireEvent(this.Event.BeforeSheetDataValidationDelete, d), d.cancel)
1204
- throw new f();
1204
+ throw new m();
1205
1205
  }
1206
1206
  })
1207
1207
  ), this.registerEventHandler(
@@ -1217,7 +1217,7 @@ class Q extends M {
1217
1217
  rules: l.getDataValidations()
1218
1218
  };
1219
1219
  if (this.fireEvent(this.Event.BeforeSheetDataValidationDeleteAll, s), s.cancel)
1220
- throw new f();
1220
+ throw new m();
1221
1221
  }
1222
1222
  })
1223
1223
  );
@@ -1228,7 +1228,7 @@ class z extends x {
1228
1228
  _initialize() {
1229
1229
  Object.defineProperty(this, "_dataValidationModel", {
1230
1230
  get() {
1231
- return this._injector.get(w);
1231
+ return this._injector.get(k);
1232
1232
  }
1233
1233
  });
1234
1234
  }
@@ -1312,7 +1312,7 @@ class z extends x {
1312
1312
  x.extend(z);
1313
1313
  class K extends N {
1314
1314
  getDataValidations() {
1315
- return this._injector.get(v).getRules(this._workbook.getUnitId(), this._worksheet.getSheetId()).map((t) => new m(t, this._worksheet, this._injector));
1315
+ return this._injector.get(w).getRules(this._workbook.getUnitId(), this._worksheet.getSheetId()).map((t) => new _(t, this._worksheet, this._injector));
1316
1316
  }
1317
1317
  getValidatorStatus() {
1318
1318
  return this._injector.get(S).validatorWorksheet(
@@ -1324,8 +1324,8 @@ class K extends N {
1324
1324
  return this.getValidatorStatus();
1325
1325
  }
1326
1326
  getDataValidation(e) {
1327
- const i = this._injector.get(v).getRuleById(this._workbook.getUnitId(), this._worksheet.getSheetId(), e);
1328
- return i ? new m(i, this._worksheet, this._injector) : null;
1327
+ const i = this._injector.get(w).getRuleById(this._workbook.getUnitId(), this._worksheet.getSheetId(), e);
1328
+ return i ? new _(i, this._worksheet, this._injector) : null;
1329
1329
  }
1330
1330
  }
1331
1331
  N.extend(K);
@@ -1357,6 +1357,6 @@ class X {
1357
1357
  }
1358
1358
  P.extend(X);
1359
1359
  export {
1360
- m as FDataValidation,
1360
+ _ as FDataValidation,
1361
1361
  E as FDataValidationBuilder
1362
1362
  };