@univerjs/data-validation 0.16.1 → 0.17.0
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 +147 -145
- package/lib/index.js +147 -145
- package/lib/types/index.d.ts +1 -1
- package/lib/types/plugin.d.ts +3 -1
- package/lib/umd/index.js +1 -1
- package/package.json +5 -5
- /package/lib/types/{controllers/config.schema.d.ts → config/config.d.ts} +0 -0
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 Y = Object.defineProperty;
|
|
2
|
+
var K = (t, e, r) => e in t ? Y(t, e, { enumerable: !0, configurable: !0, writable: !0, value: r }) : t[e] = r;
|
|
3
|
+
var c = (t, e, r) => K(t, typeof e != "symbol" ? e + "" : e, r);
|
|
4
|
+
import { Disposable as q, Tools as X, ILogService as T, CommandType as E, IResourceManagerService as Z, IUniverInstanceService as ee, Inject as V, UniverInstanceType as H, toDisposable as te, ICommandService as S, IUndoRedoService as M, Plugin as ae, merge as re, Injector as Q, IConfigService as oe, DataValidationOperator as s, LocaleService as ne } from "@univerjs/core";
|
|
5
|
+
import { Subject as ie, debounceTime as se, BehaviorSubject as de } from "rxjs";
|
|
6
|
+
function j(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 F(t) {
|
|
16
16
|
return {
|
|
17
17
|
error: t.error,
|
|
18
18
|
errorStyle: t.errorStyle,
|
|
@@ -27,18 +27,18 @@ function j(t) {
|
|
|
27
27
|
bizInfo: t.bizInfo
|
|
28
28
|
};
|
|
29
29
|
}
|
|
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 || {}),
|
|
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 || {}), le = Object.getOwnPropertyDescriptor, ue = (t, e, r, a) => {
|
|
31
|
+
for (var o = a > 1 ? void 0 : a ? le(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 h = class extends
|
|
34
|
+
}, ce = (t, e) => (r, a) => e(r, a, t);
|
|
35
|
+
let h = class extends q {
|
|
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 ie());
|
|
40
40
|
c(this, "ruleChange$", this._ruleChange$.asObservable());
|
|
41
|
-
c(this, "ruleChangeDebounce$", this.ruleChange$.pipe(
|
|
41
|
+
c(this, "ruleChangeDebounce$", this.ruleChange$.pipe(se(20)));
|
|
42
42
|
this._logService = e, this.disposeWithMe({
|
|
43
43
|
dispose: () => {
|
|
44
44
|
this._ruleChange$.complete();
|
|
@@ -74,11 +74,11 @@ let h = class extends $ {
|
|
|
74
74
|
break;
|
|
75
75
|
}
|
|
76
76
|
case p.SETTING: {
|
|
77
|
-
Object.assign(d,
|
|
77
|
+
Object.assign(d, j(a.payload));
|
|
78
78
|
break;
|
|
79
79
|
}
|
|
80
80
|
case p.OPTIONS: {
|
|
81
|
-
Object.assign(d,
|
|
81
|
+
Object.assign(d, F(a.payload));
|
|
82
82
|
break;
|
|
83
83
|
}
|
|
84
84
|
case p.ALL: {
|
|
@@ -110,7 +110,7 @@ let h = class extends $ {
|
|
|
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 = X.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,11 +170,11 @@ let h = class extends $ {
|
|
|
170
170
|
return Array.from(this._model.keys()).map((e) => [e, this.getUnitRules(e)]);
|
|
171
171
|
}
|
|
172
172
|
};
|
|
173
|
-
h =
|
|
174
|
-
|
|
173
|
+
h = ue([
|
|
174
|
+
ce(0, T)
|
|
175
175
|
], h);
|
|
176
|
-
const
|
|
177
|
-
type:
|
|
176
|
+
const A = {
|
|
177
|
+
type: E.MUTATION,
|
|
178
178
|
id: "data-validation.mutation.addRule",
|
|
179
179
|
handler(t, e) {
|
|
180
180
|
if (!e)
|
|
@@ -182,8 +182,8 @@ const S = {
|
|
|
182
182
|
const { unitId: r, subUnitId: a, rule: o, index: n, source: i = "command" } = e;
|
|
183
183
|
return t.get(h).addRule(r, a, o, i, n), !0;
|
|
184
184
|
}
|
|
185
|
-
},
|
|
186
|
-
type:
|
|
185
|
+
}, f = {
|
|
186
|
+
type: E.MUTATION,
|
|
187
187
|
id: "data-validation.mutation.removeRule",
|
|
188
188
|
handler(t, e) {
|
|
189
189
|
if (!e)
|
|
@@ -194,7 +194,7 @@ const S = {
|
|
|
194
194
|
}) : i.removeRule(r, a, o, n), !0;
|
|
195
195
|
}
|
|
196
196
|
}, v = {
|
|
197
|
-
type:
|
|
197
|
+
type: E.MUTATION,
|
|
198
198
|
id: "data-validation.mutation.updateRule",
|
|
199
199
|
handler(t, e) {
|
|
200
200
|
if (!e)
|
|
@@ -203,13 +203,13 @@ const S = {
|
|
|
203
203
|
return t.get(h).updateRule(r, a, o, n, i), !0;
|
|
204
204
|
}
|
|
205
205
|
};
|
|
206
|
-
var
|
|
207
|
-
for (var o = a > 1 ? void 0 : a ?
|
|
206
|
+
var me = Object.getOwnPropertyDescriptor, he = (t, e, r, a) => {
|
|
207
|
+
for (var o = a > 1 ? void 0 : a ? me(e, r) : e, n = t.length - 1, i; n >= 0; n--)
|
|
208
208
|
(i = t[n]) && (o = i(o) || o);
|
|
209
209
|
return o;
|
|
210
210
|
}, L = (t, e) => (r, a) => e(r, a, t);
|
|
211
|
-
const
|
|
212
|
-
let I = class extends
|
|
211
|
+
const pe = "SHEET_DATA_VALIDATION_PLUGIN";
|
|
212
|
+
let I = class extends q {
|
|
213
213
|
constructor(t, e, r) {
|
|
214
214
|
super(), this._resourceManagerService = t, this._univerInstanceService = e, this._dataValidationModel = r, this._initSnapshot();
|
|
215
215
|
}
|
|
@@ -230,8 +230,8 @@ let I = class extends $ {
|
|
|
230
230
|
};
|
|
231
231
|
this.disposeWithMe(
|
|
232
232
|
this._resourceManagerService.registerPluginResource({
|
|
233
|
-
pluginName:
|
|
234
|
-
businesses: [
|
|
233
|
+
pluginName: pe,
|
|
234
|
+
businesses: [H.UNIVER_SHEET],
|
|
235
235
|
toJson: (r) => t(r),
|
|
236
236
|
parseJson: (r) => e(r),
|
|
237
237
|
onUnLoad: (r) => {
|
|
@@ -248,17 +248,21 @@ let I = class extends $ {
|
|
|
248
248
|
);
|
|
249
249
|
}
|
|
250
250
|
};
|
|
251
|
-
I =
|
|
252
|
-
L(0,
|
|
253
|
-
L(1,
|
|
251
|
+
I = he([
|
|
252
|
+
L(0, Z),
|
|
253
|
+
L(1, ee),
|
|
254
254
|
L(2, V(h))
|
|
255
255
|
], I);
|
|
256
|
-
|
|
257
|
-
|
|
256
|
+
const ge = "@univerjs/data-validation", Ee = "0.17.0", U = {
|
|
257
|
+
name: ge,
|
|
258
|
+
version: Ee
|
|
259
|
+
};
|
|
260
|
+
var _e = /* @__PURE__ */ ((t) => (t.SHEET = "sheet", t))(_e || {});
|
|
261
|
+
class W {
|
|
258
262
|
constructor() {
|
|
259
263
|
c(this, "_validatorByScopes", /* @__PURE__ */ new Map());
|
|
260
264
|
c(this, "_validatorMap", /* @__PURE__ */ new Map());
|
|
261
|
-
c(this, "_validatorsChange$", new
|
|
265
|
+
c(this, "_validatorsChange$", new de(void 0));
|
|
262
266
|
c(this, "validatorsChange$", this._validatorsChange$.asObservable());
|
|
263
267
|
}
|
|
264
268
|
_addValidatorToScope(e, r) {
|
|
@@ -278,7 +282,7 @@ class F {
|
|
|
278
282
|
register(e) {
|
|
279
283
|
return this._validatorMap.set(e.id, e), Array.isArray(e.scopes) ? e.scopes.forEach((r) => {
|
|
280
284
|
this._addValidatorToScope(e, r);
|
|
281
|
-
}) : this._addValidatorToScope(e, e.scopes), this._validatorsChange$.next(),
|
|
285
|
+
}) : this._addValidatorToScope(e, e.scopes), this._validatorsChange$.next(), te(() => {
|
|
282
286
|
this._validatorMap.delete(e.id), Array.isArray(e.scopes) ? e.scopes.forEach((r) => {
|
|
283
287
|
this._removeValidatorFromScope(e, r);
|
|
284
288
|
}) : this._removeValidatorFromScope(e, e.scopes), this._validatorsChange$.next();
|
|
@@ -291,23 +295,23 @@ class F {
|
|
|
291
295
|
return this._validatorByScopes.get(e);
|
|
292
296
|
}
|
|
293
297
|
}
|
|
294
|
-
const
|
|
295
|
-
type:
|
|
298
|
+
const ve = {
|
|
299
|
+
type: E.COMMAND,
|
|
296
300
|
id: "data-validation.command.addRule",
|
|
297
301
|
async handler(t, e) {
|
|
298
|
-
if (t.get(
|
|
302
|
+
if (t.get(T).error("[Deprecated]: `AddDataValidationCommand` is deprecated, please use `AddSheetDataValidationCommand` in `@univerjs/sheets-data-validation` instead!"), !e)
|
|
299
303
|
return !1;
|
|
300
|
-
const { rule: a, unitId: o, subUnitId: n } = e, i = t.get(
|
|
304
|
+
const { rule: a, unitId: o, subUnitId: n } = e, i = t.get(S), l = t.get(M), d = {
|
|
301
305
|
...e,
|
|
302
306
|
rule: {
|
|
303
307
|
...e.rule,
|
|
304
308
|
ranges: [e.rule.range]
|
|
305
309
|
}
|
|
306
310
|
}, u = [{
|
|
307
|
-
id:
|
|
311
|
+
id: A.id,
|
|
308
312
|
params: d
|
|
309
313
|
}], m = [{
|
|
310
|
-
id:
|
|
314
|
+
id: f.id,
|
|
311
315
|
params: {
|
|
312
316
|
unitId: o,
|
|
313
317
|
subUnitId: n,
|
|
@@ -318,19 +322,19 @@ const Ee = {
|
|
|
318
322
|
unitID: o,
|
|
319
323
|
redoMutations: u,
|
|
320
324
|
undoMutations: m
|
|
321
|
-
}), await i.executeCommand(
|
|
325
|
+
}), await i.executeCommand(A.id, d), !0;
|
|
322
326
|
}
|
|
323
|
-
},
|
|
324
|
-
type:
|
|
327
|
+
}, Ne = {
|
|
328
|
+
type: E.COMMAND,
|
|
325
329
|
id: "data-validation.command.removeRule",
|
|
326
330
|
handler(t, e) {
|
|
327
|
-
if (t.get(
|
|
331
|
+
if (t.get(T).error("[Deprecated]: `RemoveDataValidationCommand` is deprecated, please use `RemoveSheetDataValidationCommand` in `@univerjs/sheets-data-validation` instead!"), !e)
|
|
328
332
|
return !1;
|
|
329
|
-
const { unitId: a, subUnitId: o, ruleId: n } = e, i = t.get(
|
|
330
|
-
id:
|
|
333
|
+
const { unitId: a, subUnitId: o, ruleId: n } = e, i = t.get(S), l = t.get(M), d = t.get(h), u = [{
|
|
334
|
+
id: f.id,
|
|
331
335
|
params: e
|
|
332
336
|
}], m = [{
|
|
333
|
-
id:
|
|
337
|
+
id: A.id,
|
|
334
338
|
params: {
|
|
335
339
|
unitId: a,
|
|
336
340
|
subUnitId: o,
|
|
@@ -344,18 +348,18 @@ const Ee = {
|
|
|
344
348
|
undoMutations: m,
|
|
345
349
|
redoMutations: u,
|
|
346
350
|
unitID: e.unitId
|
|
347
|
-
}), i.executeCommand(
|
|
351
|
+
}), i.executeCommand(f.id, e), !0;
|
|
348
352
|
}
|
|
349
|
-
},
|
|
350
|
-
type:
|
|
353
|
+
}, fe = {
|
|
354
|
+
type: E.COMMAND,
|
|
351
355
|
id: "data-validation.command.updateDataValidationSetting",
|
|
352
356
|
handler(t, e) {
|
|
353
|
-
if (t.get(
|
|
357
|
+
if (t.get(T).warn("[Deprecated]: `UpdateDataValidationOptionsCommand` is deprecated, please use `UpdateSheetDataValidationOptionsCommand` in `@univerjs/sheets-data-validation` instead!"), !e)
|
|
354
358
|
return !1;
|
|
355
|
-
const a = t.get(
|
|
359
|
+
const a = t.get(S), o = t.get(M), n = t.get(h), { unitId: i, subUnitId: l, ruleId: d, options: u } = e, m = n.getRuleById(i, l, d);
|
|
356
360
|
if (!m)
|
|
357
361
|
return !1;
|
|
358
|
-
const
|
|
362
|
+
const g = {
|
|
359
363
|
unitId: i,
|
|
360
364
|
subUnitId: l,
|
|
361
365
|
ruleId: d,
|
|
@@ -365,41 +369,41 @@ const Ee = {
|
|
|
365
369
|
}
|
|
366
370
|
}, _ = [{
|
|
367
371
|
id: v.id,
|
|
368
|
-
params:
|
|
369
|
-
}],
|
|
372
|
+
params: g
|
|
373
|
+
}], R = {
|
|
370
374
|
unitId: i,
|
|
371
375
|
subUnitId: l,
|
|
372
376
|
ruleId: d,
|
|
373
377
|
payload: {
|
|
374
378
|
type: p.OPTIONS,
|
|
375
|
-
payload:
|
|
379
|
+
payload: F(m)
|
|
376
380
|
}
|
|
377
|
-
},
|
|
381
|
+
}, O = [{
|
|
378
382
|
id: v.id,
|
|
379
|
-
params:
|
|
383
|
+
params: R
|
|
380
384
|
}];
|
|
381
385
|
return o.pushUndoRedo({
|
|
382
386
|
unitID: i,
|
|
383
387
|
redoMutations: _,
|
|
384
|
-
undoMutations:
|
|
385
|
-
}), a.executeCommand(v.id,
|
|
388
|
+
undoMutations: O
|
|
389
|
+
}), a.executeCommand(v.id, g), !0;
|
|
386
390
|
}
|
|
387
|
-
},
|
|
388
|
-
type:
|
|
391
|
+
}, Te = {
|
|
392
|
+
type: E.COMMAND,
|
|
389
393
|
id: "data-validation.command.updateDataValidationOptions",
|
|
390
394
|
handler(t, e) {
|
|
391
|
-
if (t.get(
|
|
395
|
+
if (t.get(T).error("[Deprecated]: `UpdateDataValidationSettingCommand` is deprecated, please use `UpdateSheetDataValidationSettingCommand` in `@univerjs/sheets-data-validation` instead!"), !e)
|
|
392
396
|
return !1;
|
|
393
|
-
const a = t.get(
|
|
394
|
-
if (!
|
|
397
|
+
const a = t.get(S), o = t.get(M), n = t.get(h), i = t.get(W), { unitId: l, subUnitId: d, ruleId: u, setting: m } = e, g = i.getValidatorItem(m.type);
|
|
398
|
+
if (!g)
|
|
395
399
|
return !1;
|
|
396
400
|
const _ = n.getRuleById(l, d, u);
|
|
397
401
|
if (!_)
|
|
398
402
|
return !1;
|
|
399
|
-
const
|
|
400
|
-
if (!
|
|
403
|
+
const R = { ..._, ...m };
|
|
404
|
+
if (!g.validatorFormula(R, l, d).success)
|
|
401
405
|
return !1;
|
|
402
|
-
const
|
|
406
|
+
const O = {
|
|
403
407
|
unitId: l,
|
|
404
408
|
subUnitId: d,
|
|
405
409
|
ruleId: u,
|
|
@@ -407,45 +411,45 @@ const Ee = {
|
|
|
407
411
|
type: p.SETTING,
|
|
408
412
|
payload: {
|
|
409
413
|
...m,
|
|
410
|
-
...
|
|
414
|
+
...g.normalizeFormula(R, l, d)
|
|
411
415
|
}
|
|
412
416
|
}
|
|
413
|
-
},
|
|
417
|
+
}, k = [{
|
|
414
418
|
id: v.id,
|
|
415
|
-
params:
|
|
416
|
-
}],
|
|
419
|
+
params: O
|
|
420
|
+
}], J = {
|
|
417
421
|
unitId: l,
|
|
418
422
|
subUnitId: d,
|
|
419
423
|
ruleId: u,
|
|
420
424
|
payload: {
|
|
421
425
|
type: p.SETTING,
|
|
422
|
-
payload:
|
|
426
|
+
payload: j(_)
|
|
423
427
|
}
|
|
424
|
-
},
|
|
428
|
+
}, z = [{
|
|
425
429
|
id: v.id,
|
|
426
|
-
params:
|
|
430
|
+
params: J
|
|
427
431
|
}];
|
|
428
432
|
return o.pushUndoRedo({
|
|
429
433
|
unitID: l,
|
|
430
|
-
redoMutations:
|
|
431
|
-
undoMutations:
|
|
432
|
-
}), a.executeCommand(v.id,
|
|
434
|
+
redoMutations: k,
|
|
435
|
+
undoMutations: z
|
|
436
|
+
}), a.executeCommand(v.id, O), !0;
|
|
433
437
|
}
|
|
434
|
-
},
|
|
435
|
-
type:
|
|
438
|
+
}, Se = {
|
|
439
|
+
type: E.COMMAND,
|
|
436
440
|
id: "data-validation.command.removeAll",
|
|
437
441
|
handler(t, e) {
|
|
438
|
-
if (t.get(
|
|
442
|
+
if (t.get(T).error("[Deprecated]: `RemoveAllDataValidationCommand` is deprecated, please use `RemoveSheetAllDataValidationCommand` in `@univerjs/sheets-data-validation` instead!"), !e)
|
|
439
443
|
return !1;
|
|
440
|
-
const { unitId: a, subUnitId: o } = e, n = t.get(
|
|
444
|
+
const { unitId: a, subUnitId: o } = e, n = t.get(S), i = t.get(h), l = t.get(M), d = [...i.getRules(a, o)], u = {
|
|
441
445
|
unitId: a,
|
|
442
446
|
subUnitId: o,
|
|
443
447
|
ruleId: d.map((_) => _.uid)
|
|
444
448
|
}, m = [{
|
|
445
|
-
id:
|
|
449
|
+
id: f.id,
|
|
446
450
|
params: u
|
|
447
|
-
}],
|
|
448
|
-
id:
|
|
451
|
+
}], g = [{
|
|
452
|
+
id: A.id,
|
|
449
453
|
params: {
|
|
450
454
|
unitId: a,
|
|
451
455
|
subUnitId: o,
|
|
@@ -454,44 +458,42 @@ const Ee = {
|
|
|
454
458
|
}];
|
|
455
459
|
return l.pushUndoRedo({
|
|
456
460
|
redoMutations: m,
|
|
457
|
-
undoMutations:
|
|
461
|
+
undoMutations: g,
|
|
458
462
|
unitID: a
|
|
459
|
-
}), n.executeCommand(
|
|
463
|
+
}), n.executeCommand(f.id, u), !0;
|
|
460
464
|
}
|
|
461
|
-
},
|
|
462
|
-
var
|
|
463
|
-
for (var o = a > 1 ? void 0 : a ?
|
|
465
|
+
}, Ae = "data-validation.config", C = {};
|
|
466
|
+
var Me = Object.getOwnPropertyDescriptor, Re = (t, e, r, a) => {
|
|
467
|
+
for (var o = a > 1 ? void 0 : a ? Me(e, r) : e, n = t.length - 1, i; n >= 0; n--)
|
|
464
468
|
(i = t[n]) && (o = i(o) || o);
|
|
465
469
|
return o;
|
|
466
|
-
}, y = (t, e) => (r, a) => e(r, a, t);
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
let C = (O = class extends te {
|
|
470
|
-
constructor(t = U, e, r, a) {
|
|
470
|
+
}, y = (t, e) => (r, a) => e(r, a, t), N;
|
|
471
|
+
let D = (N = class extends ae {
|
|
472
|
+
constructor(t = C, e, r, a) {
|
|
471
473
|
super(), this._config = t, this._injector = e, this._commandService = r, this._configService = a;
|
|
472
|
-
const { ...o } =
|
|
474
|
+
const { ...o } = re(
|
|
473
475
|
{},
|
|
474
|
-
|
|
476
|
+
C,
|
|
475
477
|
this._config
|
|
476
478
|
);
|
|
477
|
-
this._configService.setConfig(
|
|
479
|
+
this._configService.setConfig(Ae, o);
|
|
478
480
|
}
|
|
479
481
|
onStarting() {
|
|
480
482
|
[
|
|
481
483
|
[h],
|
|
482
|
-
[
|
|
484
|
+
[W],
|
|
483
485
|
[I]
|
|
484
486
|
].forEach((t) => this._injector.add(t)), [
|
|
485
487
|
// command
|
|
486
|
-
Ee,
|
|
487
|
-
Ne,
|
|
488
|
-
_e,
|
|
489
488
|
ve,
|
|
490
|
-
|
|
489
|
+
Se,
|
|
490
|
+
fe,
|
|
491
|
+
Te,
|
|
492
|
+
Ne,
|
|
491
493
|
// mutation
|
|
492
|
-
|
|
494
|
+
A,
|
|
493
495
|
v,
|
|
494
|
-
|
|
496
|
+
f
|
|
495
497
|
].forEach((t) => {
|
|
496
498
|
this._commandService.registerCommand(t);
|
|
497
499
|
});
|
|
@@ -499,14 +501,14 @@ let C = (O = class extends te {
|
|
|
499
501
|
onReady() {
|
|
500
502
|
this._injector.get(I);
|
|
501
503
|
}
|
|
502
|
-
}, c(
|
|
503
|
-
|
|
504
|
-
y(1, V(
|
|
505
|
-
y(2,
|
|
506
|
-
y(3,
|
|
507
|
-
],
|
|
504
|
+
}, c(N, "pluginName", "UNIVER_DATA_VALIDATION_PLUGIN"), c(N, "packageName", U.name), c(N, "version", U.version), c(N, "type", H.UNIVER_SHEET), N);
|
|
505
|
+
D = Re([
|
|
506
|
+
y(1, V(Q)),
|
|
507
|
+
y(2, S),
|
|
508
|
+
y(3, oe)
|
|
509
|
+
], D);
|
|
508
510
|
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 + "";
|
|
509
|
-
const
|
|
511
|
+
const b = {
|
|
510
512
|
[s.BETWEEN]: "dataValidation.ruleName.between",
|
|
511
513
|
[s.EQUAL]: "dataValidation.ruleName.equal",
|
|
512
514
|
[s.GREATER_THAN]: "dataValidation.ruleName.greaterThan",
|
|
@@ -516,7 +518,7 @@ const D = {
|
|
|
516
518
|
[s.NOT_BETWEEN]: "dataValidation.ruleName.notBetween",
|
|
517
519
|
[s.NOT_EQUAL]: "dataValidation.ruleName.notEqual",
|
|
518
520
|
NONE: "dataValidation.ruleName.legal"
|
|
519
|
-
},
|
|
521
|
+
}, w = {
|
|
520
522
|
[s.BETWEEN]: "dataValidation.errorMsg.between",
|
|
521
523
|
[s.EQUAL]: "dataValidation.errorMsg.equal",
|
|
522
524
|
[s.GREATER_THAN]: "dataValidation.errorMsg.greaterThan",
|
|
@@ -526,7 +528,7 @@ const D = {
|
|
|
526
528
|
[s.NOT_BETWEEN]: "dataValidation.errorMsg.notBetween",
|
|
527
529
|
[s.NOT_EQUAL]: "dataValidation.errorMsg.notEqual",
|
|
528
530
|
NONE: "dataValidation.errorMsg.legal"
|
|
529
|
-
},
|
|
531
|
+
}, De = {
|
|
530
532
|
[s.BETWEEN]: "dataValidation.textLength.errorMsg.between",
|
|
531
533
|
[s.EQUAL]: "dataValidation.textLength.errorMsg.equal",
|
|
532
534
|
[s.GREATER_THAN]: "dataValidation.textLength.errorMsg.greaterThan",
|
|
@@ -535,16 +537,16 @@ const D = {
|
|
|
535
537
|
[s.LESS_THAN_OR_EQUAL]: "dataValidation.textLength.errorMsg.lessThanOrEqual",
|
|
536
538
|
[s.NOT_BETWEEN]: "dataValidation.textLength.errorMsg.notBetween",
|
|
537
539
|
[s.NOT_EQUAL]: "dataValidation.textLength.errorMsg.notEqual"
|
|
538
|
-
},
|
|
540
|
+
}, be = [
|
|
539
541
|
s.BETWEEN,
|
|
540
542
|
s.NOT_BETWEEN
|
|
541
543
|
];
|
|
542
|
-
var
|
|
543
|
-
for (var o = a > 1 ? void 0 : a ?
|
|
544
|
+
var Oe = Object.getOwnPropertyDescriptor, Ve = (t, e, r, a) => {
|
|
545
|
+
for (var o = a > 1 ? void 0 : a ? Oe(e, r) : e, n = t.length - 1, i; n >= 0; n--)
|
|
544
546
|
(i = t[n]) && (o = i(o) || o);
|
|
545
547
|
return o;
|
|
546
|
-
},
|
|
547
|
-
const
|
|
548
|
+
}, B = (t, e) => (r, a) => e(r, a, t);
|
|
549
|
+
const x = "{FORMULA1}", P = "{FORMULA2}", G = "{TYPE}", Ie = {
|
|
548
550
|
[s.BETWEEN]: "dataValidation.operators.between",
|
|
549
551
|
[s.EQUAL]: "dataValidation.operators.equal",
|
|
550
552
|
[s.GREATER_THAN]: "dataValidation.operators.greaterThan",
|
|
@@ -554,8 +556,8 @@ const B = "{FORMULA1}", x = "{FORMULA2}", P = "{TYPE}", Oe = {
|
|
|
554
556
|
[s.NOT_BETWEEN]: "dataValidation.operators.notBetween",
|
|
555
557
|
[s.NOT_EQUAL]: "dataValidation.operators.notEqual"
|
|
556
558
|
};
|
|
557
|
-
var
|
|
558
|
-
let
|
|
559
|
+
var Le = /* @__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))(Le || {});
|
|
560
|
+
let $ = class {
|
|
559
561
|
// #endregion
|
|
560
562
|
constructor(t, e) {
|
|
561
563
|
c(this, "offsetFormulaByRange", !0);
|
|
@@ -568,7 +570,7 @@ let G = class {
|
|
|
568
570
|
this.localeService = t, this.injector = e;
|
|
569
571
|
}
|
|
570
572
|
get operatorNames() {
|
|
571
|
-
return this.operators.map((t) => this.localeService.t(
|
|
573
|
+
return this.operators.map((t) => this.localeService.t(Ie[t]));
|
|
572
574
|
}
|
|
573
575
|
get titleStr() {
|
|
574
576
|
return this.localeService.t(this.title);
|
|
@@ -576,13 +578,13 @@ let G = class {
|
|
|
576
578
|
generateRuleName(t) {
|
|
577
579
|
var r, a;
|
|
578
580
|
if (!t.operator)
|
|
579
|
-
return this.localeService.t(
|
|
580
|
-
const e = this.localeService.t(
|
|
581
|
+
return this.localeService.t(b.NONE).replace(G, this.titleStr);
|
|
582
|
+
const e = this.localeService.t(b[t.operator]).replace(x, (r = t.formula1) != null ? r : "").replace(P, (a = t.formula2) != null ? a : "");
|
|
581
583
|
return `${this.titleStr} ${e}`;
|
|
582
584
|
}
|
|
583
585
|
generateRuleErrorMessage(t, e) {
|
|
584
586
|
var a, o;
|
|
585
|
-
return t.operator ? `${this.localeService.t(
|
|
587
|
+
return t.operator ? `${this.localeService.t(w[t.operator]).replace(x, (a = t.formula1) != null ? a : "").replace(P, (o = t.formula2) != null ? o : "")}` : this.localeService.t(w.NONE).replace(G, this.titleStr);
|
|
586
588
|
}
|
|
587
589
|
getExtraStyle(t, e, r, a, o) {
|
|
588
590
|
}
|
|
@@ -674,27 +676,27 @@ let G = class {
|
|
|
674
676
|
}
|
|
675
677
|
}
|
|
676
678
|
};
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
],
|
|
679
|
+
$ = Ve([
|
|
680
|
+
B(0, V(ne)),
|
|
681
|
+
B(1, V(Q))
|
|
682
|
+
], $);
|
|
681
683
|
export {
|
|
682
|
-
|
|
683
|
-
|
|
684
|
+
A as AddDataValidationMutation,
|
|
685
|
+
$ as BaseDataValidator,
|
|
684
686
|
h as DataValidationModel,
|
|
685
687
|
I as DataValidationResourceController,
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
688
|
+
Le as DataValidatorDropdownType,
|
|
689
|
+
_e as DataValidatorRegistryScope,
|
|
690
|
+
W as DataValidatorRegistryService,
|
|
691
|
+
x as FORMULA1,
|
|
692
|
+
P as FORMULA2,
|
|
693
|
+
f as RemoveDataValidationMutation,
|
|
694
|
+
be as TWO_FORMULA_OPERATOR_COUNT,
|
|
695
|
+
G as TYPE,
|
|
696
|
+
De as TextLengthErrorTitleMap,
|
|
697
|
+
D as UniverDataValidationPlugin,
|
|
696
698
|
v as UpdateDataValidationMutation,
|
|
697
699
|
p as UpdateRuleType,
|
|
698
|
-
|
|
699
|
-
|
|
700
|
+
F as getRuleOptions,
|
|
701
|
+
j as getRuleSetting
|
|
700
702
|
};
|