@univerjs/data-validation 0.2.5 → 0.2.7

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/index.js CHANGED
@@ -1,136 +1,142 @@
1
- var k = Object.defineProperty;
2
- var ee = (a, e, t) => e in a ? k(a, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : a[e] = t;
3
- var c = (a, e, t) => ee(a, typeof e != "symbol" ? e + "" : e, t);
4
- import { toDisposable as te, Tools as G, DataValidationType as ae, DataValidationOperator as s, Disposable as O, DataValidationStatus as re, ILogService as y, CommandType as E, ICommandService as T, IUndoRedoService as M, UniverInstanceType as C, OnLifecycle as Q, LifecycleStages as j, Inject as v, IResourceManagerService as ne, IUniverInstanceService as W, Plugin as oe, Injector as F, LocaleService as ie } from "@univerjs/core";
5
- import { BehaviorSubject as J, Subject as w, debounceTime as b } from "rxjs";
6
- import { SheetsSelectionsService as se, RemoveSheetCommand as de, SheetInterceptorService as le } from "@univerjs/sheets";
7
- var ue = /* @__PURE__ */ ((a) => (a.SHEET = "sheet", a))(ue || {});
8
- class z {
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 { toDisposable, Tools, DataValidationType, DataValidationOperator, Disposable, DataValidationStatus, ILogService, CommandType, ICommandService, IUndoRedoService, UniverInstanceType, OnLifecycle, LifecycleStages, Inject, IResourceManagerService, IUniverInstanceService, Plugin, Injector, LocaleService } from "@univerjs/core";
6
+ import { BehaviorSubject, Subject, debounceTime } from "rxjs";
7
+ import { SheetsSelectionsService, RemoveSheetCommand, SheetInterceptorService } from "@univerjs/sheets";
8
+ var DataValidatorRegistryScope = /* @__PURE__ */ ((DataValidatorRegistryScope2) => (DataValidatorRegistryScope2.SHEET = "sheet", DataValidatorRegistryScope2))(DataValidatorRegistryScope || {});
9
+ const _DataValidatorRegistryService = class _DataValidatorRegistryService {
9
10
  constructor() {
10
- c(this, "_validatorByScopes", /* @__PURE__ */ new Map());
11
- c(this, "_validatorMap", /* @__PURE__ */ new Map());
12
- c(this, "_validatorsChange$", new J(void 0));
13
- c(this, "validatorsChange$", this._validatorsChange$.asObservable());
14
- }
15
- _addValidatorToScope(e, t) {
16
- this._validatorByScopes.has(t) || this._validatorByScopes.set(t, []);
17
- const r = this._validatorByScopes.get(t);
18
- if (r.findIndex((n) => n.id === e.id) > -1)
19
- throw new Error(`Validator item with the same id ${e.id} has already been added!`);
20
- r.push(e);
21
- }
22
- _removeValidatorFromScope(e, t) {
23
- const r = this._validatorByScopes.get(t);
24
- if (!r)
11
+ __publicField(this, "_validatorByScopes", /* @__PURE__ */ new Map());
12
+ __publicField(this, "_validatorMap", /* @__PURE__ */ new Map());
13
+ __publicField(this, "_validatorsChange$", new BehaviorSubject(void 0));
14
+ __publicField(this, "validatorsChange$", this._validatorsChange$.asObservable());
15
+ }
16
+ _addValidatorToScope(validator, scope) {
17
+ this._validatorByScopes.has(scope) || this._validatorByScopes.set(scope, []);
18
+ const validators = this._validatorByScopes.get(scope);
19
+ if (validators.findIndex((m) => m.id === validator.id) > -1)
20
+ throw new Error(`Validator item with the same id ${validator.id} has already been added!`);
21
+ validators.push(validator);
22
+ }
23
+ _removeValidatorFromScope(validator, scope) {
24
+ const validators = this._validatorByScopes.get(scope);
25
+ if (!validators)
25
26
  return;
26
- const n = r.findIndex((o) => o.id === e.id);
27
- n > -1 && r.splice(n, 1);
28
- }
29
- register(e) {
30
- return this._validatorMap.set(e.id, e), Array.isArray(e.scopes) ? e.scopes.forEach((t) => {
31
- this._addValidatorToScope(e, t);
32
- }) : this._addValidatorToScope(e, e.scopes), this._validatorsChange$.next(), te(() => {
33
- this._validatorMap.delete(e.id), Array.isArray(e.scopes) ? e.scopes.forEach((t) => {
34
- this._removeValidatorFromScope(e, t);
35
- }) : this._removeValidatorFromScope(e, e.scopes), this._validatorsChange$.next();
27
+ const index = validators.findIndex((v) => v.id === validator.id);
28
+ index > -1 && validators.splice(index, 1);
29
+ }
30
+ register(validator) {
31
+ return this._validatorMap.set(validator.id, validator), Array.isArray(validator.scopes) ? validator.scopes.forEach((scope) => {
32
+ this._addValidatorToScope(validator, scope);
33
+ }) : this._addValidatorToScope(validator, validator.scopes), this._validatorsChange$.next(), toDisposable(() => {
34
+ this._validatorMap.delete(validator.id), Array.isArray(validator.scopes) ? validator.scopes.forEach((scope) => {
35
+ this._removeValidatorFromScope(validator, scope);
36
+ }) : this._removeValidatorFromScope(validator, validator.scopes), this._validatorsChange$.next();
36
37
  });
37
38
  }
38
- getValidatorItem(e) {
39
- return this._validatorMap.get(e);
39
+ getValidatorItem(id) {
40
+ return this._validatorMap.get(id);
40
41
  }
41
- getValidatorsByScope(e) {
42
- return this._validatorByScopes.get(e);
42
+ getValidatorsByScope(scope) {
43
+ return this._validatorByScopes.get(scope);
43
44
  }
44
- }
45
- var g = /* @__PURE__ */ ((a) => (a[a.SETTING = 0] = "SETTING", a[a.RANGE = 1] = "RANGE", a[a.OPTIONS = 2] = "OPTIONS", a))(g || {});
46
- function K(a) {
45
+ };
46
+ __name(_DataValidatorRegistryService, "DataValidatorRegistryService");
47
+ let DataValidatorRegistryService = _DataValidatorRegistryService;
48
+ var UpdateRuleType = /* @__PURE__ */ ((UpdateRuleType2) => (UpdateRuleType2[UpdateRuleType2.SETTING = 0] = "SETTING", UpdateRuleType2[UpdateRuleType2.RANGE = 1] = "RANGE", UpdateRuleType2[UpdateRuleType2.OPTIONS = 2] = "OPTIONS", UpdateRuleType2))(UpdateRuleType || {});
49
+ function getRuleSetting(rule) {
47
50
  return {
48
- type: a.type,
49
- operator: a.operator,
50
- formula1: a.formula1,
51
- formula2: a.formula2,
52
- allowBlank: a.allowBlank
51
+ type: rule.type,
52
+ operator: rule.operator,
53
+ formula1: rule.formula1,
54
+ formula2: rule.formula2,
55
+ allowBlank: rule.allowBlank
53
56
  };
54
57
  }
55
- function X(a) {
58
+ __name(getRuleSetting, "getRuleSetting");
59
+ function getRuleOptions(rule) {
56
60
  return {
57
- error: a.error,
58
- errorStyle: a.errorStyle,
59
- errorTitle: a.errorTitle,
60
- imeMode: a.imeMode,
61
- prompt: a.prompt,
62
- promptTitle: a.promptTitle,
63
- showDropDown: a.showDropDown,
64
- showErrorMessage: a.showErrorMessage,
65
- showInputMessage: a.showInputMessage,
66
- renderMode: a.renderMode,
67
- bizInfo: a.bizInfo
61
+ error: rule.error,
62
+ errorStyle: rule.errorStyle,
63
+ errorTitle: rule.errorTitle,
64
+ imeMode: rule.imeMode,
65
+ prompt: rule.prompt,
66
+ promptTitle: rule.promptTitle,
67
+ showDropDown: rule.showDropDown,
68
+ showErrorMessage: rule.showErrorMessage,
69
+ showInputMessage: rule.showInputMessage,
70
+ renderMode: rule.renderMode,
71
+ bizInfo: rule.bizInfo
68
72
  };
69
73
  }
70
- function Ge(a) {
71
- const t = a.get(se).getCurrentSelections().map((o) => o.range);
74
+ __name(getRuleOptions, "getRuleOptions");
75
+ function createDefaultNewRule(accessor) {
76
+ const currentRanges = accessor.get(SheetsSelectionsService).getCurrentSelections().map((s) => s.range);
72
77
  return {
73
- uid: G.generateRandomId(6),
74
- type: ae.DECIMAL,
75
- operator: s.EQUAL,
78
+ uid: Tools.generateRandomId(6),
79
+ type: DataValidationType.DECIMAL,
80
+ operator: DataValidationOperator.EQUAL,
76
81
  formula1: "100",
77
- ranges: t != null ? t : [{ startColumn: 0, endColumn: 0, startRow: 0, endRow: 0 }]
82
+ ranges: currentRanges != null ? currentRanges : [{ startColumn: 0, endColumn: 0, startRow: 0, endRow: 0 }]
78
83
  };
79
84
  }
80
- class ce extends O {
81
- constructor(t, r) {
85
+ __name(createDefaultNewRule, "createDefaultNewRule");
86
+ const _DataValidationManager = class _DataValidationManager extends Disposable {
87
+ constructor(unitId, subUnitId) {
82
88
  super();
83
- c(this, "_dataValidations", []);
84
- c(this, "_dataValidationMap", /* @__PURE__ */ new Map());
85
- c(this, "_dataValidations$", new J(this._dataValidations));
86
- c(this, "unitId");
87
- c(this, "subUnitId");
88
- c(this, "dataValidations$", this._dataValidations$.asObservable());
89
- this.unitId = t, this.subUnitId = r, this._notice(), this.disposeWithMe({
90
- dispose: () => {
89
+ __publicField(this, "_dataValidations", []);
90
+ __publicField(this, "_dataValidationMap", /* @__PURE__ */ new Map());
91
+ __publicField(this, "_dataValidations$", new BehaviorSubject(this._dataValidations));
92
+ __publicField(this, "unitId");
93
+ __publicField(this, "subUnitId");
94
+ __publicField(this, "dataValidations$", this._dataValidations$.asObservable());
95
+ this.unitId = unitId, this.subUnitId = subUnitId, this._notice(), this.disposeWithMe({
96
+ dispose: /* @__PURE__ */ __name(() => {
91
97
  this._dataValidations$.complete();
92
- }
98
+ }, "dispose")
93
99
  });
94
100
  }
95
101
  _notice() {
96
102
  this._dataValidations$.next(this._dataValidations);
97
103
  }
98
- getRuleById(t) {
99
- return this._dataValidationMap.get(t);
104
+ getRuleById(id) {
105
+ return this._dataValidationMap.get(id);
100
106
  }
101
- getRuleIndex(t) {
102
- return this._dataValidations.findIndex((r) => r.uid === t);
107
+ getRuleIndex(id) {
108
+ return this._dataValidations.findIndex((rule) => rule.uid === id);
103
109
  }
104
- addRule(t, r) {
105
- const o = (Array.isArray(t) ? t : [t]).filter((i) => !this._dataValidationMap.has(i.uid));
106
- typeof r == "number" && r < this._dataValidations.length ? this._dataValidations.splice(r, 0, ...o) : this._dataValidations.push(...o), o.forEach((i) => {
107
- this._dataValidationMap.set(i.uid, i);
110
+ addRule(rule, index) {
111
+ const rules = (Array.isArray(rule) ? rule : [rule]).filter((item) => !this._dataValidationMap.has(item.uid));
112
+ typeof index == "number" && index < this._dataValidations.length ? this._dataValidations.splice(index, 0, ...rules) : this._dataValidations.push(...rules), rules.forEach((item) => {
113
+ this._dataValidationMap.set(item.uid, item);
108
114
  }), this._notice();
109
115
  }
110
- removeRule(t) {
111
- const r = this._dataValidations.findIndex((n) => n.uid === t);
112
- r > -1 && (this._dataValidations.splice(r, 1), this._dataValidationMap.delete(t), this._notice());
113
- }
114
- updateRule(t, r) {
115
- const n = this._dataValidationMap.get(t), o = this._dataValidations.findIndex((d) => t === d.uid);
116
- if (!n)
117
- throw new Error(`Data validation rule is not found, ruleId: ${t}.`);
118
- const i = { ...n };
119
- switch (r.type) {
120
- case g.RANGE: {
121
- i.ranges = r.payload;
116
+ removeRule(ruleId) {
117
+ const index = this._dataValidations.findIndex((item) => item.uid === ruleId);
118
+ index > -1 && (this._dataValidations.splice(index, 1), this._dataValidationMap.delete(ruleId), this._notice());
119
+ }
120
+ updateRule(ruleId, payload) {
121
+ const oldRule = this._dataValidationMap.get(ruleId), index = this._dataValidations.findIndex((rule2) => ruleId === rule2.uid);
122
+ if (!oldRule)
123
+ throw new Error(`Data validation rule is not found, ruleId: ${ruleId}.`);
124
+ const rule = { ...oldRule };
125
+ switch (payload.type) {
126
+ case UpdateRuleType.RANGE: {
127
+ rule.ranges = payload.payload;
122
128
  break;
123
129
  }
124
- case g.SETTING: {
125
- Object.assign(i, K(r.payload));
130
+ case UpdateRuleType.SETTING: {
131
+ Object.assign(rule, getRuleSetting(payload.payload));
126
132
  break;
127
133
  }
128
- case g.OPTIONS: {
129
- Object.assign(i, X(r.payload));
134
+ case UpdateRuleType.OPTIONS: {
135
+ Object.assign(rule, getRuleOptions(payload.payload));
130
136
  break;
131
137
  }
132
138
  }
133
- return this._dataValidations[o] = i, this._dataValidationMap.set(t, i), this._notice(), i;
139
+ return this._dataValidations[index] = rule, this._dataValidationMap.set(ruleId, rule), this._notice(), rule;
134
140
  }
135
141
  getDataValidations() {
136
142
  return this._dataValidations;
@@ -138,666 +144,664 @@ class ce extends O {
138
144
  toJSON() {
139
145
  return this._dataValidations;
140
146
  }
141
- validator(t, r, n, o) {
142
- return re.VALID;
147
+ validator(_content, _rule, _pos, _onComplete) {
148
+ return DataValidationStatus.VALID;
143
149
  }
144
- }
145
- var he = Object.defineProperty, pe = Object.getOwnPropertyDescriptor, _e = (a, e, t, r) => {
146
- for (var n = r > 1 ? void 0 : r ? pe(e, t) : e, o = a.length - 1, i; o >= 0; o--)
147
- (i = a[o]) && (n = (r ? i(e, t, n) : i(n)) || n);
148
- return r && n && he(e, t, n), n;
149
- }, ge = (a, e) => (t, r) => e(t, r, a);
150
- let h = class extends O {
151
- constructor(e) {
150
+ };
151
+ __name(_DataValidationManager, "DataValidationManager");
152
+ let DataValidationManager = _DataValidationManager;
153
+ var __defProp$4 = Object.defineProperty, __getOwnPropDesc$4 = Object.getOwnPropertyDescriptor, __decorateClass$4 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
154
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$4(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
155
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
156
+ return kind && result && __defProp$4(target, key, result), result;
157
+ }, "__decorateClass$4"), __decorateParam$4 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$4"), _a;
158
+ let DataValidationModel = (_a = class extends Disposable {
159
+ constructor(_logService) {
152
160
  super();
153
- c(this, "_model", /* @__PURE__ */ new Map());
154
- c(this, "_managerCreator", (e, t) => new ce(e, t));
155
- c(this, "_ruleChange$", new w());
156
- c(this, "_validStatusChange$", new w());
157
- c(this, "ruleChange$", this._ruleChange$.asObservable());
158
- c(this, "ruleChangeDebounce$", this.ruleChange$.pipe(b(20)));
159
- c(this, "validStatusChange$", this._validStatusChange$.asObservable().pipe(b(20)));
160
- this._logService = e, this.disposeWithMe({
161
- dispose: () => {
161
+ __publicField(this, "_model", /* @__PURE__ */ new Map());
162
+ __publicField(this, "_managerCreator", /* @__PURE__ */ __name((unitId, subUnitId) => new DataValidationManager(unitId, subUnitId), "_managerCreator"));
163
+ __publicField(this, "_ruleChange$", new Subject());
164
+ __publicField(this, "_validStatusChange$", new Subject());
165
+ __publicField(this, "ruleChange$", this._ruleChange$.asObservable());
166
+ __publicField(this, "ruleChangeDebounce$", this.ruleChange$.pipe(debounceTime(20)));
167
+ __publicField(this, "validStatusChange$", this._validStatusChange$.asObservable().pipe(debounceTime(20)));
168
+ this._logService = _logService, this.disposeWithMe({
169
+ dispose: /* @__PURE__ */ __name(() => {
162
170
  this._ruleChange$.complete(), this._validStatusChange$.complete();
163
- }
171
+ }, "dispose")
164
172
  });
165
173
  }
166
- setManagerCreator(e) {
167
- this._managerCreator = e;
174
+ setManagerCreator(creator) {
175
+ this._managerCreator = creator;
168
176
  }
169
- ensureManager(e, t) {
170
- this._model.has(e) || this._model.set(e, /* @__PURE__ */ new Map());
171
- const r = this._model.get(e);
172
- if (r.has(t))
173
- return r.get(t);
174
- const n = this._managerCreator(e, t);
175
- return r.set(t, n), this.disposeWithMe(n), n;
177
+ ensureManager(unitId, subUnitId) {
178
+ this._model.has(unitId) || this._model.set(unitId, /* @__PURE__ */ new Map());
179
+ const unitMap = this._model.get(unitId);
180
+ if (unitMap.has(subUnitId))
181
+ return unitMap.get(subUnitId);
182
+ const manager = this._managerCreator(unitId, subUnitId);
183
+ return unitMap.set(subUnitId, manager), this.disposeWithMe(manager), manager;
176
184
  }
177
- _addRuleSideEffect(e, t, r, n) {
178
- this.ensureManager(e, t).getRuleById(r.uid) || this._ruleChange$.next({
179
- rule: r,
185
+ _addRuleSideEffect(unitId, subUnitId, rule, source) {
186
+ this.ensureManager(unitId, subUnitId).getRuleById(rule.uid) || this._ruleChange$.next({
187
+ rule,
180
188
  type: "add",
181
- unitId: e,
182
- subUnitId: t,
183
- source: n
189
+ unitId,
190
+ subUnitId,
191
+ source
184
192
  });
185
193
  }
186
- addRule(e, t, r, n, o) {
194
+ addRule(unitId, subUnitId, rule, source, index) {
187
195
  try {
188
- const i = this.ensureManager(e, t);
189
- (Array.isArray(r) ? r : [r]).forEach((l) => {
190
- this._addRuleSideEffect(e, t, l, n);
191
- }), i.addRule(r, o);
192
- } catch (i) {
193
- this._logService.error(i);
196
+ const manager = this.ensureManager(unitId, subUnitId);
197
+ (Array.isArray(rule) ? rule : [rule]).forEach((item) => {
198
+ this._addRuleSideEffect(unitId, subUnitId, item, source);
199
+ }), manager.addRule(rule, index);
200
+ } catch (error) {
201
+ this._logService.error(error);
194
202
  }
195
203
  }
196
- updateRule(e, t, r, n, o) {
204
+ updateRule(unitId, subUnitId, ruleId, payload, source) {
197
205
  try {
198
- const d = this.ensureManager(e, t).updateRule(r, n);
206
+ const rule = this.ensureManager(unitId, subUnitId).updateRule(ruleId, payload);
199
207
  this._ruleChange$.next({
200
- rule: d,
208
+ rule,
201
209
  type: "update",
202
- unitId: e,
203
- subUnitId: t,
204
- source: o
210
+ unitId,
211
+ subUnitId,
212
+ source
205
213
  });
206
- } catch (i) {
207
- this._logService.error(i);
214
+ } catch (error) {
215
+ this._logService.error(error);
208
216
  }
209
217
  }
210
- removeRule(e, t, r, n) {
218
+ removeRule(unitId, subUnitId, ruleId, source) {
211
219
  try {
212
- const o = this.ensureManager(e, t), i = o.getRuleById(r);
213
- i && (o.removeRule(r), this._ruleChange$.next({
214
- rule: i,
220
+ const manager = this.ensureManager(unitId, subUnitId), oldRule = manager.getRuleById(ruleId);
221
+ oldRule && (manager.removeRule(ruleId), this._ruleChange$.next({
222
+ rule: oldRule,
215
223
  type: "remove",
216
- unitId: e,
217
- subUnitId: t,
218
- source: n
224
+ unitId,
225
+ subUnitId,
226
+ source
219
227
  }));
220
- } catch (o) {
221
- this._logService.error(o);
228
+ } catch (error) {
229
+ this._logService.error(error);
222
230
  }
223
231
  }
224
- getRuleById(e, t, r) {
225
- return this.ensureManager(e, t).getRuleById(r);
232
+ getRuleById(unitId, subUnitId, ruleId) {
233
+ return this.ensureManager(unitId, subUnitId).getRuleById(ruleId);
226
234
  }
227
- getRuleIndex(e, t, r) {
228
- return this.ensureManager(e, t).getRuleIndex(r);
235
+ getRuleIndex(unitId, subUnitId, ruleId) {
236
+ return this.ensureManager(unitId, subUnitId).getRuleIndex(ruleId);
229
237
  }
230
- getRules(e, t) {
231
- return this.ensureManager(e, t).getDataValidations();
238
+ getRules(unitId, subUnitId) {
239
+ return this.ensureManager(unitId, subUnitId).getDataValidations();
232
240
  }
233
- validator(e, t, r) {
234
- const { unitId: n, subUnitId: o } = r;
235
- return this.ensureManager(n, o).validator(e, t, r, (d, l) => {
236
- l && this._validStatusChange$.next({
237
- unitId: n,
238
- subUnitId: o,
239
- ruleId: t.uid,
240
- status: d
241
+ validator(content, rule, pos) {
242
+ const { unitId, subUnitId } = pos;
243
+ return this.ensureManager(unitId, subUnitId).validator(content, rule, pos, (status, changed) => {
244
+ changed && this._validStatusChange$.next({
245
+ unitId,
246
+ subUnitId,
247
+ ruleId: rule.uid,
248
+ status
241
249
  });
242
250
  });
243
251
  }
244
- getUnitRules(e) {
245
- const t = this._model.get(e);
246
- if (!t)
252
+ getUnitRules(unitId) {
253
+ const unitMap = this._model.get(unitId);
254
+ if (!unitMap)
247
255
  return [];
248
- const r = [];
249
- return t.forEach((n) => {
250
- r.push([n.subUnitId, n.getDataValidations()]);
251
- }), r;
252
- }
253
- deleteUnitRules(e) {
254
- this._model.delete(e);
255
- }
256
- getSubUnitIds(e) {
257
- var t, r;
258
- return Array.from((r = (t = this._model.get(e)) == null ? void 0 : t.keys()) != null ? r : []);
259
- }
260
- };
261
- h = _e([
262
- ge(0, y)
263
- ], h);
264
- const m = {
265
- type: E.MUTATION,
256
+ const res = [];
257
+ return unitMap.forEach((manager) => {
258
+ res.push([manager.subUnitId, manager.getDataValidations()]);
259
+ }), res;
260
+ }
261
+ deleteUnitRules(unitId) {
262
+ this._model.delete(unitId);
263
+ }
264
+ getSubUnitIds(unitId) {
265
+ var _a6, _b;
266
+ return Array.from((_b = (_a6 = this._model.get(unitId)) == null ? void 0 : _a6.keys()) != null ? _b : []);
267
+ }
268
+ }, __name(_a, "DataValidationModel"), _a);
269
+ DataValidationModel = __decorateClass$4([
270
+ __decorateParam$4(0, ILogService)
271
+ ], DataValidationModel);
272
+ const AddDataValidationMutation = {
273
+ type: CommandType.MUTATION,
266
274
  id: "data-validation.mutation.addRule",
267
- handler(a, e) {
268
- if (!e)
275
+ handler(accessor, params) {
276
+ if (!params)
269
277
  return !1;
270
- const { unitId: t, subUnitId: r, rule: n, index: o, source: i = "command" } = e;
271
- return a.get(h).addRule(t, r, n, i, o), !0;
278
+ const { unitId, subUnitId, rule, index, source = "command" } = params;
279
+ return accessor.get(DataValidationModel).addRule(unitId, subUnitId, rule, source, index), !0;
272
280
  }
273
- }, S = {
274
- type: E.MUTATION,
281
+ }, RemoveDataValidationMutation = {
282
+ type: CommandType.MUTATION,
275
283
  id: "data-validation.mutation.removeRule",
276
- handler(a, e) {
277
- if (!e)
284
+ handler(accessor, params) {
285
+ if (!params)
278
286
  return !1;
279
- const { unitId: t, subUnitId: r, ruleId: n, source: o = "command" } = e, i = a.get(h);
280
- return Array.isArray(n) ? n.forEach((d) => {
281
- i.removeRule(t, r, d, o);
282
- }) : i.removeRule(t, r, n, o), !0;
287
+ const { unitId, subUnitId, ruleId, source = "command" } = params, dataValidationModel = accessor.get(DataValidationModel);
288
+ return Array.isArray(ruleId) ? ruleId.forEach((item) => {
289
+ dataValidationModel.removeRule(unitId, subUnitId, item, source);
290
+ }) : dataValidationModel.removeRule(unitId, subUnitId, ruleId, source), !0;
283
291
  }
284
- }, f = {
285
- type: E.MUTATION,
292
+ }, UpdateDataValidationMutation = {
293
+ type: CommandType.MUTATION,
286
294
  id: "data-validation.mutation.updateRule",
287
- handler(a, e) {
288
- if (!e)
295
+ handler(accessor, params) {
296
+ if (!params)
289
297
  return !1;
290
- const { unitId: t, subUnitId: r, ruleId: n, payload: o, source: i = "command" } = e;
291
- return a.get(h).updateRule(t, r, n, o, i), !0;
298
+ const { unitId, subUnitId, ruleId, payload, source = "command" } = params;
299
+ return accessor.get(DataValidationModel).updateRule(unitId, subUnitId, ruleId, payload, source), !0;
292
300
  }
293
- }, me = {
294
- type: E.COMMAND,
301
+ }, AddDataValidationCommand = {
302
+ type: CommandType.COMMAND,
295
303
  id: "data-validation.command.addRule",
296
- async handler(a, e) {
297
- if (a.get(y).warn("[Deprecated] AddDataValidationCommand is deprecated, please use AddSheetDataValidationCommand in @univerjs/sheets-data-validation instead!"), !e)
304
+ async handler(accessor, params) {
305
+ if (accessor.get(ILogService).warn("[Deprecated] AddDataValidationCommand is deprecated, please use AddSheetDataValidationCommand in @univerjs/sheets-data-validation instead!"), !params)
298
306
  return !1;
299
- const { rule: r, unitId: n, subUnitId: o } = e, i = a.get(T), d = a.get(M), l = {
300
- ...e,
307
+ const { rule, unitId, subUnitId } = params, commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), mutationParams = {
308
+ ...params,
301
309
  rule: {
302
- ...e.rule,
303
- ranges: [e.rule.range]
310
+ ...params.rule,
311
+ ranges: [params.rule.range]
304
312
  }
305
- }, u = [{
306
- id: m.id,
307
- params: l
308
- }], p = [{
309
- id: S.id,
313
+ }, redoMutations = [{
314
+ id: AddDataValidationMutation.id,
315
+ params: mutationParams
316
+ }], undoMutations = [{
317
+ id: RemoveDataValidationMutation.id,
310
318
  params: {
311
- unitId: n,
312
- subUnitId: o,
313
- ruleId: r.uid
319
+ unitId,
320
+ subUnitId,
321
+ ruleId: rule.uid
314
322
  }
315
323
  }];
316
- return d.pushUndoRedo({
317
- unitID: n,
318
- redoMutations: u,
319
- undoMutations: p
320
- }), await i.executeCommand(m.id, l), !0;
321
- }
322
- }, Qe = (a, e) => {
323
- const t = a.get(h), { unitId: r, subUnitId: n, ruleId: o, source: i } = e;
324
- if (Array.isArray(o)) {
325
- const l = o.map((u) => t.getRuleById(r, n, u)).filter(Boolean);
324
+ return undoRedoService.pushUndoRedo({
325
+ unitID: unitId,
326
+ redoMutations,
327
+ undoMutations
328
+ }), await commandService.executeCommand(AddDataValidationMutation.id, mutationParams), !0;
329
+ }
330
+ }, removeDataValidationUndoFactory = /* @__PURE__ */ __name((accessor, redoParams) => {
331
+ const dataValidationModel = accessor.get(DataValidationModel), { unitId, subUnitId, ruleId, source } = redoParams;
332
+ if (Array.isArray(ruleId)) {
333
+ const rules = ruleId.map((id) => dataValidationModel.getRuleById(unitId, subUnitId, id)).filter(Boolean);
326
334
  return [{
327
- id: m.id,
335
+ id: AddDataValidationMutation.id,
328
336
  params: {
329
- unitId: r,
330
- subUnitId: n,
331
- rule: l,
332
- source: i
337
+ unitId,
338
+ subUnitId,
339
+ rule: rules,
340
+ source
333
341
  }
334
342
  }];
335
343
  }
336
344
  return [{
337
- id: m.id,
345
+ id: AddDataValidationMutation.id,
338
346
  params: {
339
- unitId: r,
340
- subUnitId: n,
347
+ unitId,
348
+ subUnitId,
341
349
  rule: {
342
- ...t.getRuleById(r, n, o)
350
+ ...dataValidationModel.getRuleById(unitId, subUnitId, ruleId)
343
351
  },
344
- index: t.getRuleIndex(r, n, o)
352
+ index: dataValidationModel.getRuleIndex(unitId, subUnitId, ruleId)
345
353
  }
346
354
  }];
347
- }, Ee = {
348
- type: E.COMMAND,
355
+ }, "removeDataValidationUndoFactory"), RemoveDataValidationCommand = {
356
+ type: CommandType.COMMAND,
349
357
  id: "data-validation.command.removeRule",
350
- handler(a, e) {
351
- if (!e)
358
+ handler(accessor, params) {
359
+ if (!params)
352
360
  return !1;
353
- const { unitId: t, subUnitId: r, ruleId: n } = e, o = a.get(T), i = a.get(M), d = a.get(h), l = [{
354
- id: S.id,
355
- params: e
356
- }], u = [{
357
- id: m.id,
361
+ const { unitId, subUnitId, ruleId } = params, commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), dataValidationModel = accessor.get(DataValidationModel), redoMutations = [{
362
+ id: RemoveDataValidationMutation.id,
363
+ params
364
+ }], undoMutations = [{
365
+ id: AddDataValidationMutation.id,
358
366
  params: {
359
- unitId: t,
360
- subUnitId: r,
367
+ unitId,
368
+ subUnitId,
361
369
  rule: {
362
- ...d.getRuleById(t, r, n)
370
+ ...dataValidationModel.getRuleById(unitId, subUnitId, ruleId)
363
371
  },
364
- index: d.getRuleIndex(t, r, n)
372
+ index: dataValidationModel.getRuleIndex(unitId, subUnitId, ruleId)
365
373
  }
366
374
  }];
367
- return i.pushUndoRedo({
368
- undoMutations: u,
369
- redoMutations: l,
370
- unitID: e.unitId
371
- }), o.executeCommand(S.id, e), !0;
372
- }
373
- }, ve = {
374
- type: E.COMMAND,
375
+ return undoRedoService.pushUndoRedo({
376
+ undoMutations,
377
+ redoMutations,
378
+ unitID: params.unitId
379
+ }), commandService.executeCommand(RemoveDataValidationMutation.id, params), !0;
380
+ }
381
+ }, UpdateDataValidationOptionsCommand = {
382
+ type: CommandType.COMMAND,
375
383
  id: "data-validation.command.updateDataValidationSetting",
376
- handler(a, e) {
377
- if (a.get(y).warn("[Deprecated] UpdateDataValidationOptionsCommand is deprecated, please use UpdateSheetDataValidationOptionsCommand in @univerjs/sheets-data-validation instead!"), !e)
384
+ handler(accessor, params) {
385
+ if (accessor.get(ILogService).warn("[Deprecated] UpdateDataValidationOptionsCommand is deprecated, please use UpdateSheetDataValidationOptionsCommand in @univerjs/sheets-data-validation instead!"), !params)
378
386
  return !1;
379
- const r = a.get(T), n = a.get(M), o = a.get(h), { unitId: i, subUnitId: d, ruleId: l, options: u } = e, p = o.getRuleById(i, d, l);
380
- if (!p)
387
+ const commandService = accessor.get(ICommandService), redoUndoService = accessor.get(IUndoRedoService), dataValidationModel = accessor.get(DataValidationModel), { unitId, subUnitId, ruleId, options } = params, rule = dataValidationModel.getRuleById(unitId, subUnitId, ruleId);
388
+ if (!rule)
381
389
  return !1;
382
- const _ = {
383
- unitId: i,
384
- subUnitId: d,
385
- ruleId: l,
390
+ const mutationParams = {
391
+ unitId,
392
+ subUnitId,
393
+ ruleId,
386
394
  payload: {
387
- type: g.OPTIONS,
388
- payload: u
395
+ type: UpdateRuleType.OPTIONS,
396
+ payload: options
389
397
  }
390
- }, V = [{
391
- id: f.id,
392
- params: _
393
- }], I = {
394
- unitId: i,
395
- subUnitId: d,
396
- ruleId: l,
398
+ }, redoMutations = [{
399
+ id: UpdateDataValidationMutation.id,
400
+ params: mutationParams
401
+ }], undoMutationParams = {
402
+ unitId,
403
+ subUnitId,
404
+ ruleId,
397
405
  payload: {
398
- type: g.OPTIONS,
399
- payload: X(p)
406
+ type: UpdateRuleType.OPTIONS,
407
+ payload: getRuleOptions(rule)
400
408
  }
401
- }, U = [{
402
- id: f.id,
403
- params: I
409
+ }, undoMutations = [{
410
+ id: UpdateDataValidationMutation.id,
411
+ params: undoMutationParams
404
412
  }];
405
- return n.pushUndoRedo({
406
- unitID: i,
407
- redoMutations: V,
408
- undoMutations: U
409
- }), r.executeCommand(f.id, _), !0;
410
- }
411
- }, fe = {
412
- type: E.COMMAND,
413
+ return redoUndoService.pushUndoRedo({
414
+ unitID: unitId,
415
+ redoMutations,
416
+ undoMutations
417
+ }), commandService.executeCommand(UpdateDataValidationMutation.id, mutationParams), !0;
418
+ }
419
+ }, UpdateDataValidationSettingCommand = {
420
+ type: CommandType.COMMAND,
413
421
  id: "data-validation.command.updateDataValidationOptions",
414
- handler(a, e) {
415
- if (a.get(y).warn("[Deprecated] UpdateDataValidationSettingCommand is deprecated, please use UpdateSheetDataValidationSettingCommand in @univerjs/sheets-data-validation instead!"), !e)
422
+ handler(accessor, params) {
423
+ if (accessor.get(ILogService).warn("[Deprecated] UpdateDataValidationSettingCommand is deprecated, please use UpdateSheetDataValidationSettingCommand in @univerjs/sheets-data-validation instead!"), !params)
416
424
  return !1;
417
- const r = a.get(T), n = a.get(M), o = a.get(h), i = a.get(z), { unitId: d, subUnitId: l, ruleId: u, setting: p } = e, _ = i.getValidatorItem(p.type);
418
- if (!_)
425
+ const commandService = accessor.get(ICommandService), redoUndoService = accessor.get(IUndoRedoService), dataValidationModel = accessor.get(DataValidationModel), dataValidatorRegistryService = accessor.get(DataValidatorRegistryService), { unitId, subUnitId, ruleId, setting } = params, validator = dataValidatorRegistryService.getValidatorItem(setting.type);
426
+ if (!validator)
419
427
  return !1;
420
- const V = o.getRuleById(d, l, u);
421
- if (!V || !_.validatorFormula({ ...V, ...p }, d, l).success)
428
+ const rule = dataValidationModel.getRuleById(unitId, subUnitId, ruleId);
429
+ if (!rule || !validator.validatorFormula({ ...rule, ...setting }, unitId, subUnitId).success)
422
430
  return !1;
423
- const I = {
424
- unitId: d,
425
- subUnitId: l,
426
- ruleId: u,
431
+ const mutationParams = {
432
+ unitId,
433
+ subUnitId,
434
+ ruleId,
427
435
  payload: {
428
- type: g.SETTING,
429
- payload: p
436
+ type: UpdateRuleType.SETTING,
437
+ payload: setting
430
438
  }
431
- }, U = [{
432
- id: f.id,
433
- params: I
434
- }], Y = {
435
- unitId: d,
436
- subUnitId: l,
437
- ruleId: u,
439
+ }, redoMutations = [{
440
+ id: UpdateDataValidationMutation.id,
441
+ params: mutationParams
442
+ }], undoMutationParams = {
443
+ unitId,
444
+ subUnitId,
445
+ ruleId,
438
446
  payload: {
439
- type: g.SETTING,
440
- payload: K(V)
447
+ type: UpdateRuleType.SETTING,
448
+ payload: getRuleSetting(rule)
441
449
  }
442
- }, Z = [{
443
- id: f.id,
444
- params: Y
450
+ }, undoMutations = [{
451
+ id: UpdateDataValidationMutation.id,
452
+ params: undoMutationParams
445
453
  }];
446
- return n.pushUndoRedo({
447
- unitID: d,
448
- redoMutations: U,
449
- undoMutations: Z
450
- }), r.executeCommand(f.id, I), !0;
451
- }
452
- }, Se = {
453
- type: E.COMMAND,
454
+ return redoUndoService.pushUndoRedo({
455
+ unitID: unitId,
456
+ redoMutations,
457
+ undoMutations
458
+ }), commandService.executeCommand(UpdateDataValidationMutation.id, mutationParams), !0;
459
+ }
460
+ }, RemoveAllDataValidationCommand = {
461
+ type: CommandType.COMMAND,
454
462
  id: "data-validation.command.removeAll",
455
- handler(a, e) {
456
- if (!e)
463
+ handler(accessor, params) {
464
+ if (!params)
457
465
  return !1;
458
- const { unitId: t, subUnitId: r } = e, n = a.get(T), o = a.get(h), i = a.get(M), d = [...o.getRules(t, r)], l = {
459
- unitId: t,
460
- subUnitId: r,
461
- ruleId: d.map((_) => _.uid)
462
- }, u = [{
463
- id: S.id,
464
- params: l
465
- }], p = [{
466
- id: m.id,
466
+ const { unitId, subUnitId } = params, commandService = accessor.get(ICommandService), dataValidationModel = accessor.get(DataValidationModel), undoRedoService = accessor.get(IUndoRedoService), currentRules = [...dataValidationModel.getRules(unitId, subUnitId)], redoParams = {
467
+ unitId,
468
+ subUnitId,
469
+ ruleId: currentRules.map((rule) => rule.uid)
470
+ }, redoMutations = [{
471
+ id: RemoveDataValidationMutation.id,
472
+ params: redoParams
473
+ }], undoMutations = [{
474
+ id: AddDataValidationMutation.id,
467
475
  params: {
468
- unitId: t,
469
- subUnitId: r,
470
- rule: d
476
+ unitId,
477
+ subUnitId,
478
+ rule: currentRules
471
479
  }
472
480
  }];
473
- return i.pushUndoRedo({
474
- redoMutations: u,
475
- undoMutations: p,
476
- unitID: t
477
- }), n.executeCommand(S.id, l), !0;
481
+ return undoRedoService.pushUndoRedo({
482
+ redoMutations,
483
+ undoMutations,
484
+ unitID: unitId
485
+ }), commandService.executeCommand(RemoveDataValidationMutation.id, redoParams), !0;
478
486
  }
479
487
  };
480
- var Te = Object.defineProperty, Ve = Object.getOwnPropertyDescriptor, Me = (a, e, t, r) => {
481
- for (var n = r > 1 ? void 0 : r ? Ve(e, t) : e, o = a.length - 1, i; o >= 0; o--)
482
- (i = a[o]) && (n = (r ? i(e, t, n) : i(n)) || n);
483
- return r && n && Te(e, t, n), n;
484
- }, D = (a, e) => (t, r) => e(t, r, a);
485
- const Ie = "SHEET_DATA_VALIDATION_PLUGIN";
486
- let A = class extends O {
487
- constructor(a, e, t) {
488
- super(), this._resourceManagerService = a, this._univerInstanceService = e, this._dataValidationModel = t, this._initSnapshot();
488
+ var __defProp$3 = Object.defineProperty, __getOwnPropDesc$3 = Object.getOwnPropertyDescriptor, __decorateClass$3 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
489
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$3(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
490
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
491
+ return kind && result && __defProp$3(target, key, result), result;
492
+ }, "__decorateClass$3"), __decorateParam$3 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$3");
493
+ const DATA_VALIDATION_PLUGIN_NAME = "SHEET_DATA_VALIDATION_PLUGIN";
494
+ var _a2;
495
+ let DataValidationResourceController = (_a2 = class extends Disposable {
496
+ constructor(_resourceManagerService, _univerInstanceService, _dataValidationModel) {
497
+ super(), this._resourceManagerService = _resourceManagerService, this._univerInstanceService = _univerInstanceService, this._dataValidationModel = _dataValidationModel, this._initSnapshot();
489
498
  }
490
499
  _initSnapshot() {
491
- const a = (t) => {
492
- const r = this._dataValidationModel.getUnitRules(t), n = {};
493
- return r ? (r.forEach(([o, i]) => {
494
- n[o] = i;
495
- }), JSON.stringify(n)) : "";
496
- }, e = (t) => {
497
- if (!t)
500
+ const toJson = /* @__PURE__ */ __name((unitID) => {
501
+ const map = this._dataValidationModel.getUnitRules(unitID), resultMap = {};
502
+ return map ? (map.forEach(([key, v]) => {
503
+ resultMap[key] = v;
504
+ }), JSON.stringify(resultMap)) : "";
505
+ }, "toJson"), parseJson = /* @__PURE__ */ __name((json) => {
506
+ if (!json)
498
507
  return {};
499
508
  try {
500
- return JSON.parse(t);
509
+ return JSON.parse(json);
501
510
  } catch {
502
511
  return {};
503
512
  }
504
- };
513
+ }, "parseJson");
505
514
  this.disposeWithMe(
506
515
  this._resourceManagerService.registerPluginResource({
507
- pluginName: Ie,
508
- businesses: [C.UNIVER_SHEET],
509
- toJson: (t) => a(t),
510
- parseJson: (t) => e(t),
511
- onUnLoad: (t) => {
512
- this._dataValidationModel.deleteUnitRules(t);
513
- },
514
- onLoad: (t, r) => {
515
- Object.keys(r).forEach((n) => {
516
- r[n].forEach((i) => {
517
- this._dataValidationModel.addRule(t, n, i, "patched");
516
+ pluginName: DATA_VALIDATION_PLUGIN_NAME,
517
+ businesses: [UniverInstanceType.UNIVER_SHEET],
518
+ toJson: /* @__PURE__ */ __name((unitID) => toJson(unitID), "toJson"),
519
+ parseJson: /* @__PURE__ */ __name((json) => parseJson(json), "parseJson"),
520
+ onUnLoad: /* @__PURE__ */ __name((unitID) => {
521
+ this._dataValidationModel.deleteUnitRules(unitID);
522
+ }, "onUnLoad"),
523
+ onLoad: /* @__PURE__ */ __name((unitID, value) => {
524
+ Object.keys(value).forEach((subunitId) => {
525
+ value[subunitId].forEach((rule) => {
526
+ this._dataValidationModel.addRule(unitID, subunitId, rule, "patched");
518
527
  });
519
528
  });
520
- }
529
+ }, "onLoad")
521
530
  })
522
531
  );
523
532
  }
524
- };
525
- A = Me([
526
- Q(j.Ready, A),
527
- D(0, ne),
528
- D(1, W),
529
- D(2, v(h))
530
- ], A);
531
- var Re = Object.defineProperty, Ae = Object.getOwnPropertyDescriptor, Ne = (a, e, t, r) => {
532
- for (var n = r > 1 ? void 0 : r ? Ae(e, t) : e, o = a.length - 1, i; o >= 0; o--)
533
- (i = a[o]) && (n = (r ? i(e, t, n) : i(n)) || n);
534
- return r && n && Re(e, t, n), n;
535
- }, L = (a, e) => (t, r) => e(t, r, a);
536
- let N = class extends O {
537
- constructor(a, e, t) {
538
- super(), this._sheetInterceptorService = a, this._univerInstanceService = e, this._dataValidationModel = t, this._initSheetChange();
533
+ }, __name(_a2, "DataValidationResourceController"), _a2);
534
+ DataValidationResourceController = __decorateClass$3([
535
+ OnLifecycle(LifecycleStages.Ready, DataValidationResourceController),
536
+ __decorateParam$3(0, IResourceManagerService),
537
+ __decorateParam$3(1, IUniverInstanceService),
538
+ __decorateParam$3(2, Inject(DataValidationModel))
539
+ ], DataValidationResourceController);
540
+ var __defProp$2 = Object.defineProperty, __getOwnPropDesc$2 = Object.getOwnPropertyDescriptor, __decorateClass$2 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
541
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$2(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
542
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
543
+ return kind && result && __defProp$2(target, key, result), result;
544
+ }, "__decorateClass$2"), __decorateParam$2 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$2"), _a3;
545
+ let DataValidationSheetController = (_a3 = class extends Disposable {
546
+ constructor(_sheetInterceptorService, _univerInstanceService, _dataValidationModel) {
547
+ super(), this._sheetInterceptorService = _sheetInterceptorService, this._univerInstanceService = _univerInstanceService, this._dataValidationModel = _dataValidationModel, this._initSheetChange();
539
548
  }
540
549
  _initSheetChange() {
541
550
  this.disposeWithMe(
542
551
  this._sheetInterceptorService.interceptCommand({
543
- getMutations: (a) => {
544
- var e;
545
- if (a.id === de.id) {
546
- const t = a.params, r = t.unitId || this._univerInstanceService.getCurrentUnitForType(C.UNIVER_SHEET).getUnitId(), n = this._univerInstanceService.getUniverSheetInstance(r);
547
- if (!n)
552
+ getMutations: /* @__PURE__ */ __name((commandInfo) => {
553
+ var _a6;
554
+ if (commandInfo.id === RemoveSheetCommand.id) {
555
+ const params = commandInfo.params, unitId = params.unitId || this._univerInstanceService.getCurrentUnitForType(UniverInstanceType.UNIVER_SHEET).getUnitId(), workbook = this._univerInstanceService.getUniverSheetInstance(unitId);
556
+ if (!workbook)
548
557
  return { redos: [], undos: [] };
549
- const o = t.subUnitId || ((e = n.getActiveSheet()) == null ? void 0 : e.getSheetId());
550
- if (!o)
558
+ const subUnitId = params.subUnitId || ((_a6 = workbook.getActiveSheet()) == null ? void 0 : _a6.getSheetId());
559
+ if (!subUnitId)
551
560
  return { redos: [], undos: [] };
552
- const i = this._dataValidationModel.ensureManager(r, o);
553
- if (!i)
561
+ const manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
562
+ if (!manager)
554
563
  return { redos: [], undos: [] };
555
- const d = i.getDataValidations(), l = d.map((_) => _.uid), u = {
556
- unitId: r,
557
- subUnitId: o,
558
- ruleId: l,
564
+ const rules = manager.getDataValidations(), ids = rules.map((i) => i.uid), redoParams = {
565
+ unitId,
566
+ subUnitId,
567
+ ruleId: ids,
559
568
  source: "patched"
560
- }, p = {
561
- unitId: r,
562
- subUnitId: o,
563
- rule: d,
569
+ }, undoParams = {
570
+ unitId,
571
+ subUnitId,
572
+ rule: rules,
564
573
  source: "patched"
565
574
  };
566
575
  return {
567
576
  redos: [{
568
- id: S.id,
569
- params: u
577
+ id: RemoveDataValidationMutation.id,
578
+ params: redoParams
570
579
  }],
571
580
  undos: [{
572
- id: m.id,
573
- params: p
581
+ id: AddDataValidationMutation.id,
582
+ params: undoParams
574
583
  }]
575
584
  };
576
585
  }
577
586
  return { redos: [], undos: [] };
578
- }
587
+ }, "getMutations")
579
588
  })
580
589
  );
581
590
  }
582
- };
583
- N = Ne([
584
- Q(j.Ready, N),
585
- L(0, v(le)),
586
- L(1, v(W)),
587
- L(2, v(h))
588
- ], N);
589
- var Oe = Object.defineProperty, ye = Object.getOwnPropertyDescriptor, Ue = (a, e, t, r) => {
590
- for (var n = r > 1 ? void 0 : r ? ye(e, t) : e, o = a.length - 1, i; o >= 0; o--)
591
- (i = a[o]) && (n = (r ? i(e, t, n) : i(n)) || n);
592
- return r && n && Oe(e, t, n), n;
593
- }, B = (a, e) => (t, r) => e(t, r, a);
594
- const De = "UNIVER_DATA_VALIDATION_PLUGIN";
595
- var R;
596
- let P = (R = class extends oe {
597
- constructor(a, e, t) {
598
- super(), this._injector = e, this._commandService = t;
599
- }
600
- onStarting(a) {
591
+ }, __name(_a3, "DataValidationSheetController"), _a3);
592
+ DataValidationSheetController = __decorateClass$2([
593
+ OnLifecycle(LifecycleStages.Ready, DataValidationSheetController),
594
+ __decorateParam$2(0, Inject(SheetInterceptorService)),
595
+ __decorateParam$2(1, Inject(IUniverInstanceService)),
596
+ __decorateParam$2(2, Inject(DataValidationModel))
597
+ ], DataValidationSheetController);
598
+ var __defProp$1 = Object.defineProperty, __getOwnPropDesc$1 = Object.getOwnPropertyDescriptor, __decorateClass$1 = /* @__PURE__ */ __name((decorators, target, key, kind) => {
599
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc$1(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
600
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
601
+ return kind && result && __defProp$1(target, key, result), result;
602
+ }, "__decorateClass$1"), __decorateParam$1 = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam$1");
603
+ const PLUGIN_NAME = "UNIVER_DATA_VALIDATION_PLUGIN";
604
+ var _a4;
605
+ let UniverDataValidationPlugin = (_a4 = class extends Plugin {
606
+ constructor(_config, _injector, _commandService) {
607
+ super(), this._injector = _injector, this._commandService = _commandService;
608
+ }
609
+ onStarting() {
601
610
  [
602
- // model
603
- [h],
604
- // service
605
- [z],
606
- [A],
607
- [N]
608
- ].forEach(
609
- (e) => {
610
- a.add(e);
611
- }
612
- ), [
611
+ [DataValidationModel],
612
+ [DataValidatorRegistryService],
613
+ [DataValidationResourceController],
614
+ [DataValidationSheetController]
615
+ ].forEach((d) => this._injector.add(d)), [
613
616
  // command
614
- me,
615
- Se,
616
- ve,
617
- fe,
618
- Ee,
617
+ AddDataValidationCommand,
618
+ RemoveAllDataValidationCommand,
619
+ UpdateDataValidationOptionsCommand,
620
+ UpdateDataValidationSettingCommand,
621
+ RemoveDataValidationCommand,
619
622
  // mutation
620
- m,
621
- f,
622
- S
623
- ].forEach((e) => {
624
- this._commandService.registerCommand(e);
623
+ AddDataValidationMutation,
624
+ UpdateDataValidationMutation,
625
+ RemoveDataValidationMutation
626
+ ].forEach((command) => {
627
+ this._commandService.registerCommand(command);
625
628
  });
626
629
  }
627
- }, c(R, "pluginName", De), c(R, "type", C.UNIVER_SHEET), R);
628
- P = Ue([
629
- B(1, v(F)),
630
- B(2, T)
631
- ], P);
632
- s.BETWEEN + "", s.EQUAL + "", s.GREATER_THAN + "", s.GREATER_THAN_OR_EQUAL + "", s.LESS_THAN + "", s.LESS_THAN_OR_EQUAL + "", s.NOT_BETWEEN + "", s.NOT_EQUAL + "";
633
- const Le = {
634
- [s.BETWEEN]: "dataValidation.ruleName.between",
635
- [s.EQUAL]: "dataValidation.ruleName.equal",
636
- [s.GREATER_THAN]: "dataValidation.ruleName.greaterThan",
637
- [s.GREATER_THAN_OR_EQUAL]: "dataValidation.ruleName.greaterThanOrEqual",
638
- [s.LESS_THAN]: "dataValidation.ruleName.lessThan",
639
- [s.LESS_THAN_OR_EQUAL]: "dataValidation.ruleName.lessThanOrEqual",
640
- [s.NOT_BETWEEN]: "dataValidation.ruleName.notBetween",
641
- [s.NOT_EQUAL]: "dataValidation.ruleName.notEqual"
642
- }, Ce = {
643
- [s.BETWEEN]: "dataValidation.errorMsg.between",
644
- [s.EQUAL]: "dataValidation.errorMsg.equal",
645
- [s.GREATER_THAN]: "dataValidation.errorMsg.greaterThan",
646
- [s.GREATER_THAN_OR_EQUAL]: "dataValidation.errorMsg.greaterThanOrEqual",
647
- [s.LESS_THAN]: "dataValidation.errorMsg.lessThan",
648
- [s.LESS_THAN_OR_EQUAL]: "dataValidation.errorMsg.lessThanOrEqual",
649
- [s.NOT_BETWEEN]: "dataValidation.errorMsg.notBetween",
650
- [s.NOT_EQUAL]: "dataValidation.errorMsg.notEqual"
651
- }, je = {
652
- [s.BETWEEN]: "dataValidation.textLength.errorMsg.between",
653
- [s.EQUAL]: "dataValidation.textLength.errorMsg.equal",
654
- [s.GREATER_THAN]: "dataValidation.textLength.errorMsg.greaterThan",
655
- [s.GREATER_THAN_OR_EQUAL]: "dataValidation.textLength.errorMsg.greaterThanOrEqual",
656
- [s.LESS_THAN]: "dataValidation.textLength.errorMsg.lessThan",
657
- [s.LESS_THAN_OR_EQUAL]: "dataValidation.textLength.errorMsg.lessThanOrEqual",
658
- [s.NOT_BETWEEN]: "dataValidation.textLength.errorMsg.notBetween",
659
- [s.NOT_EQUAL]: "dataValidation.textLength.errorMsg.notEqual"
630
+ }, __name(_a4, "UniverDataValidationPlugin"), __publicField(_a4, "pluginName", PLUGIN_NAME), __publicField(_a4, "type", UniverInstanceType.UNIVER_SHEET), _a4);
631
+ UniverDataValidationPlugin = __decorateClass$1([
632
+ __decorateParam$1(1, Inject(Injector)),
633
+ __decorateParam$1(2, ICommandService)
634
+ ], UniverDataValidationPlugin);
635
+ DataValidationOperator.BETWEEN + "", DataValidationOperator.EQUAL + "", DataValidationOperator.GREATER_THAN + "", DataValidationOperator.GREATER_THAN_OR_EQUAL + "", DataValidationOperator.LESS_THAN + "", DataValidationOperator.LESS_THAN_OR_EQUAL + "", DataValidationOperator.NOT_BETWEEN + "", DataValidationOperator.NOT_EQUAL + "";
636
+ const OperatorTitleMap = {
637
+ [DataValidationOperator.BETWEEN]: "dataValidation.ruleName.between",
638
+ [DataValidationOperator.EQUAL]: "dataValidation.ruleName.equal",
639
+ [DataValidationOperator.GREATER_THAN]: "dataValidation.ruleName.greaterThan",
640
+ [DataValidationOperator.GREATER_THAN_OR_EQUAL]: "dataValidation.ruleName.greaterThanOrEqual",
641
+ [DataValidationOperator.LESS_THAN]: "dataValidation.ruleName.lessThan",
642
+ [DataValidationOperator.LESS_THAN_OR_EQUAL]: "dataValidation.ruleName.lessThanOrEqual",
643
+ [DataValidationOperator.NOT_BETWEEN]: "dataValidation.ruleName.notBetween",
644
+ [DataValidationOperator.NOT_EQUAL]: "dataValidation.ruleName.notEqual"
645
+ }, OperatorErrorTitleMap = {
646
+ [DataValidationOperator.BETWEEN]: "dataValidation.errorMsg.between",
647
+ [DataValidationOperator.EQUAL]: "dataValidation.errorMsg.equal",
648
+ [DataValidationOperator.GREATER_THAN]: "dataValidation.errorMsg.greaterThan",
649
+ [DataValidationOperator.GREATER_THAN_OR_EQUAL]: "dataValidation.errorMsg.greaterThanOrEqual",
650
+ [DataValidationOperator.LESS_THAN]: "dataValidation.errorMsg.lessThan",
651
+ [DataValidationOperator.LESS_THAN_OR_EQUAL]: "dataValidation.errorMsg.lessThanOrEqual",
652
+ [DataValidationOperator.NOT_BETWEEN]: "dataValidation.errorMsg.notBetween",
653
+ [DataValidationOperator.NOT_EQUAL]: "dataValidation.errorMsg.notEqual"
654
+ }, TextLengthErrorTitleMap = {
655
+ [DataValidationOperator.BETWEEN]: "dataValidation.textLength.errorMsg.between",
656
+ [DataValidationOperator.EQUAL]: "dataValidation.textLength.errorMsg.equal",
657
+ [DataValidationOperator.GREATER_THAN]: "dataValidation.textLength.errorMsg.greaterThan",
658
+ [DataValidationOperator.GREATER_THAN_OR_EQUAL]: "dataValidation.textLength.errorMsg.greaterThanOrEqual",
659
+ [DataValidationOperator.LESS_THAN]: "dataValidation.textLength.errorMsg.lessThan",
660
+ [DataValidationOperator.LESS_THAN_OR_EQUAL]: "dataValidation.textLength.errorMsg.lessThanOrEqual",
661
+ [DataValidationOperator.NOT_BETWEEN]: "dataValidation.textLength.errorMsg.notBetween",
662
+ [DataValidationOperator.NOT_EQUAL]: "dataValidation.textLength.errorMsg.notEqual"
660
663
  };
661
- var we = Object.defineProperty, be = Object.getOwnPropertyDescriptor, Be = (a, e, t, r) => {
662
- for (var n = r > 1 ? void 0 : r ? be(e, t) : e, o = a.length - 1, i; o >= 0; o--)
663
- (i = a[o]) && (n = (r ? i(e, t, n) : i(n)) || n);
664
- return r && n && we(e, t, n), n;
665
- }, $ = (a, e) => (t, r) => e(t, r, a);
666
- const x = "{FORMULA1}", H = "{FORMULA2}", Pe = {
667
- [s.BETWEEN]: "dataValidation.operators.between",
668
- [s.EQUAL]: "dataValidation.operators.equal",
669
- [s.GREATER_THAN]: "dataValidation.operators.greaterThan",
670
- [s.GREATER_THAN_OR_EQUAL]: "dataValidation.operators.greaterThanOrEqual",
671
- [s.LESS_THAN]: "dataValidation.operators.lessThan",
672
- [s.LESS_THAN_OR_EQUAL]: "dataValidation.operators.lessThanOrEqual",
673
- [s.NOT_BETWEEN]: "dataValidation.operators.notBetween",
674
- [s.NOT_EQUAL]: "dataValidation.operators.notEqual"
664
+ var __defProp2 = Object.defineProperty, __getOwnPropDesc = Object.getOwnPropertyDescriptor, __decorateClass = /* @__PURE__ */ __name((decorators, target, key, kind) => {
665
+ for (var result = kind > 1 ? void 0 : kind ? __getOwnPropDesc(target, key) : target, i = decorators.length - 1, decorator; i >= 0; i--)
666
+ (decorator = decorators[i]) && (result = (kind ? decorator(target, key, result) : decorator(result)) || result);
667
+ return kind && result && __defProp2(target, key, result), result;
668
+ }, "__decorateClass"), __decorateParam = /* @__PURE__ */ __name((index, decorator) => (target, key) => decorator(target, key, index), "__decorateParam");
669
+ const FORMULA1 = "{FORMULA1}", FORMULA2 = "{FORMULA2}", operatorNameMap = {
670
+ [DataValidationOperator.BETWEEN]: "dataValidation.operators.between",
671
+ [DataValidationOperator.EQUAL]: "dataValidation.operators.equal",
672
+ [DataValidationOperator.GREATER_THAN]: "dataValidation.operators.greaterThan",
673
+ [DataValidationOperator.GREATER_THAN_OR_EQUAL]: "dataValidation.operators.greaterThanOrEqual",
674
+ [DataValidationOperator.LESS_THAN]: "dataValidation.operators.lessThan",
675
+ [DataValidationOperator.LESS_THAN_OR_EQUAL]: "dataValidation.operators.lessThanOrEqual",
676
+ [DataValidationOperator.NOT_BETWEEN]: "dataValidation.operators.notBetween",
677
+ [DataValidationOperator.NOT_EQUAL]: "dataValidation.operators.notEqual"
675
678
  };
676
- let q = class {
677
- constructor(a, e) {
678
- c(this, "canvasRender", null);
679
- c(this, "dropdown");
680
- c(this, "optionsInput");
681
- this.localeService = a, this.injector = e;
679
+ var _a5;
680
+ let BaseDataValidator = (_a5 = class {
681
+ constructor(localeService, injector) {
682
+ __publicField(this, "canvasRender", null);
683
+ __publicField(this, "dropdown");
684
+ __publicField(this, "optionsInput");
685
+ this.localeService = localeService, this.injector = injector;
682
686
  }
683
687
  get operatorNames() {
684
- return this.operators.map((a) => this.localeService.t(Pe[a]));
688
+ return this.operators.map((operator) => this.localeService.t(operatorNameMap[operator]));
685
689
  }
686
690
  get titleStr() {
687
691
  return this.localeService.t(this.title);
688
692
  }
689
- skipDefaultFontRender(a, e, t) {
693
+ skipDefaultFontRender(rule, cellValue, pos) {
690
694
  return !1;
691
695
  }
692
- generateRuleName(a) {
693
- var t, r;
694
- if (!a.operator)
696
+ generateRuleName(rule) {
697
+ var _a6, _b;
698
+ if (!rule.operator)
695
699
  return this.titleStr;
696
- const e = this.localeService.t(Le[a.operator]).replace(x, (t = a.formula1) != null ? t : "").replace(H, (r = a.formula2) != null ? r : "");
697
- return `${this.titleStr} ${e}`;
700
+ const ruleName = this.localeService.t(OperatorTitleMap[rule.operator]).replace(FORMULA1, (_a6 = rule.formula1) != null ? _a6 : "").replace(FORMULA2, (_b = rule.formula2) != null ? _b : "");
701
+ return `${this.titleStr} ${ruleName}`;
698
702
  }
699
- generateRuleErrorMessage(a) {
700
- var t, r;
701
- return a.operator ? `${this.localeService.t(Ce[a.operator]).replace(x, (t = a.formula1) != null ? t : "").replace(H, (r = a.formula2) != null ? r : "")}` : this.titleStr;
703
+ generateRuleErrorMessage(rule) {
704
+ var _a6, _b;
705
+ return rule.operator ? `${this.localeService.t(OperatorErrorTitleMap[rule.operator]).replace(FORMULA1, (_a6 = rule.formula1) != null ? _a6 : "").replace(FORMULA2, (_b = rule.formula2) != null ? _b : "")}` : this.titleStr;
702
706
  }
703
- getRuleFinalError(a) {
704
- return a.showInputMessage && a.error ? a.error : this.generateRuleErrorMessage(a);
707
+ getRuleFinalError(rule) {
708
+ return rule.showInputMessage && rule.error ? rule.error : this.generateRuleErrorMessage(rule);
705
709
  }
706
- isEmptyCellValue(a) {
707
- return a === "" || a === void 0 || a === null;
710
+ isEmptyCellValue(cellValue) {
711
+ return cellValue === "" || cellValue === void 0 || cellValue === null;
708
712
  }
709
- async isValidType(a, e, t) {
713
+ async isValidType(cellInfo, formula, rule) {
710
714
  return !0;
711
715
  }
712
- transform(a, e, t) {
713
- return a;
716
+ transform(cellInfo, formula, rule) {
717
+ return cellInfo;
714
718
  }
715
- async validatorIsEqual(a, e, t) {
719
+ async validatorIsEqual(cellInfo, formula, rule) {
716
720
  return !0;
717
721
  }
718
- async validatorIsNotEqual(a, e, t) {
722
+ async validatorIsNotEqual(cellInfo, formula, rule) {
719
723
  return !0;
720
724
  }
721
- async validatorIsBetween(a, e, t) {
725
+ async validatorIsBetween(cellInfo, formula, rule) {
722
726
  return !0;
723
727
  }
724
- async validatorIsNotBetween(a, e, t) {
728
+ async validatorIsNotBetween(cellInfo, formula, rule) {
725
729
  return !0;
726
730
  }
727
- async validatorIsGreaterThan(a, e, t) {
731
+ async validatorIsGreaterThan(cellInfo, formula, rule) {
728
732
  return !0;
729
733
  }
730
- async validatorIsGreaterThanOrEqual(a, e, t) {
734
+ async validatorIsGreaterThanOrEqual(cellInfo, formula, rule) {
731
735
  return !0;
732
736
  }
733
- async validatorIsLessThan(a, e, t) {
737
+ async validatorIsLessThan(cellInfo, formula, rule) {
734
738
  return !0;
735
739
  }
736
- async validatorIsLessThanOrEqual(a, e, t) {
740
+ async validatorIsLessThanOrEqual(cellInfo, formula, rule) {
737
741
  return !0;
738
742
  }
739
- async validator(a, e) {
740
- const { value: t, unitId: r, subUnitId: n } = a, o = this.isEmptyCellValue(t), { allowBlank: i = !0, operator: d } = e;
741
- if (o)
742
- return i;
743
- const l = await this.parseFormula(e, r, n);
744
- if (!await this.isValidType(a, l, e))
743
+ async validator(cellInfo, rule) {
744
+ const { value: cellValue, unitId, subUnitId } = cellInfo, isEmpty = this.isEmptyCellValue(cellValue), { allowBlank = !0, operator } = rule;
745
+ if (isEmpty)
746
+ return allowBlank;
747
+ const formulaInfo = await this.parseFormula(rule, unitId, subUnitId);
748
+ if (!await this.isValidType(cellInfo, formulaInfo, rule))
745
749
  return !1;
746
- if (!G.isDefine(d))
750
+ if (!Tools.isDefine(operator))
747
751
  return !0;
748
- const u = this.transform(a, l, e);
749
- switch (d) {
750
- case s.BETWEEN:
751
- return this.validatorIsBetween(u, l, e);
752
- case s.EQUAL:
753
- return this.validatorIsEqual(u, l, e);
754
- case s.GREATER_THAN:
755
- return this.validatorIsGreaterThan(u, l, e);
756
- case s.GREATER_THAN_OR_EQUAL:
757
- return this.validatorIsGreaterThanOrEqual(u, l, e);
758
- case s.LESS_THAN:
759
- return this.validatorIsLessThan(u, l, e);
760
- case s.LESS_THAN_OR_EQUAL:
761
- return this.validatorIsLessThanOrEqual(u, l, e);
762
- case s.NOT_BETWEEN:
763
- return this.validatorIsNotBetween(u, l, e);
764
- case s.NOT_EQUAL:
765
- return this.validatorIsNotEqual(u, l, e);
752
+ const transformedCell = this.transform(cellInfo, formulaInfo, rule);
753
+ switch (operator) {
754
+ case DataValidationOperator.BETWEEN:
755
+ return this.validatorIsBetween(transformedCell, formulaInfo, rule);
756
+ case DataValidationOperator.EQUAL:
757
+ return this.validatorIsEqual(transformedCell, formulaInfo, rule);
758
+ case DataValidationOperator.GREATER_THAN:
759
+ return this.validatorIsGreaterThan(transformedCell, formulaInfo, rule);
760
+ case DataValidationOperator.GREATER_THAN_OR_EQUAL:
761
+ return this.validatorIsGreaterThanOrEqual(transformedCell, formulaInfo, rule);
762
+ case DataValidationOperator.LESS_THAN:
763
+ return this.validatorIsLessThan(transformedCell, formulaInfo, rule);
764
+ case DataValidationOperator.LESS_THAN_OR_EQUAL:
765
+ return this.validatorIsLessThanOrEqual(transformedCell, formulaInfo, rule);
766
+ case DataValidationOperator.NOT_BETWEEN:
767
+ return this.validatorIsNotBetween(transformedCell, formulaInfo, rule);
768
+ case DataValidationOperator.NOT_EQUAL:
769
+ return this.validatorIsNotEqual(transformedCell, formulaInfo, rule);
766
770
  default:
767
771
  throw new Error("Unknown operator.");
768
772
  }
769
773
  }
770
- };
771
- q = Be([
772
- $(0, v(ie)),
773
- $(1, v(F))
774
- ], q);
775
- const We = [
776
- s.BETWEEN,
777
- s.NOT_BETWEEN
774
+ }, __name(_a5, "BaseDataValidator"), _a5);
775
+ BaseDataValidator = __decorateClass([
776
+ __decorateParam(0, Inject(LocaleService)),
777
+ __decorateParam(1, Inject(Injector))
778
+ ], BaseDataValidator);
779
+ const TWO_FORMULA_OPERATOR_COUNT = [
780
+ DataValidationOperator.BETWEEN,
781
+ DataValidationOperator.NOT_BETWEEN
778
782
  ];
779
783
  export {
780
- me as AddDataValidationCommand,
781
- m as AddDataValidationMutation,
782
- q as BaseDataValidator,
783
- ce as DataValidationManager,
784
- h as DataValidationModel,
785
- A as DataValidationResourceController,
786
- N as DataValidationSheetController,
787
- ue as DataValidatorRegistryScope,
788
- z as DataValidatorRegistryService,
789
- Se as RemoveAllDataValidationCommand,
790
- Ee as RemoveDataValidationCommand,
791
- S as RemoveDataValidationMutation,
792
- We as TWO_FORMULA_OPERATOR_COUNT,
793
- je as TextLengthErrorTitleMap,
794
- P as UniverDataValidationPlugin,
795
- f as UpdateDataValidationMutation,
796
- ve as UpdateDataValidationOptionsCommand,
797
- fe as UpdateDataValidationSettingCommand,
798
- g as UpdateRuleType,
799
- Ge as createDefaultNewRule,
800
- X as getRuleOptions,
801
- K as getRuleSetting,
802
- Qe as removeDataValidationUndoFactory
784
+ AddDataValidationCommand,
785
+ AddDataValidationMutation,
786
+ BaseDataValidator,
787
+ DataValidationManager,
788
+ DataValidationModel,
789
+ DataValidationResourceController,
790
+ DataValidationSheetController,
791
+ DataValidatorRegistryScope,
792
+ DataValidatorRegistryService,
793
+ RemoveAllDataValidationCommand,
794
+ RemoveDataValidationCommand,
795
+ RemoveDataValidationMutation,
796
+ TWO_FORMULA_OPERATOR_COUNT,
797
+ TextLengthErrorTitleMap,
798
+ UniverDataValidationPlugin,
799
+ UpdateDataValidationMutation,
800
+ UpdateDataValidationOptionsCommand,
801
+ UpdateDataValidationSettingCommand,
802
+ UpdateRuleType,
803
+ createDefaultNewRule,
804
+ getRuleOptions,
805
+ getRuleSetting,
806
+ removeDataValidationUndoFactory
803
807
  };