@univerjs/data-validation 0.6.10-nightly.202504161609 → 0.6.10
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/LICENSE +176 -0
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +147 -140
- package/lib/index.js +147 -140
- package/lib/types/index.d.ts +2 -0
- package/lib/types/types/const/operator-text-map.d.ts +2 -2
- package/lib/types/validators/base-data-validator.d.ts +14 -1
- package/lib/umd/index.js +1 -1
- package/package.json +5 -5
package/lib/es/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var c = (t, e, r) =>
|
|
4
|
-
import { Disposable as
|
|
5
|
-
import { Subject as
|
|
6
|
-
function
|
|
1
|
+
var z = Object.defineProperty;
|
|
2
|
+
var Y = (t, e, r) => e in t ? z(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var c = (t, e, r) => Y(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { Disposable as $, Tools as K, ILogService as f, IResourceManagerService as X, IUniverInstanceService as Z, Inject as V, UniverInstanceType as q, toDisposable as ee, CommandType as g, ICommandService as T, IUndoRedoService as A, Plugin as te, merge as ae, Injector as H, IConfigService as re, DataValidationOperator as s, LocaleService as oe } from "@univerjs/core";
|
|
5
|
+
import { Subject as ne, debounceTime as ie, BehaviorSubject as se } from "rxjs";
|
|
6
|
+
function Q(t) {
|
|
7
7
|
return {
|
|
8
8
|
type: t.type,
|
|
9
9
|
operator: t.operator,
|
|
@@ -12,7 +12,7 @@ function q(t) {
|
|
|
12
12
|
allowBlank: t.allowBlank
|
|
13
13
|
};
|
|
14
14
|
}
|
|
15
|
-
function
|
|
15
|
+
function j(t) {
|
|
16
16
|
return {
|
|
17
17
|
error: t.error,
|
|
18
18
|
errorStyle: t.errorStyle,
|
|
@@ -27,18 +27,18 @@ function H(t) {
|
|
|
27
27
|
bizInfo: t.bizInfo
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
-
var
|
|
31
|
-
for (var o = a > 1 ? void 0 : a ?
|
|
30
|
+
var p = /* @__PURE__ */ ((t) => (t[t.SETTING = 0] = "SETTING", t[t.RANGE = 1] = "RANGE", t[t.OPTIONS = 2] = "OPTIONS", t[t.ALL = 3] = "ALL", t))(p || {}), de = Object.getOwnPropertyDescriptor, le = (t, e, r, a) => {
|
|
31
|
+
for (var o = a > 1 ? void 0 : a ? de(e, r) : e, n = t.length - 1, i; n >= 0; n--)
|
|
32
32
|
(i = t[n]) && (o = i(o) || o);
|
|
33
33
|
return o;
|
|
34
|
-
},
|
|
35
|
-
let
|
|
34
|
+
}, ue = (t, e) => (r, a) => e(r, a, t);
|
|
35
|
+
let h = class extends $ {
|
|
36
36
|
constructor(e) {
|
|
37
37
|
super();
|
|
38
38
|
c(this, "_model", /* @__PURE__ */ new Map());
|
|
39
|
-
c(this, "_ruleChange$", new
|
|
39
|
+
c(this, "_ruleChange$", new ne());
|
|
40
40
|
c(this, "ruleChange$", this._ruleChange$.asObservable());
|
|
41
|
-
c(this, "ruleChangeDebounce$", this.ruleChange$.pipe(
|
|
41
|
+
c(this, "ruleChangeDebounce$", this.ruleChange$.pipe(ie(20)));
|
|
42
42
|
this._logService = e, this.disposeWithMe({
|
|
43
43
|
dispose: () => {
|
|
44
44
|
this._ruleChange$.complete();
|
|
@@ -69,19 +69,19 @@ let p = class extends x {
|
|
|
69
69
|
throw new Error(`Data validation rule is not found, ruleId: ${r}.`);
|
|
70
70
|
const d = { ...i };
|
|
71
71
|
switch (a.type) {
|
|
72
|
-
case
|
|
72
|
+
case p.RANGE: {
|
|
73
73
|
d.ranges = a.payload;
|
|
74
74
|
break;
|
|
75
75
|
}
|
|
76
|
-
case
|
|
77
|
-
Object.assign(d,
|
|
76
|
+
case p.SETTING: {
|
|
77
|
+
Object.assign(d, Q(a.payload));
|
|
78
78
|
break;
|
|
79
79
|
}
|
|
80
|
-
case
|
|
81
|
-
Object.assign(d,
|
|
80
|
+
case p.OPTIONS: {
|
|
81
|
+
Object.assign(d, j(a.payload));
|
|
82
82
|
break;
|
|
83
83
|
}
|
|
84
|
-
case
|
|
84
|
+
case p.ALL: {
|
|
85
85
|
Object.assign(d, a.payload);
|
|
86
86
|
break;
|
|
87
87
|
}
|
|
@@ -110,7 +110,7 @@ let p = class extends x {
|
|
|
110
110
|
}
|
|
111
111
|
updateRule(e, r, a, o, n) {
|
|
112
112
|
try {
|
|
113
|
-
const i = this._ensureMap(e, r), l =
|
|
113
|
+
const i = this._ensureMap(e, r), l = K.deepClone(i.map.get(a));
|
|
114
114
|
if (!l)
|
|
115
115
|
throw new Error(`Data validation rule is not found, ruleId: ${a}.`);
|
|
116
116
|
const d = this._updateSubUnitRule(i, a, o);
|
|
@@ -170,16 +170,16 @@ let p = class extends x {
|
|
|
170
170
|
return Array.from(this._model.keys()).map((e) => [e, this.getUnitRules(e)]);
|
|
171
171
|
}
|
|
172
172
|
};
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
],
|
|
176
|
-
var
|
|
177
|
-
for (var o = a > 1 ? void 0 : a ?
|
|
173
|
+
h = le([
|
|
174
|
+
ue(0, f)
|
|
175
|
+
], h);
|
|
176
|
+
var ce = Object.getOwnPropertyDescriptor, me = (t, e, r, a) => {
|
|
177
|
+
for (var o = a > 1 ? void 0 : a ? ce(e, r) : e, n = t.length - 1, i; n >= 0; n--)
|
|
178
178
|
(i = t[n]) && (o = i(o) || o);
|
|
179
179
|
return o;
|
|
180
|
-
},
|
|
181
|
-
const
|
|
182
|
-
let I = class extends
|
|
180
|
+
}, L = (t, e) => (r, a) => e(r, a, t);
|
|
181
|
+
const he = "SHEET_DATA_VALIDATION_PLUGIN";
|
|
182
|
+
let I = class extends $ {
|
|
183
183
|
constructor(t, e, r) {
|
|
184
184
|
super(), this._resourceManagerService = t, this._univerInstanceService = e, this._dataValidationModel = r, this._initSnapshot();
|
|
185
185
|
}
|
|
@@ -200,8 +200,8 @@ let I = class extends x {
|
|
|
200
200
|
};
|
|
201
201
|
this.disposeWithMe(
|
|
202
202
|
this._resourceManagerService.registerPluginResource({
|
|
203
|
-
pluginName:
|
|
204
|
-
businesses: [
|
|
203
|
+
pluginName: he,
|
|
204
|
+
businesses: [q.UNIVER_SHEET],
|
|
205
205
|
toJson: (r) => t(r),
|
|
206
206
|
parseJson: (r) => e(r),
|
|
207
207
|
onUnLoad: (r) => {
|
|
@@ -218,17 +218,17 @@ let I = class extends x {
|
|
|
218
218
|
);
|
|
219
219
|
}
|
|
220
220
|
};
|
|
221
|
-
I =
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
221
|
+
I = me([
|
|
222
|
+
L(0, X),
|
|
223
|
+
L(1, Z),
|
|
224
|
+
L(2, V(h))
|
|
225
225
|
], I);
|
|
226
|
-
var
|
|
227
|
-
class
|
|
226
|
+
var pe = /* @__PURE__ */ ((t) => (t.SHEET = "sheet", t))(pe || {});
|
|
227
|
+
class F {
|
|
228
228
|
constructor() {
|
|
229
229
|
c(this, "_validatorByScopes", /* @__PURE__ */ new Map());
|
|
230
230
|
c(this, "_validatorMap", /* @__PURE__ */ new Map());
|
|
231
|
-
c(this, "_validatorsChange$", new
|
|
231
|
+
c(this, "_validatorsChange$", new se(void 0));
|
|
232
232
|
c(this, "validatorsChange$", this._validatorsChange$.asObservable());
|
|
233
233
|
}
|
|
234
234
|
_addValidatorToScope(e, r) {
|
|
@@ -248,7 +248,7 @@ class Q {
|
|
|
248
248
|
register(e) {
|
|
249
249
|
return this._validatorMap.set(e.id, e), Array.isArray(e.scopes) ? e.scopes.forEach((r) => {
|
|
250
250
|
this._addValidatorToScope(e, r);
|
|
251
|
-
}) : this._addValidatorToScope(e, e.scopes), this._validatorsChange$.next(),
|
|
251
|
+
}) : this._addValidatorToScope(e, e.scopes), this._validatorsChange$.next(), ee(() => {
|
|
252
252
|
this._validatorMap.delete(e.id), Array.isArray(e.scopes) ? e.scopes.forEach((r) => {
|
|
253
253
|
this._removeValidatorFromScope(e, r);
|
|
254
254
|
}) : this._removeValidatorFromScope(e, e.scopes), this._validatorsChange$.next();
|
|
@@ -268,15 +268,15 @@ const S = {
|
|
|
268
268
|
if (!e)
|
|
269
269
|
return !1;
|
|
270
270
|
const { unitId: r, subUnitId: a, rule: o, index: n, source: i = "command" } = e;
|
|
271
|
-
return t.get(
|
|
271
|
+
return t.get(h).addRule(r, a, o, i, n), !0;
|
|
272
272
|
}
|
|
273
|
-
},
|
|
273
|
+
}, N = {
|
|
274
274
|
type: g.MUTATION,
|
|
275
275
|
id: "data-validation.mutation.removeRule",
|
|
276
276
|
handler(t, e) {
|
|
277
277
|
if (!e)
|
|
278
278
|
return !1;
|
|
279
|
-
const { unitId: r, subUnitId: a, ruleId: o, source: n = "command" } = e, i = t.get(
|
|
279
|
+
const { unitId: r, subUnitId: a, ruleId: o, source: n = "command" } = e, i = t.get(h);
|
|
280
280
|
return Array.isArray(o) ? o.forEach((l) => {
|
|
281
281
|
i.removeRule(r, a, l, n);
|
|
282
282
|
}) : i.removeRule(r, a, o, n), !0;
|
|
@@ -288,13 +288,13 @@ const S = {
|
|
|
288
288
|
if (!e)
|
|
289
289
|
return !1;
|
|
290
290
|
const { unitId: r, subUnitId: a, ruleId: o, payload: n, source: i = "command" } = e;
|
|
291
|
-
return t.get(
|
|
291
|
+
return t.get(h).updateRule(r, a, o, n, i), !0;
|
|
292
292
|
}
|
|
293
|
-
},
|
|
293
|
+
}, Ee = {
|
|
294
294
|
type: g.COMMAND,
|
|
295
295
|
id: "data-validation.command.addRule",
|
|
296
296
|
async handler(t, e) {
|
|
297
|
-
if (t.get(
|
|
297
|
+
if (t.get(f).error("[Deprecated]: `AddDataValidationCommand` is deprecated, please use `AddSheetDataValidationCommand` in `@univerjs/sheets-data-validation` instead!"), !e)
|
|
298
298
|
return !1;
|
|
299
299
|
const { rule: a, unitId: o, subUnitId: n } = e, i = t.get(T), l = t.get(A), d = {
|
|
300
300
|
...e,
|
|
@@ -306,7 +306,7 @@ const S = {
|
|
|
306
306
|
id: S.id,
|
|
307
307
|
params: d
|
|
308
308
|
}], m = [{
|
|
309
|
-
id:
|
|
309
|
+
id: N.id,
|
|
310
310
|
params: {
|
|
311
311
|
unitId: o,
|
|
312
312
|
subUnitId: n,
|
|
@@ -319,14 +319,14 @@ const S = {
|
|
|
319
319
|
undoMutations: m
|
|
320
320
|
}), await i.executeCommand(S.id, d), !0;
|
|
321
321
|
}
|
|
322
|
-
},
|
|
322
|
+
}, ge = {
|
|
323
323
|
type: g.COMMAND,
|
|
324
324
|
id: "data-validation.command.removeRule",
|
|
325
325
|
handler(t, e) {
|
|
326
|
-
if (t.get(
|
|
326
|
+
if (t.get(f).error("[Deprecated]: `RemoveDataValidationCommand` is deprecated, please use `RemoveSheetDataValidationCommand` in `@univerjs/sheets-data-validation` instead!"), !e)
|
|
327
327
|
return !1;
|
|
328
|
-
const { unitId: a, subUnitId: o, ruleId: n } = e, i = t.get(T), l = t.get(A), d = t.get(
|
|
329
|
-
id:
|
|
328
|
+
const { unitId: a, subUnitId: o, ruleId: n } = e, i = t.get(T), l = t.get(A), d = t.get(h), u = [{
|
|
329
|
+
id: N.id,
|
|
330
330
|
params: e
|
|
331
331
|
}], m = [{
|
|
332
332
|
id: S.id,
|
|
@@ -343,35 +343,35 @@ const S = {
|
|
|
343
343
|
undoMutations: m,
|
|
344
344
|
redoMutations: u,
|
|
345
345
|
unitID: e.unitId
|
|
346
|
-
}), i.executeCommand(
|
|
346
|
+
}), i.executeCommand(N.id, e), !0;
|
|
347
347
|
}
|
|
348
|
-
},
|
|
348
|
+
}, _e = {
|
|
349
349
|
type: g.COMMAND,
|
|
350
350
|
id: "data-validation.command.updateDataValidationSetting",
|
|
351
351
|
handler(t, e) {
|
|
352
|
-
if (t.get(
|
|
352
|
+
if (t.get(f).warn("[Deprecated]: `UpdateDataValidationOptionsCommand` is deprecated, please use `UpdateSheetDataValidationOptionsCommand` in `@univerjs/sheets-data-validation` instead!"), !e)
|
|
353
353
|
return !1;
|
|
354
|
-
const a = t.get(T), o = t.get(A), n = t.get(
|
|
354
|
+
const a = t.get(T), o = t.get(A), n = t.get(h), { unitId: i, subUnitId: l, ruleId: d, options: u } = e, m = n.getRuleById(i, l, d);
|
|
355
355
|
if (!m)
|
|
356
356
|
return !1;
|
|
357
|
-
const
|
|
357
|
+
const E = {
|
|
358
358
|
unitId: i,
|
|
359
359
|
subUnitId: l,
|
|
360
360
|
ruleId: d,
|
|
361
361
|
payload: {
|
|
362
|
-
type:
|
|
362
|
+
type: p.OPTIONS,
|
|
363
363
|
payload: u
|
|
364
364
|
}
|
|
365
|
-
},
|
|
365
|
+
}, _ = [{
|
|
366
366
|
id: v.id,
|
|
367
|
-
params:
|
|
367
|
+
params: E
|
|
368
368
|
}], M = {
|
|
369
369
|
unitId: i,
|
|
370
370
|
subUnitId: l,
|
|
371
371
|
ruleId: d,
|
|
372
372
|
payload: {
|
|
373
|
-
type:
|
|
374
|
-
payload:
|
|
373
|
+
type: p.OPTIONS,
|
|
374
|
+
payload: j(m)
|
|
375
375
|
}
|
|
376
376
|
}, R = [{
|
|
377
377
|
id: v.id,
|
|
@@ -379,71 +379,71 @@ const S = {
|
|
|
379
379
|
}];
|
|
380
380
|
return o.pushUndoRedo({
|
|
381
381
|
unitID: i,
|
|
382
|
-
redoMutations:
|
|
382
|
+
redoMutations: _,
|
|
383
383
|
undoMutations: R
|
|
384
|
-
}), a.executeCommand(v.id,
|
|
384
|
+
}), a.executeCommand(v.id, E), !0;
|
|
385
385
|
}
|
|
386
|
-
},
|
|
386
|
+
}, ve = {
|
|
387
387
|
type: g.COMMAND,
|
|
388
388
|
id: "data-validation.command.updateDataValidationOptions",
|
|
389
389
|
handler(t, e) {
|
|
390
|
-
if (t.get(
|
|
391
|
-
return !1;
|
|
392
|
-
const a = t.get(T), o = t.get(A), n = t.get(p), i = t.get(Q), { unitId: l, subUnitId: d, ruleId: u, setting: m } = e, _ = i.getValidatorItem(m.type);
|
|
393
|
-
if (!_)
|
|
390
|
+
if (t.get(f).error("[Deprecated]: `UpdateDataValidationSettingCommand` is deprecated, please use `UpdateSheetDataValidationSettingCommand` in `@univerjs/sheets-data-validation` instead!"), !e)
|
|
394
391
|
return !1;
|
|
395
|
-
const
|
|
392
|
+
const a = t.get(T), o = t.get(A), n = t.get(h), i = t.get(F), { unitId: l, subUnitId: d, ruleId: u, setting: m } = e, E = i.getValidatorItem(m.type);
|
|
396
393
|
if (!E)
|
|
397
394
|
return !1;
|
|
398
|
-
const
|
|
399
|
-
if (!_
|
|
395
|
+
const _ = n.getRuleById(l, d, u);
|
|
396
|
+
if (!_)
|
|
397
|
+
return !1;
|
|
398
|
+
const M = { ..._, ...m };
|
|
399
|
+
if (!E.validatorFormula(M, l, d).success)
|
|
400
400
|
return !1;
|
|
401
401
|
const R = {
|
|
402
402
|
unitId: l,
|
|
403
403
|
subUnitId: d,
|
|
404
404
|
ruleId: u,
|
|
405
405
|
payload: {
|
|
406
|
-
type:
|
|
406
|
+
type: p.SETTING,
|
|
407
407
|
payload: {
|
|
408
408
|
...m,
|
|
409
|
-
...
|
|
409
|
+
...E.normalizeFormula(M, l, d)
|
|
410
410
|
}
|
|
411
411
|
}
|
|
412
|
-
},
|
|
412
|
+
}, W = [{
|
|
413
413
|
id: v.id,
|
|
414
414
|
params: R
|
|
415
|
-
}],
|
|
415
|
+
}], k = {
|
|
416
416
|
unitId: l,
|
|
417
417
|
subUnitId: d,
|
|
418
418
|
ruleId: u,
|
|
419
419
|
payload: {
|
|
420
|
-
type:
|
|
421
|
-
payload:
|
|
420
|
+
type: p.SETTING,
|
|
421
|
+
payload: Q(_)
|
|
422
422
|
}
|
|
423
|
-
},
|
|
423
|
+
}, J = [{
|
|
424
424
|
id: v.id,
|
|
425
|
-
params:
|
|
425
|
+
params: k
|
|
426
426
|
}];
|
|
427
427
|
return o.pushUndoRedo({
|
|
428
428
|
unitID: l,
|
|
429
|
-
redoMutations:
|
|
430
|
-
undoMutations:
|
|
429
|
+
redoMutations: W,
|
|
430
|
+
undoMutations: J
|
|
431
431
|
}), a.executeCommand(v.id, R), !0;
|
|
432
432
|
}
|
|
433
|
-
},
|
|
433
|
+
}, Ne = {
|
|
434
434
|
type: g.COMMAND,
|
|
435
435
|
id: "data-validation.command.removeAll",
|
|
436
436
|
handler(t, e) {
|
|
437
|
-
if (t.get(
|
|
437
|
+
if (t.get(f).error("[Deprecated]: `RemoveAllDataValidationCommand` is deprecated, please use `RemoveSheetAllDataValidationCommand` in `@univerjs/sheets-data-validation` instead!"), !e)
|
|
438
438
|
return !1;
|
|
439
|
-
const { unitId: a, subUnitId: o } = e, n = t.get(T), i = t.get(
|
|
439
|
+
const { unitId: a, subUnitId: o } = e, n = t.get(T), i = t.get(h), l = t.get(A), d = [...i.getRules(a, o)], u = {
|
|
440
440
|
unitId: a,
|
|
441
441
|
subUnitId: o,
|
|
442
|
-
ruleId: d.map((
|
|
442
|
+
ruleId: d.map((_) => _.uid)
|
|
443
443
|
}, m = [{
|
|
444
|
-
id:
|
|
444
|
+
id: N.id,
|
|
445
445
|
params: u
|
|
446
|
-
}],
|
|
446
|
+
}], E = [{
|
|
447
447
|
id: S.id,
|
|
448
448
|
params: {
|
|
449
449
|
unitId: a,
|
|
@@ -453,44 +453,44 @@ const S = {
|
|
|
453
453
|
}];
|
|
454
454
|
return l.pushUndoRedo({
|
|
455
455
|
redoMutations: m,
|
|
456
|
-
undoMutations:
|
|
456
|
+
undoMutations: E,
|
|
457
457
|
unitID: a
|
|
458
|
-
}), n.executeCommand(
|
|
458
|
+
}), n.executeCommand(N.id, u), !0;
|
|
459
459
|
}
|
|
460
|
-
},
|
|
461
|
-
var
|
|
462
|
-
for (var o = a > 1 ? void 0 : a ?
|
|
460
|
+
}, fe = "data-validation.config", U = {};
|
|
461
|
+
var Te = Object.getOwnPropertyDescriptor, Se = (t, e, r, a) => {
|
|
462
|
+
for (var o = a > 1 ? void 0 : a ? Te(e, r) : e, n = t.length - 1, i; n >= 0; n--)
|
|
463
463
|
(i = t[n]) && (o = i(o) || o);
|
|
464
464
|
return o;
|
|
465
|
-
},
|
|
466
|
-
const
|
|
467
|
-
var
|
|
468
|
-
let
|
|
465
|
+
}, y = (t, e) => (r, a) => e(r, a, t);
|
|
466
|
+
const Ae = "UNIVER_DATA_VALIDATION_PLUGIN";
|
|
467
|
+
var O;
|
|
468
|
+
let C = (O = class extends te {
|
|
469
469
|
constructor(t = U, e, r, a) {
|
|
470
470
|
super(), this._config = t, this._injector = e, this._commandService = r, this._configService = a;
|
|
471
|
-
const { ...o } =
|
|
471
|
+
const { ...o } = ae(
|
|
472
472
|
{},
|
|
473
473
|
U,
|
|
474
474
|
this._config
|
|
475
475
|
);
|
|
476
|
-
this._configService.setConfig(
|
|
476
|
+
this._configService.setConfig(fe, o);
|
|
477
477
|
}
|
|
478
478
|
onStarting() {
|
|
479
479
|
[
|
|
480
|
-
[
|
|
481
|
-
[
|
|
480
|
+
[h],
|
|
481
|
+
[F],
|
|
482
482
|
[I]
|
|
483
483
|
].forEach((t) => this._injector.add(t)), [
|
|
484
484
|
// command
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
he,
|
|
485
|
+
Ee,
|
|
486
|
+
Ne,
|
|
488
487
|
_e,
|
|
489
|
-
|
|
488
|
+
ve,
|
|
489
|
+
ge,
|
|
490
490
|
// mutation
|
|
491
491
|
S,
|
|
492
492
|
v,
|
|
493
|
-
|
|
493
|
+
N
|
|
494
494
|
].forEach((t) => {
|
|
495
495
|
this._commandService.registerCommand(t);
|
|
496
496
|
});
|
|
@@ -498,14 +498,14 @@ let D = (V = class extends X {
|
|
|
498
498
|
onReady() {
|
|
499
499
|
this._injector.get(I);
|
|
500
500
|
}
|
|
501
|
-
}, c(
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
],
|
|
501
|
+
}, c(O, "pluginName", Ae), c(O, "type", q.UNIVER_SHEET), O);
|
|
502
|
+
C = Se([
|
|
503
|
+
y(1, V(H)),
|
|
504
|
+
y(2, T),
|
|
505
|
+
y(3, re)
|
|
506
|
+
], C);
|
|
507
507
|
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 + "";
|
|
508
|
-
const
|
|
508
|
+
const D = {
|
|
509
509
|
[s.BETWEEN]: "dataValidation.ruleName.between",
|
|
510
510
|
[s.EQUAL]: "dataValidation.ruleName.equal",
|
|
511
511
|
[s.GREATER_THAN]: "dataValidation.ruleName.greaterThan",
|
|
@@ -513,8 +513,9 @@ const Te = {
|
|
|
513
513
|
[s.LESS_THAN]: "dataValidation.ruleName.lessThan",
|
|
514
514
|
[s.LESS_THAN_OR_EQUAL]: "dataValidation.ruleName.lessThanOrEqual",
|
|
515
515
|
[s.NOT_BETWEEN]: "dataValidation.ruleName.notBetween",
|
|
516
|
-
[s.NOT_EQUAL]: "dataValidation.ruleName.notEqual"
|
|
517
|
-
|
|
516
|
+
[s.NOT_EQUAL]: "dataValidation.ruleName.notEqual",
|
|
517
|
+
NONE: "dataValidation.ruleName.legal"
|
|
518
|
+
}, b = {
|
|
518
519
|
[s.BETWEEN]: "dataValidation.errorMsg.between",
|
|
519
520
|
[s.EQUAL]: "dataValidation.errorMsg.equal",
|
|
520
521
|
[s.GREATER_THAN]: "dataValidation.errorMsg.greaterThan",
|
|
@@ -522,8 +523,9 @@ const Te = {
|
|
|
522
523
|
[s.LESS_THAN]: "dataValidation.errorMsg.lessThan",
|
|
523
524
|
[s.LESS_THAN_OR_EQUAL]: "dataValidation.errorMsg.lessThanOrEqual",
|
|
524
525
|
[s.NOT_BETWEEN]: "dataValidation.errorMsg.notBetween",
|
|
525
|
-
[s.NOT_EQUAL]: "dataValidation.errorMsg.notEqual"
|
|
526
|
-
|
|
526
|
+
[s.NOT_EQUAL]: "dataValidation.errorMsg.notEqual",
|
|
527
|
+
NONE: "dataValidation.errorMsg.legal"
|
|
528
|
+
}, Ue = {
|
|
527
529
|
[s.BETWEEN]: "dataValidation.textLength.errorMsg.between",
|
|
528
530
|
[s.EQUAL]: "dataValidation.textLength.errorMsg.equal",
|
|
529
531
|
[s.GREATER_THAN]: "dataValidation.textLength.errorMsg.greaterThan",
|
|
@@ -532,16 +534,16 @@ const Te = {
|
|
|
532
534
|
[s.LESS_THAN_OR_EQUAL]: "dataValidation.textLength.errorMsg.lessThanOrEqual",
|
|
533
535
|
[s.NOT_BETWEEN]: "dataValidation.textLength.errorMsg.notBetween",
|
|
534
536
|
[s.NOT_EQUAL]: "dataValidation.textLength.errorMsg.notEqual"
|
|
535
|
-
},
|
|
537
|
+
}, Ce = [
|
|
536
538
|
s.BETWEEN,
|
|
537
539
|
s.NOT_BETWEEN
|
|
538
540
|
];
|
|
539
|
-
var
|
|
540
|
-
for (var o = a > 1 ? void 0 : a ?
|
|
541
|
+
var Me = Object.getOwnPropertyDescriptor, Re = (t, e, r, a) => {
|
|
542
|
+
for (var o = a > 1 ? void 0 : a ? Me(e, r) : e, n = t.length - 1, i; n >= 0; n--)
|
|
541
543
|
(i = t[n]) && (o = i(o) || o);
|
|
542
544
|
return o;
|
|
543
545
|
}, w = (t, e) => (r, a) => e(r, a, t);
|
|
544
|
-
const
|
|
546
|
+
const B = "{FORMULA1}", x = "{FORMULA2}", P = "{TYPE}", Oe = {
|
|
545
547
|
[s.BETWEEN]: "dataValidation.operators.between",
|
|
546
548
|
[s.EQUAL]: "dataValidation.operators.equal",
|
|
547
549
|
[s.GREATER_THAN]: "dataValidation.operators.greaterThan",
|
|
@@ -551,20 +553,21 @@ const b = "{FORMULA1}", C = "{FORMULA2}", Re = {
|
|
|
551
553
|
[s.NOT_BETWEEN]: "dataValidation.operators.notBetween",
|
|
552
554
|
[s.NOT_EQUAL]: "dataValidation.operators.notEqual"
|
|
553
555
|
};
|
|
554
|
-
|
|
556
|
+
var Ve = /* @__PURE__ */ ((t) => (t.DATE = "date", t.TIME = "time", t.DATETIME = "datetime", t.LIST = "list", t.MULTIPLE_LIST = "multipleList", t.COLOR = "color", t.CASCADE = "cascade", t))(Ve || {});
|
|
557
|
+
let G = class {
|
|
555
558
|
// #endregion
|
|
556
559
|
constructor(t, e) {
|
|
557
560
|
c(this, "offsetFormulaByRange", !0);
|
|
558
561
|
// #region UI related
|
|
559
562
|
c(this, "formulaInput");
|
|
560
563
|
c(this, "canvasRender", null);
|
|
561
|
-
c(this, "
|
|
564
|
+
c(this, "dropdownType");
|
|
562
565
|
c(this, "optionsInput");
|
|
563
566
|
c(this, "skipDefaultFontRender");
|
|
564
567
|
this.localeService = t, this.injector = e;
|
|
565
568
|
}
|
|
566
569
|
get operatorNames() {
|
|
567
|
-
return this.operators.map((t) => this.localeService.t(
|
|
570
|
+
return this.operators.map((t) => this.localeService.t(Oe[t]));
|
|
568
571
|
}
|
|
569
572
|
get titleStr() {
|
|
570
573
|
return this.localeService.t(this.title);
|
|
@@ -572,13 +575,13 @@ let B = class {
|
|
|
572
575
|
generateRuleName(t) {
|
|
573
576
|
var r, a;
|
|
574
577
|
if (!t.operator)
|
|
575
|
-
return this.titleStr;
|
|
576
|
-
const e = this.localeService.t(
|
|
578
|
+
return this.localeService.t(D.NONE).replace(P, this.titleStr);
|
|
579
|
+
const e = this.localeService.t(D[t.operator]).replace(B, (r = t.formula1) != null ? r : "").replace(x, (a = t.formula2) != null ? a : "");
|
|
577
580
|
return `${this.titleStr} ${e}`;
|
|
578
581
|
}
|
|
579
582
|
generateRuleErrorMessage(t, e) {
|
|
580
583
|
var a, o;
|
|
581
|
-
return t.operator ? `${this.localeService.t(
|
|
584
|
+
return t.operator ? `${this.localeService.t(b[t.operator]).replace(B, (a = t.formula1) != null ? a : "").replace(x, (o = t.formula2) != null ? o : "")}` : this.localeService.t(b.NONE).replace(P, this.titleStr);
|
|
582
585
|
}
|
|
583
586
|
getExtraStyle(t, e, r, a, o) {
|
|
584
587
|
}
|
|
@@ -645,7 +648,7 @@ let B = class {
|
|
|
645
648
|
const d = await this.parseFormula(e, a, o, t.row, t.column);
|
|
646
649
|
if (!d.isFormulaValid || !await this.isValidType(t, d, e))
|
|
647
650
|
return !1;
|
|
648
|
-
if (!
|
|
651
|
+
if (!l)
|
|
649
652
|
return !0;
|
|
650
653
|
const u = this.transform(t, d, e);
|
|
651
654
|
switch (l) {
|
|
@@ -670,23 +673,27 @@ let B = class {
|
|
|
670
673
|
}
|
|
671
674
|
}
|
|
672
675
|
};
|
|
673
|
-
|
|
674
|
-
w(0,
|
|
675
|
-
w(1,
|
|
676
|
-
],
|
|
676
|
+
G = Re([
|
|
677
|
+
w(0, V(oe)),
|
|
678
|
+
w(1, V(H))
|
|
679
|
+
], G);
|
|
677
680
|
export {
|
|
678
681
|
S as AddDataValidationMutation,
|
|
679
|
-
|
|
680
|
-
|
|
682
|
+
G as BaseDataValidator,
|
|
683
|
+
h as DataValidationModel,
|
|
681
684
|
I as DataValidationResourceController,
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
685
|
+
Ve as DataValidatorDropdownType,
|
|
686
|
+
pe as DataValidatorRegistryScope,
|
|
687
|
+
F as DataValidatorRegistryService,
|
|
688
|
+
B as FORMULA1,
|
|
689
|
+
x as FORMULA2,
|
|
690
|
+
N as RemoveDataValidationMutation,
|
|
691
|
+
Ce as TWO_FORMULA_OPERATOR_COUNT,
|
|
692
|
+
P as TYPE,
|
|
693
|
+
Ue as TextLengthErrorTitleMap,
|
|
694
|
+
C as UniverDataValidationPlugin,
|
|
688
695
|
v as UpdateDataValidationMutation,
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
696
|
+
p as UpdateRuleType,
|
|
697
|
+
j as getRuleOptions,
|
|
698
|
+
Q as getRuleSetting
|
|
692
699
|
};
|