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