@univerjs/sheets-data-validation 0.10.12-nightly.202510251119 → 0.10.13-nightly.202510290902
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 +255 -255
- package/lib/index.js +255 -255
- package/lib/umd/index.js +1 -1
- package/package.json +9 -9
package/lib/es/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var St = Object.defineProperty;
|
|
2
2
|
var Et = (o, a, e) => a in o ? St(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e;
|
|
3
3
|
var m = (o, a, e) => Et(o, typeof a != "symbol" ? a + "" : a, e);
|
|
4
|
-
import { Inject as v, ICommandService as U, IUniverInstanceService as
|
|
5
|
-
import { DataValidationModel as
|
|
4
|
+
import { Inject as v, ICommandService as U, IUniverInstanceService as O, Disposable as W, ObjectMatrix as Se, getIntersectRange as ot, UniverInstanceType as N, Range as L, Rectangle as I, isFormulaString as S, DataValidationType as T, getOriginCellValue as Vt, RBush as Mt, debounce as yt, Tools as E, DataValidationStatus as b, WrapStrategy as ve, DataValidationOperator as h, numfmt as P, dayjs as st, DataValidationRenderMode as Pe, CommandType as z, IUndoRedoService as Z, sequenceExecute as Ae, isRangesEqual as nt, IPermissionService as Tt, generateRandomId as Ye, toDisposable as Xe, Injector as Ke, CellValueType as Ft, RxDisposable as Nt, LifecycleService as Ct, LifecycleStages as et, bufferDebounceTime as Ot, DependentOn as wt, IConfigService as It, Plugin as At, merge as Dt } from "@univerjs/core";
|
|
5
|
+
import { DataValidationModel as De, DataValidatorRegistryService as q, UpdateRuleType as M, BaseDataValidator as G, TextLengthErrorTitleMap as bt, AddDataValidationMutation as D, RemoveDataValidationMutation as A, UpdateDataValidationMutation as y, getRuleSetting as Lt, getRuleOptions as Ut, UniverDataValidationPlugin as Bt } from "@univerjs/data-validation";
|
|
6
6
|
import { ERROR_TYPE_SET as xt, LexerTreeBuilder as Y, isReferenceString as lt, sequenceNodeType as Pt, deserializeRangeWithSheet as Ht, deserializeRangeWithSheetWithCache as Wt, operatorToken as $t } from "@univerjs/engine-formula";
|
|
7
7
|
import { SetRangeValuesMutation as se, RemoveSheetMutation as ut, getSheetCommandTarget as ze, SetRangeValuesUndoMutationFactory as dt, WorksheetViewPermission as kt, RefRangeService as jt, handleCommonDefaultRangeChangeWithEffectRefCommands as Qt, SheetInterceptorService as ct, RemoveSheetCommand as qt, CopySheetCommand as Gt, SheetsSelectionsService as ht, ClearSelectionAllCommand as Yt } from "@univerjs/sheets";
|
|
8
8
|
import { Subject as Ge, bufferWhen as Xt, filter as tt } from "rxjs";
|
|
@@ -41,7 +41,7 @@ let Q = class extends W {
|
|
|
41
41
|
(e = this._cacheMatrix.get(t)) == null || e.delete(r);
|
|
42
42
|
}
|
|
43
43
|
})), this.disposeWithMe(this._univerInstanceService.unitDisposed$.subscribe((a) => {
|
|
44
|
-
a.type ===
|
|
44
|
+
a.type === N.UNIVER_SHEET && this._cacheMatrix.delete(a.getUnitId());
|
|
45
45
|
}));
|
|
46
46
|
}
|
|
47
47
|
_ensureCache(a, e) {
|
|
@@ -81,18 +81,18 @@ let Q = class extends W {
|
|
|
81
81
|
};
|
|
82
82
|
Q = zt([
|
|
83
83
|
He(0, v(U)),
|
|
84
|
-
He(1, v(
|
|
85
|
-
He(2, v(
|
|
84
|
+
He(1, v(O)),
|
|
85
|
+
He(2, v(De))
|
|
86
86
|
], Q);
|
|
87
87
|
function oe(o) {
|
|
88
88
|
var a, e;
|
|
89
89
|
return (e = (a = o == null ? void 0 : o[0]) == null ? void 0 : a[0]) == null ? void 0 : e.v;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function pe(o) {
|
|
92
92
|
var a;
|
|
93
93
|
return (a = o == null ? void 0 : o[0]) == null ? void 0 : a[0];
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function C(o) {
|
|
96
96
|
return !xt.has(o);
|
|
97
97
|
}
|
|
98
98
|
function de(o, a) {
|
|
@@ -122,7 +122,7 @@ let H = class extends W {
|
|
|
122
122
|
this.disposeWithMe(this._registerOtherFormulaService.formulaResult$.subscribe((a) => {
|
|
123
123
|
for (const e in a) {
|
|
124
124
|
const t = a[e];
|
|
125
|
-
if (this._instanceSrv.getUnitType(e) ===
|
|
125
|
+
if (this._instanceSrv.getUnitType(e) === N.UNIVER_SHEET)
|
|
126
126
|
for (const i in t) {
|
|
127
127
|
const s = t[i], { ruleFormulaMap: n } = this._ensureMaps(e, i);
|
|
128
128
|
s.forEach((l) => {
|
|
@@ -148,7 +148,7 @@ let H = class extends W {
|
|
|
148
148
|
_handleDirtyRanges(a, e, t) {
|
|
149
149
|
this._dataValidationModel.getRules(a, e).forEach((i) => {
|
|
150
150
|
const s = i.ranges;
|
|
151
|
-
|
|
151
|
+
I.doAnyRangesIntersect(s, t) && this.makeRuleDirty(a, e, i.uid);
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
_initDirtyRanges() {
|
|
@@ -193,36 +193,36 @@ let H = class extends W {
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
async getCellFormulaValue(a, e, t, r, i) {
|
|
196
|
-
var
|
|
196
|
+
var f, p;
|
|
197
197
|
const { ruleFormulaMap: s } = this._ensureMaps(a, e), n = s.get(t);
|
|
198
198
|
if (!n)
|
|
199
199
|
return Promise.resolve(void 0);
|
|
200
200
|
const l = await this._registerOtherFormulaService.getFormulaValue(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, g = i - d;
|
|
201
|
-
return
|
|
201
|
+
return pe((p = (f = l == null ? void 0 : l.result) == null ? void 0 : f[c]) == null ? void 0 : p[g]);
|
|
202
202
|
}
|
|
203
203
|
async getCellFormula2Value(a, e, t, r, i) {
|
|
204
|
-
var
|
|
204
|
+
var f, p;
|
|
205
205
|
const { ruleFormulaMap2: s } = this._ensureMaps(a, e), n = s.get(t);
|
|
206
206
|
if (!n)
|
|
207
207
|
return Promise.resolve(void 0);
|
|
208
208
|
const l = await this._registerOtherFormulaService.getFormulaValue(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, g = i - d;
|
|
209
|
-
return
|
|
209
|
+
return pe((p = (f = l == null ? void 0 : l.result) == null ? void 0 : f[c]) == null ? void 0 : p[g]);
|
|
210
210
|
}
|
|
211
211
|
getCellFormulaValueSync(a, e, t, r, i) {
|
|
212
|
-
var
|
|
212
|
+
var f, p;
|
|
213
213
|
const { ruleFormulaMap: s } = this._ensureMaps(a, e), n = s.get(t);
|
|
214
214
|
if (!n)
|
|
215
215
|
return;
|
|
216
216
|
const l = this._registerOtherFormulaService.getFormulaValueSync(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, g = i - d;
|
|
217
|
-
return
|
|
217
|
+
return pe((p = (f = l == null ? void 0 : l.result) == null ? void 0 : f[c]) == null ? void 0 : p[g]);
|
|
218
218
|
}
|
|
219
219
|
getCellFormula2ValueSync(a, e, t, r, i) {
|
|
220
|
-
var
|
|
220
|
+
var f, p;
|
|
221
221
|
const { ruleFormulaMap2: s } = this._ensureMaps(a, e), n = s.get(t);
|
|
222
222
|
if (!n)
|
|
223
223
|
return;
|
|
224
224
|
const l = this._registerOtherFormulaService.getFormulaValueSync(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, g = i - d;
|
|
225
|
-
return
|
|
225
|
+
return pe((p = (f = l == null ? void 0 : l.result) == null ? void 0 : f[c]) == null ? void 0 : p[g]);
|
|
226
226
|
}
|
|
227
227
|
getRuleFormulaInfo(a, e, t) {
|
|
228
228
|
const { ruleFormulaMap: r } = this._ensureMaps(a, e);
|
|
@@ -235,9 +235,9 @@ let H = class extends W {
|
|
|
235
235
|
}
|
|
236
236
|
};
|
|
237
237
|
H = Jt([
|
|
238
|
-
re(0,
|
|
238
|
+
re(0, O),
|
|
239
239
|
re(1, v(mt)),
|
|
240
|
-
re(2, v(
|
|
240
|
+
re(2, v(De)),
|
|
241
241
|
re(3, v(Q)),
|
|
242
242
|
re(4, v(q))
|
|
243
243
|
], H);
|
|
@@ -256,7 +256,7 @@ let K = class extends W {
|
|
|
256
256
|
this.disposeWithMe(this._registerOtherFormulaService.formulaResult$.subscribe((a) => {
|
|
257
257
|
for (const e in a) {
|
|
258
258
|
const t = a[e];
|
|
259
|
-
if (this._instanceService.getUnitType(e) ===
|
|
259
|
+
if (this._instanceService.getUnitType(e) === N.UNIVER_SHEET)
|
|
260
260
|
for (const i in t) {
|
|
261
261
|
const s = t[i], n = this._ensureRuleFormulaMap(e, i);
|
|
262
262
|
s.forEach((l) => {
|
|
@@ -327,16 +327,16 @@ let K = class extends W {
|
|
|
327
327
|
}
|
|
328
328
|
};
|
|
329
329
|
K = ta([
|
|
330
|
-
ie(0,
|
|
330
|
+
ie(0, O),
|
|
331
331
|
ie(1, v(mt)),
|
|
332
332
|
ie(2, v(Q)),
|
|
333
|
-
ie(3, v(
|
|
333
|
+
ie(3, v(De)),
|
|
334
334
|
ie(4, v(q))
|
|
335
335
|
], K);
|
|
336
336
|
function ne(o) {
|
|
337
337
|
return Vt(o);
|
|
338
338
|
}
|
|
339
|
-
function
|
|
339
|
+
function pt(o) {
|
|
340
340
|
var a;
|
|
341
341
|
return String((a = ne(o)) != null ? a : "");
|
|
342
342
|
}
|
|
@@ -367,14 +367,14 @@ class Ze {
|
|
|
367
367
|
}
|
|
368
368
|
get _worksheet() {
|
|
369
369
|
var a;
|
|
370
|
-
return (a = this._univerInstanceService.getUnit(this._unitId,
|
|
370
|
+
return (a = this._univerInstanceService.getUnit(this._unitId, N.UNIVER_SHEET)) == null ? void 0 : a.getSheetBySheetId(this._subUnitId);
|
|
371
371
|
}
|
|
372
372
|
_addRule(a, e) {
|
|
373
373
|
if (!this._worksheet)
|
|
374
374
|
return;
|
|
375
|
-
const t =
|
|
375
|
+
const t = I.mergeRanges(e.map((r) => L.transformRange(r, this._worksheet)));
|
|
376
376
|
this._map.forEach((r, i) => {
|
|
377
|
-
const s =
|
|
377
|
+
const s = I.subtractMulti(r, t);
|
|
378
378
|
s.length === 0 ? this._map.delete(i) : this._map.set(i, s);
|
|
379
379
|
}), this._dirty = !0, this._map.set(a, t), this._debonceBuildTree();
|
|
380
380
|
}
|
|
@@ -386,7 +386,7 @@ class Ze {
|
|
|
386
386
|
return;
|
|
387
387
|
const e = a.map((t) => L.transformRange(t, this._worksheet));
|
|
388
388
|
this._map.forEach((t, r) => {
|
|
389
|
-
const i =
|
|
389
|
+
const i = I.subtractMulti(t, e);
|
|
390
390
|
i.length === 0 ? this._map.delete(r) : this._map.set(r, i);
|
|
391
391
|
}), this._dirty = !0, this._debonceBuildTree();
|
|
392
392
|
}
|
|
@@ -404,10 +404,10 @@ class Ze {
|
|
|
404
404
|
if (!t.length)
|
|
405
405
|
return;
|
|
406
406
|
let r = this._map.get(e);
|
|
407
|
-
r ? (this._map.set(e,
|
|
407
|
+
r ? (this._map.set(e, I.mergeRanges([...r, ...t])), r = this._map.get(e)) : (r = t, this._map.set(e, r)), this._map.forEach((i, s) => {
|
|
408
408
|
if (s === e)
|
|
409
409
|
return;
|
|
410
|
-
const n =
|
|
410
|
+
const n = I.subtractMulti(i, t);
|
|
411
411
|
n.length === 0 ? this._map.delete(s) : this._map.set(s, n);
|
|
412
412
|
});
|
|
413
413
|
}), this._dirty = !0, this._debonceBuildTree();
|
|
@@ -418,11 +418,11 @@ class Ze {
|
|
|
418
418
|
return a.forEach((r, i) => {
|
|
419
419
|
var l;
|
|
420
420
|
const s = (l = this._map.get(r.uid)) != null ? l : [], n = r.ranges;
|
|
421
|
-
s.length !== 0 && (s.length !== n.length || s.some((u, d) => !
|
|
421
|
+
s.length !== 0 && (s.length !== n.length || s.some((u, d) => !I.equals(u, n[d]))) && e.push({
|
|
422
422
|
type: "update",
|
|
423
423
|
ruleId: r.uid,
|
|
424
424
|
oldRanges: n,
|
|
425
|
-
newRanges:
|
|
425
|
+
newRanges: I.sort(s),
|
|
426
426
|
rule: r
|
|
427
427
|
}), s.length === 0 && (e.push({
|
|
428
428
|
type: "delete",
|
|
@@ -437,11 +437,11 @@ class Ze {
|
|
|
437
437
|
return a.forEach((i, s) => {
|
|
438
438
|
var u;
|
|
439
439
|
const n = (u = this._map.get(i.uid)) != null ? u : [], l = i.ranges;
|
|
440
|
-
n.length !== 0 && (n.length !== l.length || n.some((d, c) => !
|
|
440
|
+
n.length !== 0 && (n.length !== l.length || n.some((d, c) => !I.equals(d, l[c]))) && t.push({
|
|
441
441
|
type: "update",
|
|
442
442
|
ruleId: i.uid,
|
|
443
443
|
oldRanges: l,
|
|
444
|
-
newRanges:
|
|
444
|
+
newRanges: I.sort(n),
|
|
445
445
|
rule: i
|
|
446
446
|
}), n.length === 0 && (t.push({
|
|
447
447
|
type: "delete",
|
|
@@ -455,7 +455,7 @@ class Ze {
|
|
|
455
455
|
type: "add",
|
|
456
456
|
rule: {
|
|
457
457
|
...i,
|
|
458
|
-
ranges:
|
|
458
|
+
ranges: I.sort(s)
|
|
459
459
|
}
|
|
460
460
|
});
|
|
461
461
|
}), t;
|
|
@@ -577,21 +577,21 @@ let F = class extends W {
|
|
|
577
577
|
return this._dataValidationModel.getRuleById(a, e, i);
|
|
578
578
|
}
|
|
579
579
|
validator(a, e, t) {
|
|
580
|
-
const { col: r, row: i, unitId: s, subUnitId: n, worksheet: l } = e, u = (
|
|
581
|
-
t && t(
|
|
580
|
+
const { col: r, row: i, unitId: s, subUnitId: n, worksheet: l } = e, u = (p, R) => {
|
|
581
|
+
t && t(p, R), R && this._validStatusChange$.next({
|
|
582
582
|
unitId: s,
|
|
583
583
|
subUnitId: n,
|
|
584
584
|
ruleId: a.uid,
|
|
585
|
-
status:
|
|
585
|
+
status: p,
|
|
586
586
|
row: i,
|
|
587
587
|
col: r
|
|
588
588
|
});
|
|
589
|
-
}, d = l.getCellValueOnly(i, r), c = this.getValidator(a.type), g = l.getCellRaw(i, r),
|
|
589
|
+
}, d = l.getCellValueOnly(i, r), c = this.getValidator(a.type), g = l.getCellRaw(i, r), f = ne(g);
|
|
590
590
|
if (c) {
|
|
591
|
-
const
|
|
592
|
-
return R == null ? (
|
|
591
|
+
const p = this._dataValidationCacheService.ensureCache(s, n), R = p.getValue(i, r);
|
|
592
|
+
return R == null ? (p.setValue(i, r, b.VALIDATING), c.validator(
|
|
593
593
|
{
|
|
594
|
-
value:
|
|
594
|
+
value: f,
|
|
595
595
|
unitId: s,
|
|
596
596
|
subUnitId: n,
|
|
597
597
|
row: i,
|
|
@@ -603,8 +603,8 @@ let F = class extends W {
|
|
|
603
603
|
},
|
|
604
604
|
a
|
|
605
605
|
).then((V) => {
|
|
606
|
-
const
|
|
607
|
-
|
|
606
|
+
const _ = V ? b.VALID : b.INVALID, w = p.getValue(i, r);
|
|
607
|
+
_ === b.VALID ? p.realDeleteValue(i, r) : p.setValue(i, r, _), u(_, R !== w);
|
|
608
608
|
}), b.VALIDATING) : (u(R != null ? R : b.VALID, !1), R != null ? R : b.VALID);
|
|
609
609
|
} else
|
|
610
610
|
return u(b.VALID, !1), b.VALID;
|
|
@@ -635,8 +635,8 @@ let F = class extends W {
|
|
|
635
635
|
}
|
|
636
636
|
};
|
|
637
637
|
F = ra([
|
|
638
|
-
X(0, v(
|
|
639
|
-
X(1,
|
|
638
|
+
X(0, v(De)),
|
|
639
|
+
X(1, O),
|
|
640
640
|
X(2, v(q)),
|
|
641
641
|
X(3, v(Q)),
|
|
642
642
|
X(4, v(K)),
|
|
@@ -647,7 +647,7 @@ const Ee = 1, Ve = 0;
|
|
|
647
647
|
function at(o, a) {
|
|
648
648
|
return E.isBlank(o) ? a.t("dataValidation.validFail.value") : S(o) ? a.t("dataValidation.validFail.primitive") : "";
|
|
649
649
|
}
|
|
650
|
-
const
|
|
650
|
+
const fe = (o) => E.isDefine(o) && String(o).toLowerCase() === "true" ? "1" : String(o).toLowerCase() === "false" ? "0" : o;
|
|
651
651
|
class ia extends G {
|
|
652
652
|
constructor() {
|
|
653
653
|
super(...arguments);
|
|
@@ -683,11 +683,11 @@ class ia extends G {
|
|
|
683
683
|
};
|
|
684
684
|
}
|
|
685
685
|
async parseFormula(e, t, r) {
|
|
686
|
-
var c, g,
|
|
687
|
-
const { formula1: i = Ee, formula2: s = Ve } = e, n = await this._formulaService.getRuleFormulaResult(t, r, e.uid), l = S(i) ? oe((g = (c = n == null ? void 0 : n[0]) == null ? void 0 : c.result) == null ? void 0 : g[0][0]) : i, u = S(s) ? oe((
|
|
686
|
+
var c, g, f, p;
|
|
687
|
+
const { formula1: i = Ee, formula2: s = Ve } = e, n = await this._formulaService.getRuleFormulaResult(t, r, e.uid), l = S(i) ? oe((g = (c = n == null ? void 0 : n[0]) == null ? void 0 : c.result) == null ? void 0 : g[0][0]) : i, u = S(s) ? oe((p = (f = n == null ? void 0 : n[1]) == null ? void 0 : f.result) == null ? void 0 : p[0][0]) : s, d = C(String(l)) && C(String(u));
|
|
688
688
|
return {
|
|
689
|
-
formula1:
|
|
690
|
-
formula2:
|
|
689
|
+
formula1: fe(l),
|
|
690
|
+
formula2: fe(u),
|
|
691
691
|
originFormula1: l,
|
|
692
692
|
originFormula2: u,
|
|
693
693
|
isFormulaValid: d
|
|
@@ -699,11 +699,11 @@ class ia extends G {
|
|
|
699
699
|
};
|
|
700
700
|
}
|
|
701
701
|
parseFormulaSync(e, t, r) {
|
|
702
|
-
var c, g,
|
|
703
|
-
const { formula1: i = Ee, formula2: s = Ve } = e, n = this._formulaService.getRuleFormulaResultSync(t, r, e.uid), l = S(i) ? oe((g = (c = n == null ? void 0 : n[0]) == null ? void 0 : c.result) == null ? void 0 : g[0][0]) : i, u = S(s) ? oe((
|
|
702
|
+
var c, g, f, p;
|
|
703
|
+
const { formula1: i = Ee, formula2: s = Ve } = e, n = this._formulaService.getRuleFormulaResultSync(t, r, e.uid), l = S(i) ? oe((g = (c = n == null ? void 0 : n[0]) == null ? void 0 : c.result) == null ? void 0 : g[0][0]) : i, u = S(s) ? oe((p = (f = n == null ? void 0 : n[1]) == null ? void 0 : f.result) == null ? void 0 : p[0][0]) : s, d = C(String(l)) && C(String(u));
|
|
704
704
|
return {
|
|
705
|
-
formula1:
|
|
706
|
-
formula2:
|
|
705
|
+
formula1: fe(l),
|
|
706
|
+
formula2: fe(u),
|
|
707
707
|
originFormula1: l,
|
|
708
708
|
originFormula2: u,
|
|
709
709
|
isFormulaValid: d
|
|
@@ -758,7 +758,7 @@ const rt = {
|
|
|
758
758
|
function Ka(o) {
|
|
759
759
|
return o.filter(Boolean).join(",");
|
|
760
760
|
}
|
|
761
|
-
function
|
|
761
|
+
function _e(o) {
|
|
762
762
|
return o.split(",").filter(Boolean);
|
|
763
763
|
}
|
|
764
764
|
function za(o) {
|
|
@@ -802,7 +802,7 @@ class na extends G {
|
|
|
802
802
|
m(this, "_lexerTreeBuilder", this.injector.get(Y));
|
|
803
803
|
}
|
|
804
804
|
async parseFormula(e, t, r, i, s) {
|
|
805
|
-
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c =
|
|
805
|
+
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c = C(String(n == null ? void 0 : n.v)) && C(String(l == null ? void 0 : l.v));
|
|
806
806
|
return {
|
|
807
807
|
formula1: We(S(u) ? n == null ? void 0 : n.v : u),
|
|
808
808
|
formula2: We(S(d) ? l == null ? void 0 : l.v : d),
|
|
@@ -935,7 +935,7 @@ class la extends G {
|
|
|
935
935
|
return e == null ? Number.NaN : +e;
|
|
936
936
|
}
|
|
937
937
|
async parseFormula(e, t, r, i, s) {
|
|
938
|
-
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c =
|
|
938
|
+
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c = C(String(n == null ? void 0 : n.v)) && C(String(l == null ? void 0 : l.v));
|
|
939
939
|
return {
|
|
940
940
|
formula1: this._parseNumber(S(u) ? n == null ? void 0 : n.v : u),
|
|
941
941
|
formula2: this._parseNumber(S(d) ? l == null ? void 0 : l.v : d),
|
|
@@ -979,7 +979,7 @@ function $e(o) {
|
|
|
979
979
|
a.add(P.format(t.s.n.pattern, r, { throws: !1 }));
|
|
980
980
|
return;
|
|
981
981
|
}
|
|
982
|
-
|
|
982
|
+
C(r.toString()) && a.add(r.toString());
|
|
983
983
|
}
|
|
984
984
|
});
|
|
985
985
|
}
|
|
@@ -1001,17 +1001,17 @@ function ca(o, a) {
|
|
|
1001
1001
|
const { formula1: e = "", ranges: t } = o;
|
|
1002
1002
|
if (lt(e.slice(1))) {
|
|
1003
1003
|
const i = Ht(e.slice(1));
|
|
1004
|
-
if ((!i.sheetName || i.sheetName === a) && t.some((s) =>
|
|
1004
|
+
if ((!i.sheetName || i.sheetName === a) && t.some((s) => I.intersects(s, i.range)))
|
|
1005
1005
|
return !0;
|
|
1006
1006
|
}
|
|
1007
1007
|
return !1;
|
|
1008
1008
|
}
|
|
1009
|
-
class
|
|
1009
|
+
class ft extends G {
|
|
1010
1010
|
constructor() {
|
|
1011
1011
|
super(...arguments);
|
|
1012
1012
|
m(this, "formulaService", this.injector.get(K));
|
|
1013
1013
|
m(this, "_lexer", this.injector.get(Y));
|
|
1014
|
-
m(this, "_univerInstanceService", this.injector.get(
|
|
1014
|
+
m(this, "_univerInstanceService", this.injector.get(O));
|
|
1015
1015
|
m(this, "order", 50);
|
|
1016
1016
|
m(this, "offsetFormulaByRange", !1);
|
|
1017
1017
|
m(this, "id", T.LIST);
|
|
@@ -1022,7 +1022,7 @@ class pt extends G {
|
|
|
1022
1022
|
}
|
|
1023
1023
|
validatorFormula(e, t, r) {
|
|
1024
1024
|
var u, d, c;
|
|
1025
|
-
const i = !E.isBlank(e.formula1), s = da((u = e.formula1) != null ? u : "", this._lexer), n = (c = (d = this._univerInstanceService.getUnit(t,
|
|
1025
|
+
const i = !E.isBlank(e.formula1), s = da((u = e.formula1) != null ? u : "", this._lexer), n = (c = (d = this._univerInstanceService.getUnit(t, N.UNIVER_SHEET)) == null ? void 0 : d.getSheetBySheetId(r)) == null ? void 0 : c.getName(), l = ca(e, n != null ? n : "");
|
|
1026
1026
|
return {
|
|
1027
1027
|
success: !!(i && s && !l),
|
|
1028
1028
|
formula1: i ? s ? l ? this.localeService.t("dataValidation.validFail.listIntersects") : void 0 : this.localeService.t("dataValidation.validFail.listInvalid") : this.localeService.t("dataValidation.validFail.list")
|
|
@@ -1047,7 +1047,7 @@ class pt extends G {
|
|
|
1047
1047
|
}
|
|
1048
1048
|
parseCellValue(e) {
|
|
1049
1049
|
const t = e.toString();
|
|
1050
|
-
return
|
|
1050
|
+
return _e(t);
|
|
1051
1051
|
}
|
|
1052
1052
|
async parseFormula(e, t, r) {
|
|
1053
1053
|
var l, u;
|
|
@@ -1055,13 +1055,13 @@ class pt extends G {
|
|
|
1055
1055
|
return {
|
|
1056
1056
|
formula1: void 0,
|
|
1057
1057
|
formula2: void 0,
|
|
1058
|
-
isFormulaValid:
|
|
1058
|
+
isFormulaValid: C(String(s))
|
|
1059
1059
|
};
|
|
1060
1060
|
}
|
|
1061
1061
|
async isValidType(e, t, r) {
|
|
1062
|
-
var g,
|
|
1063
|
-
const { value: i, unitId: s, subUnitId: n } = e, { formula1: l = "" } = r, u = await this.formulaService.getRuleFormulaResult(s, n, r.uid), d = S(l) ? $e((
|
|
1064
|
-
return this.parseCellValue(i).every((
|
|
1062
|
+
var g, f;
|
|
1063
|
+
const { value: i, unitId: s, subUnitId: n } = e, { formula1: l = "" } = r, u = await this.formulaService.getRuleFormulaResult(s, n, r.uid), d = S(l) ? $e((f = (g = u == null ? void 0 : u[0]) == null ? void 0 : g.result) == null ? void 0 : f[0][0]) : _e(l);
|
|
1064
|
+
return this.parseCellValue(i).every((p) => d.includes(p));
|
|
1065
1065
|
}
|
|
1066
1066
|
generateRuleName() {
|
|
1067
1067
|
return this.localeService.t("dataValidation.list.name");
|
|
@@ -1070,22 +1070,22 @@ class pt extends G {
|
|
|
1070
1070
|
return this.localeService.t("dataValidation.list.error");
|
|
1071
1071
|
}
|
|
1072
1072
|
getList(e, t, r) {
|
|
1073
|
-
var g,
|
|
1074
|
-
const { formula1: i = "" } = e, s = this.injector.get(
|
|
1073
|
+
var g, f, p, R;
|
|
1074
|
+
const { formula1: i = "" } = e, s = this.injector.get(O), n = (g = t ? s.getUniverSheetInstance(t) : void 0) != null ? g : s.getCurrentUnitForType(N.UNIVER_SHEET);
|
|
1075
1075
|
if (!n) return [];
|
|
1076
|
-
const l = (
|
|
1076
|
+
const l = (f = r ? n.getSheetBySheetId(r) : void 0) != null ? f : n.getActiveSheet();
|
|
1077
1077
|
if (!l) return [];
|
|
1078
1078
|
const u = n.getUnitId(), d = l.getSheetId(), c = this.formulaService.getRuleFormulaResultSync(u, d, e.uid);
|
|
1079
|
-
return S(i) ? $e((R = (
|
|
1079
|
+
return S(i) ? $e((R = (p = c == null ? void 0 : c[0]) == null ? void 0 : p.result) == null ? void 0 : R[0][0]) : _e(i);
|
|
1080
1080
|
}
|
|
1081
1081
|
async getListAsync(e, t, r) {
|
|
1082
|
-
var g,
|
|
1083
|
-
const { formula1: i = "" } = e, s = this.injector.get(
|
|
1082
|
+
var g, f, p, R;
|
|
1083
|
+
const { formula1: i = "" } = e, s = this.injector.get(O), n = (g = t ? s.getUniverSheetInstance(t) : void 0) != null ? g : s.getCurrentUnitForType(N.UNIVER_SHEET);
|
|
1084
1084
|
if (!n) return [];
|
|
1085
|
-
const l = (
|
|
1085
|
+
const l = (f = r ? n.getSheetBySheetId(r) : void 0) != null ? f : n.getActiveSheet();
|
|
1086
1086
|
if (!l) return [];
|
|
1087
1087
|
const u = n.getUnitId(), d = l.getSheetId(), c = await this.formulaService.getRuleFormulaResult(u, d, e.uid);
|
|
1088
|
-
return S(i) ? $e((R = (
|
|
1088
|
+
return S(i) ? $e((R = (p = c == null ? void 0 : c[0]) == null ? void 0 : p.result) == null ? void 0 : R[0][0]) : _e(i);
|
|
1089
1089
|
}
|
|
1090
1090
|
getListWithColor(e, t, r) {
|
|
1091
1091
|
const i = this.getList(e, t, r), s = (e.formula2 || "").split(",");
|
|
@@ -1141,7 +1141,7 @@ class ha extends G {
|
|
|
1141
1141
|
return e == null ? Number.NaN : +e;
|
|
1142
1142
|
}
|
|
1143
1143
|
async parseFormula(e, t, r, i, s) {
|
|
1144
|
-
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c =
|
|
1144
|
+
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c = C(String(n == null ? void 0 : n.v)) && C(String(l == null ? void 0 : l.v));
|
|
1145
1145
|
return {
|
|
1146
1146
|
formula1: this._parseNumber(S(u) ? n == null ? void 0 : n.v : u),
|
|
1147
1147
|
formula2: this._parseNumber(S(d) ? l == null ? void 0 : l.v : d),
|
|
@@ -1165,67 +1165,67 @@ class ha extends G {
|
|
|
1165
1165
|
return `${this.localeService.t(bt[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
1166
1166
|
}
|
|
1167
1167
|
}
|
|
1168
|
-
function
|
|
1168
|
+
function _t(o) {
|
|
1169
1169
|
var e, t;
|
|
1170
1170
|
return o ? o.p ? !((t = (e = o.p.body) == null ? void 0 : e.dataStream) != null ? t : "").slice(0, -2).trim() : E.isBlank(o.v) : !0;
|
|
1171
1171
|
}
|
|
1172
1172
|
function Ue(o, a, e, t, r = "command", i = !0) {
|
|
1173
|
-
const s = t.get(Y), n = t.get(q), l = [], u = [], d = t.get(F), c = t.get(
|
|
1173
|
+
const s = t.get(Y), n = t.get(q), l = [], u = [], d = t.get(F), c = t.get(O), g = ze(c, { unitId: o, subUnitId: a });
|
|
1174
1174
|
if (!g)
|
|
1175
1175
|
return {
|
|
1176
1176
|
redoMutations: l,
|
|
1177
1177
|
undoMutations: u
|
|
1178
1178
|
};
|
|
1179
|
-
const { worksheet:
|
|
1179
|
+
const { worksheet: f } = g, p = new Se();
|
|
1180
1180
|
let R = !1;
|
|
1181
|
-
function V(
|
|
1182
|
-
i &&
|
|
1181
|
+
function V(_, w) {
|
|
1182
|
+
i && _.forEach(($) => {
|
|
1183
1183
|
L.foreach($, (B, k) => {
|
|
1184
|
-
const x =
|
|
1185
|
-
(
|
|
1186
|
-
v:
|
|
1184
|
+
const x = f.getCellRaw(B, k), J = pt(x);
|
|
1185
|
+
(_t(x) || J === w) && !(x != null && x.p) && (R = !0, p.setValue(B, k, {
|
|
1186
|
+
v: w,
|
|
1187
1187
|
p: null
|
|
1188
1188
|
}));
|
|
1189
1189
|
});
|
|
1190
1190
|
});
|
|
1191
1191
|
}
|
|
1192
|
-
if (e.forEach((
|
|
1193
|
-
switch (
|
|
1192
|
+
if (e.forEach((_) => {
|
|
1193
|
+
switch (_.type) {
|
|
1194
1194
|
case "delete":
|
|
1195
1195
|
l.push({
|
|
1196
|
-
id:
|
|
1196
|
+
id: A.id,
|
|
1197
1197
|
params: {
|
|
1198
1198
|
unitId: o,
|
|
1199
1199
|
subUnitId: a,
|
|
1200
|
-
ruleId:
|
|
1200
|
+
ruleId: _.rule.uid,
|
|
1201
1201
|
source: r
|
|
1202
1202
|
}
|
|
1203
1203
|
}), u.unshift({
|
|
1204
|
-
id:
|
|
1204
|
+
id: D.id,
|
|
1205
1205
|
params: {
|
|
1206
1206
|
unitId: o,
|
|
1207
1207
|
subUnitId: a,
|
|
1208
|
-
rule:
|
|
1209
|
-
index:
|
|
1208
|
+
rule: _.rule,
|
|
1209
|
+
index: _.index,
|
|
1210
1210
|
source: r
|
|
1211
1211
|
}
|
|
1212
1212
|
});
|
|
1213
1213
|
break;
|
|
1214
1214
|
case "update": {
|
|
1215
|
-
if (de(
|
|
1216
|
-
const $ =
|
|
1217
|
-
he !==
|
|
1215
|
+
if (de(_.rule.type, n)) {
|
|
1216
|
+
const $ = _.oldRanges[0].startRow, B = _.oldRanges[0].startColumn, k = _.newRanges[0].startRow, x = _.newRanges[0].startColumn, J = k - $, ce = x - B, he = S(_.rule.formula1) ? s.moveFormulaRefOffset(_.rule.formula1, ce, J) : _.rule.formula1, me = S(_.rule.formula2) ? s.moveFormulaRefOffset(_.rule.formula2, ce, J) : _.rule.formula2;
|
|
1217
|
+
he !== _.rule.formula1 || me !== _.rule.formula2 || !nt(_.newRanges, _.oldRanges) ? (l.push({
|
|
1218
1218
|
id: y.id,
|
|
1219
1219
|
params: {
|
|
1220
1220
|
unitId: o,
|
|
1221
1221
|
subUnitId: a,
|
|
1222
|
-
ruleId:
|
|
1222
|
+
ruleId: _.ruleId,
|
|
1223
1223
|
payload: {
|
|
1224
1224
|
type: M.ALL,
|
|
1225
1225
|
payload: {
|
|
1226
1226
|
formula1: he,
|
|
1227
1227
|
formula2: me,
|
|
1228
|
-
ranges:
|
|
1228
|
+
ranges: _.newRanges
|
|
1229
1229
|
}
|
|
1230
1230
|
}
|
|
1231
1231
|
}
|
|
@@ -1234,13 +1234,13 @@ function Ue(o, a, e, t, r = "command", i = !0) {
|
|
|
1234
1234
|
params: {
|
|
1235
1235
|
unitId: o,
|
|
1236
1236
|
subUnitId: a,
|
|
1237
|
-
ruleId:
|
|
1237
|
+
ruleId: _.ruleId,
|
|
1238
1238
|
payload: {
|
|
1239
1239
|
type: M.ALL,
|
|
1240
1240
|
payload: {
|
|
1241
|
-
formula1:
|
|
1242
|
-
formula2:
|
|
1243
|
-
ranges:
|
|
1241
|
+
formula1: _.rule.formula1,
|
|
1242
|
+
formula2: _.rule.formula2,
|
|
1243
|
+
ranges: _.oldRanges
|
|
1244
1244
|
}
|
|
1245
1245
|
}
|
|
1246
1246
|
}
|
|
@@ -1249,10 +1249,10 @@ function Ue(o, a, e, t, r = "command", i = !0) {
|
|
|
1249
1249
|
params: {
|
|
1250
1250
|
unitId: o,
|
|
1251
1251
|
subUnitId: a,
|
|
1252
|
-
ruleId:
|
|
1252
|
+
ruleId: _.ruleId,
|
|
1253
1253
|
payload: {
|
|
1254
1254
|
type: M.RANGE,
|
|
1255
|
-
payload:
|
|
1255
|
+
payload: _.newRanges
|
|
1256
1256
|
},
|
|
1257
1257
|
source: r
|
|
1258
1258
|
}
|
|
@@ -1261,10 +1261,10 @@ function Ue(o, a, e, t, r = "command", i = !0) {
|
|
|
1261
1261
|
params: {
|
|
1262
1262
|
unitId: o,
|
|
1263
1263
|
subUnitId: a,
|
|
1264
|
-
ruleId:
|
|
1264
|
+
ruleId: _.ruleId,
|
|
1265
1265
|
payload: {
|
|
1266
1266
|
type: M.RANGE,
|
|
1267
|
-
payload:
|
|
1267
|
+
payload: _.oldRanges
|
|
1268
1268
|
},
|
|
1269
1269
|
source: r
|
|
1270
1270
|
}
|
|
@@ -1275,10 +1275,10 @@ function Ue(o, a, e, t, r = "command", i = !0) {
|
|
|
1275
1275
|
params: {
|
|
1276
1276
|
unitId: o,
|
|
1277
1277
|
subUnitId: a,
|
|
1278
|
-
ruleId:
|
|
1278
|
+
ruleId: _.ruleId,
|
|
1279
1279
|
payload: {
|
|
1280
1280
|
type: M.RANGE,
|
|
1281
|
-
payload:
|
|
1281
|
+
payload: _.newRanges
|
|
1282
1282
|
},
|
|
1283
1283
|
source: r
|
|
1284
1284
|
}
|
|
@@ -1287,58 +1287,58 @@ function Ue(o, a, e, t, r = "command", i = !0) {
|
|
|
1287
1287
|
params: {
|
|
1288
1288
|
unitId: o,
|
|
1289
1289
|
subUnitId: a,
|
|
1290
|
-
ruleId:
|
|
1290
|
+
ruleId: _.ruleId,
|
|
1291
1291
|
payload: {
|
|
1292
1292
|
type: M.RANGE,
|
|
1293
|
-
payload:
|
|
1293
|
+
payload: _.oldRanges
|
|
1294
1294
|
},
|
|
1295
1295
|
source: r
|
|
1296
1296
|
}
|
|
1297
1297
|
});
|
|
1298
|
-
const
|
|
1299
|
-
if (
|
|
1300
|
-
const B = d.getValidator(T.CHECKBOX).parseFormulaSync(
|
|
1301
|
-
V(
|
|
1298
|
+
const w = d.getRuleById(o, a, _.ruleId);
|
|
1299
|
+
if (w && w.type === T.CHECKBOX) {
|
|
1300
|
+
const B = d.getValidator(T.CHECKBOX).parseFormulaSync(w, o, a);
|
|
1301
|
+
V(_.newRanges, B.formula2);
|
|
1302
1302
|
}
|
|
1303
1303
|
break;
|
|
1304
1304
|
}
|
|
1305
1305
|
case "add": {
|
|
1306
1306
|
if (l.push({
|
|
1307
|
-
id:
|
|
1307
|
+
id: D.id,
|
|
1308
1308
|
params: {
|
|
1309
1309
|
unitId: o,
|
|
1310
1310
|
subUnitId: a,
|
|
1311
|
-
rule:
|
|
1311
|
+
rule: _.rule,
|
|
1312
1312
|
source: r
|
|
1313
1313
|
}
|
|
1314
1314
|
}), u.unshift({
|
|
1315
|
-
id:
|
|
1315
|
+
id: A.id,
|
|
1316
1316
|
params: {
|
|
1317
1317
|
unitId: o,
|
|
1318
1318
|
subUnitId: a,
|
|
1319
|
-
ruleId:
|
|
1319
|
+
ruleId: _.rule.uid,
|
|
1320
1320
|
source: r
|
|
1321
1321
|
}
|
|
1322
|
-
}),
|
|
1323
|
-
const $ = d.getValidator(T.CHECKBOX).parseFormulaSync(
|
|
1324
|
-
V(
|
|
1322
|
+
}), _.rule.type === T.CHECKBOX) {
|
|
1323
|
+
const $ = d.getValidator(T.CHECKBOX).parseFormulaSync(_.rule, o, a);
|
|
1324
|
+
V(_.rule.ranges, $.originFormula2);
|
|
1325
1325
|
}
|
|
1326
1326
|
break;
|
|
1327
1327
|
}
|
|
1328
1328
|
}
|
|
1329
1329
|
}), R) {
|
|
1330
|
-
const
|
|
1330
|
+
const _ = {
|
|
1331
1331
|
id: se.id,
|
|
1332
1332
|
params: {
|
|
1333
1333
|
unitId: o,
|
|
1334
1334
|
subUnitId: a,
|
|
1335
|
-
cellValue:
|
|
1335
|
+
cellValue: p.getData()
|
|
1336
1336
|
}
|
|
1337
|
-
},
|
|
1337
|
+
}, w = {
|
|
1338
1338
|
id: se.id,
|
|
1339
|
-
params: dt(t,
|
|
1339
|
+
params: dt(t, _.params)
|
|
1340
1340
|
};
|
|
1341
|
-
l.push(
|
|
1341
|
+
l.push(_), u.push(w);
|
|
1342
1342
|
}
|
|
1343
1343
|
return {
|
|
1344
1344
|
redoMutations: l,
|
|
@@ -1356,12 +1356,12 @@ const ma = {
|
|
|
1356
1356
|
return !1;
|
|
1357
1357
|
const d = s.getRuleObjectMatrix(e, t).clone();
|
|
1358
1358
|
d.updateRange(i, r);
|
|
1359
|
-
const c = d.diff(s.getRules(e, t)), { redoMutations: g, undoMutations:
|
|
1359
|
+
const c = d.diff(s.getRules(e, t)), { redoMutations: g, undoMutations: f } = Ue(e, t, c, o);
|
|
1360
1360
|
return l.pushUndoRedo({
|
|
1361
|
-
undoMutations:
|
|
1361
|
+
undoMutations: f,
|
|
1362
1362
|
redoMutations: g,
|
|
1363
1363
|
unitID: e
|
|
1364
|
-
}),
|
|
1364
|
+
}), Ae(g, n), !0;
|
|
1365
1365
|
}
|
|
1366
1366
|
}, ga = {
|
|
1367
1367
|
type: z.COMMAND,
|
|
@@ -1378,12 +1378,12 @@ const ma = {
|
|
|
1378
1378
|
...r,
|
|
1379
1379
|
...d == null ? void 0 : d.normalizeFormula(r, e, t)
|
|
1380
1380
|
}
|
|
1381
|
-
}, { redoMutations: g, undoMutations:
|
|
1381
|
+
}, { redoMutations: g, undoMutations: f } = Ue(e, t, u, o);
|
|
1382
1382
|
return g.push({
|
|
1383
|
-
id: N.id,
|
|
1384
|
-
params: c
|
|
1385
|
-
}), p.unshift({
|
|
1386
1383
|
id: D.id,
|
|
1384
|
+
params: c
|
|
1385
|
+
}), f.unshift({
|
|
1386
|
+
id: A.id,
|
|
1387
1387
|
params: {
|
|
1388
1388
|
unitId: e,
|
|
1389
1389
|
subUnitId: t,
|
|
@@ -1392,10 +1392,10 @@ const ma = {
|
|
|
1392
1392
|
}), n.pushUndoRedo({
|
|
1393
1393
|
unitID: e,
|
|
1394
1394
|
redoMutations: g,
|
|
1395
|
-
undoMutations:
|
|
1396
|
-
}),
|
|
1395
|
+
undoMutations: f
|
|
1396
|
+
}), Ae(g, s), !0;
|
|
1397
1397
|
}
|
|
1398
|
-
},
|
|
1398
|
+
}, pa = {
|
|
1399
1399
|
type: z.COMMAND,
|
|
1400
1400
|
id: "sheets.command.update-data-validation-setting",
|
|
1401
1401
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -1411,7 +1411,7 @@ const ma = {
|
|
|
1411
1411
|
const g = { ...c, ...u };
|
|
1412
1412
|
if (!d.validatorFormula(g, s, n).success)
|
|
1413
1413
|
return !1;
|
|
1414
|
-
const
|
|
1414
|
+
const f = {
|
|
1415
1415
|
unitId: s,
|
|
1416
1416
|
subUnitId: n,
|
|
1417
1417
|
ruleId: l,
|
|
@@ -1422,9 +1422,9 @@ const ma = {
|
|
|
1422
1422
|
...d.normalizeFormula(g, s, n)
|
|
1423
1423
|
}
|
|
1424
1424
|
}
|
|
1425
|
-
},
|
|
1425
|
+
}, p = [{
|
|
1426
1426
|
id: y.id,
|
|
1427
|
-
params:
|
|
1427
|
+
params: f
|
|
1428
1428
|
}], R = {
|
|
1429
1429
|
unitId: s,
|
|
1430
1430
|
subUnitId: n,
|
|
@@ -1438,14 +1438,14 @@ const ma = {
|
|
|
1438
1438
|
params: R
|
|
1439
1439
|
}];
|
|
1440
1440
|
if (u.type === T.CHECKBOX) {
|
|
1441
|
-
const
|
|
1441
|
+
const w = c.ranges, $ = o.get(O), B = ze($, { unitId: s, subUnitId: n });
|
|
1442
1442
|
if (B) {
|
|
1443
1443
|
const k = new Se(), { worksheet: x } = B, { formula2: J = Ve, formula1: ce = Ee } = c, { formula2: he = Ve, formula1: me = Ee } = u;
|
|
1444
1444
|
let Be = !1;
|
|
1445
|
-
if (
|
|
1445
|
+
if (w.forEach((ge) => {
|
|
1446
1446
|
L.foreach(ge, (ae, xe) => {
|
|
1447
|
-
const j = x.getCellRaw(ae, xe), Je =
|
|
1448
|
-
(
|
|
1447
|
+
const j = x.getCellRaw(ae, xe), Je = pt(j);
|
|
1448
|
+
(_t(j) || Je === String(J)) && !(j != null && j.p) ? (k.setValue(ae, xe, {
|
|
1449
1449
|
v: he,
|
|
1450
1450
|
p: null
|
|
1451
1451
|
}), Be = !0) : Je === String(ce) && !(j != null && j.p) && (k.setValue(ae, xe, {
|
|
@@ -1465,17 +1465,17 @@ const ma = {
|
|
|
1465
1465
|
id: se.id,
|
|
1466
1466
|
params: dt(o, ge.params)
|
|
1467
1467
|
};
|
|
1468
|
-
|
|
1468
|
+
p.push(ge), V.push(ae);
|
|
1469
1469
|
}
|
|
1470
1470
|
}
|
|
1471
1471
|
}
|
|
1472
|
-
return
|
|
1472
|
+
return Ae(p, e).result ? (t.pushUndoRedo({
|
|
1473
1473
|
unitID: s,
|
|
1474
|
-
redoMutations:
|
|
1474
|
+
redoMutations: p,
|
|
1475
1475
|
undoMutations: V
|
|
1476
1476
|
}), !0) : !1;
|
|
1477
1477
|
}
|
|
1478
|
-
},
|
|
1478
|
+
}, fa = {
|
|
1479
1479
|
type: z.COMMAND,
|
|
1480
1480
|
id: "sheets.command.update-data-validation-options",
|
|
1481
1481
|
handler(o, a) {
|
|
@@ -1503,32 +1503,32 @@ const ma = {
|
|
|
1503
1503
|
type: M.OPTIONS,
|
|
1504
1504
|
payload: Ut(u)
|
|
1505
1505
|
}
|
|
1506
|
-
},
|
|
1506
|
+
}, f = [{
|
|
1507
1507
|
id: y.id,
|
|
1508
1508
|
params: g
|
|
1509
1509
|
}];
|
|
1510
1510
|
return t.pushUndoRedo({
|
|
1511
1511
|
unitID: i,
|
|
1512
1512
|
redoMutations: c,
|
|
1513
|
-
undoMutations:
|
|
1513
|
+
undoMutations: f
|
|
1514
1514
|
}), e.executeCommand(y.id, d), !0;
|
|
1515
1515
|
}
|
|
1516
|
-
},
|
|
1516
|
+
}, _a = {
|
|
1517
1517
|
type: z.COMMAND,
|
|
1518
1518
|
id: "sheets.command.clear-range-data-validation",
|
|
1519
1519
|
handler(o, a) {
|
|
1520
1520
|
if (!a)
|
|
1521
1521
|
return !1;
|
|
1522
|
-
const { unitId: e, subUnitId: t, ranges: r } = a, i = o.get(U), s = o.get(
|
|
1522
|
+
const { unitId: e, subUnitId: t, ranges: r } = a, i = o.get(U), s = o.get(O), n = ze(s, { unitId: e, subUnitId: t }), l = o.get(F);
|
|
1523
1523
|
if (!n) return !1;
|
|
1524
1524
|
const u = o.get(Z), d = l.getRuleObjectMatrix(e, t).clone();
|
|
1525
1525
|
d.removeRange(r);
|
|
1526
|
-
const c = d.diff(l.getRules(e, t)), { redoMutations: g, undoMutations:
|
|
1526
|
+
const c = d.diff(l.getRules(e, t)), { redoMutations: g, undoMutations: f } = Ue(e, t, c, o);
|
|
1527
1527
|
return u.pushUndoRedo({
|
|
1528
1528
|
unitID: e,
|
|
1529
1529
|
redoMutations: g,
|
|
1530
|
-
undoMutations:
|
|
1531
|
-
}),
|
|
1530
|
+
undoMutations: f
|
|
1531
|
+
}), Ae(g, i).result;
|
|
1532
1532
|
}
|
|
1533
1533
|
}, Ra = {
|
|
1534
1534
|
type: z.COMMAND,
|
|
@@ -1541,10 +1541,10 @@ const ma = {
|
|
|
1541
1541
|
subUnitId: t,
|
|
1542
1542
|
ruleId: n.map((c) => c.uid)
|
|
1543
1543
|
}, u = [{
|
|
1544
|
-
id:
|
|
1544
|
+
id: A.id,
|
|
1545
1545
|
params: l
|
|
1546
1546
|
}], d = [{
|
|
1547
|
-
id:
|
|
1547
|
+
id: D.id,
|
|
1548
1548
|
params: {
|
|
1549
1549
|
unitId: e,
|
|
1550
1550
|
subUnitId: t,
|
|
@@ -1555,14 +1555,14 @@ const ma = {
|
|
|
1555
1555
|
redoMutations: u,
|
|
1556
1556
|
undoMutations: d,
|
|
1557
1557
|
unitID: e
|
|
1558
|
-
}), r.executeCommand(
|
|
1558
|
+
}), r.executeCommand(A.id, l), !0;
|
|
1559
1559
|
}
|
|
1560
1560
|
}, va = (o, a) => {
|
|
1561
1561
|
const e = o.get(F), { unitId: t, subUnitId: r, ruleId: i, source: s } = a;
|
|
1562
1562
|
if (Array.isArray(i)) {
|
|
1563
1563
|
const l = i.map((u) => e.getRuleById(t, r, u)).filter(Boolean);
|
|
1564
1564
|
return [{
|
|
1565
|
-
id:
|
|
1565
|
+
id: D.id,
|
|
1566
1566
|
params: {
|
|
1567
1567
|
unitId: t,
|
|
1568
1568
|
subUnitId: r,
|
|
@@ -1572,7 +1572,7 @@ const ma = {
|
|
|
1572
1572
|
}];
|
|
1573
1573
|
}
|
|
1574
1574
|
return [{
|
|
1575
|
-
id:
|
|
1575
|
+
id: D.id,
|
|
1576
1576
|
params: {
|
|
1577
1577
|
unitId: t,
|
|
1578
1578
|
subUnitId: r,
|
|
@@ -1589,10 +1589,10 @@ const ma = {
|
|
|
1589
1589
|
if (!a)
|
|
1590
1590
|
return !1;
|
|
1591
1591
|
const { unitId: e, subUnitId: t, ruleId: r } = a, i = o.get(U), s = o.get(Z), n = o.get(F), l = [{
|
|
1592
|
-
id:
|
|
1592
|
+
id: A.id,
|
|
1593
1593
|
params: a
|
|
1594
1594
|
}], u = [{
|
|
1595
|
-
id:
|
|
1595
|
+
id: D.id,
|
|
1596
1596
|
params: {
|
|
1597
1597
|
unitId: e,
|
|
1598
1598
|
subUnitId: t,
|
|
@@ -1606,7 +1606,7 @@ const ma = {
|
|
|
1606
1606
|
undoMutations: u,
|
|
1607
1607
|
redoMutations: l,
|
|
1608
1608
|
unitID: a.unitId
|
|
1609
|
-
}), i.executeCommand(
|
|
1609
|
+
}), i.executeCommand(A.id, a), !0;
|
|
1610
1610
|
}
|
|
1611
1611
|
}, Ea = "SHEET_DATA_VALIDATION_PLUGIN";
|
|
1612
1612
|
var Rt = /* @__PURE__ */ ((o) => (o[o.View = 0] = "View", o[o.Edit = 1] = "Edit", o[o.ManageCollaborator = 2] = "ManageCollaborator", o[o.Print = 3] = "Print", o[o.Duplicate = 4] = "Duplicate", o[o.Comment = 5] = "Comment", o[o.Copy = 6] = "Copy", o[o.Share = 7] = "Share", o[o.Export = 8] = "Export", o[o.MoveWorksheet = 9] = "MoveWorksheet", o[o.DeleteWorksheet = 10] = "DeleteWorksheet", o[o.HideWorksheet = 11] = "HideWorksheet", o[o.RenameWorksheet = 12] = "RenameWorksheet", o[o.CreateWorksheet = 13] = "CreateWorksheet", o[o.SetWorksheetStyle = 14] = "SetWorksheetStyle", o[o.EditWorksheetCell = 15] = "EditWorksheetCell", o[o.InsertHyperlink = 16] = "InsertHyperlink", o[o.Sort = 17] = "Sort", o[o.Filter = 18] = "Filter", o[o.PivotTable = 19] = "PivotTable", o[o.FloatImg = 20] = "FloatImg", o[o.History = 21] = "History", o[o.RwHgtClWdt = 22] = "RwHgtClWdt", o[o.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", o[o.ViewFilter = 24] = "ViewFilter", o[o.MoveSheet = 25] = "MoveSheet", o[o.DeleteSheet = 26] = "DeleteSheet", o[o.HideSheet = 27] = "HideSheet", o[o.CopySheet = 28] = "CopySheet", o[o.RenameSheet = 29] = "RenameSheet", o[o.CreateSheet = 30] = "CreateSheet", o[o.SelectProtectedCells = 31] = "SelectProtectedCells", o[o.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", o[o.SetCellStyle = 33] = "SetCellStyle", o[o.SetCellValue = 34] = "SetCellValue", o[o.SetRowStyle = 35] = "SetRowStyle", o[o.SetColumnStyle = 36] = "SetColumnStyle", o[o.InsertRow = 37] = "InsertRow", o[o.InsertColumn = 38] = "InsertColumn", o[o.DeleteRow = 39] = "DeleteRow", o[o.DeleteColumn = 40] = "DeleteColumn", o[o.EditExtraObject = 41] = "EditExtraObject", o[o.Delete = 42] = "Delete", o[o.RecoverHistory = 43] = "RecoverHistory", o[o.ViewHistory = 44] = "ViewHistory", o[o.CreatePermissionObject = 45] = "CreatePermissionObject", o[o.UNRECOGNIZED = -1] = "UNRECOGNIZED", o))(Rt || {}), Va = Object.getOwnPropertyDescriptor, Ma = (o, a, e, t) => {
|
|
@@ -1627,7 +1627,7 @@ let Te = class extends W {
|
|
|
1627
1627
|
const i = a[r];
|
|
1628
1628
|
if (typeof i == "string")
|
|
1629
1629
|
continue;
|
|
1630
|
-
const { token: s } = i, n = Wt(s), l = this._univerInstanceService.getCurrentUnitForType(
|
|
1630
|
+
const { token: s } = i, n = Wt(s), l = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET);
|
|
1631
1631
|
let u = l.getActiveSheet();
|
|
1632
1632
|
const d = l.getUnitId();
|
|
1633
1633
|
if (n.sheetName) {
|
|
@@ -1638,11 +1638,11 @@ let Te = class extends W {
|
|
|
1638
1638
|
}
|
|
1639
1639
|
if (!u)
|
|
1640
1640
|
return !1;
|
|
1641
|
-
const { startRow: c, endRow: g, startColumn:
|
|
1641
|
+
const { startRow: c, endRow: g, startColumn: f, endColumn: p } = n.range;
|
|
1642
1642
|
for (let R = c; R <= g; R++)
|
|
1643
|
-
for (let V =
|
|
1644
|
-
const
|
|
1645
|
-
if ((
|
|
1643
|
+
for (let V = f; V <= p; V++) {
|
|
1644
|
+
const _ = (t = (e = u.getCell(R, V)) == null ? void 0 : e.selectionProtection) == null ? void 0 : t[0];
|
|
1645
|
+
if ((_ == null ? void 0 : _[Rt.View]) === !1)
|
|
1646
1646
|
return !1;
|
|
1647
1647
|
}
|
|
1648
1648
|
}
|
|
@@ -1650,7 +1650,7 @@ let Te = class extends W {
|
|
|
1650
1650
|
}
|
|
1651
1651
|
};
|
|
1652
1652
|
Te = Ma([
|
|
1653
|
-
ke(0,
|
|
1653
|
+
ke(0, O),
|
|
1654
1654
|
ke(1, Tt),
|
|
1655
1655
|
ke(2, v(Y))
|
|
1656
1656
|
], Te);
|
|
@@ -1678,7 +1678,7 @@ let Fe = class extends W {
|
|
|
1678
1678
|
if (u.length === 0)
|
|
1679
1679
|
return {
|
|
1680
1680
|
undos: [{
|
|
1681
|
-
id:
|
|
1681
|
+
id: D.id,
|
|
1682
1682
|
params: {
|
|
1683
1683
|
unitId: a,
|
|
1684
1684
|
subUnitId: e,
|
|
@@ -1687,7 +1687,7 @@ let Fe = class extends W {
|
|
|
1687
1687
|
}
|
|
1688
1688
|
}],
|
|
1689
1689
|
redos: [{
|
|
1690
|
-
id:
|
|
1690
|
+
id: A.id,
|
|
1691
1691
|
params: {
|
|
1692
1692
|
unitId: a,
|
|
1693
1693
|
subUnitId: e,
|
|
@@ -1730,24 +1730,24 @@ let Fe = class extends W {
|
|
|
1730
1730
|
source: "patched"
|
|
1731
1731
|
}
|
|
1732
1732
|
});
|
|
1733
|
-
for (let
|
|
1734
|
-
const
|
|
1733
|
+
for (let f = 1; f < u.length; f++) {
|
|
1734
|
+
const p = u[f], R = Ye();
|
|
1735
1735
|
d.push({
|
|
1736
|
-
id:
|
|
1736
|
+
id: D.id,
|
|
1737
1737
|
params: {
|
|
1738
1738
|
unitId: a,
|
|
1739
1739
|
subUnitId: e,
|
|
1740
1740
|
rule: {
|
|
1741
1741
|
...t,
|
|
1742
1742
|
uid: R,
|
|
1743
|
-
formula1:
|
|
1744
|
-
formula2:
|
|
1745
|
-
ranges:
|
|
1743
|
+
formula1: p.formulas[0],
|
|
1744
|
+
formula2: p.formulas[1],
|
|
1745
|
+
ranges: p.ranges
|
|
1746
1746
|
},
|
|
1747
1747
|
source: "patched"
|
|
1748
1748
|
}
|
|
1749
1749
|
}), c.push({
|
|
1750
|
-
id:
|
|
1750
|
+
id: A.id,
|
|
1751
1751
|
params: {
|
|
1752
1752
|
unitId: a,
|
|
1753
1753
|
subUnitId: e,
|
|
@@ -1802,12 +1802,12 @@ Fe = Fa([
|
|
|
1802
1802
|
je(1, v(gt)),
|
|
1803
1803
|
je(2, v(q))
|
|
1804
1804
|
], Fe);
|
|
1805
|
-
var
|
|
1806
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1805
|
+
var Na = Object.getOwnPropertyDescriptor, Ca = (o, a, e, t) => {
|
|
1806
|
+
for (var r = t > 1 ? void 0 : t ? Na(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1807
1807
|
(s = o[i]) && (r = s(r) || r);
|
|
1808
1808
|
return r;
|
|
1809
1809
|
}, ee = (o, a) => (e, t) => a(e, t, o);
|
|
1810
|
-
let
|
|
1810
|
+
let Ne = class extends W {
|
|
1811
1811
|
constructor(a, e, t, r, i, s) {
|
|
1812
1812
|
super();
|
|
1813
1813
|
m(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
@@ -1826,10 +1826,10 @@ let Ce = class extends W {
|
|
|
1826
1826
|
const g = this._dataValidationModel.getRuleById(a, e, r);
|
|
1827
1827
|
if (!g)
|
|
1828
1828
|
return { redos: [], undos: [] };
|
|
1829
|
-
const
|
|
1830
|
-
if (!
|
|
1829
|
+
const f = g[d];
|
|
1830
|
+
if (!f || f === c)
|
|
1831
1831
|
return { redos: [], undos: [] };
|
|
1832
|
-
const
|
|
1832
|
+
const p = {
|
|
1833
1833
|
unitId: a,
|
|
1834
1834
|
subUnitId: e,
|
|
1835
1835
|
ruleId: t.uid,
|
|
@@ -1859,15 +1859,15 @@ let Ce = class extends W {
|
|
|
1859
1859
|
}, V = [
|
|
1860
1860
|
{
|
|
1861
1861
|
id: y.id,
|
|
1862
|
-
params:
|
|
1862
|
+
params: p
|
|
1863
1863
|
}
|
|
1864
|
-
],
|
|
1864
|
+
], _ = [
|
|
1865
1865
|
{
|
|
1866
1866
|
id: y.id,
|
|
1867
1867
|
params: R
|
|
1868
1868
|
}
|
|
1869
1869
|
];
|
|
1870
|
-
return { redos: V, undos:
|
|
1870
|
+
return { redos: V, undos: _ };
|
|
1871
1871
|
}, l = this._dataValidationFormulaService.getRuleFormulaInfo(a, e, r);
|
|
1872
1872
|
if (l) {
|
|
1873
1873
|
const [d, c] = l;
|
|
@@ -1876,7 +1876,7 @@ let Ce = class extends W {
|
|
|
1876
1876
|
a,
|
|
1877
1877
|
e,
|
|
1878
1878
|
d.text,
|
|
1879
|
-
(
|
|
1879
|
+
(f) => n("formula1", f)
|
|
1880
1880
|
);
|
|
1881
1881
|
s.add(() => g.dispose());
|
|
1882
1882
|
}
|
|
@@ -1885,7 +1885,7 @@ let Ce = class extends W {
|
|
|
1885
1885
|
a,
|
|
1886
1886
|
e,
|
|
1887
1887
|
c.text,
|
|
1888
|
-
(
|
|
1888
|
+
(f) => n("formula2", f)
|
|
1889
1889
|
);
|
|
1890
1890
|
s.add(() => g.dispose());
|
|
1891
1891
|
}
|
|
@@ -1894,11 +1894,11 @@ let Ce = class extends W {
|
|
|
1894
1894
|
register(a, e, t) {
|
|
1895
1895
|
var l;
|
|
1896
1896
|
const r = (u) => {
|
|
1897
|
-
const d = [...t.ranges], g = d.map((
|
|
1897
|
+
const d = [...t.ranges], g = d.map((p) => Qt(p, u)).filter((p) => !!p).flat();
|
|
1898
1898
|
if (nt(g, d))
|
|
1899
1899
|
return { redos: [], undos: [] };
|
|
1900
1900
|
if (g.length) {
|
|
1901
|
-
const
|
|
1901
|
+
const p = {
|
|
1902
1902
|
unitId: a,
|
|
1903
1903
|
subUnitId: e,
|
|
1904
1904
|
ruleId: t.uid,
|
|
@@ -1907,7 +1907,7 @@ let Ce = class extends W {
|
|
|
1907
1907
|
payload: g
|
|
1908
1908
|
},
|
|
1909
1909
|
source: "patched"
|
|
1910
|
-
}, R = [{ id: y.id, params:
|
|
1910
|
+
}, R = [{ id: y.id, params: p }], V = [{
|
|
1911
1911
|
id: y.id,
|
|
1912
1912
|
params: {
|
|
1913
1913
|
unitId: a,
|
|
@@ -1922,7 +1922,7 @@ let Ce = class extends W {
|
|
|
1922
1922
|
}];
|
|
1923
1923
|
return { redos: R, undos: V };
|
|
1924
1924
|
} else {
|
|
1925
|
-
const
|
|
1925
|
+
const p = { unitId: a, subUnitId: e, ruleId: t.uid }, R = [{ id: A.id, params: p }], V = va(this._injector, p);
|
|
1926
1926
|
return { redos: R, undos: V };
|
|
1927
1927
|
}
|
|
1928
1928
|
}, i = [];
|
|
@@ -1967,20 +1967,20 @@ let Ce = class extends W {
|
|
|
1967
1967
|
}));
|
|
1968
1968
|
}
|
|
1969
1969
|
};
|
|
1970
|
-
|
|
1970
|
+
Ne = Ca([
|
|
1971
1971
|
ee(0, v(F)),
|
|
1972
1972
|
ee(1, v(Ke)),
|
|
1973
1973
|
ee(2, v(jt)),
|
|
1974
1974
|
ee(3, v(K)),
|
|
1975
1975
|
ee(4, v(gt)),
|
|
1976
1976
|
ee(5, v(q))
|
|
1977
|
-
],
|
|
1978
|
-
var
|
|
1979
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1977
|
+
], Ne);
|
|
1978
|
+
var Oa = Object.getOwnPropertyDescriptor, wa = (o, a, e, t) => {
|
|
1979
|
+
for (var r = t > 1 ? void 0 : t ? Oa(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1980
1980
|
(s = o[i]) && (r = s(r) || r);
|
|
1981
1981
|
return r;
|
|
1982
1982
|
}, Qe = (o, a) => (e, t) => a(e, t, o);
|
|
1983
|
-
let
|
|
1983
|
+
let Ce = class extends W {
|
|
1984
1984
|
constructor(o, a, e) {
|
|
1985
1985
|
super(), this._sheetInterceptorService = o, this._univerInstanceService = a, this._sheetDataValidationModel = e, this._initSheetChange();
|
|
1986
1986
|
}
|
|
@@ -1992,7 +1992,7 @@ let Oe = class extends W {
|
|
|
1992
1992
|
getMutations: (o) => {
|
|
1993
1993
|
var a;
|
|
1994
1994
|
if (o.id === qt.id) {
|
|
1995
|
-
const e = o.params, t = e.unitId || this._univerInstanceService.getCurrentUnitForType(
|
|
1995
|
+
const e = o.params, t = e.unitId || this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET).getUnitId(), r = this._univerInstanceService.getUniverSheetInstance(t);
|
|
1996
1996
|
if (!r)
|
|
1997
1997
|
return { redos: [], undos: [] };
|
|
1998
1998
|
const i = e.subUnitId || ((a = r.getActiveSheet()) == null ? void 0 : a.getSheetId());
|
|
@@ -2014,11 +2014,11 @@ let Oe = class extends W {
|
|
|
2014
2014
|
};
|
|
2015
2015
|
return {
|
|
2016
2016
|
redos: [{
|
|
2017
|
-
id:
|
|
2017
|
+
id: A.id,
|
|
2018
2018
|
params: l
|
|
2019
2019
|
}],
|
|
2020
2020
|
undos: [{
|
|
2021
|
-
id:
|
|
2021
|
+
id: D.id,
|
|
2022
2022
|
params: u
|
|
2023
2023
|
}]
|
|
2024
2024
|
};
|
|
@@ -2033,7 +2033,7 @@ let Oe = class extends W {
|
|
|
2033
2033
|
return {
|
|
2034
2034
|
redos: [
|
|
2035
2035
|
{
|
|
2036
|
-
id:
|
|
2036
|
+
id: D.id,
|
|
2037
2037
|
params: {
|
|
2038
2038
|
unitId: t,
|
|
2039
2039
|
subUnitId: i,
|
|
@@ -2044,7 +2044,7 @@ let Oe = class extends W {
|
|
|
2044
2044
|
],
|
|
2045
2045
|
undos: [
|
|
2046
2046
|
{
|
|
2047
|
-
id:
|
|
2047
|
+
id: A.id,
|
|
2048
2048
|
params: {
|
|
2049
2049
|
unitId: t,
|
|
2050
2050
|
subUnitId: i,
|
|
@@ -2061,12 +2061,12 @@ let Oe = class extends W {
|
|
|
2061
2061
|
);
|
|
2062
2062
|
}
|
|
2063
2063
|
};
|
|
2064
|
-
|
|
2064
|
+
Ce = wa([
|
|
2065
2065
|
Qe(0, v(ct)),
|
|
2066
|
-
Qe(1, v(
|
|
2066
|
+
Qe(1, v(O)),
|
|
2067
2067
|
Qe(2, v(F))
|
|
2068
|
-
],
|
|
2069
|
-
class
|
|
2068
|
+
], Ce);
|
|
2069
|
+
class Ia extends G {
|
|
2070
2070
|
constructor() {
|
|
2071
2071
|
super(...arguments);
|
|
2072
2072
|
m(this, "id", T.ANY);
|
|
@@ -2095,7 +2095,7 @@ class Aa extends G {
|
|
|
2095
2095
|
return this.localeService.t("dataValidation.any.error");
|
|
2096
2096
|
}
|
|
2097
2097
|
}
|
|
2098
|
-
class
|
|
2098
|
+
class Aa extends G {
|
|
2099
2099
|
constructor() {
|
|
2100
2100
|
super(...arguments);
|
|
2101
2101
|
m(this, "id", T.CUSTOM);
|
|
@@ -2123,7 +2123,7 @@ class Da extends G {
|
|
|
2123
2123
|
}
|
|
2124
2124
|
async isValidType(e, t, r) {
|
|
2125
2125
|
const { column: i, row: s, unitId: n, subUnitId: l } = e, u = await this._customFormulaService.getCellFormulaValue(n, l, r.uid, s, i), d = u == null ? void 0 : u.v;
|
|
2126
|
-
return
|
|
2126
|
+
return C(String(d)) && E.isDefine(d) && d !== "" ? u.t === Ft.BOOLEAN ? !!d : typeof d == "boolean" ? d : typeof d == "number" ? !!d : typeof d == "string" ? C(d) : !!d : !1;
|
|
2127
2127
|
}
|
|
2128
2128
|
generateRuleErrorMessage(e) {
|
|
2129
2129
|
return this.localeService.t("dataValidation.custom.error");
|
|
@@ -2133,7 +2133,7 @@ class Da extends G {
|
|
|
2133
2133
|
return this.localeService.t("dataValidation.custom.ruleName").replace("{FORMULA1}", (t = e.formula1) != null ? t : "");
|
|
2134
2134
|
}
|
|
2135
2135
|
}
|
|
2136
|
-
class
|
|
2136
|
+
class Da extends ft {
|
|
2137
2137
|
constructor() {
|
|
2138
2138
|
super(...arguments);
|
|
2139
2139
|
m(this, "id", T.LIST_MULTIPLE);
|
|
@@ -2180,11 +2180,11 @@ class ba extends G {
|
|
|
2180
2180
|
return e == null ? Number.NaN : +e;
|
|
2181
2181
|
}
|
|
2182
2182
|
async parseFormula(e, t, r, i, s) {
|
|
2183
|
-
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c = S(u) ? n == null ? void 0 : n.v : u, g = S(d) ? l == null ? void 0 : l.v : d,
|
|
2183
|
+
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c = S(u) ? n == null ? void 0 : n.v : u, g = S(d) ? l == null ? void 0 : l.v : d, f = C(`${c}`) && C(`${g}`);
|
|
2184
2184
|
return {
|
|
2185
2185
|
formula1: this._parseNumber(c),
|
|
2186
2186
|
formula2: this._parseNumber(g),
|
|
2187
|
-
isFormulaValid:
|
|
2187
|
+
isFormulaValid: f
|
|
2188
2188
|
};
|
|
2189
2189
|
}
|
|
2190
2190
|
validatorFormula(e, t, r) {
|
|
@@ -2215,7 +2215,7 @@ var La = Object.getOwnPropertyDescriptor, Ua = (o, a, e, t) => {
|
|
|
2215
2215
|
(s = o[i]) && (r = s(r) || r);
|
|
2216
2216
|
return r;
|
|
2217
2217
|
}, te = (o, a) => (e, t) => a(e, t, o);
|
|
2218
|
-
let
|
|
2218
|
+
let Oe = class extends Nt {
|
|
2219
2219
|
constructor(o, a, e, t, r, i) {
|
|
2220
2220
|
super(), this._univerInstanceService = o, this._dataValidatorRegistryService = a, this._injector = e, this._selectionManagerService = t, this._sheetInterceptorService = r, this._sheetDataValidationModel = i, this._init();
|
|
2221
2221
|
}
|
|
@@ -2224,15 +2224,15 @@ let we = class extends Ct {
|
|
|
2224
2224
|
}
|
|
2225
2225
|
_registerValidators() {
|
|
2226
2226
|
[
|
|
2227
|
-
|
|
2227
|
+
Ia,
|
|
2228
2228
|
la,
|
|
2229
2229
|
ba,
|
|
2230
2230
|
ha,
|
|
2231
2231
|
na,
|
|
2232
2232
|
ia,
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2233
|
+
ft,
|
|
2234
|
+
Da,
|
|
2235
|
+
Aa
|
|
2236
2236
|
].forEach((o) => {
|
|
2237
2237
|
const a = this._injector.createInstance(o);
|
|
2238
2238
|
this.disposeWithMe(this._dataValidatorRegistryService.register(a)), this.disposeWithMe(Xe(() => this._injector.delete(o)));
|
|
@@ -2243,7 +2243,7 @@ let we = class extends Ct {
|
|
|
2243
2243
|
getMutations: (o) => {
|
|
2244
2244
|
var a;
|
|
2245
2245
|
if (o.id === Yt.id) {
|
|
2246
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
2246
|
+
const e = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET), t = e.getUnitId(), r = e.getActiveSheet();
|
|
2247
2247
|
if (!r)
|
|
2248
2248
|
throw new Error("No active sheet found");
|
|
2249
2249
|
const i = r.getSheetId(), s = (a = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : a.map((c) => c.range), n = this._sheetDataValidationModel.getRuleObjectMatrix(t, i).clone();
|
|
@@ -2262,20 +2262,20 @@ let we = class extends Ct {
|
|
|
2262
2262
|
});
|
|
2263
2263
|
}
|
|
2264
2264
|
};
|
|
2265
|
-
|
|
2266
|
-
te(0,
|
|
2265
|
+
Oe = Ua([
|
|
2266
|
+
te(0, O),
|
|
2267
2267
|
te(1, v(q)),
|
|
2268
2268
|
te(2, v(Ke)),
|
|
2269
2269
|
te(3, v(ht)),
|
|
2270
2270
|
te(4, v(ct)),
|
|
2271
2271
|
te(5, v(F))
|
|
2272
|
-
],
|
|
2272
|
+
], Oe);
|
|
2273
2273
|
var Ba = Object.getOwnPropertyDescriptor, xa = (o, a, e, t) => {
|
|
2274
2274
|
for (var r = t > 1 ? void 0 : t ? Ba(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
2275
2275
|
(s = o[i]) && (r = s(r) || r);
|
|
2276
2276
|
return r;
|
|
2277
2277
|
}, Re = (o, a) => (e, t) => a(e, t, o);
|
|
2278
|
-
let
|
|
2278
|
+
let we = class extends W {
|
|
2279
2279
|
constructor(o, a, e, t) {
|
|
2280
2280
|
super(), this._univerInstanceService = o, this._sheetDataValidationModel = a, this._dataValidationCacheService = e, this._lifecycleService = t, this._initRecalculate();
|
|
2281
2281
|
}
|
|
@@ -2283,10 +2283,10 @@ let Ie = class extends W {
|
|
|
2283
2283
|
const o = (a) => {
|
|
2284
2284
|
if (a.length === 0)
|
|
2285
2285
|
return;
|
|
2286
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
2286
|
+
const e = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET), t = e == null ? void 0 : e.getActiveSheet(), r = {};
|
|
2287
2287
|
a.flat().forEach((i) => {
|
|
2288
2288
|
r[i.unitId] || (r[i.unitId] = {}), r[i.unitId][i.subUnitId] || (r[i.unitId][i.subUnitId] = []);
|
|
2289
|
-
const s = this._univerInstanceService.getUnit(i.unitId,
|
|
2289
|
+
const s = this._univerInstanceService.getUnit(i.unitId, N.UNIVER_SHEET), n = s == null ? void 0 : s.getSheetBySheetId(i.subUnitId);
|
|
2290
2290
|
n && r[i.unitId][i.subUnitId].push(...i.ranges.map((l) => L.transformRange(l, n)));
|
|
2291
2291
|
}), Object.entries(r).forEach(([i, s]) => {
|
|
2292
2292
|
Object.entries(s).forEach(([n, l]) => {
|
|
@@ -2296,7 +2296,7 @@ let Ie = class extends W {
|
|
|
2296
2296
|
});
|
|
2297
2297
|
});
|
|
2298
2298
|
};
|
|
2299
|
-
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(Xt(() => this._lifecycleService.lifecycle$.pipe(tt((a) => a === et.Rendered)))).subscribe(o)), this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(tt(() => this._lifecycleService.stage >= et.Rendered),
|
|
2299
|
+
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(Xt(() => this._lifecycleService.lifecycle$.pipe(tt((a) => a === et.Rendered)))).subscribe(o)), this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(tt(() => this._lifecycleService.stage >= et.Rendered), Ot(20)).subscribe(o));
|
|
2300
2300
|
}
|
|
2301
2301
|
async _validatorByCell(o, a, e, t) {
|
|
2302
2302
|
const r = o.getUnitId(), i = a.getSheetId();
|
|
@@ -2310,7 +2310,7 @@ let Ie = class extends W {
|
|
|
2310
2310
|
}) : b.VALID;
|
|
2311
2311
|
}
|
|
2312
2312
|
async validatorCell(o, a, e, t) {
|
|
2313
|
-
const r = this._univerInstanceService.getUnit(o,
|
|
2313
|
+
const r = this._univerInstanceService.getUnit(o, N.UNIVER_SHEET);
|
|
2314
2314
|
if (!r)
|
|
2315
2315
|
throw new Error(`cannot find current workbook, unitId: ${o}`);
|
|
2316
2316
|
const i = r.getSheetBySheetId(a);
|
|
@@ -2321,7 +2321,7 @@ let Ie = class extends W {
|
|
|
2321
2321
|
validatorRanges(o, a, e) {
|
|
2322
2322
|
if (!e.length)
|
|
2323
2323
|
return Promise.resolve([]);
|
|
2324
|
-
const t = this._univerInstanceService.getUnit(o,
|
|
2324
|
+
const t = this._univerInstanceService.getUnit(o, N.UNIVER_SHEET);
|
|
2325
2325
|
if (!t)
|
|
2326
2326
|
throw new Error(`cannot find current workbook, unitId: ${o}`);
|
|
2327
2327
|
const r = t.getSheetBySheetId(a);
|
|
@@ -2336,7 +2336,7 @@ let Ie = class extends W {
|
|
|
2336
2336
|
}));
|
|
2337
2337
|
}
|
|
2338
2338
|
async validatorWorksheet(o, a) {
|
|
2339
|
-
const e = this._univerInstanceService.getUnit(o,
|
|
2339
|
+
const e = this._univerInstanceService.getUnit(o, N.UNIVER_SHEET);
|
|
2340
2340
|
if (!e)
|
|
2341
2341
|
throw new Error(`cannot find current workbook, unitId: ${o}`);
|
|
2342
2342
|
const t = e.getSheetBySheetId(a);
|
|
@@ -2373,21 +2373,21 @@ let Ie = class extends W {
|
|
|
2373
2373
|
return this.getDataValidations(o, a, e)[0];
|
|
2374
2374
|
}
|
|
2375
2375
|
};
|
|
2376
|
-
|
|
2377
|
-
Re(0,
|
|
2376
|
+
we = xa([
|
|
2377
|
+
Re(0, O),
|
|
2378
2378
|
Re(1, v(F)),
|
|
2379
2379
|
Re(2, v(Q)),
|
|
2380
|
-
Re(3, v(
|
|
2381
|
-
],
|
|
2380
|
+
Re(3, v(Ct))
|
|
2381
|
+
], we);
|
|
2382
2382
|
var Pa = Object.defineProperty, Ha = Object.getOwnPropertyDescriptor, Wa = (o, a, e) => a in o ? Pa(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e, $a = (o, a, e, t) => {
|
|
2383
2383
|
for (var r = t > 1 ? void 0 : t ? Ha(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
2384
2384
|
(s = o[i]) && (r = s(r) || r);
|
|
2385
2385
|
return r;
|
|
2386
2386
|
}, qe = (o, a) => (e, t) => a(e, t, o), vt = (o, a, e) => Wa(o, typeof a != "symbol" ? a + "" : a, e);
|
|
2387
|
-
let
|
|
2387
|
+
let Ie = class extends At {
|
|
2388
2388
|
constructor(o = it, a, e, t) {
|
|
2389
2389
|
super(), this._config = o, this._injector = a, this._commandService = e, this._configService = t;
|
|
2390
|
-
const { ...r } =
|
|
2390
|
+
const { ...r } = Dt(
|
|
2391
2391
|
{},
|
|
2392
2392
|
it,
|
|
2393
2393
|
this._config
|
|
@@ -2399,42 +2399,42 @@ let Ae = class extends Dt {
|
|
|
2399
2399
|
[Q],
|
|
2400
2400
|
[K],
|
|
2401
2401
|
[H],
|
|
2402
|
-
[Ie],
|
|
2403
|
-
[F],
|
|
2404
2402
|
[we],
|
|
2405
|
-
[
|
|
2403
|
+
[F],
|
|
2406
2404
|
[Oe],
|
|
2405
|
+
[Te],
|
|
2407
2406
|
[Ce],
|
|
2407
|
+
[Ne],
|
|
2408
2408
|
[Fe]
|
|
2409
2409
|
].forEach((o) => {
|
|
2410
2410
|
this._injector.add(o);
|
|
2411
2411
|
}), [
|
|
2412
2412
|
ga,
|
|
2413
2413
|
ma,
|
|
2414
|
-
_a,
|
|
2415
2414
|
pa,
|
|
2415
|
+
fa,
|
|
2416
2416
|
Sa,
|
|
2417
2417
|
Ra,
|
|
2418
|
-
|
|
2418
|
+
_a
|
|
2419
2419
|
].forEach((o) => {
|
|
2420
2420
|
this._commandService.registerCommand(o);
|
|
2421
|
-
}), this._injector.get(Q), this._injector.get(
|
|
2421
|
+
}), this._injector.get(Q), this._injector.get(we), this._injector.get(Oe), this._injector.get(Fe), this._injector.get(Ne);
|
|
2422
2422
|
}
|
|
2423
2423
|
onReady() {
|
|
2424
|
-
this._injector.get(
|
|
2424
|
+
this._injector.get(Ce);
|
|
2425
2425
|
}
|
|
2426
2426
|
onRendered() {
|
|
2427
2427
|
this._injector.get(Te);
|
|
2428
2428
|
}
|
|
2429
2429
|
};
|
|
2430
|
-
vt(
|
|
2431
|
-
vt(
|
|
2432
|
-
|
|
2433
|
-
|
|
2430
|
+
vt(Ie, "pluginName", Ea);
|
|
2431
|
+
vt(Ie, "type", N.UNIVER_SHEET);
|
|
2432
|
+
Ie = $a([
|
|
2433
|
+
wt(Bt),
|
|
2434
2434
|
qe(1, v(Ke)),
|
|
2435
2435
|
qe(2, U),
|
|
2436
|
-
qe(3,
|
|
2437
|
-
],
|
|
2436
|
+
qe(3, It)
|
|
2437
|
+
], Ie);
|
|
2438
2438
|
function Za(o) {
|
|
2439
2439
|
const e = o.get(ht).getCurrentSelections().map((i) => i.range);
|
|
2440
2440
|
return {
|
|
@@ -2454,7 +2454,7 @@ export {
|
|
|
2454
2454
|
ar as CHECKBOX_FORMULA_INPUT_NAME,
|
|
2455
2455
|
Ja as CUSTOM_FORMULA_INPUT_NAME,
|
|
2456
2456
|
ia as CheckboxValidator,
|
|
2457
|
-
|
|
2457
|
+
_a as ClearRangeDataValidationCommand,
|
|
2458
2458
|
Ea as DATA_VALIDATION_PLUGIN_NAME,
|
|
2459
2459
|
Q as DataValidationCacheService,
|
|
2460
2460
|
H as DataValidationCustomFormulaService,
|
|
@@ -2462,26 +2462,26 @@ export {
|
|
|
2462
2462
|
K as DataValidationFormulaService,
|
|
2463
2463
|
na as DateValidator,
|
|
2464
2464
|
tr as LIST_FORMULA_INPUT_NAME,
|
|
2465
|
-
|
|
2466
|
-
|
|
2465
|
+
Da as ListMultipleValidator,
|
|
2466
|
+
ft as ListValidator,
|
|
2467
2467
|
Ra as RemoveSheetAllDataValidationCommand,
|
|
2468
2468
|
Sa as RemoveSheetDataValidationCommand,
|
|
2469
2469
|
F as SheetDataValidationModel,
|
|
2470
|
-
|
|
2471
|
-
|
|
2472
|
-
|
|
2470
|
+
we as SheetsDataValidationValidatorService,
|
|
2471
|
+
Ie as UniverSheetsDataValidationPlugin,
|
|
2472
|
+
fa as UpdateSheetDataValidationOptionsCommand,
|
|
2473
2473
|
ma as UpdateSheetDataValidationRangeCommand,
|
|
2474
|
-
|
|
2474
|
+
pa as UpdateSheetDataValidationSettingCommand,
|
|
2475
2475
|
Za as createDefaultNewRule,
|
|
2476
|
-
|
|
2476
|
+
_e as deserializeListOptions,
|
|
2477
2477
|
ye as getCellValueNumber,
|
|
2478
2478
|
ne as getCellValueOrigin,
|
|
2479
2479
|
za as getDataValidationCellValue,
|
|
2480
2480
|
Ue as getDataValidationDiffMutations,
|
|
2481
|
-
|
|
2481
|
+
pe as getFormulaCellData,
|
|
2482
2482
|
oe as getFormulaResult,
|
|
2483
2483
|
Le as getTransformedFormula,
|
|
2484
|
-
|
|
2484
|
+
C as isLegalFormulaResult,
|
|
2485
2485
|
Ka as serializeListOptions,
|
|
2486
|
-
|
|
2486
|
+
fe as transformCheckboxValue
|
|
2487
2487
|
};
|