@univerjs/sheets-data-validation 0.7.0-nightly.202505111606 → 0.7.0-nightly.202505121607
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 +214 -214
- package/lib/index.js +214 -214
- package/lib/umd/index.js +1 -1
- package/package.json +8 -8
package/lib/es/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var vt = Object.defineProperty;
|
|
2
2
|
var Rt = (o, a, e) => a in o ? vt(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e;
|
|
3
3
|
var m = (o, a, e) => Rt(o, typeof a != "symbol" ? a + "" : a, e);
|
|
4
|
-
import { Inject as R, ICommandService as U, IUniverInstanceService as
|
|
5
|
-
import { DataValidationModel as Ye, DataValidatorRegistryService as q, UpdateRuleType as
|
|
4
|
+
import { Inject as R, ICommandService as U, IUniverInstanceService as w, Disposable as W, ObjectMatrix as Se, UniverInstanceType as C, Range as b, Rectangle as I, isFormulaString as S, DataValidationType as T, getOriginCellValue as St, RBush as Et, debounce as Vt, Tools as E, DataValidationStatus as N, WrapStrategy as Re, DataValidationOperator as h, numfmt as H, dayjs as it, DataValidationRenderMode as xe, CommandType as z, IUndoRedoService as Z, sequenceExecute as De, isRangesEqual as ot, generateRandomId as Mt, toDisposable as qe, IPermissionService as yt, Injector as Ge, CellValueType as Tt, RxDisposable as Ft, LifecycleService as Ct, LifecycleStages as Ze, bufferDebounceTime as Ot, DependentOn as wt, IConfigService as At, Plugin as It, merge as Dt } from "@univerjs/core";
|
|
5
|
+
import { DataValidationModel as Ye, DataValidatorRegistryService as q, UpdateRuleType as M, BaseDataValidator as G, TextLengthErrorTitleMap as Nt, AddDataValidationMutation as L, RemoveDataValidationMutation as D, UpdateDataValidationMutation as y, getRuleSetting as bt, getRuleOptions as Lt, UniverDataValidationPlugin as Ut } from "@univerjs/data-validation";
|
|
6
6
|
import { SetRangeValuesMutation as se, RemoveSheetMutation as st, getSheetCommandTarget as Xe, SetRangeValuesUndoMutationFactory as nt, WorksheetViewPermission as Bt, RefRangeService as xt, handleCommonDefaultRangeChangeWithEffectRefCommands as Ht, SheetInterceptorService as lt, RemoveSheetCommand as Pt, SheetsSelectionsService as ut, ClearSelectionAllCommand as Wt } from "@univerjs/sheets";
|
|
7
7
|
import { Subject as Qe, bufferWhen as $t, filter as Je } from "rxjs";
|
|
8
8
|
import { RegisterOtherFormulaService as dt, FormulaRefRangeService as ct } from "@univerjs/sheets-formula";
|
|
@@ -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 === C.UNIVER_SHEET && this._cacheMatrix.delete(a.getUnitId());
|
|
45
45
|
}));
|
|
46
46
|
}
|
|
47
47
|
_ensureCache(a, e) {
|
|
@@ -81,7 +81,7 @@ let Q = class extends W {
|
|
|
81
81
|
};
|
|
82
82
|
Q = Kt([
|
|
83
83
|
et(0, R(U)),
|
|
84
|
-
et(1, R(
|
|
84
|
+
et(1, R(w))
|
|
85
85
|
], Q);
|
|
86
86
|
function oe(o) {
|
|
87
87
|
var a, e;
|
|
@@ -91,7 +91,7 @@ function _e(o) {
|
|
|
91
91
|
var a;
|
|
92
92
|
return (a = o == null ? void 0 : o[0]) == null ? void 0 : a[0];
|
|
93
93
|
}
|
|
94
|
-
function
|
|
94
|
+
function O(o) {
|
|
95
95
|
return !kt.has(o);
|
|
96
96
|
}
|
|
97
97
|
function de(o, a) {
|
|
@@ -118,7 +118,7 @@ let P = class extends W {
|
|
|
118
118
|
this.disposeWithMe(this._registerOtherFormulaService.formulaResult$.subscribe((a) => {
|
|
119
119
|
for (const e in a) {
|
|
120
120
|
const t = a[e];
|
|
121
|
-
if (this._instanceSrv.getUnitType(e) ===
|
|
121
|
+
if (this._instanceSrv.getUnitType(e) === C.UNIVER_SHEET)
|
|
122
122
|
for (const i in t) {
|
|
123
123
|
const s = t[i], { ruleFormulaMap: n } = this._ensureMaps(e, i);
|
|
124
124
|
s.forEach((l) => {
|
|
@@ -144,7 +144,7 @@ let P = class extends W {
|
|
|
144
144
|
_handleDirtyRanges(a, e, t) {
|
|
145
145
|
this._dataValidationModel.getRules(a, e).forEach((i) => {
|
|
146
146
|
const s = i.ranges;
|
|
147
|
-
|
|
147
|
+
I.doAnyRangesIntersect(s, t) && this.makeRuleDirty(a, e, i.uid);
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
_initDirtyRanges() {
|
|
@@ -231,7 +231,7 @@ let P = class extends W {
|
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
233
|
P = Zt([
|
|
234
|
-
re(0,
|
|
234
|
+
re(0, w),
|
|
235
235
|
re(1, R(dt)),
|
|
236
236
|
re(2, R(Ye)),
|
|
237
237
|
re(3, R(Q)),
|
|
@@ -252,7 +252,7 @@ let K = class extends W {
|
|
|
252
252
|
this.disposeWithMe(this._registerOtherFormulaService.formulaResult$.subscribe((a) => {
|
|
253
253
|
for (const e in a) {
|
|
254
254
|
const t = a[e];
|
|
255
|
-
if (this._instanceService.getUnitType(e) ===
|
|
255
|
+
if (this._instanceService.getUnitType(e) === C.UNIVER_SHEET)
|
|
256
256
|
for (const i in t) {
|
|
257
257
|
const s = t[i], n = this._ensureRuleFormulaMap(e, i);
|
|
258
258
|
s.forEach((l) => {
|
|
@@ -323,7 +323,7 @@ let K = class extends W {
|
|
|
323
323
|
}
|
|
324
324
|
};
|
|
325
325
|
K = ea([
|
|
326
|
-
ie(0,
|
|
326
|
+
ie(0, w),
|
|
327
327
|
ie(1, R(dt)),
|
|
328
328
|
ie(2, R(Q)),
|
|
329
329
|
ie(3, R(Ye)),
|
|
@@ -339,7 +339,7 @@ function mt(o) {
|
|
|
339
339
|
class Ke {
|
|
340
340
|
constructor(a, e, t, r, i = !1) {
|
|
341
341
|
m(this, "_map");
|
|
342
|
-
m(this, "_tree", new
|
|
342
|
+
m(this, "_tree", new Et());
|
|
343
343
|
m(this, "_dirty", !0);
|
|
344
344
|
m(this, "_buildTree", () => {
|
|
345
345
|
if (!this._dirty || this._disableTree)
|
|
@@ -358,19 +358,19 @@ class Ke {
|
|
|
358
358
|
});
|
|
359
359
|
}), this._tree.load(a), this._dirty = !1;
|
|
360
360
|
});
|
|
361
|
-
m(this, "_debonceBuildTree",
|
|
361
|
+
m(this, "_debonceBuildTree", Vt(this._buildTree, 0));
|
|
362
362
|
this._unitId = e, this._subUnitId = t, this._univerInstanceService = r, this._disableTree = i, this._map = a, this._buildTree();
|
|
363
363
|
}
|
|
364
364
|
get _worksheet() {
|
|
365
365
|
var a;
|
|
366
|
-
return (a = this._univerInstanceService.getUnit(this._unitId,
|
|
366
|
+
return (a = this._univerInstanceService.getUnit(this._unitId, C.UNIVER_SHEET)) == null ? void 0 : a.getSheetBySheetId(this._subUnitId);
|
|
367
367
|
}
|
|
368
368
|
_addRule(a, e) {
|
|
369
369
|
if (!this._worksheet)
|
|
370
370
|
return;
|
|
371
|
-
const t =
|
|
371
|
+
const t = I.mergeRanges(e.map((r) => b.transformRange(r, this._worksheet)));
|
|
372
372
|
this._map.forEach((r, i) => {
|
|
373
|
-
const s =
|
|
373
|
+
const s = I.subtractMulti(r, t);
|
|
374
374
|
s.length === 0 ? this._map.delete(i) : this._map.set(i, s);
|
|
375
375
|
}), this._dirty = !0, this._map.set(a, t), this._debonceBuildTree();
|
|
376
376
|
}
|
|
@@ -382,7 +382,7 @@ class Ke {
|
|
|
382
382
|
return;
|
|
383
383
|
const e = a.map((t) => b.transformRange(t, this._worksheet));
|
|
384
384
|
this._map.forEach((t, r) => {
|
|
385
|
-
const i =
|
|
385
|
+
const i = I.subtractMulti(t, e);
|
|
386
386
|
i.length === 0 ? this._map.delete(r) : this._map.set(r, i);
|
|
387
387
|
}), this._dirty = !0, this._debonceBuildTree();
|
|
388
388
|
}
|
|
@@ -400,10 +400,10 @@ class Ke {
|
|
|
400
400
|
if (!t.length)
|
|
401
401
|
return;
|
|
402
402
|
let r = this._map.get(e);
|
|
403
|
-
r ? (this._map.set(e,
|
|
403
|
+
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) => {
|
|
404
404
|
if (s === e)
|
|
405
405
|
return;
|
|
406
|
-
const n =
|
|
406
|
+
const n = I.subtractMulti(i, t);
|
|
407
407
|
n.length === 0 ? this._map.delete(s) : this._map.set(s, n);
|
|
408
408
|
});
|
|
409
409
|
}), this._dirty = !0, this._debonceBuildTree();
|
|
@@ -414,11 +414,11 @@ class Ke {
|
|
|
414
414
|
return a.forEach((r, i) => {
|
|
415
415
|
var l;
|
|
416
416
|
const s = (l = this._map.get(r.uid)) != null ? l : [], n = r.ranges;
|
|
417
|
-
s.length !== 0 && (s.length !== n.length || s.some((u, d) => !
|
|
417
|
+
s.length !== 0 && (s.length !== n.length || s.some((u, d) => !I.equals(u, n[d]))) && e.push({
|
|
418
418
|
type: "update",
|
|
419
419
|
ruleId: r.uid,
|
|
420
420
|
oldRanges: n,
|
|
421
|
-
newRanges:
|
|
421
|
+
newRanges: I.sort(s),
|
|
422
422
|
rule: r
|
|
423
423
|
}), s.length === 0 && (e.push({
|
|
424
424
|
type: "delete",
|
|
@@ -433,11 +433,11 @@ class Ke {
|
|
|
433
433
|
return a.forEach((i, s) => {
|
|
434
434
|
var u;
|
|
435
435
|
const n = (u = this._map.get(i.uid)) != null ? u : [], l = i.ranges;
|
|
436
|
-
n.length !== 0 && (n.length !== l.length || n.some((d, c) => !
|
|
436
|
+
n.length !== 0 && (n.length !== l.length || n.some((d, c) => !I.equals(d, l[c]))) && t.push({
|
|
437
437
|
type: "update",
|
|
438
438
|
ruleId: i.uid,
|
|
439
439
|
oldRanges: l,
|
|
440
|
-
newRanges:
|
|
440
|
+
newRanges: I.sort(n),
|
|
441
441
|
rule: i
|
|
442
442
|
}), n.length === 0 && (t.push({
|
|
443
443
|
type: "delete",
|
|
@@ -451,14 +451,14 @@ class Ke {
|
|
|
451
451
|
type: "add",
|
|
452
452
|
rule: {
|
|
453
453
|
...i,
|
|
454
|
-
ranges:
|
|
454
|
+
ranges: I.sort(s)
|
|
455
455
|
}
|
|
456
456
|
});
|
|
457
457
|
}), t;
|
|
458
458
|
}
|
|
459
459
|
clone() {
|
|
460
460
|
return new Ke(
|
|
461
|
-
new Map(
|
|
461
|
+
new Map(E.deepClone(Array.from(this._map.entries()))),
|
|
462
462
|
this._unitId,
|
|
463
463
|
this._subUnitId,
|
|
464
464
|
this._univerInstanceService,
|
|
@@ -556,7 +556,7 @@ let F = class extends W {
|
|
|
556
556
|
...r,
|
|
557
557
|
...i.payload
|
|
558
558
|
};
|
|
559
|
-
i.type ===
|
|
559
|
+
i.type === M.RANGE ? s.updateRange(t, i.payload) : i.type === M.ALL && s.updateRange(t, i.payload.ranges), this._dataValidationCacheService.removeRule(a, e, r), this._dataValidationCacheService.addRule(a, e, n), this._dataValidationFormulaService.removeRule(a, e, r.uid), this._dataValidationFormulaService.addRule(a, e, n), this._dataValidationCustomFormulaService.deleteByRuleId(a, e, t), this._dataValidationCustomFormulaService.addRule(a, e, n);
|
|
560
560
|
}
|
|
561
561
|
_removeRule(a, e, t) {
|
|
562
562
|
this._ensureRuleMatrix(a, e).removeRule(t), this._dataValidationCacheService.removeRule(a, e, t), this._dataValidationCustomFormulaService.deleteByRuleId(a, e, t.uid);
|
|
@@ -585,7 +585,7 @@ let F = class extends W {
|
|
|
585
585
|
}, d = l.getCellValueOnly(i, r), c = this.getValidator(a.type), g = l.getCellRaw(i, r), p = ne(g);
|
|
586
586
|
if (c) {
|
|
587
587
|
const _ = this._dataValidationCacheService.ensureCache(s, n), v = _.getValue(i, r);
|
|
588
|
-
return v == null ? (_.setValue(i, r,
|
|
588
|
+
return v == null ? (_.setValue(i, r, N.VALIDATING), c.validator(
|
|
589
589
|
{
|
|
590
590
|
value: p,
|
|
591
591
|
unitId: s,
|
|
@@ -598,12 +598,12 @@ let F = class extends W {
|
|
|
598
598
|
t: g == null ? void 0 : g.t
|
|
599
599
|
},
|
|
600
600
|
a
|
|
601
|
-
).then((
|
|
602
|
-
const f =
|
|
603
|
-
f ===
|
|
604
|
-
}),
|
|
601
|
+
).then((V) => {
|
|
602
|
+
const f = V ? N.VALID : N.INVALID, A = _.getValue(i, r);
|
|
603
|
+
f === N.VALID ? _.realDeleteValue(i, r) : _.setValue(i, r, f), u(f, v !== A);
|
|
604
|
+
}), N.VALIDATING) : (u(v != null ? v : N.VALID, !1), v != null ? v : N.VALID);
|
|
605
605
|
} else
|
|
606
|
-
return u(
|
|
606
|
+
return u(N.VALID, !1), N.VALID;
|
|
607
607
|
}
|
|
608
608
|
getRuleObjectMatrix(a, e) {
|
|
609
609
|
return this._ensureRuleMatrix(a, e);
|
|
@@ -632,18 +632,18 @@ let F = class extends W {
|
|
|
632
632
|
};
|
|
633
633
|
F = aa([
|
|
634
634
|
X(0, R(Ye)),
|
|
635
|
-
X(1,
|
|
635
|
+
X(1, w),
|
|
636
636
|
X(2, R(q)),
|
|
637
637
|
X(3, R(Q)),
|
|
638
638
|
X(4, R(K)),
|
|
639
639
|
X(5, R(P)),
|
|
640
640
|
X(6, U)
|
|
641
641
|
], F);
|
|
642
|
-
const
|
|
642
|
+
const Ee = 1, Ve = 0;
|
|
643
643
|
function tt(o, a) {
|
|
644
|
-
return
|
|
644
|
+
return E.isBlank(o) ? a.t("dataValidation.validFail.value") : S(o) ? a.t("dataValidation.validFail.primitive") : "";
|
|
645
645
|
}
|
|
646
|
-
const pe = (o) =>
|
|
646
|
+
const pe = (o) => E.isDefine(o) && String(o).toLowerCase() === "true" ? "1" : String(o).toLowerCase() === "false" ? "0" : o;
|
|
647
647
|
class ra extends G {
|
|
648
648
|
constructor() {
|
|
649
649
|
super(...arguments);
|
|
@@ -661,7 +661,7 @@ class ra extends G {
|
|
|
661
661
|
}
|
|
662
662
|
validatorFormula(e, t, r) {
|
|
663
663
|
const { formula1: i, formula2: s } = e, n = i === s;
|
|
664
|
-
if (
|
|
664
|
+
if (E.isBlank(i) && E.isBlank(s))
|
|
665
665
|
return {
|
|
666
666
|
success: !0
|
|
667
667
|
};
|
|
@@ -680,7 +680,7 @@ class ra extends G {
|
|
|
680
680
|
}
|
|
681
681
|
async parseFormula(e, t, r) {
|
|
682
682
|
var c, g, p, _;
|
|
683
|
-
const { formula1: i =
|
|
683
|
+
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 = n == null ? void 0 : n[1]) == null ? void 0 : p.result) == null ? void 0 : _[0][0]) : s, d = O(String(l)) && O(String(u));
|
|
684
684
|
return {
|
|
685
685
|
formula1: pe(l),
|
|
686
686
|
formula2: pe(u),
|
|
@@ -696,7 +696,7 @@ class ra extends G {
|
|
|
696
696
|
}
|
|
697
697
|
parseFormulaSync(e, t, r) {
|
|
698
698
|
var c, g, p, _;
|
|
699
|
-
const { formula1: i =
|
|
699
|
+
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 = n == null ? void 0 : n[1]) == null ? void 0 : p.result) == null ? void 0 : _[0][0]) : s, d = O(String(l)) && O(String(u));
|
|
700
700
|
return {
|
|
701
701
|
formula1: pe(l),
|
|
702
702
|
formula2: pe(u),
|
|
@@ -707,7 +707,7 @@ class ra extends G {
|
|
|
707
707
|
}
|
|
708
708
|
async isValidType(e, t, r) {
|
|
709
709
|
const { value: i, unitId: s, subUnitId: n } = e, { formula1: l, formula2: u, originFormula1: d, originFormula2: c } = await this.parseFormula(r, s, n);
|
|
710
|
-
return !
|
|
710
|
+
return !E.isDefine(l) || !E.isDefine(u) ? !0 : E.isDefine(i) && (String(i) === String(l) || String(i) === String(u) || String(i) === String(d != null ? d : "") || String(i) === String(c != null ? c : ""));
|
|
711
711
|
}
|
|
712
712
|
generateRuleErrorMessage(e) {
|
|
713
713
|
return this.localeService.t("dataValidation.checkbox.error");
|
|
@@ -747,7 +747,7 @@ const at = {
|
|
|
747
747
|
[h.NOT_BETWEEN]: "dataValidation.date.errorMsg.notBetween",
|
|
748
748
|
[h.NOT_EQUAL]: "dataValidation.date.errorMsg.notEqual",
|
|
749
749
|
NONE: "dataValidation.date.errorMsg.legal"
|
|
750
|
-
},
|
|
750
|
+
}, Ne = [
|
|
751
751
|
h.BETWEEN,
|
|
752
752
|
h.NOT_BETWEEN
|
|
753
753
|
], le = "{FORMULA1}", ue = "{FORMULA2}";
|
|
@@ -775,7 +775,7 @@ const He = (o) => {
|
|
|
775
775
|
if (typeof o == "number" || !Number.isNaN(+o))
|
|
776
776
|
return +o;
|
|
777
777
|
const a = (e = H.parseDate(o)) == null ? void 0 : e.v;
|
|
778
|
-
return
|
|
778
|
+
return E.isDefine(a) ? a : (t = H.parseDate(it(o).format("YYYY-MM-DD HH:mm:ss"))) == null ? void 0 : t.v;
|
|
779
779
|
};
|
|
780
780
|
class sa extends G {
|
|
781
781
|
constructor() {
|
|
@@ -798,7 +798,7 @@ class sa extends G {
|
|
|
798
798
|
m(this, "_lexerTreeBuilder", this.injector.get(Y));
|
|
799
799
|
}
|
|
800
800
|
async parseFormula(e, t, r, i, s) {
|
|
801
|
-
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 =
|
|
801
|
+
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 = O(String(n == null ? void 0 : n.v)) && O(String(l == null ? void 0 : l.v));
|
|
802
802
|
return {
|
|
803
803
|
formula1: He(S(u) ? n == null ? void 0 : n.v : u),
|
|
804
804
|
formula2: He(S(d) ? l == null ? void 0 : l.v : d),
|
|
@@ -810,7 +810,7 @@ class sa extends G {
|
|
|
810
810
|
return typeof r == "number" && typeof t == "string" ? !!H.parseDate(t) : typeof t == "string" ? !!H.parseDate(t) : !1;
|
|
811
811
|
}
|
|
812
812
|
_validatorSingleFormula(e) {
|
|
813
|
-
return !
|
|
813
|
+
return !E.isBlank(e) && (S(e) || !Number.isNaN(+e) || !!(e && H.parseDate(e)));
|
|
814
814
|
}
|
|
815
815
|
validatorFormula(e, t, r) {
|
|
816
816
|
const i = e.operator;
|
|
@@ -819,7 +819,7 @@ class sa extends G {
|
|
|
819
819
|
success: !0
|
|
820
820
|
};
|
|
821
821
|
const s = this._validatorSingleFormula(e.formula1), n = this.localeService.t("dataValidation.validFail.date");
|
|
822
|
-
if (
|
|
822
|
+
if (Ne.includes(i)) {
|
|
823
823
|
const u = this._validatorSingleFormula(e.formula2);
|
|
824
824
|
return {
|
|
825
825
|
success: s && u,
|
|
@@ -879,7 +879,7 @@ class sa extends G {
|
|
|
879
879
|
}
|
|
880
880
|
h.BETWEEN + "", h.EQUAL + "", h.GREATER_THAN + "", h.GREATER_THAN_OR_EQUAL + "", h.LESS_THAN + "", h.LESS_THAN_OR_EQUAL + "", h.NOT_BETWEEN + "", h.NOT_EQUAL + "";
|
|
881
881
|
h.BETWEEN + "", h.EQUAL + "", h.GREATER_THAN + "", h.GREATER_THAN_OR_EQUAL + "", h.LESS_THAN + "", h.LESS_THAN_OR_EQUAL + "", h.NOT_BETWEEN + "", h.NOT_EQUAL + "";
|
|
882
|
-
const
|
|
882
|
+
const Me = {
|
|
883
883
|
[h.BETWEEN]: "dataValidation.errorMsg.between",
|
|
884
884
|
[h.EQUAL]: "dataValidation.errorMsg.equal",
|
|
885
885
|
[h.GREATER_THAN]: "dataValidation.errorMsg.greaterThan",
|
|
@@ -890,7 +890,7 @@ const ye = {
|
|
|
890
890
|
[h.NOT_EQUAL]: "dataValidation.errorMsg.notEqual",
|
|
891
891
|
NONE: "dataValidation.errorMsg.legal"
|
|
892
892
|
};
|
|
893
|
-
function
|
|
893
|
+
function ye(o) {
|
|
894
894
|
return +o;
|
|
895
895
|
}
|
|
896
896
|
class na extends G {
|
|
@@ -914,24 +914,24 @@ class na extends G {
|
|
|
914
914
|
m(this, "scopes", ["sheet"]);
|
|
915
915
|
}
|
|
916
916
|
_isFormulaOrNumber(e) {
|
|
917
|
-
return !
|
|
917
|
+
return !E.isBlank(e) && (S(e) || !Number.isNaN(+e));
|
|
918
918
|
}
|
|
919
919
|
async isValidType(e, t, r) {
|
|
920
920
|
const { value: i } = e;
|
|
921
|
-
return !Number.isNaN(
|
|
921
|
+
return !Number.isNaN(ye(i));
|
|
922
922
|
}
|
|
923
923
|
transform(e, t, r) {
|
|
924
924
|
const { value: i } = e;
|
|
925
925
|
return {
|
|
926
926
|
...e,
|
|
927
|
-
value:
|
|
927
|
+
value: ye(i)
|
|
928
928
|
};
|
|
929
929
|
}
|
|
930
930
|
_parseNumber(e) {
|
|
931
931
|
return e == null ? Number.NaN : +e;
|
|
932
932
|
}
|
|
933
933
|
async parseFormula(e, t, r, i, s) {
|
|
934
|
-
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 =
|
|
934
|
+
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 = O(String(n == null ? void 0 : n.v)) && O(String(l == null ? void 0 : l.v));
|
|
935
935
|
return {
|
|
936
936
|
formula1: this._parseNumber(S(u) ? n == null ? void 0 : n.v : u),
|
|
937
937
|
formula2: this._parseNumber(S(d) ? l == null ? void 0 : l.v : d),
|
|
@@ -944,7 +944,7 @@ class na extends G {
|
|
|
944
944
|
return {
|
|
945
945
|
success: !0
|
|
946
946
|
};
|
|
947
|
-
const s =
|
|
947
|
+
const s = E.isDefine(e.formula1) && this._isFormulaOrNumber(e.formula1), n = E.isDefine(e.formula2) && this._isFormulaOrNumber(e.formula2), l = Ne.includes(i), u = this.localeService.t("dataValidation.validFail.number");
|
|
948
948
|
return l ? {
|
|
949
949
|
success: s && n,
|
|
950
950
|
formula1: s ? void 0 : u,
|
|
@@ -956,9 +956,9 @@ class na extends G {
|
|
|
956
956
|
}
|
|
957
957
|
generateRuleErrorMessage(e, t) {
|
|
958
958
|
if (!e.operator)
|
|
959
|
-
return this.localeService.t(
|
|
959
|
+
return this.localeService.t(Me.NONE).replace("{TYPE}", this.titleStr);
|
|
960
960
|
const { transformedFormula1: r, transformedFormula2: i } = be(this._lexerTreeBuilder, e, t);
|
|
961
|
-
return `${this.localeService.t(
|
|
961
|
+
return `${this.localeService.t(Me[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
964
|
function Pe(o) {
|
|
@@ -975,7 +975,7 @@ function Pe(o) {
|
|
|
975
975
|
a.add(H.format(t.s.n.pattern, r, { throws: !1 }));
|
|
976
976
|
return;
|
|
977
977
|
}
|
|
978
|
-
|
|
978
|
+
O(r.toString()) && a.add(r.toString());
|
|
979
979
|
}
|
|
980
980
|
});
|
|
981
981
|
}
|
|
@@ -997,7 +997,7 @@ function da(o, a) {
|
|
|
997
997
|
const { formula1: e = "", ranges: t } = o;
|
|
998
998
|
if (ht(e.slice(1))) {
|
|
999
999
|
const i = Qt(e.slice(1));
|
|
1000
|
-
if ((!i.sheetName || i.sheetName === a) && t.some((s) =>
|
|
1000
|
+
if ((!i.sheetName || i.sheetName === a) && t.some((s) => I.intersects(s, i.range)))
|
|
1001
1001
|
return !0;
|
|
1002
1002
|
}
|
|
1003
1003
|
return !1;
|
|
@@ -1007,7 +1007,7 @@ class gt extends G {
|
|
|
1007
1007
|
super(...arguments);
|
|
1008
1008
|
m(this, "formulaService", this.injector.get(K));
|
|
1009
1009
|
m(this, "_lexer", this.injector.get(Y));
|
|
1010
|
-
m(this, "_univerInstanceService", this.injector.get(
|
|
1010
|
+
m(this, "_univerInstanceService", this.injector.get(w));
|
|
1011
1011
|
m(this, "order", 50);
|
|
1012
1012
|
m(this, "offsetFormulaByRange", !1);
|
|
1013
1013
|
m(this, "id", T.LIST);
|
|
@@ -1018,7 +1018,7 @@ class gt extends G {
|
|
|
1018
1018
|
}
|
|
1019
1019
|
validatorFormula(e, t, r) {
|
|
1020
1020
|
var u, d, c;
|
|
1021
|
-
const i = !
|
|
1021
|
+
const i = !E.isBlank(e.formula1), s = ua((u = e.formula1) != null ? u : "", this._lexer), n = (c = (d = this._univerInstanceService.getUnit(t, C.UNIVER_SHEET)) == null ? void 0 : d.getSheetBySheetId(r)) == null ? void 0 : c.getName(), l = da(e, n != null ? n : "");
|
|
1022
1022
|
return {
|
|
1023
1023
|
success: !!(i && s && !l),
|
|
1024
1024
|
formula1: i ? s ? l ? this.localeService.t("dataValidation.validFail.listIntersects") : void 0 : this.localeService.t("dataValidation.validFail.listInvalid") : this.localeService.t("dataValidation.validFail.list")
|
|
@@ -1051,7 +1051,7 @@ class gt extends G {
|
|
|
1051
1051
|
return {
|
|
1052
1052
|
formula1: void 0,
|
|
1053
1053
|
formula2: void 0,
|
|
1054
|
-
isFormulaValid:
|
|
1054
|
+
isFormulaValid: O(String(s))
|
|
1055
1055
|
};
|
|
1056
1056
|
}
|
|
1057
1057
|
async isValidType(e, t, r) {
|
|
@@ -1067,7 +1067,7 @@ class gt extends G {
|
|
|
1067
1067
|
}
|
|
1068
1068
|
getList(e, t, r) {
|
|
1069
1069
|
var g, p, _, v;
|
|
1070
|
-
const { formula1: i = "" } = e, s = this.injector.get(
|
|
1070
|
+
const { formula1: i = "" } = e, s = this.injector.get(w), n = (g = t ? s.getUniverSheetInstance(t) : void 0) != null ? g : s.getCurrentUnitForType(C.UNIVER_SHEET);
|
|
1071
1071
|
if (!n) return [];
|
|
1072
1072
|
const l = (p = r ? n.getSheetBySheetId(r) : void 0) != null ? p : n.getActiveSheet();
|
|
1073
1073
|
if (!l) return [];
|
|
@@ -1076,7 +1076,7 @@ class gt extends G {
|
|
|
1076
1076
|
}
|
|
1077
1077
|
async getListAsync(e, t, r) {
|
|
1078
1078
|
var g, p, _, v;
|
|
1079
|
-
const { formula1: i = "" } = e, s = this.injector.get(
|
|
1079
|
+
const { formula1: i = "" } = e, s = this.injector.get(w), n = (g = t ? s.getUniverSheetInstance(t) : void 0) != null ? g : s.getCurrentUnitForType(C.UNIVER_SHEET);
|
|
1080
1080
|
if (!n) return [];
|
|
1081
1081
|
const l = (p = r ? n.getSheetBySheetId(r) : void 0) != null ? p : n.getActiveSheet();
|
|
1082
1082
|
if (!l) return [];
|
|
@@ -1115,7 +1115,7 @@ class ca extends G {
|
|
|
1115
1115
|
m(this, "_customFormulaService", this.injector.get(P));
|
|
1116
1116
|
}
|
|
1117
1117
|
_isFormulaOrInt(e) {
|
|
1118
|
-
return !
|
|
1118
|
+
return !E.isBlank(e) && (S(e) || !Number.isNaN(+e) && Number.isInteger(+e));
|
|
1119
1119
|
}
|
|
1120
1120
|
validatorFormula(e, t, r) {
|
|
1121
1121
|
const i = e.operator;
|
|
@@ -1123,7 +1123,7 @@ class ca extends G {
|
|
|
1123
1123
|
return {
|
|
1124
1124
|
success: !1
|
|
1125
1125
|
};
|
|
1126
|
-
const s =
|
|
1126
|
+
const s = E.isDefine(e.formula1) && this._isFormulaOrInt(e.formula1), n = E.isDefine(e.formula2) && this._isFormulaOrInt(e.formula2), l = Ne.includes(i), u = this.localeService.t("dataValidation.validFail.number");
|
|
1127
1127
|
return l ? {
|
|
1128
1128
|
success: s && n,
|
|
1129
1129
|
formula1: s ? void 0 : u,
|
|
@@ -1137,7 +1137,7 @@ class ca extends G {
|
|
|
1137
1137
|
return e == null ? Number.NaN : +e;
|
|
1138
1138
|
}
|
|
1139
1139
|
async parseFormula(e, t, r, i, s) {
|
|
1140
|
-
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 =
|
|
1140
|
+
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 = O(String(n == null ? void 0 : n.v)) && O(String(l == null ? void 0 : l.v));
|
|
1141
1141
|
return {
|
|
1142
1142
|
formula1: this._parseNumber(S(u) ? n == null ? void 0 : n.v : u),
|
|
1143
1143
|
formula2: this._parseNumber(S(d) ? l == null ? void 0 : l.v : d),
|
|
@@ -1158,15 +1158,15 @@ class ca extends G {
|
|
|
1158
1158
|
if (!e.operator)
|
|
1159
1159
|
return this.titleStr;
|
|
1160
1160
|
const { transformedFormula1: r, transformedFormula2: i } = be(this._lexerTreeBuilder, e, t);
|
|
1161
|
-
return `${this.localeService.t(
|
|
1161
|
+
return `${this.localeService.t(Nt[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
1162
1162
|
}
|
|
1163
1163
|
}
|
|
1164
1164
|
function _t(o) {
|
|
1165
1165
|
var e, t;
|
|
1166
|
-
return o ? o.p ? !((t = (e = o.p.body) == null ? void 0 : e.dataStream) != null ? t : "").slice(0, -2).trim() :
|
|
1166
|
+
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;
|
|
1167
1167
|
}
|
|
1168
1168
|
function Le(o, a, e, t, r = "command", i = !0) {
|
|
1169
|
-
const s = t.get(Y), n = t.get(q), l = [], u = [], d = t.get(F), c = t.get(
|
|
1169
|
+
const s = t.get(Y), n = t.get(q), l = [], u = [], d = t.get(F), c = t.get(w), g = Xe(c, { unitId: o, subUnitId: a });
|
|
1170
1170
|
if (!g)
|
|
1171
1171
|
return {
|
|
1172
1172
|
redoMutations: l,
|
|
@@ -1174,12 +1174,12 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1174
1174
|
};
|
|
1175
1175
|
const { worksheet: p } = g, _ = new Se();
|
|
1176
1176
|
let v = !1;
|
|
1177
|
-
function
|
|
1177
|
+
function V(f, A) {
|
|
1178
1178
|
i && f.forEach(($) => {
|
|
1179
1179
|
b.foreach($, (B, k) => {
|
|
1180
1180
|
const x = p.getCellRaw(B, k), J = mt(x);
|
|
1181
|
-
(_t(x) || J ===
|
|
1182
|
-
v:
|
|
1181
|
+
(_t(x) || J === A) && !(x != null && x.p) && (v = !0, _.setValue(B, k, {
|
|
1182
|
+
v: A,
|
|
1183
1183
|
p: null
|
|
1184
1184
|
}));
|
|
1185
1185
|
});
|
|
@@ -1189,7 +1189,7 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1189
1189
|
switch (f.type) {
|
|
1190
1190
|
case "delete":
|
|
1191
1191
|
l.push({
|
|
1192
|
-
id:
|
|
1192
|
+
id: D.id,
|
|
1193
1193
|
params: {
|
|
1194
1194
|
unitId: o,
|
|
1195
1195
|
subUnitId: a,
|
|
@@ -1211,13 +1211,13 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1211
1211
|
if (de(f.rule.type, n)) {
|
|
1212
1212
|
const $ = f.oldRanges[0].startRow, B = f.oldRanges[0].startColumn, k = f.newRanges[0].startRow, x = f.newRanges[0].startColumn, J = k - $, ce = x - B, he = S(f.rule.formula1) ? s.moveFormulaRefOffset(f.rule.formula1, ce, J) : f.rule.formula1, me = S(f.rule.formula2) ? s.moveFormulaRefOffset(f.rule.formula2, ce, J) : f.rule.formula2;
|
|
1213
1213
|
he !== f.rule.formula1 || me !== f.rule.formula2 || !ot(f.newRanges, f.oldRanges) ? (l.push({
|
|
1214
|
-
id:
|
|
1214
|
+
id: y.id,
|
|
1215
1215
|
params: {
|
|
1216
1216
|
unitId: o,
|
|
1217
1217
|
subUnitId: a,
|
|
1218
1218
|
ruleId: f.ruleId,
|
|
1219
1219
|
payload: {
|
|
1220
|
-
type:
|
|
1220
|
+
type: M.ALL,
|
|
1221
1221
|
payload: {
|
|
1222
1222
|
formula1: he,
|
|
1223
1223
|
formula2: me,
|
|
@@ -1226,13 +1226,13 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1226
1226
|
}
|
|
1227
1227
|
}
|
|
1228
1228
|
}), u.unshift({
|
|
1229
|
-
id:
|
|
1229
|
+
id: y.id,
|
|
1230
1230
|
params: {
|
|
1231
1231
|
unitId: o,
|
|
1232
1232
|
subUnitId: a,
|
|
1233
1233
|
ruleId: f.ruleId,
|
|
1234
1234
|
payload: {
|
|
1235
|
-
type:
|
|
1235
|
+
type: M.ALL,
|
|
1236
1236
|
payload: {
|
|
1237
1237
|
formula1: f.rule.formula1,
|
|
1238
1238
|
formula2: f.rule.formula2,
|
|
@@ -1241,25 +1241,25 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1241
1241
|
}
|
|
1242
1242
|
}
|
|
1243
1243
|
})) : (l.push({
|
|
1244
|
-
id:
|
|
1244
|
+
id: y.id,
|
|
1245
1245
|
params: {
|
|
1246
1246
|
unitId: o,
|
|
1247
1247
|
subUnitId: a,
|
|
1248
1248
|
ruleId: f.ruleId,
|
|
1249
1249
|
payload: {
|
|
1250
|
-
type:
|
|
1250
|
+
type: M.RANGE,
|
|
1251
1251
|
payload: f.newRanges
|
|
1252
1252
|
},
|
|
1253
1253
|
source: r
|
|
1254
1254
|
}
|
|
1255
1255
|
}), u.unshift({
|
|
1256
|
-
id:
|
|
1256
|
+
id: y.id,
|
|
1257
1257
|
params: {
|
|
1258
1258
|
unitId: o,
|
|
1259
1259
|
subUnitId: a,
|
|
1260
1260
|
ruleId: f.ruleId,
|
|
1261
1261
|
payload: {
|
|
1262
|
-
type:
|
|
1262
|
+
type: M.RANGE,
|
|
1263
1263
|
payload: f.oldRanges
|
|
1264
1264
|
},
|
|
1265
1265
|
source: r
|
|
@@ -1267,34 +1267,34 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1267
1267
|
}));
|
|
1268
1268
|
} else
|
|
1269
1269
|
l.push({
|
|
1270
|
-
id:
|
|
1270
|
+
id: y.id,
|
|
1271
1271
|
params: {
|
|
1272
1272
|
unitId: o,
|
|
1273
1273
|
subUnitId: a,
|
|
1274
1274
|
ruleId: f.ruleId,
|
|
1275
1275
|
payload: {
|
|
1276
|
-
type:
|
|
1276
|
+
type: M.RANGE,
|
|
1277
1277
|
payload: f.newRanges
|
|
1278
1278
|
},
|
|
1279
1279
|
source: r
|
|
1280
1280
|
}
|
|
1281
1281
|
}), u.unshift({
|
|
1282
|
-
id:
|
|
1282
|
+
id: y.id,
|
|
1283
1283
|
params: {
|
|
1284
1284
|
unitId: o,
|
|
1285
1285
|
subUnitId: a,
|
|
1286
1286
|
ruleId: f.ruleId,
|
|
1287
1287
|
payload: {
|
|
1288
|
-
type:
|
|
1288
|
+
type: M.RANGE,
|
|
1289
1289
|
payload: f.oldRanges
|
|
1290
1290
|
},
|
|
1291
1291
|
source: r
|
|
1292
1292
|
}
|
|
1293
1293
|
});
|
|
1294
|
-
const
|
|
1295
|
-
if (
|
|
1296
|
-
const B = d.getValidator(T.CHECKBOX).parseFormulaSync(
|
|
1297
|
-
|
|
1294
|
+
const A = d.getRuleById(o, a, f.ruleId);
|
|
1295
|
+
if (A && A.type === T.CHECKBOX) {
|
|
1296
|
+
const B = d.getValidator(T.CHECKBOX).parseFormulaSync(A, o, a);
|
|
1297
|
+
V(f.newRanges, B.formula2);
|
|
1298
1298
|
}
|
|
1299
1299
|
break;
|
|
1300
1300
|
}
|
|
@@ -1308,7 +1308,7 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1308
1308
|
source: r
|
|
1309
1309
|
}
|
|
1310
1310
|
}), u.unshift({
|
|
1311
|
-
id:
|
|
1311
|
+
id: D.id,
|
|
1312
1312
|
params: {
|
|
1313
1313
|
unitId: o,
|
|
1314
1314
|
subUnitId: a,
|
|
@@ -1317,7 +1317,7 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1317
1317
|
}
|
|
1318
1318
|
}), f.rule.type === T.CHECKBOX) {
|
|
1319
1319
|
const $ = d.getValidator(T.CHECKBOX).parseFormulaSync(f.rule, o, a);
|
|
1320
|
-
|
|
1320
|
+
V(f.rule.ranges, $.originFormula2);
|
|
1321
1321
|
}
|
|
1322
1322
|
break;
|
|
1323
1323
|
}
|
|
@@ -1330,11 +1330,11 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1330
1330
|
subUnitId: a,
|
|
1331
1331
|
cellValue: _.getData()
|
|
1332
1332
|
}
|
|
1333
|
-
},
|
|
1333
|
+
}, A = {
|
|
1334
1334
|
id: se.id,
|
|
1335
1335
|
params: nt(t, f.params)
|
|
1336
1336
|
};
|
|
1337
|
-
l.push(f), u.push(
|
|
1337
|
+
l.push(f), u.push(A);
|
|
1338
1338
|
}
|
|
1339
1339
|
return {
|
|
1340
1340
|
redoMutations: l,
|
|
@@ -1357,7 +1357,7 @@ const ha = {
|
|
|
1357
1357
|
undoMutations: p,
|
|
1358
1358
|
redoMutations: g,
|
|
1359
1359
|
unitID: e
|
|
1360
|
-
}),
|
|
1360
|
+
}), De(g, n), !0;
|
|
1361
1361
|
}
|
|
1362
1362
|
}, ma = {
|
|
1363
1363
|
type: z.COMMAND,
|
|
@@ -1379,7 +1379,7 @@ const ha = {
|
|
|
1379
1379
|
id: L.id,
|
|
1380
1380
|
params: c
|
|
1381
1381
|
}), p.unshift({
|
|
1382
|
-
id:
|
|
1382
|
+
id: D.id,
|
|
1383
1383
|
params: {
|
|
1384
1384
|
unitId: e,
|
|
1385
1385
|
subUnitId: t,
|
|
@@ -1389,7 +1389,7 @@ const ha = {
|
|
|
1389
1389
|
unitID: e,
|
|
1390
1390
|
redoMutations: g,
|
|
1391
1391
|
undoMutations: p
|
|
1392
|
-
}),
|
|
1392
|
+
}), De(g, s), !0;
|
|
1393
1393
|
}
|
|
1394
1394
|
}, ga = {
|
|
1395
1395
|
type: z.COMMAND,
|
|
@@ -1412,33 +1412,33 @@ const ha = {
|
|
|
1412
1412
|
subUnitId: n,
|
|
1413
1413
|
ruleId: l,
|
|
1414
1414
|
payload: {
|
|
1415
|
-
type:
|
|
1415
|
+
type: M.SETTING,
|
|
1416
1416
|
payload: {
|
|
1417
1417
|
...u,
|
|
1418
1418
|
...d.normalizeFormula(g, s, n)
|
|
1419
1419
|
}
|
|
1420
1420
|
}
|
|
1421
1421
|
}, _ = [{
|
|
1422
|
-
id:
|
|
1422
|
+
id: y.id,
|
|
1423
1423
|
params: p
|
|
1424
1424
|
}], v = {
|
|
1425
1425
|
unitId: s,
|
|
1426
1426
|
subUnitId: n,
|
|
1427
1427
|
ruleId: l,
|
|
1428
1428
|
payload: {
|
|
1429
|
-
type:
|
|
1429
|
+
type: M.SETTING,
|
|
1430
1430
|
payload: bt(c)
|
|
1431
1431
|
}
|
|
1432
|
-
},
|
|
1433
|
-
id:
|
|
1432
|
+
}, V = [{
|
|
1433
|
+
id: y.id,
|
|
1434
1434
|
params: v
|
|
1435
1435
|
}];
|
|
1436
1436
|
if (u.type === T.CHECKBOX) {
|
|
1437
|
-
const
|
|
1437
|
+
const A = c.ranges, $ = o.get(w), B = Xe($, { unitId: s, subUnitId: n });
|
|
1438
1438
|
if (B) {
|
|
1439
|
-
const k = new Se(), { worksheet: x } = B, { formula2: J =
|
|
1439
|
+
const k = new Se(), { worksheet: x } = B, { formula2: J = Ve, formula1: ce = Ee } = c, { formula2: he = Ve, formula1: me = Ee } = u;
|
|
1440
1440
|
let Ue = !1;
|
|
1441
|
-
if (
|
|
1441
|
+
if (A.forEach((ge) => {
|
|
1442
1442
|
b.foreach(ge, (ae, Be) => {
|
|
1443
1443
|
const j = x.getCellRaw(ae, Be), ze = mt(j);
|
|
1444
1444
|
(_t(j) || ze === String(J)) && !(j != null && j.p) ? (k.setValue(ae, Be, {
|
|
@@ -1461,14 +1461,14 @@ const ha = {
|
|
|
1461
1461
|
id: se.id,
|
|
1462
1462
|
params: nt(o, ge.params)
|
|
1463
1463
|
};
|
|
1464
|
-
_.push(ge),
|
|
1464
|
+
_.push(ge), V.push(ae);
|
|
1465
1465
|
}
|
|
1466
1466
|
}
|
|
1467
1467
|
}
|
|
1468
|
-
return
|
|
1468
|
+
return De(_, e).result ? (t.pushUndoRedo({
|
|
1469
1469
|
unitID: s,
|
|
1470
1470
|
redoMutations: _,
|
|
1471
|
-
undoMutations:
|
|
1471
|
+
undoMutations: V
|
|
1472
1472
|
}), !0) : !1;
|
|
1473
1473
|
}
|
|
1474
1474
|
}, _a = {
|
|
@@ -1485,29 +1485,29 @@ const ha = {
|
|
|
1485
1485
|
subUnitId: s,
|
|
1486
1486
|
ruleId: n,
|
|
1487
1487
|
payload: {
|
|
1488
|
-
type:
|
|
1488
|
+
type: M.OPTIONS,
|
|
1489
1489
|
payload: l
|
|
1490
1490
|
}
|
|
1491
1491
|
}, c = [{
|
|
1492
|
-
id:
|
|
1492
|
+
id: y.id,
|
|
1493
1493
|
params: d
|
|
1494
1494
|
}], g = {
|
|
1495
1495
|
unitId: i,
|
|
1496
1496
|
subUnitId: s,
|
|
1497
1497
|
ruleId: n,
|
|
1498
1498
|
payload: {
|
|
1499
|
-
type:
|
|
1499
|
+
type: M.OPTIONS,
|
|
1500
1500
|
payload: Lt(u)
|
|
1501
1501
|
}
|
|
1502
1502
|
}, p = [{
|
|
1503
|
-
id:
|
|
1503
|
+
id: y.id,
|
|
1504
1504
|
params: g
|
|
1505
1505
|
}];
|
|
1506
1506
|
return t.pushUndoRedo({
|
|
1507
1507
|
unitID: i,
|
|
1508
1508
|
redoMutations: c,
|
|
1509
1509
|
undoMutations: p
|
|
1510
|
-
}), e.executeCommand(
|
|
1510
|
+
}), e.executeCommand(y.id, d), !0;
|
|
1511
1511
|
}
|
|
1512
1512
|
}, pa = {
|
|
1513
1513
|
type: z.COMMAND,
|
|
@@ -1515,7 +1515,7 @@ const ha = {
|
|
|
1515
1515
|
handler(o, a) {
|
|
1516
1516
|
if (!a)
|
|
1517
1517
|
return !1;
|
|
1518
|
-
const { unitId: e, subUnitId: t, ranges: r } = a, i = o.get(U), s = o.get(
|
|
1518
|
+
const { unitId: e, subUnitId: t, ranges: r } = a, i = o.get(U), s = o.get(w), n = Xe(s, { unitId: e, subUnitId: t }), l = o.get(F);
|
|
1519
1519
|
if (!n) return !1;
|
|
1520
1520
|
const u = o.get(Z), d = l.getRuleObjectMatrix(e, t).clone();
|
|
1521
1521
|
d.removeRange(r);
|
|
@@ -1524,7 +1524,7 @@ const ha = {
|
|
|
1524
1524
|
unitID: e,
|
|
1525
1525
|
redoMutations: g,
|
|
1526
1526
|
undoMutations: p
|
|
1527
|
-
}),
|
|
1527
|
+
}), De(g, i).result;
|
|
1528
1528
|
}
|
|
1529
1529
|
}, fa = {
|
|
1530
1530
|
type: z.COMMAND,
|
|
@@ -1537,7 +1537,7 @@ const ha = {
|
|
|
1537
1537
|
subUnitId: t,
|
|
1538
1538
|
ruleId: n.map((c) => c.uid)
|
|
1539
1539
|
}, u = [{
|
|
1540
|
-
id:
|
|
1540
|
+
id: D.id,
|
|
1541
1541
|
params: l
|
|
1542
1542
|
}], d = [{
|
|
1543
1543
|
id: L.id,
|
|
@@ -1551,7 +1551,7 @@ const ha = {
|
|
|
1551
1551
|
redoMutations: u,
|
|
1552
1552
|
undoMutations: d,
|
|
1553
1553
|
unitID: e
|
|
1554
|
-
}), r.executeCommand(
|
|
1554
|
+
}), r.executeCommand(D.id, l), !0;
|
|
1555
1555
|
}
|
|
1556
1556
|
}, va = (o, a) => {
|
|
1557
1557
|
const e = o.get(F), { unitId: t, subUnitId: r, ruleId: i, source: s } = a;
|
|
@@ -1585,7 +1585,7 @@ const ha = {
|
|
|
1585
1585
|
if (!a)
|
|
1586
1586
|
return !1;
|
|
1587
1587
|
const { unitId: e, subUnitId: t, ruleId: r } = a, i = o.get(U), s = o.get(Z), n = o.get(F), l = [{
|
|
1588
|
-
id:
|
|
1588
|
+
id: D.id,
|
|
1589
1589
|
params: a
|
|
1590
1590
|
}], u = [{
|
|
1591
1591
|
id: L.id,
|
|
@@ -1602,11 +1602,11 @@ const ha = {
|
|
|
1602
1602
|
undoMutations: u,
|
|
1603
1603
|
redoMutations: l,
|
|
1604
1604
|
unitID: a.unitId
|
|
1605
|
-
}), i.executeCommand(
|
|
1605
|
+
}), i.executeCommand(D.id, a), !0;
|
|
1606
1606
|
}
|
|
1607
1607
|
}, Sa = "sheets-data-validation.config", rt = {};
|
|
1608
|
-
var
|
|
1609
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1608
|
+
var Ea = Object.getOwnPropertyDescriptor, Va = (o, a, e, t) => {
|
|
1609
|
+
for (var r = t > 1 ? void 0 : t ? Ea(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1610
1610
|
(s = o[i]) && (r = s(r) || r);
|
|
1611
1611
|
return r;
|
|
1612
1612
|
}, We = (o, a) => (e, t) => a(e, t, o);
|
|
@@ -1637,7 +1637,7 @@ let Te = class extends W {
|
|
|
1637
1637
|
}
|
|
1638
1638
|
}],
|
|
1639
1639
|
redos: [{
|
|
1640
|
-
id:
|
|
1640
|
+
id: D.id,
|
|
1641
1641
|
params: {
|
|
1642
1642
|
unitId: a,
|
|
1643
1643
|
subUnitId: e,
|
|
@@ -1648,13 +1648,13 @@ let Te = class extends W {
|
|
|
1648
1648
|
};
|
|
1649
1649
|
const d = [], c = [], g = u[0];
|
|
1650
1650
|
d.push({
|
|
1651
|
-
id:
|
|
1651
|
+
id: y.id,
|
|
1652
1652
|
params: {
|
|
1653
1653
|
unitId: a,
|
|
1654
1654
|
subUnitId: e,
|
|
1655
1655
|
ruleId: t.uid,
|
|
1656
1656
|
payload: {
|
|
1657
|
-
type:
|
|
1657
|
+
type: M.ALL,
|
|
1658
1658
|
payload: {
|
|
1659
1659
|
ranges: g.ranges,
|
|
1660
1660
|
formula1: g.formulas[0],
|
|
@@ -1664,13 +1664,13 @@ let Te = class extends W {
|
|
|
1664
1664
|
source: "patched"
|
|
1665
1665
|
}
|
|
1666
1666
|
}), c.push({
|
|
1667
|
-
id:
|
|
1667
|
+
id: y.id,
|
|
1668
1668
|
params: {
|
|
1669
1669
|
unitId: a,
|
|
1670
1670
|
subUnitId: e,
|
|
1671
1671
|
ruleId: t.uid,
|
|
1672
1672
|
payload: {
|
|
1673
|
-
type:
|
|
1673
|
+
type: M.ALL,
|
|
1674
1674
|
payload: {
|
|
1675
1675
|
ranges: r,
|
|
1676
1676
|
formula1: i,
|
|
@@ -1681,7 +1681,7 @@ let Te = class extends W {
|
|
|
1681
1681
|
}
|
|
1682
1682
|
});
|
|
1683
1683
|
for (let p = 1; p < u.length; p++) {
|
|
1684
|
-
const _ = u[p], v =
|
|
1684
|
+
const _ = u[p], v = Mt();
|
|
1685
1685
|
d.push({
|
|
1686
1686
|
id: L.id,
|
|
1687
1687
|
params: {
|
|
@@ -1697,7 +1697,7 @@ let Te = class extends W {
|
|
|
1697
1697
|
source: "patched"
|
|
1698
1698
|
}
|
|
1699
1699
|
}), c.push({
|
|
1700
|
-
id:
|
|
1700
|
+
id: D.id,
|
|
1701
1701
|
params: {
|
|
1702
1702
|
unitId: a,
|
|
1703
1703
|
subUnitId: e,
|
|
@@ -1747,13 +1747,13 @@ let Te = class extends W {
|
|
|
1747
1747
|
}));
|
|
1748
1748
|
}
|
|
1749
1749
|
};
|
|
1750
|
-
Te =
|
|
1750
|
+
Te = Va([
|
|
1751
1751
|
We(0, R(F)),
|
|
1752
1752
|
We(1, R(ct)),
|
|
1753
1753
|
We(2, R(q))
|
|
1754
1754
|
], Te);
|
|
1755
|
-
var pt = /* @__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))(pt || {}),
|
|
1756
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1755
|
+
var pt = /* @__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))(pt || {}), Ma = Object.getOwnPropertyDescriptor, ya = (o, a, e, t) => {
|
|
1756
|
+
for (var r = t > 1 ? void 0 : t ? Ma(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1757
1757
|
(s = o[i]) && (r = s(r) || r);
|
|
1758
1758
|
return r;
|
|
1759
1759
|
}, $e = (o, a) => (e, t) => a(e, t, o);
|
|
@@ -1770,7 +1770,7 @@ let Fe = class extends W {
|
|
|
1770
1770
|
const i = a[r];
|
|
1771
1771
|
if (typeof i == "string")
|
|
1772
1772
|
continue;
|
|
1773
|
-
const { token: s } = i, n = qt(s), l = this._univerInstanceService.getCurrentUnitForType(
|
|
1773
|
+
const { token: s } = i, n = qt(s), l = this._univerInstanceService.getCurrentUnitForType(C.UNIVER_SHEET);
|
|
1774
1774
|
let u = l.getActiveSheet();
|
|
1775
1775
|
const d = l.getUnitId();
|
|
1776
1776
|
if (n.sheetName) {
|
|
@@ -1783,8 +1783,8 @@ let Fe = class extends W {
|
|
|
1783
1783
|
return !1;
|
|
1784
1784
|
const { startRow: c, endRow: g, startColumn: p, endColumn: _ } = n.range;
|
|
1785
1785
|
for (let v = c; v <= g; v++)
|
|
1786
|
-
for (let
|
|
1787
|
-
const f = (t = (e = u.getCell(v,
|
|
1786
|
+
for (let V = p; V <= _; V++) {
|
|
1787
|
+
const f = (t = (e = u.getCell(v, V)) == null ? void 0 : e.selectionProtection) == null ? void 0 : t[0];
|
|
1788
1788
|
if ((f == null ? void 0 : f[pt.View]) === !1)
|
|
1789
1789
|
return !1;
|
|
1790
1790
|
}
|
|
@@ -1792,9 +1792,9 @@ let Fe = class extends W {
|
|
|
1792
1792
|
return !0;
|
|
1793
1793
|
}
|
|
1794
1794
|
};
|
|
1795
|
-
Fe =
|
|
1796
|
-
$e(0,
|
|
1797
|
-
$e(1,
|
|
1795
|
+
Fe = ya([
|
|
1796
|
+
$e(0, w),
|
|
1797
|
+
$e(1, yt),
|
|
1798
1798
|
$e(2, R(Y))
|
|
1799
1799
|
], Fe);
|
|
1800
1800
|
var Ta = Object.getOwnPropertyDescriptor, Fa = (o, a, e, t) => {
|
|
@@ -1802,7 +1802,7 @@ var Ta = Object.getOwnPropertyDescriptor, Fa = (o, a, e, t) => {
|
|
|
1802
1802
|
(s = o[i]) && (r = s(r) || r);
|
|
1803
1803
|
return r;
|
|
1804
1804
|
}, ee = (o, a) => (e, t) => a(e, t, o);
|
|
1805
|
-
let
|
|
1805
|
+
let Ce = class extends W {
|
|
1806
1806
|
constructor(a, e, t, r, i, s) {
|
|
1807
1807
|
super();
|
|
1808
1808
|
m(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
@@ -1829,7 +1829,7 @@ let Ne = class extends W {
|
|
|
1829
1829
|
subUnitId: e,
|
|
1830
1830
|
ruleId: t.uid,
|
|
1831
1831
|
payload: {
|
|
1832
|
-
type:
|
|
1832
|
+
type: M.SETTING,
|
|
1833
1833
|
payload: {
|
|
1834
1834
|
type: g.type,
|
|
1835
1835
|
formula1: g.formula1,
|
|
@@ -1843,7 +1843,7 @@ let Ne = class extends W {
|
|
|
1843
1843
|
subUnitId: e,
|
|
1844
1844
|
ruleId: t.uid,
|
|
1845
1845
|
payload: {
|
|
1846
|
-
type:
|
|
1846
|
+
type: M.SETTING,
|
|
1847
1847
|
payload: {
|
|
1848
1848
|
type: g.type,
|
|
1849
1849
|
formula1: g.formula1,
|
|
@@ -1851,18 +1851,18 @@ let Ne = class extends W {
|
|
|
1851
1851
|
}
|
|
1852
1852
|
},
|
|
1853
1853
|
source: "patched"
|
|
1854
|
-
},
|
|
1854
|
+
}, V = [
|
|
1855
1855
|
{
|
|
1856
|
-
id:
|
|
1856
|
+
id: y.id,
|
|
1857
1857
|
params: _
|
|
1858
1858
|
}
|
|
1859
1859
|
], f = [
|
|
1860
1860
|
{
|
|
1861
|
-
id:
|
|
1861
|
+
id: y.id,
|
|
1862
1862
|
params: v
|
|
1863
1863
|
}
|
|
1864
1864
|
];
|
|
1865
|
-
return { redos:
|
|
1865
|
+
return { redos: V, undos: f };
|
|
1866
1866
|
}, l = this._dataValidationFormulaService.getRuleFormulaInfo(a, e, r);
|
|
1867
1867
|
if (l) {
|
|
1868
1868
|
const [d, c] = l;
|
|
@@ -1898,27 +1898,27 @@ let Ne = class extends W {
|
|
|
1898
1898
|
subUnitId: e,
|
|
1899
1899
|
ruleId: t.uid,
|
|
1900
1900
|
payload: {
|
|
1901
|
-
type:
|
|
1901
|
+
type: M.RANGE,
|
|
1902
1902
|
payload: g
|
|
1903
1903
|
},
|
|
1904
1904
|
source: "patched"
|
|
1905
|
-
}, v = [{ id:
|
|
1906
|
-
id:
|
|
1905
|
+
}, v = [{ id: y.id, params: _ }], V = [{
|
|
1906
|
+
id: y.id,
|
|
1907
1907
|
params: {
|
|
1908
1908
|
unitId: a,
|
|
1909
1909
|
subUnitId: e,
|
|
1910
1910
|
ruleId: t.uid,
|
|
1911
1911
|
payload: {
|
|
1912
|
-
type:
|
|
1912
|
+
type: M.RANGE,
|
|
1913
1913
|
payload: d
|
|
1914
1914
|
},
|
|
1915
1915
|
source: "patched"
|
|
1916
1916
|
}
|
|
1917
1917
|
}];
|
|
1918
|
-
return { redos: v, undos:
|
|
1918
|
+
return { redos: v, undos: V };
|
|
1919
1919
|
} else {
|
|
1920
|
-
const _ = { unitId: a, subUnitId: e, ruleId: t.uid }, v = [{ id:
|
|
1921
|
-
return { redos: v, undos:
|
|
1920
|
+
const _ = { unitId: a, subUnitId: e, ruleId: t.uid }, v = [{ id: D.id, params: _ }], V = va(this._injector, _);
|
|
1921
|
+
return { redos: v, undos: V };
|
|
1922
1922
|
}
|
|
1923
1923
|
}, i = [];
|
|
1924
1924
|
t.ranges.forEach((u) => {
|
|
@@ -1962,20 +1962,20 @@ let Ne = class extends W {
|
|
|
1962
1962
|
}));
|
|
1963
1963
|
}
|
|
1964
1964
|
};
|
|
1965
|
-
|
|
1965
|
+
Ce = Fa([
|
|
1966
1966
|
ee(0, R(F)),
|
|
1967
1967
|
ee(1, R(Ge)),
|
|
1968
1968
|
ee(2, R(xt)),
|
|
1969
1969
|
ee(3, R(K)),
|
|
1970
1970
|
ee(4, R(ct)),
|
|
1971
1971
|
ee(5, R(q))
|
|
1972
|
-
],
|
|
1973
|
-
var
|
|
1974
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1972
|
+
], Ce);
|
|
1973
|
+
var Ca = Object.getOwnPropertyDescriptor, Oa = (o, a, e, t) => {
|
|
1974
|
+
for (var r = t > 1 ? void 0 : t ? Ca(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1975
1975
|
(s = o[i]) && (r = s(r) || r);
|
|
1976
1976
|
return r;
|
|
1977
1977
|
}, ke = (o, a) => (e, t) => a(e, t, o);
|
|
1978
|
-
let
|
|
1978
|
+
let Oe = class extends W {
|
|
1979
1979
|
constructor(o, a, e) {
|
|
1980
1980
|
super(), this._sheetInterceptorService = o, this._univerInstanceService = a, this._sheetDataValidationModel = e, this._initSheetChange();
|
|
1981
1981
|
}
|
|
@@ -1985,7 +1985,7 @@ let Ce = class extends W {
|
|
|
1985
1985
|
getMutations: (o) => {
|
|
1986
1986
|
var a;
|
|
1987
1987
|
if (o.id === Pt.id) {
|
|
1988
|
-
const e = o.params, t = e.unitId || this._univerInstanceService.getCurrentUnitForType(
|
|
1988
|
+
const e = o.params, t = e.unitId || this._univerInstanceService.getCurrentUnitForType(C.UNIVER_SHEET).getUnitId(), r = this._univerInstanceService.getUniverSheetInstance(t);
|
|
1989
1989
|
if (!r)
|
|
1990
1990
|
return { redos: [], undos: [] };
|
|
1991
1991
|
const i = e.subUnitId || ((a = r.getActiveSheet()) == null ? void 0 : a.getSheetId());
|
|
@@ -2007,7 +2007,7 @@ let Ce = class extends W {
|
|
|
2007
2007
|
};
|
|
2008
2008
|
return {
|
|
2009
2009
|
redos: [{
|
|
2010
|
-
id:
|
|
2010
|
+
id: D.id,
|
|
2011
2011
|
params: l
|
|
2012
2012
|
}],
|
|
2013
2013
|
undos: [{
|
|
@@ -2022,12 +2022,12 @@ let Ce = class extends W {
|
|
|
2022
2022
|
);
|
|
2023
2023
|
}
|
|
2024
2024
|
};
|
|
2025
|
-
|
|
2025
|
+
Oe = Oa([
|
|
2026
2026
|
ke(0, R(lt)),
|
|
2027
|
-
ke(1, R(
|
|
2027
|
+
ke(1, R(w)),
|
|
2028
2028
|
ke(2, R(F))
|
|
2029
|
-
],
|
|
2030
|
-
class
|
|
2029
|
+
], Oe);
|
|
2030
|
+
class wa extends G {
|
|
2031
2031
|
constructor() {
|
|
2032
2032
|
super(...arguments);
|
|
2033
2033
|
m(this, "id", T.ANY);
|
|
@@ -2056,7 +2056,7 @@ class Oa extends G {
|
|
|
2056
2056
|
return this.localeService.t("dataValidation.any.error");
|
|
2057
2057
|
}
|
|
2058
2058
|
}
|
|
2059
|
-
class
|
|
2059
|
+
class Aa extends G {
|
|
2060
2060
|
constructor() {
|
|
2061
2061
|
super(...arguments);
|
|
2062
2062
|
m(this, "id", T.CUSTOM);
|
|
@@ -2084,7 +2084,7 @@ class wa extends G {
|
|
|
2084
2084
|
}
|
|
2085
2085
|
async isValidType(e, t, r) {
|
|
2086
2086
|
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;
|
|
2087
|
-
return
|
|
2087
|
+
return O(String(d)) && E.isDefine(d) && d !== "" ? u.t === Tt.BOOLEAN ? !!d : typeof d == "boolean" ? d : typeof d == "number" ? !!d : typeof d == "string" ? O(d) : !!d : !1;
|
|
2088
2088
|
}
|
|
2089
2089
|
generateRuleErrorMessage(e) {
|
|
2090
2090
|
return this.localeService.t("dataValidation.custom.error");
|
|
@@ -2094,7 +2094,7 @@ class wa extends G {
|
|
|
2094
2094
|
return this.localeService.t("dataValidation.custom.ruleName").replace("{FORMULA1}", (t = e.formula1) != null ? t : "");
|
|
2095
2095
|
}
|
|
2096
2096
|
}
|
|
2097
|
-
class
|
|
2097
|
+
class Ia extends gt {
|
|
2098
2098
|
constructor() {
|
|
2099
2099
|
super(...arguments);
|
|
2100
2100
|
m(this, "id", T.LIST_MULTIPLE);
|
|
@@ -2103,7 +2103,7 @@ class Aa extends gt {
|
|
|
2103
2103
|
m(this, "skipDefaultFontRender", () => !0);
|
|
2104
2104
|
}
|
|
2105
2105
|
}
|
|
2106
|
-
class
|
|
2106
|
+
class Da extends G {
|
|
2107
2107
|
constructor() {
|
|
2108
2108
|
super(...arguments);
|
|
2109
2109
|
m(this, "_customFormulaService", this.injector.get(P));
|
|
@@ -2124,24 +2124,24 @@ class Ia extends G {
|
|
|
2124
2124
|
m(this, "scopes", ["sheet"]);
|
|
2125
2125
|
}
|
|
2126
2126
|
_isFormulaOrInt(e) {
|
|
2127
|
-
return !
|
|
2127
|
+
return !E.isBlank(e) && (S(e) || !Number.isNaN(+e) && Number.isInteger(+e));
|
|
2128
2128
|
}
|
|
2129
2129
|
async isValidType(e, t, r) {
|
|
2130
|
-
const { value: i } = e, s =
|
|
2130
|
+
const { value: i } = e, s = ye(i);
|
|
2131
2131
|
return !Number.isNaN(s) && Number.isInteger(s);
|
|
2132
2132
|
}
|
|
2133
2133
|
transform(e, t, r) {
|
|
2134
2134
|
const { value: i } = e;
|
|
2135
2135
|
return {
|
|
2136
2136
|
...e,
|
|
2137
|
-
value:
|
|
2137
|
+
value: ye(i)
|
|
2138
2138
|
};
|
|
2139
2139
|
}
|
|
2140
2140
|
_parseNumber(e) {
|
|
2141
2141
|
return e == null ? Number.NaN : +e;
|
|
2142
2142
|
}
|
|
2143
2143
|
async parseFormula(e, t, r, i, s) {
|
|
2144
|
-
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, p =
|
|
2144
|
+
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, p = O(`${c}`) && O(`${g}`);
|
|
2145
2145
|
return {
|
|
2146
2146
|
formula1: this._parseNumber(c),
|
|
2147
2147
|
formula2: this._parseNumber(g),
|
|
@@ -2154,7 +2154,7 @@ class Ia extends G {
|
|
|
2154
2154
|
return {
|
|
2155
2155
|
success: !0
|
|
2156
2156
|
};
|
|
2157
|
-
const s =
|
|
2157
|
+
const s = E.isDefine(e.formula1) && this._isFormulaOrInt(e.formula1), n = E.isDefine(e.formula2) && this._isFormulaOrInt(e.formula2), l = Ne.includes(i), u = this.localeService.t("dataValidation.validFail.number");
|
|
2158
2158
|
return l ? {
|
|
2159
2159
|
success: s && n,
|
|
2160
2160
|
formula1: s ? void 0 : u,
|
|
@@ -2166,17 +2166,17 @@ class Ia extends G {
|
|
|
2166
2166
|
}
|
|
2167
2167
|
generateRuleErrorMessage(e, t) {
|
|
2168
2168
|
if (!e.operator)
|
|
2169
|
-
return this.localeService.t(
|
|
2169
|
+
return this.localeService.t(Me.NONE).replace("{TYPE}", this.titleStr);
|
|
2170
2170
|
const { transformedFormula1: r, transformedFormula2: i } = be(this._lexerTreeBuilder, e, t);
|
|
2171
|
-
return `${this.localeService.t(
|
|
2171
|
+
return `${this.localeService.t(Me[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
2172
2172
|
}
|
|
2173
2173
|
}
|
|
2174
|
-
var
|
|
2175
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2174
|
+
var Na = Object.getOwnPropertyDescriptor, ba = (o, a, e, t) => {
|
|
2175
|
+
for (var r = t > 1 ? void 0 : t ? Na(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
2176
2176
|
(s = o[i]) && (r = s(r) || r);
|
|
2177
2177
|
return r;
|
|
2178
2178
|
}, te = (o, a) => (e, t) => a(e, t, o);
|
|
2179
|
-
let
|
|
2179
|
+
let we = class extends Ft {
|
|
2180
2180
|
constructor(o, a, e, t, r, i) {
|
|
2181
2181
|
super(), this._univerInstanceService = o, this._dataValidatorRegistryService = a, this._injector = e, this._selectionManagerService = t, this._sheetInterceptorService = r, this._sheetDataValidationModel = i, this._init();
|
|
2182
2182
|
}
|
|
@@ -2185,15 +2185,15 @@ let Oe = class extends Ft {
|
|
|
2185
2185
|
}
|
|
2186
2186
|
_registerValidators() {
|
|
2187
2187
|
[
|
|
2188
|
-
|
|
2188
|
+
wa,
|
|
2189
2189
|
na,
|
|
2190
|
-
|
|
2190
|
+
Da,
|
|
2191
2191
|
ca,
|
|
2192
2192
|
sa,
|
|
2193
2193
|
ra,
|
|
2194
2194
|
gt,
|
|
2195
|
-
|
|
2196
|
-
|
|
2195
|
+
Ia,
|
|
2196
|
+
Aa
|
|
2197
2197
|
].forEach((o) => {
|
|
2198
2198
|
const a = this._injector.createInstance(o);
|
|
2199
2199
|
this.disposeWithMe(this._dataValidatorRegistryService.register(a)), this.disposeWithMe(qe(() => this._injector.delete(o)));
|
|
@@ -2204,7 +2204,7 @@ let Oe = class extends Ft {
|
|
|
2204
2204
|
getMutations: (o) => {
|
|
2205
2205
|
var a;
|
|
2206
2206
|
if (o.id === Wt.id) {
|
|
2207
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
2207
|
+
const e = this._univerInstanceService.getCurrentUnitForType(C.UNIVER_SHEET), t = e.getUnitId(), r = e.getActiveSheet();
|
|
2208
2208
|
if (!r)
|
|
2209
2209
|
throw new Error("No active sheet found");
|
|
2210
2210
|
const i = r.getSheetId(), s = (a = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : a.map((c) => c.range), n = this._sheetDataValidationModel.getRuleObjectMatrix(t, i).clone();
|
|
@@ -2223,20 +2223,20 @@ let Oe = class extends Ft {
|
|
|
2223
2223
|
});
|
|
2224
2224
|
}
|
|
2225
2225
|
};
|
|
2226
|
-
|
|
2227
|
-
te(0,
|
|
2226
|
+
we = ba([
|
|
2227
|
+
te(0, w),
|
|
2228
2228
|
te(1, R(q)),
|
|
2229
2229
|
te(2, R(Ge)),
|
|
2230
2230
|
te(3, R(ut)),
|
|
2231
2231
|
te(4, R(lt)),
|
|
2232
2232
|
te(5, R(F))
|
|
2233
|
-
],
|
|
2233
|
+
], we);
|
|
2234
2234
|
var La = Object.getOwnPropertyDescriptor, Ua = (o, a, e, t) => {
|
|
2235
2235
|
for (var r = t > 1 ? void 0 : t ? La(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
2236
2236
|
(s = o[i]) && (r = s(r) || r);
|
|
2237
2237
|
return r;
|
|
2238
2238
|
}, ve = (o, a) => (e, t) => a(e, t, o);
|
|
2239
|
-
let
|
|
2239
|
+
let Ae = class extends W {
|
|
2240
2240
|
constructor(o, a, e, t) {
|
|
2241
2241
|
super(), this._univerInstanceService = o, this._sheetDataValidationModel = a, this._dataValidationCacheService = e, this._lifecycleService = t, this._initRecalculate();
|
|
2242
2242
|
}
|
|
@@ -2244,10 +2244,10 @@ let we = class extends W {
|
|
|
2244
2244
|
const o = (a) => {
|
|
2245
2245
|
if (a.length === 0)
|
|
2246
2246
|
return;
|
|
2247
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
2247
|
+
const e = this._univerInstanceService.getCurrentUnitForType(C.UNIVER_SHEET), t = e == null ? void 0 : e.getActiveSheet(), r = {};
|
|
2248
2248
|
a.flat().forEach((i) => {
|
|
2249
2249
|
r[i.unitId] || (r[i.unitId] = {}), r[i.unitId][i.subUnitId] || (r[i.unitId][i.subUnitId] = []);
|
|
2250
|
-
const s = this._univerInstanceService.getUnit(i.unitId,
|
|
2250
|
+
const s = this._univerInstanceService.getUnit(i.unitId, C.UNIVER_SHEET), n = s == null ? void 0 : s.getSheetBySheetId(i.subUnitId);
|
|
2251
2251
|
n && r[i.unitId][i.subUnitId].push(...i.ranges.map((l) => b.transformRange(l, n)));
|
|
2252
2252
|
}), Object.entries(r).forEach(([i, s]) => {
|
|
2253
2253
|
Object.entries(s).forEach(([n, l]) => {
|
|
@@ -2257,21 +2257,21 @@ let we = class extends W {
|
|
|
2257
2257
|
});
|
|
2258
2258
|
});
|
|
2259
2259
|
};
|
|
2260
|
-
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe($t(() => this._lifecycleService.lifecycle$.pipe(Je((a) => a === Ze.Rendered)))).subscribe(o)), this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(Je(() => this._lifecycleService.stage >= Ze.Rendered),
|
|
2260
|
+
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe($t(() => this._lifecycleService.lifecycle$.pipe(Je((a) => a === Ze.Rendered)))).subscribe(o)), this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(Je(() => this._lifecycleService.stage >= Ze.Rendered), Ot(20)).subscribe(o));
|
|
2261
2261
|
}
|
|
2262
2262
|
async _validatorByCell(o, a, e, t) {
|
|
2263
2263
|
const r = o.getUnitId(), i = a.getSheetId();
|
|
2264
|
-
if (!
|
|
2264
|
+
if (!E.isDefine(e) || !E.isDefine(t))
|
|
2265
2265
|
throw new Error(`row or col is not defined, row: ${e}, col: ${t}`);
|
|
2266
2266
|
const s = this._sheetDataValidationModel.getRuleByLocation(r, i, e, t);
|
|
2267
2267
|
return s ? new Promise((n) => {
|
|
2268
2268
|
this._sheetDataValidationModel.validator(s, { unitId: r, subUnitId: i, row: e, col: t, worksheet: a, workbook: o }, (l) => {
|
|
2269
2269
|
n(l);
|
|
2270
2270
|
});
|
|
2271
|
-
}) :
|
|
2271
|
+
}) : N.VALID;
|
|
2272
2272
|
}
|
|
2273
2273
|
async validatorCell(o, a, e, t) {
|
|
2274
|
-
const r = this._univerInstanceService.getUnit(o,
|
|
2274
|
+
const r = this._univerInstanceService.getUnit(o, C.UNIVER_SHEET);
|
|
2275
2275
|
if (!r)
|
|
2276
2276
|
throw new Error(`cannot find current workbook, unitId: ${o}`);
|
|
2277
2277
|
const i = r.getSheetBySheetId(a);
|
|
@@ -2282,7 +2282,7 @@ let we = class extends W {
|
|
|
2282
2282
|
validatorRanges(o, a, e) {
|
|
2283
2283
|
if (!e.length)
|
|
2284
2284
|
return Promise.resolve([]);
|
|
2285
|
-
const t = this._univerInstanceService.getUnit(o,
|
|
2285
|
+
const t = this._univerInstanceService.getUnit(o, C.UNIVER_SHEET);
|
|
2286
2286
|
if (!t)
|
|
2287
2287
|
throw new Error(`cannot find current workbook, unitId: ${o}`);
|
|
2288
2288
|
const r = t.getSheetBySheetId(a);
|
|
@@ -2296,7 +2296,7 @@ let we = class extends W {
|
|
|
2296
2296
|
}));
|
|
2297
2297
|
}
|
|
2298
2298
|
async validatorWorksheet(o, a) {
|
|
2299
|
-
const e = this._univerInstanceService.getUnit(o,
|
|
2299
|
+
const e = this._univerInstanceService.getUnit(o, C.UNIVER_SHEET);
|
|
2300
2300
|
if (!e)
|
|
2301
2301
|
throw new Error(`cannot find current workbook, unitId: ${o}`);
|
|
2302
2302
|
const t = e.getSheetBySheetId(a);
|
|
@@ -2329,21 +2329,21 @@ let we = class extends W {
|
|
|
2329
2329
|
return this.getDataValidations(o, a, e)[0];
|
|
2330
2330
|
}
|
|
2331
2331
|
};
|
|
2332
|
-
|
|
2333
|
-
ve(0,
|
|
2332
|
+
Ae = Ua([
|
|
2333
|
+
ve(0, w),
|
|
2334
2334
|
ve(1, R(F)),
|
|
2335
2335
|
ve(2, R(Q)),
|
|
2336
|
-
ve(3, R(
|
|
2337
|
-
],
|
|
2336
|
+
ve(3, R(Ct))
|
|
2337
|
+
], Ae);
|
|
2338
2338
|
var Ba = Object.defineProperty, xa = Object.getOwnPropertyDescriptor, Ha = (o, a, e) => a in o ? Ba(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e, Pa = (o, a, e, t) => {
|
|
2339
2339
|
for (var r = t > 1 ? void 0 : t ? xa(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
2340
2340
|
(s = o[i]) && (r = s(r) || r);
|
|
2341
2341
|
return r;
|
|
2342
2342
|
}, je = (o, a) => (e, t) => a(e, t, o), ft = (o, a, e) => Ha(o, typeof a != "symbol" ? a + "" : a, e);
|
|
2343
|
-
let
|
|
2343
|
+
let Ie = class extends It {
|
|
2344
2344
|
constructor(o = rt, a, e, t) {
|
|
2345
2345
|
super(), this._config = o, this._injector = a, this._commandService = e, this._configService = t;
|
|
2346
|
-
const { ...r } =
|
|
2346
|
+
const { ...r } = Dt(
|
|
2347
2347
|
{},
|
|
2348
2348
|
rt,
|
|
2349
2349
|
this._config
|
|
@@ -2355,12 +2355,12 @@ let Ae = class extends At {
|
|
|
2355
2355
|
[Q],
|
|
2356
2356
|
[K],
|
|
2357
2357
|
[P],
|
|
2358
|
-
[
|
|
2358
|
+
[Ae],
|
|
2359
2359
|
[F],
|
|
2360
|
-
[
|
|
2360
|
+
[we],
|
|
2361
2361
|
[Fe],
|
|
2362
|
+
[Oe],
|
|
2362
2363
|
[Ce],
|
|
2363
|
-
[Ne],
|
|
2364
2364
|
[Te]
|
|
2365
2365
|
].forEach((o) => {
|
|
2366
2366
|
this._injector.add(o);
|
|
@@ -2374,27 +2374,27 @@ let Ae = class extends At {
|
|
|
2374
2374
|
pa
|
|
2375
2375
|
].forEach((o) => {
|
|
2376
2376
|
this._commandService.registerCommand(o);
|
|
2377
|
-
}), this._injector.get(Q), this._injector.get(
|
|
2377
|
+
}), this._injector.get(Q), this._injector.get(Ae), this._injector.get(we), this._injector.get(Te), this._injector.get(Ce);
|
|
2378
2378
|
}
|
|
2379
2379
|
onReady() {
|
|
2380
|
-
this._injector.get(
|
|
2380
|
+
this._injector.get(Oe);
|
|
2381
2381
|
}
|
|
2382
2382
|
onRendered() {
|
|
2383
2383
|
this._injector.get(Fe);
|
|
2384
2384
|
}
|
|
2385
2385
|
};
|
|
2386
|
-
ft(
|
|
2387
|
-
ft(
|
|
2388
|
-
|
|
2389
|
-
|
|
2386
|
+
ft(Ie, "pluginName", Yt);
|
|
2387
|
+
ft(Ie, "type", C.UNIVER_SHEET);
|
|
2388
|
+
Ie = Pa([
|
|
2389
|
+
wt(Ut),
|
|
2390
2390
|
je(1, R(Ge)),
|
|
2391
2391
|
je(2, U),
|
|
2392
|
-
je(3,
|
|
2393
|
-
],
|
|
2392
|
+
je(3, At)
|
|
2393
|
+
], Ie);
|
|
2394
2394
|
function Ka(o) {
|
|
2395
2395
|
const e = o.get(ut).getCurrentSelections().map((i) => i.range);
|
|
2396
2396
|
return {
|
|
2397
|
-
uid:
|
|
2397
|
+
uid: E.generateRandomId(6),
|
|
2398
2398
|
type: T.DECIMAL,
|
|
2399
2399
|
operator: h.EQUAL,
|
|
2400
2400
|
formula1: "100",
|
|
@@ -2405,8 +2405,8 @@ const za = "data-validation.custom-formula-input", Za = "data-validation.formula
|
|
|
2405
2405
|
export {
|
|
2406
2406
|
ma as AddSheetDataValidationCommand,
|
|
2407
2407
|
Za as BASE_FORMULA_INPUT_NAME,
|
|
2408
|
-
|
|
2409
|
-
|
|
2408
|
+
Ee as CHECKBOX_FORMULA_1,
|
|
2409
|
+
Ve as CHECKBOX_FORMULA_2,
|
|
2410
2410
|
er as CHECKBOX_FORMULA_INPUT_NAME,
|
|
2411
2411
|
za as CUSTOM_FORMULA_INPUT_NAME,
|
|
2412
2412
|
ra as CheckboxValidator,
|
|
@@ -2418,26 +2418,26 @@ export {
|
|
|
2418
2418
|
K as DataValidationFormulaService,
|
|
2419
2419
|
sa as DateValidator,
|
|
2420
2420
|
Ja as LIST_FORMULA_INPUT_NAME,
|
|
2421
|
-
|
|
2421
|
+
Ia as ListMultipleValidator,
|
|
2422
2422
|
gt as ListValidator,
|
|
2423
2423
|
fa as RemoveSheetAllDataValidationCommand,
|
|
2424
2424
|
Ra as RemoveSheetDataValidationCommand,
|
|
2425
2425
|
F as SheetDataValidationModel,
|
|
2426
|
-
|
|
2427
|
-
|
|
2426
|
+
Ae as SheetsDataValidationValidatorService,
|
|
2427
|
+
Ie as UniverSheetsDataValidationPlugin,
|
|
2428
2428
|
_a as UpdateSheetDataValidationOptionsCommand,
|
|
2429
2429
|
ha as UpdateSheetDataValidationRangeCommand,
|
|
2430
2430
|
ga as UpdateSheetDataValidationSettingCommand,
|
|
2431
2431
|
Ka as createDefaultNewRule,
|
|
2432
2432
|
fe as deserializeListOptions,
|
|
2433
|
-
|
|
2433
|
+
ye as getCellValueNumber,
|
|
2434
2434
|
ne as getCellValueOrigin,
|
|
2435
2435
|
Xa as getDataValidationCellValue,
|
|
2436
2436
|
Le as getDataValidationDiffMutations,
|
|
2437
2437
|
_e as getFormulaCellData,
|
|
2438
2438
|
oe as getFormulaResult,
|
|
2439
2439
|
be as getTransformedFormula,
|
|
2440
|
-
|
|
2440
|
+
O as isLegalFormulaResult,
|
|
2441
2441
|
Ya as serializeListOptions,
|
|
2442
2442
|
pe as transformCheckboxValue
|
|
2443
2443
|
};
|