@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/cjs/index.js +1 -1
- package/lib/es/index.js +594 -590
- package/lib/types/plugin.d.ts +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +10 -10
package/lib/es/index.js
CHANGED
|
@@ -1,136 +1,142 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
|
|
8
|
-
|
|
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
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
}
|
|
15
|
-
_addValidatorToScope(
|
|
16
|
-
this._validatorByScopes.has(
|
|
17
|
-
const
|
|
18
|
-
if (
|
|
19
|
-
throw new Error(`Validator item with the same id ${
|
|
20
|
-
|
|
21
|
-
}
|
|
22
|
-
_removeValidatorFromScope(
|
|
23
|
-
const
|
|
24
|
-
if (!
|
|
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
|
|
27
|
-
|
|
28
|
-
}
|
|
29
|
-
register(
|
|
30
|
-
return this._validatorMap.set(
|
|
31
|
-
this._addValidatorToScope(
|
|
32
|
-
}) : this._addValidatorToScope(
|
|
33
|
-
this._validatorMap.delete(
|
|
34
|
-
this._removeValidatorFromScope(
|
|
35
|
-
}) : this._removeValidatorFromScope(
|
|
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(
|
|
39
|
-
return this._validatorMap.get(
|
|
39
|
+
getValidatorItem(id) {
|
|
40
|
+
return this._validatorMap.get(id);
|
|
40
41
|
}
|
|
41
|
-
getValidatorsByScope(
|
|
42
|
-
return this._validatorByScopes.get(
|
|
42
|
+
getValidatorsByScope(scope) {
|
|
43
|
+
return this._validatorByScopes.get(scope);
|
|
43
44
|
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
|
|
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:
|
|
49
|
-
operator:
|
|
50
|
-
formula1:
|
|
51
|
-
formula2:
|
|
52
|
-
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
|
-
|
|
58
|
+
__name(getRuleSetting, "getRuleSetting");
|
|
59
|
+
function getRuleOptions(rule) {
|
|
56
60
|
return {
|
|
57
|
-
error:
|
|
58
|
-
errorStyle:
|
|
59
|
-
errorTitle:
|
|
60
|
-
imeMode:
|
|
61
|
-
prompt:
|
|
62
|
-
promptTitle:
|
|
63
|
-
showDropDown:
|
|
64
|
-
showErrorMessage:
|
|
65
|
-
showInputMessage:
|
|
66
|
-
renderMode:
|
|
67
|
-
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
|
-
|
|
71
|
-
|
|
74
|
+
__name(getRuleOptions, "getRuleOptions");
|
|
75
|
+
function createDefaultNewRule(accessor) {
|
|
76
|
+
const currentRanges = accessor.get(SheetsSelectionsService).getCurrentSelections().map((s) => s.range);
|
|
72
77
|
return {
|
|
73
|
-
uid:
|
|
74
|
-
type:
|
|
75
|
-
operator:
|
|
78
|
+
uid: Tools.generateRandomId(6),
|
|
79
|
+
type: DataValidationType.DECIMAL,
|
|
80
|
+
operator: DataValidationOperator.EQUAL,
|
|
76
81
|
formula1: "100",
|
|
77
|
-
ranges:
|
|
82
|
+
ranges: currentRanges != null ? currentRanges : [{ startColumn: 0, endColumn: 0, startRow: 0, endRow: 0 }]
|
|
78
83
|
};
|
|
79
84
|
}
|
|
80
|
-
|
|
81
|
-
|
|
85
|
+
__name(createDefaultNewRule, "createDefaultNewRule");
|
|
86
|
+
const _DataValidationManager = class _DataValidationManager extends Disposable {
|
|
87
|
+
constructor(unitId, subUnitId) {
|
|
82
88
|
super();
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
this.unitId =
|
|
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(
|
|
99
|
-
return this._dataValidationMap.get(
|
|
104
|
+
getRuleById(id) {
|
|
105
|
+
return this._dataValidationMap.get(id);
|
|
100
106
|
}
|
|
101
|
-
getRuleIndex(
|
|
102
|
-
return this._dataValidations.findIndex((
|
|
107
|
+
getRuleIndex(id) {
|
|
108
|
+
return this._dataValidations.findIndex((rule) => rule.uid === id);
|
|
103
109
|
}
|
|
104
|
-
addRule(
|
|
105
|
-
const
|
|
106
|
-
typeof
|
|
107
|
-
this._dataValidationMap.set(
|
|
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(
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
}
|
|
114
|
-
updateRule(
|
|
115
|
-
const
|
|
116
|
-
if (!
|
|
117
|
-
throw new Error(`Data validation rule is not found, ruleId: ${
|
|
118
|
-
const
|
|
119
|
-
switch (
|
|
120
|
-
case
|
|
121
|
-
|
|
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
|
|
125
|
-
Object.assign(
|
|
130
|
+
case UpdateRuleType.SETTING: {
|
|
131
|
+
Object.assign(rule, getRuleSetting(payload.payload));
|
|
126
132
|
break;
|
|
127
133
|
}
|
|
128
|
-
case
|
|
129
|
-
Object.assign(
|
|
134
|
+
case UpdateRuleType.OPTIONS: {
|
|
135
|
+
Object.assign(rule, getRuleOptions(payload.payload));
|
|
130
136
|
break;
|
|
131
137
|
}
|
|
132
138
|
}
|
|
133
|
-
return this._dataValidations[
|
|
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(
|
|
142
|
-
return
|
|
147
|
+
validator(_content, _rule, _pos, _onComplete) {
|
|
148
|
+
return DataValidationStatus.VALID;
|
|
143
149
|
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
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
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
this._logService =
|
|
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(
|
|
167
|
-
this._managerCreator =
|
|
174
|
+
setManagerCreator(creator) {
|
|
175
|
+
this._managerCreator = creator;
|
|
168
176
|
}
|
|
169
|
-
ensureManager(
|
|
170
|
-
this._model.has(
|
|
171
|
-
const
|
|
172
|
-
if (
|
|
173
|
-
return
|
|
174
|
-
const
|
|
175
|
-
return
|
|
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(
|
|
178
|
-
this.ensureManager(
|
|
179
|
-
rule
|
|
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
|
|
182
|
-
subUnitId
|
|
183
|
-
source
|
|
189
|
+
unitId,
|
|
190
|
+
subUnitId,
|
|
191
|
+
source
|
|
184
192
|
});
|
|
185
193
|
}
|
|
186
|
-
addRule(
|
|
194
|
+
addRule(unitId, subUnitId, rule, source, index) {
|
|
187
195
|
try {
|
|
188
|
-
const
|
|
189
|
-
(Array.isArray(
|
|
190
|
-
this._addRuleSideEffect(
|
|
191
|
-
}),
|
|
192
|
-
} catch (
|
|
193
|
-
this._logService.error(
|
|
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(
|
|
204
|
+
updateRule(unitId, subUnitId, ruleId, payload, source) {
|
|
197
205
|
try {
|
|
198
|
-
const
|
|
206
|
+
const rule = this.ensureManager(unitId, subUnitId).updateRule(ruleId, payload);
|
|
199
207
|
this._ruleChange$.next({
|
|
200
|
-
rule
|
|
208
|
+
rule,
|
|
201
209
|
type: "update",
|
|
202
|
-
unitId
|
|
203
|
-
subUnitId
|
|
204
|
-
source
|
|
210
|
+
unitId,
|
|
211
|
+
subUnitId,
|
|
212
|
+
source
|
|
205
213
|
});
|
|
206
|
-
} catch (
|
|
207
|
-
this._logService.error(
|
|
214
|
+
} catch (error) {
|
|
215
|
+
this._logService.error(error);
|
|
208
216
|
}
|
|
209
217
|
}
|
|
210
|
-
removeRule(
|
|
218
|
+
removeRule(unitId, subUnitId, ruleId, source) {
|
|
211
219
|
try {
|
|
212
|
-
const
|
|
213
|
-
|
|
214
|
-
rule:
|
|
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
|
|
217
|
-
subUnitId
|
|
218
|
-
source
|
|
224
|
+
unitId,
|
|
225
|
+
subUnitId,
|
|
226
|
+
source
|
|
219
227
|
}));
|
|
220
|
-
} catch (
|
|
221
|
-
this._logService.error(
|
|
228
|
+
} catch (error) {
|
|
229
|
+
this._logService.error(error);
|
|
222
230
|
}
|
|
223
231
|
}
|
|
224
|
-
getRuleById(
|
|
225
|
-
return this.ensureManager(
|
|
232
|
+
getRuleById(unitId, subUnitId, ruleId) {
|
|
233
|
+
return this.ensureManager(unitId, subUnitId).getRuleById(ruleId);
|
|
226
234
|
}
|
|
227
|
-
getRuleIndex(
|
|
228
|
-
return this.ensureManager(
|
|
235
|
+
getRuleIndex(unitId, subUnitId, ruleId) {
|
|
236
|
+
return this.ensureManager(unitId, subUnitId).getRuleIndex(ruleId);
|
|
229
237
|
}
|
|
230
|
-
getRules(
|
|
231
|
-
return this.ensureManager(
|
|
238
|
+
getRules(unitId, subUnitId) {
|
|
239
|
+
return this.ensureManager(unitId, subUnitId).getDataValidations();
|
|
232
240
|
}
|
|
233
|
-
validator(
|
|
234
|
-
const { unitId
|
|
235
|
-
return this.ensureManager(
|
|
236
|
-
|
|
237
|
-
unitId
|
|
238
|
-
subUnitId
|
|
239
|
-
ruleId:
|
|
240
|
-
status
|
|
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(
|
|
245
|
-
const
|
|
246
|
-
if (!
|
|
252
|
+
getUnitRules(unitId) {
|
|
253
|
+
const unitMap = this._model.get(unitId);
|
|
254
|
+
if (!unitMap)
|
|
247
255
|
return [];
|
|
248
|
-
const
|
|
249
|
-
return
|
|
250
|
-
|
|
251
|
-
}),
|
|
252
|
-
}
|
|
253
|
-
deleteUnitRules(
|
|
254
|
-
this._model.delete(
|
|
255
|
-
}
|
|
256
|
-
getSubUnitIds(
|
|
257
|
-
var
|
|
258
|
-
return Array.from((
|
|
259
|
-
}
|
|
260
|
-
};
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
],
|
|
264
|
-
const
|
|
265
|
-
type:
|
|
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(
|
|
268
|
-
if (!
|
|
275
|
+
handler(accessor, params) {
|
|
276
|
+
if (!params)
|
|
269
277
|
return !1;
|
|
270
|
-
const { unitId
|
|
271
|
-
return
|
|
278
|
+
const { unitId, subUnitId, rule, index, source = "command" } = params;
|
|
279
|
+
return accessor.get(DataValidationModel).addRule(unitId, subUnitId, rule, source, index), !0;
|
|
272
280
|
}
|
|
273
|
-
},
|
|
274
|
-
type:
|
|
281
|
+
}, RemoveDataValidationMutation = {
|
|
282
|
+
type: CommandType.MUTATION,
|
|
275
283
|
id: "data-validation.mutation.removeRule",
|
|
276
|
-
handler(
|
|
277
|
-
if (!
|
|
284
|
+
handler(accessor, params) {
|
|
285
|
+
if (!params)
|
|
278
286
|
return !1;
|
|
279
|
-
const { unitId
|
|
280
|
-
return Array.isArray(
|
|
281
|
-
|
|
282
|
-
}) :
|
|
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
|
-
},
|
|
285
|
-
type:
|
|
292
|
+
}, UpdateDataValidationMutation = {
|
|
293
|
+
type: CommandType.MUTATION,
|
|
286
294
|
id: "data-validation.mutation.updateRule",
|
|
287
|
-
handler(
|
|
288
|
-
if (!
|
|
295
|
+
handler(accessor, params) {
|
|
296
|
+
if (!params)
|
|
289
297
|
return !1;
|
|
290
|
-
const { unitId
|
|
291
|
-
return
|
|
298
|
+
const { unitId, subUnitId, ruleId, payload, source = "command" } = params;
|
|
299
|
+
return accessor.get(DataValidationModel).updateRule(unitId, subUnitId, ruleId, payload, source), !0;
|
|
292
300
|
}
|
|
293
|
-
},
|
|
294
|
-
type:
|
|
301
|
+
}, AddDataValidationCommand = {
|
|
302
|
+
type: CommandType.COMMAND,
|
|
295
303
|
id: "data-validation.command.addRule",
|
|
296
|
-
async handler(
|
|
297
|
-
if (
|
|
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
|
|
300
|
-
...
|
|
307
|
+
const { rule, unitId, subUnitId } = params, commandService = accessor.get(ICommandService), undoRedoService = accessor.get(IUndoRedoService), mutationParams = {
|
|
308
|
+
...params,
|
|
301
309
|
rule: {
|
|
302
|
-
...
|
|
303
|
-
ranges: [
|
|
310
|
+
...params.rule,
|
|
311
|
+
ranges: [params.rule.range]
|
|
304
312
|
}
|
|
305
|
-
},
|
|
306
|
-
id:
|
|
307
|
-
params:
|
|
308
|
-
}],
|
|
309
|
-
id:
|
|
313
|
+
}, redoMutations = [{
|
|
314
|
+
id: AddDataValidationMutation.id,
|
|
315
|
+
params: mutationParams
|
|
316
|
+
}], undoMutations = [{
|
|
317
|
+
id: RemoveDataValidationMutation.id,
|
|
310
318
|
params: {
|
|
311
|
-
unitId
|
|
312
|
-
subUnitId
|
|
313
|
-
ruleId:
|
|
319
|
+
unitId,
|
|
320
|
+
subUnitId,
|
|
321
|
+
ruleId: rule.uid
|
|
314
322
|
}
|
|
315
323
|
}];
|
|
316
|
-
return
|
|
317
|
-
unitID:
|
|
318
|
-
redoMutations
|
|
319
|
-
undoMutations
|
|
320
|
-
}), await
|
|
321
|
-
}
|
|
322
|
-
},
|
|
323
|
-
const
|
|
324
|
-
if (Array.isArray(
|
|
325
|
-
const
|
|
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:
|
|
335
|
+
id: AddDataValidationMutation.id,
|
|
328
336
|
params: {
|
|
329
|
-
unitId
|
|
330
|
-
subUnitId
|
|
331
|
-
rule:
|
|
332
|
-
source
|
|
337
|
+
unitId,
|
|
338
|
+
subUnitId,
|
|
339
|
+
rule: rules,
|
|
340
|
+
source
|
|
333
341
|
}
|
|
334
342
|
}];
|
|
335
343
|
}
|
|
336
344
|
return [{
|
|
337
|
-
id:
|
|
345
|
+
id: AddDataValidationMutation.id,
|
|
338
346
|
params: {
|
|
339
|
-
unitId
|
|
340
|
-
subUnitId
|
|
347
|
+
unitId,
|
|
348
|
+
subUnitId,
|
|
341
349
|
rule: {
|
|
342
|
-
...
|
|
350
|
+
...dataValidationModel.getRuleById(unitId, subUnitId, ruleId)
|
|
343
351
|
},
|
|
344
|
-
index:
|
|
352
|
+
index: dataValidationModel.getRuleIndex(unitId, subUnitId, ruleId)
|
|
345
353
|
}
|
|
346
354
|
}];
|
|
347
|
-
},
|
|
348
|
-
type:
|
|
355
|
+
}, "removeDataValidationUndoFactory"), RemoveDataValidationCommand = {
|
|
356
|
+
type: CommandType.COMMAND,
|
|
349
357
|
id: "data-validation.command.removeRule",
|
|
350
|
-
handler(
|
|
351
|
-
if (!
|
|
358
|
+
handler(accessor, params) {
|
|
359
|
+
if (!params)
|
|
352
360
|
return !1;
|
|
353
|
-
const { unitId
|
|
354
|
-
id:
|
|
355
|
-
params
|
|
356
|
-
}],
|
|
357
|
-
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
|
|
360
|
-
subUnitId
|
|
367
|
+
unitId,
|
|
368
|
+
subUnitId,
|
|
361
369
|
rule: {
|
|
362
|
-
...
|
|
370
|
+
...dataValidationModel.getRuleById(unitId, subUnitId, ruleId)
|
|
363
371
|
},
|
|
364
|
-
index:
|
|
372
|
+
index: dataValidationModel.getRuleIndex(unitId, subUnitId, ruleId)
|
|
365
373
|
}
|
|
366
374
|
}];
|
|
367
|
-
return
|
|
368
|
-
undoMutations
|
|
369
|
-
redoMutations
|
|
370
|
-
unitID:
|
|
371
|
-
}),
|
|
372
|
-
}
|
|
373
|
-
},
|
|
374
|
-
type:
|
|
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(
|
|
377
|
-
if (
|
|
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
|
|
380
|
-
if (!
|
|
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
|
|
384
|
-
subUnitId
|
|
385
|
-
ruleId
|
|
390
|
+
const mutationParams = {
|
|
391
|
+
unitId,
|
|
392
|
+
subUnitId,
|
|
393
|
+
ruleId,
|
|
386
394
|
payload: {
|
|
387
|
-
type:
|
|
388
|
-
payload:
|
|
395
|
+
type: UpdateRuleType.OPTIONS,
|
|
396
|
+
payload: options
|
|
389
397
|
}
|
|
390
|
-
},
|
|
391
|
-
id:
|
|
392
|
-
params:
|
|
393
|
-
}],
|
|
394
|
-
unitId
|
|
395
|
-
subUnitId
|
|
396
|
-
ruleId
|
|
398
|
+
}, redoMutations = [{
|
|
399
|
+
id: UpdateDataValidationMutation.id,
|
|
400
|
+
params: mutationParams
|
|
401
|
+
}], undoMutationParams = {
|
|
402
|
+
unitId,
|
|
403
|
+
subUnitId,
|
|
404
|
+
ruleId,
|
|
397
405
|
payload: {
|
|
398
|
-
type:
|
|
399
|
-
payload:
|
|
406
|
+
type: UpdateRuleType.OPTIONS,
|
|
407
|
+
payload: getRuleOptions(rule)
|
|
400
408
|
}
|
|
401
|
-
},
|
|
402
|
-
id:
|
|
403
|
-
params:
|
|
409
|
+
}, undoMutations = [{
|
|
410
|
+
id: UpdateDataValidationMutation.id,
|
|
411
|
+
params: undoMutationParams
|
|
404
412
|
}];
|
|
405
|
-
return
|
|
406
|
-
unitID:
|
|
407
|
-
redoMutations
|
|
408
|
-
undoMutations
|
|
409
|
-
}),
|
|
410
|
-
}
|
|
411
|
-
},
|
|
412
|
-
type:
|
|
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(
|
|
415
|
-
if (
|
|
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
|
|
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
|
|
421
|
-
if (!
|
|
428
|
+
const rule = dataValidationModel.getRuleById(unitId, subUnitId, ruleId);
|
|
429
|
+
if (!rule || !validator.validatorFormula({ ...rule, ...setting }, unitId, subUnitId).success)
|
|
422
430
|
return !1;
|
|
423
|
-
const
|
|
424
|
-
unitId
|
|
425
|
-
subUnitId
|
|
426
|
-
ruleId
|
|
431
|
+
const mutationParams = {
|
|
432
|
+
unitId,
|
|
433
|
+
subUnitId,
|
|
434
|
+
ruleId,
|
|
427
435
|
payload: {
|
|
428
|
-
type:
|
|
429
|
-
payload:
|
|
436
|
+
type: UpdateRuleType.SETTING,
|
|
437
|
+
payload: setting
|
|
430
438
|
}
|
|
431
|
-
},
|
|
432
|
-
id:
|
|
433
|
-
params:
|
|
434
|
-
}],
|
|
435
|
-
unitId
|
|
436
|
-
subUnitId
|
|
437
|
-
ruleId
|
|
439
|
+
}, redoMutations = [{
|
|
440
|
+
id: UpdateDataValidationMutation.id,
|
|
441
|
+
params: mutationParams
|
|
442
|
+
}], undoMutationParams = {
|
|
443
|
+
unitId,
|
|
444
|
+
subUnitId,
|
|
445
|
+
ruleId,
|
|
438
446
|
payload: {
|
|
439
|
-
type:
|
|
440
|
-
payload:
|
|
447
|
+
type: UpdateRuleType.SETTING,
|
|
448
|
+
payload: getRuleSetting(rule)
|
|
441
449
|
}
|
|
442
|
-
},
|
|
443
|
-
id:
|
|
444
|
-
params:
|
|
450
|
+
}, undoMutations = [{
|
|
451
|
+
id: UpdateDataValidationMutation.id,
|
|
452
|
+
params: undoMutationParams
|
|
445
453
|
}];
|
|
446
|
-
return
|
|
447
|
-
unitID:
|
|
448
|
-
redoMutations
|
|
449
|
-
undoMutations
|
|
450
|
-
}),
|
|
451
|
-
}
|
|
452
|
-
},
|
|
453
|
-
type:
|
|
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(
|
|
456
|
-
if (!
|
|
463
|
+
handler(accessor, params) {
|
|
464
|
+
if (!params)
|
|
457
465
|
return !1;
|
|
458
|
-
const { unitId
|
|
459
|
-
unitId
|
|
460
|
-
subUnitId
|
|
461
|
-
ruleId:
|
|
462
|
-
},
|
|
463
|
-
id:
|
|
464
|
-
params:
|
|
465
|
-
}],
|
|
466
|
-
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
|
|
469
|
-
subUnitId
|
|
470
|
-
rule:
|
|
476
|
+
unitId,
|
|
477
|
+
subUnitId,
|
|
478
|
+
rule: currentRules
|
|
471
479
|
}
|
|
472
480
|
}];
|
|
473
|
-
return
|
|
474
|
-
redoMutations
|
|
475
|
-
undoMutations
|
|
476
|
-
unitID:
|
|
477
|
-
}),
|
|
481
|
+
return undoRedoService.pushUndoRedo({
|
|
482
|
+
redoMutations,
|
|
483
|
+
undoMutations,
|
|
484
|
+
unitID: unitId
|
|
485
|
+
}), commandService.executeCommand(RemoveDataValidationMutation.id, redoParams), !0;
|
|
478
486
|
}
|
|
479
487
|
};
|
|
480
|
-
var
|
|
481
|
-
for (var
|
|
482
|
-
(
|
|
483
|
-
return
|
|
484
|
-
},
|
|
485
|
-
const
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
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
|
|
492
|
-
const
|
|
493
|
-
return
|
|
494
|
-
|
|
495
|
-
}), JSON.stringify(
|
|
496
|
-
},
|
|
497
|
-
if (!
|
|
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(
|
|
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:
|
|
508
|
-
businesses: [
|
|
509
|
-
toJson: (
|
|
510
|
-
parseJson: (
|
|
511
|
-
onUnLoad: (
|
|
512
|
-
this._dataValidationModel.deleteUnitRules(
|
|
513
|
-
},
|
|
514
|
-
onLoad: (
|
|
515
|
-
Object.keys(
|
|
516
|
-
|
|
517
|
-
this._dataValidationModel.addRule(
|
|
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
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
],
|
|
531
|
-
var
|
|
532
|
-
for (var
|
|
533
|
-
(
|
|
534
|
-
return
|
|
535
|
-
},
|
|
536
|
-
let
|
|
537
|
-
constructor(
|
|
538
|
-
super(), this._sheetInterceptorService =
|
|
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: (
|
|
544
|
-
var
|
|
545
|
-
if (
|
|
546
|
-
const
|
|
547
|
-
if (!
|
|
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
|
|
550
|
-
if (!
|
|
558
|
+
const subUnitId = params.subUnitId || ((_a6 = workbook.getActiveSheet()) == null ? void 0 : _a6.getSheetId());
|
|
559
|
+
if (!subUnitId)
|
|
551
560
|
return { redos: [], undos: [] };
|
|
552
|
-
const
|
|
553
|
-
if (!
|
|
561
|
+
const manager = this._dataValidationModel.ensureManager(unitId, subUnitId);
|
|
562
|
+
if (!manager)
|
|
554
563
|
return { redos: [], undos: [] };
|
|
555
|
-
const
|
|
556
|
-
unitId
|
|
557
|
-
subUnitId
|
|
558
|
-
ruleId:
|
|
564
|
+
const rules = manager.getDataValidations(), ids = rules.map((i) => i.uid), redoParams = {
|
|
565
|
+
unitId,
|
|
566
|
+
subUnitId,
|
|
567
|
+
ruleId: ids,
|
|
559
568
|
source: "patched"
|
|
560
|
-
},
|
|
561
|
-
unitId
|
|
562
|
-
subUnitId
|
|
563
|
-
rule:
|
|
569
|
+
}, undoParams = {
|
|
570
|
+
unitId,
|
|
571
|
+
subUnitId,
|
|
572
|
+
rule: rules,
|
|
564
573
|
source: "patched"
|
|
565
574
|
};
|
|
566
575
|
return {
|
|
567
576
|
redos: [{
|
|
568
|
-
id:
|
|
569
|
-
params:
|
|
577
|
+
id: RemoveDataValidationMutation.id,
|
|
578
|
+
params: redoParams
|
|
570
579
|
}],
|
|
571
580
|
undos: [{
|
|
572
|
-
id:
|
|
573
|
-
params:
|
|
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
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
],
|
|
589
|
-
var
|
|
590
|
-
for (var
|
|
591
|
-
(
|
|
592
|
-
return
|
|
593
|
-
},
|
|
594
|
-
const
|
|
595
|
-
var
|
|
596
|
-
let
|
|
597
|
-
constructor(
|
|
598
|
-
super(), this._injector =
|
|
599
|
-
}
|
|
600
|
-
onStarting(
|
|
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
|
-
|
|
603
|
-
[
|
|
604
|
-
|
|
605
|
-
[
|
|
606
|
-
|
|
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
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
617
|
+
AddDataValidationCommand,
|
|
618
|
+
RemoveAllDataValidationCommand,
|
|
619
|
+
UpdateDataValidationOptionsCommand,
|
|
620
|
+
UpdateDataValidationSettingCommand,
|
|
621
|
+
RemoveDataValidationCommand,
|
|
619
622
|
// mutation
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
].forEach((
|
|
624
|
-
this._commandService.registerCommand(
|
|
623
|
+
AddDataValidationMutation,
|
|
624
|
+
UpdateDataValidationMutation,
|
|
625
|
+
RemoveDataValidationMutation
|
|
626
|
+
].forEach((command) => {
|
|
627
|
+
this._commandService.registerCommand(command);
|
|
625
628
|
});
|
|
626
629
|
}
|
|
627
|
-
},
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
],
|
|
632
|
-
|
|
633
|
-
const
|
|
634
|
-
[
|
|
635
|
-
[
|
|
636
|
-
[
|
|
637
|
-
[
|
|
638
|
-
[
|
|
639
|
-
[
|
|
640
|
-
[
|
|
641
|
-
[
|
|
642
|
-
},
|
|
643
|
-
[
|
|
644
|
-
[
|
|
645
|
-
[
|
|
646
|
-
[
|
|
647
|
-
[
|
|
648
|
-
[
|
|
649
|
-
[
|
|
650
|
-
[
|
|
651
|
-
},
|
|
652
|
-
[
|
|
653
|
-
[
|
|
654
|
-
[
|
|
655
|
-
[
|
|
656
|
-
[
|
|
657
|
-
[
|
|
658
|
-
[
|
|
659
|
-
[
|
|
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
|
|
662
|
-
for (var
|
|
663
|
-
(
|
|
664
|
-
return
|
|
665
|
-
},
|
|
666
|
-
const
|
|
667
|
-
[
|
|
668
|
-
[
|
|
669
|
-
[
|
|
670
|
-
[
|
|
671
|
-
[
|
|
672
|
-
[
|
|
673
|
-
[
|
|
674
|
-
[
|
|
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
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
this
|
|
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((
|
|
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(
|
|
693
|
+
skipDefaultFontRender(rule, cellValue, pos) {
|
|
690
694
|
return !1;
|
|
691
695
|
}
|
|
692
|
-
generateRuleName(
|
|
693
|
-
var
|
|
694
|
-
if (!
|
|
696
|
+
generateRuleName(rule) {
|
|
697
|
+
var _a6, _b;
|
|
698
|
+
if (!rule.operator)
|
|
695
699
|
return this.titleStr;
|
|
696
|
-
const
|
|
697
|
-
return `${this.titleStr} ${
|
|
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(
|
|
700
|
-
var
|
|
701
|
-
return
|
|
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(
|
|
704
|
-
return
|
|
707
|
+
getRuleFinalError(rule) {
|
|
708
|
+
return rule.showInputMessage && rule.error ? rule.error : this.generateRuleErrorMessage(rule);
|
|
705
709
|
}
|
|
706
|
-
isEmptyCellValue(
|
|
707
|
-
return
|
|
710
|
+
isEmptyCellValue(cellValue) {
|
|
711
|
+
return cellValue === "" || cellValue === void 0 || cellValue === null;
|
|
708
712
|
}
|
|
709
|
-
async isValidType(
|
|
713
|
+
async isValidType(cellInfo, formula, rule) {
|
|
710
714
|
return !0;
|
|
711
715
|
}
|
|
712
|
-
transform(
|
|
713
|
-
return
|
|
716
|
+
transform(cellInfo, formula, rule) {
|
|
717
|
+
return cellInfo;
|
|
714
718
|
}
|
|
715
|
-
async validatorIsEqual(
|
|
719
|
+
async validatorIsEqual(cellInfo, formula, rule) {
|
|
716
720
|
return !0;
|
|
717
721
|
}
|
|
718
|
-
async validatorIsNotEqual(
|
|
722
|
+
async validatorIsNotEqual(cellInfo, formula, rule) {
|
|
719
723
|
return !0;
|
|
720
724
|
}
|
|
721
|
-
async validatorIsBetween(
|
|
725
|
+
async validatorIsBetween(cellInfo, formula, rule) {
|
|
722
726
|
return !0;
|
|
723
727
|
}
|
|
724
|
-
async validatorIsNotBetween(
|
|
728
|
+
async validatorIsNotBetween(cellInfo, formula, rule) {
|
|
725
729
|
return !0;
|
|
726
730
|
}
|
|
727
|
-
async validatorIsGreaterThan(
|
|
731
|
+
async validatorIsGreaterThan(cellInfo, formula, rule) {
|
|
728
732
|
return !0;
|
|
729
733
|
}
|
|
730
|
-
async validatorIsGreaterThanOrEqual(
|
|
734
|
+
async validatorIsGreaterThanOrEqual(cellInfo, formula, rule) {
|
|
731
735
|
return !0;
|
|
732
736
|
}
|
|
733
|
-
async validatorIsLessThan(
|
|
737
|
+
async validatorIsLessThan(cellInfo, formula, rule) {
|
|
734
738
|
return !0;
|
|
735
739
|
}
|
|
736
|
-
async validatorIsLessThanOrEqual(
|
|
740
|
+
async validatorIsLessThanOrEqual(cellInfo, formula, rule) {
|
|
737
741
|
return !0;
|
|
738
742
|
}
|
|
739
|
-
async validator(
|
|
740
|
-
const { value:
|
|
741
|
-
if (
|
|
742
|
-
return
|
|
743
|
-
const
|
|
744
|
-
if (!await this.isValidType(
|
|
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 (!
|
|
750
|
+
if (!Tools.isDefine(operator))
|
|
747
751
|
return !0;
|
|
748
|
-
const
|
|
749
|
-
switch (
|
|
750
|
-
case
|
|
751
|
-
return this.validatorIsBetween(
|
|
752
|
-
case
|
|
753
|
-
return this.validatorIsEqual(
|
|
754
|
-
case
|
|
755
|
-
return this.validatorIsGreaterThan(
|
|
756
|
-
case
|
|
757
|
-
return this.validatorIsGreaterThanOrEqual(
|
|
758
|
-
case
|
|
759
|
-
return this.validatorIsLessThan(
|
|
760
|
-
case
|
|
761
|
-
return this.validatorIsLessThanOrEqual(
|
|
762
|
-
case
|
|
763
|
-
return this.validatorIsNotBetween(
|
|
764
|
-
case
|
|
765
|
-
return this.validatorIsNotEqual(
|
|
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
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
],
|
|
775
|
-
const
|
|
776
|
-
|
|
777
|
-
|
|
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
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
784
|
-
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
|
|
793
|
-
|
|
794
|
-
|
|
795
|
-
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
799
|
-
|
|
800
|
-
|
|
801
|
-
|
|
802
|
-
|
|
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
|
};
|