@univerjs/sheets-data-validation 0.6.6 → 0.6.7-experimental.20250326-6499c07
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 +309 -309
- package/lib/umd/index.js +1 -1
- package/package.json +10 -10
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var ft = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var g = (o, a, e) =>
|
|
4
|
-
import { Inject as
|
|
5
|
-
import { DataValidationModel as Ge, DataValidatorRegistryService as q, UpdateRuleType as
|
|
2
|
+
var Rt = (o, a, e) => a in o ? ft(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e;
|
|
3
|
+
var g = (o, a, e) => Rt(o, typeof a != "symbol" ? a + "" : a, e);
|
|
4
|
+
import { Inject as v, ICommandService as x, IUniverInstanceService as w, Disposable as W, ObjectMatrix as Se, UniverInstanceType as N, Range as b, Rectangle as I, isFormulaString as S, DataValidationType as T, getOriginCellValue as vt, RBush as St, debounce as Vt, Tools as V, DataValidationStatus as D, WrapStrategy as ve, DataValidationOperator as h, numfmt as j, dayjs as at, DataValidationRenderMode as Be, CommandType as z, IUndoRedoService as Z, sequenceExecute as Ie, isRangesEqual as rt, generateRandomId as Mt, toDisposable as Qe, IPermissionService as yt, Injector as qe, CellValueType as Et, RxDisposable as Tt, LifecycleService as Ft, LifecycleStages as ze, bufferDebounceTime as Nt, DependentOn as Ct, IConfigService as wt, Plugin as Ot, merge as It } from "@univerjs/core";
|
|
5
|
+
import { DataValidationModel as Ge, DataValidatorRegistryService as q, UpdateRuleType as y, BaseDataValidator as G, TextLengthErrorTitleMap as At, AddDataValidationMutation as L, RemoveDataValidationMutation as A, UpdateDataValidationMutation as E, getRuleSetting as Dt, getRuleOptions as bt, UniverDataValidationPlugin as Lt } from "@univerjs/data-validation";
|
|
6
6
|
import { SetRangeValuesMutation as se, RemoveSheetMutation as it, getSheetCommandTarget as Ye, SetRangeValuesUndoMutationFactory as ot, WorksheetViewPermission as xt, RefRangeService as Bt, handleCommonDefaultRangeChangeWithEffectRefCommands as Ut, SheetInterceptorService as st, RemoveSheetCommand as Ht, SheetsSelectionsService as nt, ClearSelectionAllCommand as Wt } from "@univerjs/sheets";
|
|
7
7
|
import { Subject as je, bufferWhen as Pt, filter as Ze } from "rxjs";
|
|
8
8
|
import { RegisterOtherFormulaService as lt, FormulaRefRangeService as ut } 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 === N.UNIVER_SHEET && this._cacheMatrix.delete(a.getUnitId());
|
|
45
45
|
}));
|
|
46
46
|
}
|
|
47
47
|
_ensureCache(a, e) {
|
|
@@ -62,7 +62,7 @@ let Q = class extends W {
|
|
|
62
62
|
markRangeDirty(a, e, t, r) {
|
|
63
63
|
const i = this._ensureCache(a, e);
|
|
64
64
|
t.forEach((s) => {
|
|
65
|
-
|
|
65
|
+
b.foreach(s, (n, l) => {
|
|
66
66
|
i.setValue(n, l, void 0);
|
|
67
67
|
});
|
|
68
68
|
}), this._dirtyRanges$.next({ unitId: a, subUnitId: e, ranges: t, isSetRange: r });
|
|
@@ -70,7 +70,7 @@ let Q = class extends W {
|
|
|
70
70
|
_deleteRange(a, e, t) {
|
|
71
71
|
const r = this._ensureCache(a, e);
|
|
72
72
|
t.forEach((i) => {
|
|
73
|
-
|
|
73
|
+
b.foreach(i, (s, n) => {
|
|
74
74
|
r.realDeleteValue(s, n);
|
|
75
75
|
});
|
|
76
76
|
}), this._dirtyRanges$.next({ unitId: a, subUnitId: e, ranges: t });
|
|
@@ -80,8 +80,8 @@ let Q = class extends W {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
Q = Xt([
|
|
83
|
-
Je(0,
|
|
84
|
-
Je(1,
|
|
83
|
+
Je(0, v(x)),
|
|
84
|
+
Je(1, v(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 C(o) {
|
|
95
95
|
return !$t.has(o);
|
|
96
96
|
}
|
|
97
97
|
function de(o, a) {
|
|
@@ -118,7 +118,7 @@ let H = 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) === N.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 H = 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,11 +231,11 @@ let H = class extends W {
|
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
233
|
H = zt([
|
|
234
|
-
re(0,
|
|
235
|
-
re(1,
|
|
236
|
-
re(2,
|
|
237
|
-
re(3,
|
|
238
|
-
re(4,
|
|
234
|
+
re(0, w),
|
|
235
|
+
re(1, v(lt)),
|
|
236
|
+
re(2, v(Ge)),
|
|
237
|
+
re(3, v(Q)),
|
|
238
|
+
re(4, v(q))
|
|
239
239
|
], H);
|
|
240
240
|
var Zt = Object.getOwnPropertyDescriptor, Jt = (o, a, e, t) => {
|
|
241
241
|
for (var r = t > 1 ? void 0 : t ? Zt(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
@@ -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) === N.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,14 +323,14 @@ let K = class extends W {
|
|
|
323
323
|
}
|
|
324
324
|
};
|
|
325
325
|
K = Jt([
|
|
326
|
-
ie(0,
|
|
327
|
-
ie(1,
|
|
328
|
-
ie(2,
|
|
329
|
-
ie(3,
|
|
330
|
-
ie(4,
|
|
326
|
+
ie(0, w),
|
|
327
|
+
ie(1, v(lt)),
|
|
328
|
+
ie(2, v(Q)),
|
|
329
|
+
ie(3, v(Ge)),
|
|
330
|
+
ie(4, v(q))
|
|
331
331
|
], K);
|
|
332
332
|
function ne(o) {
|
|
333
|
-
return
|
|
333
|
+
return vt(o);
|
|
334
334
|
}
|
|
335
335
|
function ct(o) {
|
|
336
336
|
var a;
|
|
@@ -358,19 +358,19 @@ class Xe {
|
|
|
358
358
|
});
|
|
359
359
|
}), this._tree.load(a), this._dirty = !1;
|
|
360
360
|
});
|
|
361
|
-
g(this, "_debonceBuildTree",
|
|
361
|
+
g(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, N.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
|
}
|
|
@@ -380,9 +380,9 @@ class Xe {
|
|
|
380
380
|
removeRange(a) {
|
|
381
381
|
if (!this._worksheet)
|
|
382
382
|
return;
|
|
383
|
-
const e = a.map((t) =>
|
|
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 Xe {
|
|
|
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 Xe {
|
|
|
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 Xe {
|
|
|
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 Xe {
|
|
|
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 Xe(
|
|
461
|
-
new Map(
|
|
461
|
+
new Map(V.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 === y.RANGE ? s.updateRange(t, i.payload) : i.type === y.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);
|
|
@@ -573,8 +573,8 @@ let F = class extends W {
|
|
|
573
573
|
return this._dataValidationModel.getRuleById(a, e, i);
|
|
574
574
|
}
|
|
575
575
|
validator(a, e, t) {
|
|
576
|
-
const { col: r, row: i, unitId: s, subUnitId: n, worksheet: l } = e, u = (_,
|
|
577
|
-
t && t(_,
|
|
576
|
+
const { col: r, row: i, unitId: s, subUnitId: n, worksheet: l } = e, u = (_, R) => {
|
|
577
|
+
t && t(_, R), R && this._validStatusChange$.next({
|
|
578
578
|
unitId: s,
|
|
579
579
|
subUnitId: n,
|
|
580
580
|
ruleId: a.uid,
|
|
@@ -584,8 +584,8 @@ let F = class extends W {
|
|
|
584
584
|
});
|
|
585
585
|
}, d = l.getCellValueOnly(i, r), c = this.getValidator(a.type), m = l.getCellRaw(i, r), p = ne(m);
|
|
586
586
|
if (c) {
|
|
587
|
-
const _ = this._dataValidationCacheService.ensureCache(s, n),
|
|
588
|
-
return
|
|
587
|
+
const _ = this._dataValidationCacheService.ensureCache(s, n), R = _.getValue(i, r);
|
|
588
|
+
return R == null ? (_.setValue(i, r, D.VALIDATING), c.validator(
|
|
589
589
|
{
|
|
590
590
|
value: p,
|
|
591
591
|
unitId: s,
|
|
@@ -598,14 +598,14 @@ let F = class extends W {
|
|
|
598
598
|
t: m == null ? void 0 : m.t
|
|
599
599
|
},
|
|
600
600
|
a
|
|
601
|
-
).then((
|
|
602
|
-
const f =
|
|
603
|
-
f ===
|
|
604
|
-
const
|
|
605
|
-
u(f,
|
|
606
|
-
}),
|
|
601
|
+
).then((M) => {
|
|
602
|
+
const f = M ? D.VALID : D.INVALID;
|
|
603
|
+
f === D.VALID ? _.realDeleteValue(i, r) : _.setValue(i, r, f);
|
|
604
|
+
const O = _.getValue(i, r);
|
|
605
|
+
u(f, R !== O);
|
|
606
|
+
}), D.VALIDATING) : (u(R != null ? R : D.VALID, !1), R != null ? R : D.VALID);
|
|
607
607
|
} else
|
|
608
|
-
return u(
|
|
608
|
+
return u(D.VALID, !1), D.VALID;
|
|
609
609
|
}
|
|
610
610
|
getRuleObjectMatrix(a, e) {
|
|
611
611
|
return this._ensureRuleMatrix(a, e);
|
|
@@ -633,19 +633,19 @@ let F = class extends W {
|
|
|
633
633
|
}
|
|
634
634
|
};
|
|
635
635
|
F = ta([
|
|
636
|
-
X(0,
|
|
637
|
-
X(1,
|
|
638
|
-
X(2,
|
|
639
|
-
X(3,
|
|
640
|
-
X(4,
|
|
641
|
-
X(5,
|
|
636
|
+
X(0, v(Ge)),
|
|
637
|
+
X(1, w),
|
|
638
|
+
X(2, v(q)),
|
|
639
|
+
X(3, v(Q)),
|
|
640
|
+
X(4, v(K)),
|
|
641
|
+
X(5, v(H)),
|
|
642
642
|
X(6, x)
|
|
643
643
|
], F);
|
|
644
|
-
const
|
|
644
|
+
const Ve = 1, Me = 0;
|
|
645
645
|
function et(o, a) {
|
|
646
|
-
return
|
|
646
|
+
return V.isBlank(o) ? a.t("dataValidation.validFail.value") : S(o) ? a.t("dataValidation.validFail.primitive") : "";
|
|
647
647
|
}
|
|
648
|
-
const pe = (o) =>
|
|
648
|
+
const pe = (o) => V.isDefine(o) && String(o).toLowerCase() === "true" ? "1" : String(o).toLowerCase() === "false" ? "0" : o;
|
|
649
649
|
class aa extends G {
|
|
650
650
|
constructor() {
|
|
651
651
|
super(...arguments);
|
|
@@ -662,7 +662,7 @@ class aa extends G {
|
|
|
662
662
|
}
|
|
663
663
|
validatorFormula(e, t, r) {
|
|
664
664
|
const { formula1: i, formula2: s } = e, n = i === s;
|
|
665
|
-
if (
|
|
665
|
+
if (V.isBlank(i) && V.isBlank(s))
|
|
666
666
|
return {
|
|
667
667
|
success: !0
|
|
668
668
|
};
|
|
@@ -681,7 +681,7 @@ class aa extends G {
|
|
|
681
681
|
}
|
|
682
682
|
async parseFormula(e, t, r) {
|
|
683
683
|
var c, m, p, _;
|
|
684
|
-
const { formula1: i =
|
|
684
|
+
const { formula1: i = Ve, formula2: s = Me } = e, n = await this._formulaService.getRuleFormulaResult(t, r, e.uid), l = S(i) ? oe((m = (c = n == null ? void 0 : n[0]) == null ? void 0 : c.result) == null ? void 0 : m[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 = C(String(l)) && C(String(u));
|
|
685
685
|
return {
|
|
686
686
|
formula1: pe(l),
|
|
687
687
|
formula2: pe(u),
|
|
@@ -692,12 +692,12 @@ class aa extends G {
|
|
|
692
692
|
}
|
|
693
693
|
getExtraStyle(e, t) {
|
|
694
694
|
return {
|
|
695
|
-
tb:
|
|
695
|
+
tb: ve.CLIP
|
|
696
696
|
};
|
|
697
697
|
}
|
|
698
698
|
parseFormulaSync(e, t, r) {
|
|
699
699
|
var c, m, p, _;
|
|
700
|
-
const { formula1: i =
|
|
700
|
+
const { formula1: i = Ve, formula2: s = Me } = e, n = this._formulaService.getRuleFormulaResultSync(t, r, e.uid), l = S(i) ? oe((m = (c = n == null ? void 0 : n[0]) == null ? void 0 : c.result) == null ? void 0 : m[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 = C(String(l)) && C(String(u));
|
|
701
701
|
return {
|
|
702
702
|
formula1: pe(l),
|
|
703
703
|
formula2: pe(u),
|
|
@@ -708,7 +708,7 @@ class aa extends G {
|
|
|
708
708
|
}
|
|
709
709
|
async isValidType(e, t, r) {
|
|
710
710
|
const { value: i, unitId: s, subUnitId: n } = e, { formula1: l, formula2: u, originFormula1: d, originFormula2: c } = await this.parseFormula(r, s, n);
|
|
711
|
-
return !
|
|
711
|
+
return !V.isDefine(l) || !V.isDefine(u) ? !0 : V.isDefine(i) && (String(i) === String(l) || String(i) === String(u) || String(i) === String(d != null ? d : "") || String(i) === String(c != null ? c : ""));
|
|
712
712
|
}
|
|
713
713
|
generateRuleErrorMessage(e) {
|
|
714
714
|
return this.localeService.t("dataValidation.checkbox.error");
|
|
@@ -743,7 +743,7 @@ const ia = {
|
|
|
743
743
|
[h.LESS_THAN_OR_EQUAL]: "dataValidation.date.errorMsg.lessThanOrEqual",
|
|
744
744
|
[h.NOT_BETWEEN]: "dataValidation.date.errorMsg.notBetween",
|
|
745
745
|
[h.NOT_EQUAL]: "dataValidation.date.errorMsg.notEqual"
|
|
746
|
-
},
|
|
746
|
+
}, Ae = [
|
|
747
747
|
h.BETWEEN,
|
|
748
748
|
h.NOT_BETWEEN
|
|
749
749
|
], le = "{FORMULA1}", ue = "{FORMULA2}";
|
|
@@ -757,7 +757,7 @@ function Xa(o) {
|
|
|
757
757
|
const a = ne(o);
|
|
758
758
|
return a == null ? "" : a.toString();
|
|
759
759
|
}
|
|
760
|
-
function
|
|
760
|
+
function De(o, a, e) {
|
|
761
761
|
const { formula1: t, formula2: r } = a, i = a.ranges[0].startRow, s = a.ranges[0].startColumn, n = e.row - i, l = e.col - s, u = S(t) ? o.moveFormulaRefOffset(t, l, n, !0) : t, d = S(r) ? o.moveFormulaRefOffset(r, l, n, !0) : r;
|
|
762
762
|
return {
|
|
763
763
|
transformedFormula1: u,
|
|
@@ -771,7 +771,7 @@ const Ue = (o) => {
|
|
|
771
771
|
if (typeof o == "number" || !Number.isNaN(+o))
|
|
772
772
|
return +o;
|
|
773
773
|
const a = (e = j.parseDate(o)) == null ? void 0 : e.v;
|
|
774
|
-
return
|
|
774
|
+
return V.isDefine(a) ? a : (t = j.parseDate(at(o).format("YYYY-MM-DD HH:mm:ss"))) == null ? void 0 : t.v;
|
|
775
775
|
};
|
|
776
776
|
class sa extends G {
|
|
777
777
|
constructor() {
|
|
@@ -793,7 +793,7 @@ class sa extends G {
|
|
|
793
793
|
g(this, "_lexerTreeBuilder", this.injector.get(Y));
|
|
794
794
|
}
|
|
795
795
|
async parseFormula(e, t, r, i, s) {
|
|
796
|
-
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 =
|
|
796
|
+
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));
|
|
797
797
|
return {
|
|
798
798
|
formula1: Ue(S(u) ? n == null ? void 0 : n.v : u),
|
|
799
799
|
formula2: Ue(S(d) ? l == null ? void 0 : l.v : d),
|
|
@@ -805,7 +805,7 @@ class sa extends G {
|
|
|
805
805
|
return typeof r == "number" && typeof t == "string" ? !0 : typeof t == "string" ? !!j.parseDate(t) : !1;
|
|
806
806
|
}
|
|
807
807
|
_validatorSingleFormula(e) {
|
|
808
|
-
return !
|
|
808
|
+
return !V.isBlank(e) && (S(e) || !Number.isNaN(+e) || !!(e && j.parseDate(e)));
|
|
809
809
|
}
|
|
810
810
|
validatorFormula(e, t, r) {
|
|
811
811
|
const i = e.operator;
|
|
@@ -814,7 +814,7 @@ class sa extends G {
|
|
|
814
814
|
success: !1
|
|
815
815
|
};
|
|
816
816
|
const s = this._validatorSingleFormula(e.formula1), n = this.localeService.t("dataValidation.validFail.date");
|
|
817
|
-
if (
|
|
817
|
+
if (Ae.includes(i)) {
|
|
818
818
|
const u = this._validatorSingleFormula(e.formula2);
|
|
819
819
|
return {
|
|
820
820
|
success: s && u,
|
|
@@ -868,7 +868,7 @@ class sa extends G {
|
|
|
868
868
|
generateRuleErrorMessage(e, t) {
|
|
869
869
|
if (!e.operator)
|
|
870
870
|
return this.titleStr;
|
|
871
|
-
const { transformedFormula1: r, transformedFormula2: i } =
|
|
871
|
+
const { transformedFormula1: r, transformedFormula2: i } = De(this._lexerTreeBuilder, e, t);
|
|
872
872
|
return `${this.localeService.t(oa[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
873
873
|
}
|
|
874
874
|
}
|
|
@@ -884,7 +884,7 @@ const ht = {
|
|
|
884
884
|
[h.NOT_BETWEEN]: "dataValidation.errorMsg.notBetween",
|
|
885
885
|
[h.NOT_EQUAL]: "dataValidation.errorMsg.notEqual"
|
|
886
886
|
};
|
|
887
|
-
function
|
|
887
|
+
function ye(o) {
|
|
888
888
|
let a = o;
|
|
889
889
|
return typeof o == "string" ? ((o.startsWith("¥") || o.startsWith("$")) && (a = o.slice(1)), +a) : +o;
|
|
890
890
|
}
|
|
@@ -908,24 +908,24 @@ class na extends G {
|
|
|
908
908
|
g(this, "scopes", ["sheet"]);
|
|
909
909
|
}
|
|
910
910
|
_isFormulaOrNumber(e) {
|
|
911
|
-
return !
|
|
911
|
+
return !V.isBlank(e) && (S(e) || !Number.isNaN(+e));
|
|
912
912
|
}
|
|
913
913
|
async isValidType(e, t, r) {
|
|
914
914
|
const { value: i } = e;
|
|
915
|
-
return !Number.isNaN(
|
|
915
|
+
return !Number.isNaN(ye(i));
|
|
916
916
|
}
|
|
917
917
|
transform(e, t, r) {
|
|
918
918
|
const { value: i } = e;
|
|
919
919
|
return {
|
|
920
920
|
...e,
|
|
921
|
-
value:
|
|
921
|
+
value: ye(i)
|
|
922
922
|
};
|
|
923
923
|
}
|
|
924
924
|
_parseNumber(e) {
|
|
925
925
|
return e == null ? Number.NaN : +e;
|
|
926
926
|
}
|
|
927
927
|
async parseFormula(e, t, r, i, s) {
|
|
928
|
-
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 =
|
|
928
|
+
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));
|
|
929
929
|
return {
|
|
930
930
|
formula1: this._parseNumber(S(u) ? n == null ? void 0 : n.v : u),
|
|
931
931
|
formula2: this._parseNumber(S(d) ? l == null ? void 0 : l.v : d),
|
|
@@ -938,7 +938,7 @@ class na extends G {
|
|
|
938
938
|
return {
|
|
939
939
|
success: !1
|
|
940
940
|
};
|
|
941
|
-
const s =
|
|
941
|
+
const s = V.isDefine(e.formula1) && this._isFormulaOrNumber(e.formula1), n = V.isDefine(e.formula2) && this._isFormulaOrNumber(e.formula2), l = Ae.includes(i), u = this.localeService.t("dataValidation.validFail.number");
|
|
942
942
|
return l ? {
|
|
943
943
|
success: s && n,
|
|
944
944
|
formula1: s ? void 0 : u,
|
|
@@ -951,7 +951,7 @@ class na extends G {
|
|
|
951
951
|
generateRuleErrorMessage(e, t) {
|
|
952
952
|
if (!e.operator)
|
|
953
953
|
return this.titleStr;
|
|
954
|
-
const { transformedFormula1: r, transformedFormula2: i } =
|
|
954
|
+
const { transformedFormula1: r, transformedFormula2: i } = De(this._lexerTreeBuilder, e, t);
|
|
955
955
|
return `${this.localeService.t(ht[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
956
956
|
}
|
|
957
957
|
}
|
|
@@ -969,7 +969,7 @@ function He(o) {
|
|
|
969
969
|
a.add(j.format(t.s.n.pattern, r, { throws: !1 }));
|
|
970
970
|
return;
|
|
971
971
|
}
|
|
972
|
-
|
|
972
|
+
C(r.toString()) && a.add(r.toString());
|
|
973
973
|
}
|
|
974
974
|
});
|
|
975
975
|
}
|
|
@@ -991,7 +991,7 @@ function da(o, a) {
|
|
|
991
991
|
const { formula1: e = "", ranges: t } = o;
|
|
992
992
|
if (dt(e.slice(1))) {
|
|
993
993
|
const i = jt(e.slice(1));
|
|
994
|
-
if ((!i.sheetName || i.sheetName === a) && t.some((s) =>
|
|
994
|
+
if ((!i.sheetName || i.sheetName === a) && t.some((s) => I.intersects(s, i.range)))
|
|
995
995
|
return !0;
|
|
996
996
|
}
|
|
997
997
|
return !1;
|
|
@@ -1001,7 +1001,7 @@ class mt extends G {
|
|
|
1001
1001
|
super(...arguments);
|
|
1002
1002
|
g(this, "formulaService", this.injector.get(K));
|
|
1003
1003
|
g(this, "_lexer", this.injector.get(Y));
|
|
1004
|
-
g(this, "_univerInstanceService", this.injector.get(
|
|
1004
|
+
g(this, "_univerInstanceService", this.injector.get(w));
|
|
1005
1005
|
g(this, "offsetFormulaByRange", !1);
|
|
1006
1006
|
g(this, "id", T.LIST);
|
|
1007
1007
|
g(this, "title", "dataValidation.list.title");
|
|
@@ -1011,7 +1011,7 @@ class mt extends G {
|
|
|
1011
1011
|
}
|
|
1012
1012
|
validatorFormula(e, t, r) {
|
|
1013
1013
|
var u, d, c;
|
|
1014
|
-
const i = !
|
|
1014
|
+
const i = !V.isBlank(e.formula1), s = ua((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 = da(e, n != null ? n : "");
|
|
1015
1015
|
return {
|
|
1016
1016
|
success: !!(i && s && !l),
|
|
1017
1017
|
formula1: i ? s ? l ? this.localeService.t("dataValidation.validFail.listIntersects") : void 0 : this.localeService.t("dataValidation.validFail.listInvalid") : this.localeService.t("dataValidation.validFail.list")
|
|
@@ -1019,7 +1019,7 @@ class mt extends G {
|
|
|
1019
1019
|
}
|
|
1020
1020
|
getExtraStyle(e, t, { style: r }) {
|
|
1021
1021
|
var s;
|
|
1022
|
-
const i = (s = r.tb !==
|
|
1022
|
+
const i = (s = r.tb !== ve.OVERFLOW ? r.tb : ve.CLIP) != null ? s : ve.WRAP;
|
|
1023
1023
|
if (e.type === T.LIST && (e.renderMode === Be.ARROW || e.renderMode === Be.TEXT)) {
|
|
1024
1024
|
const n = this.getListWithColorMap(e), l = `${t != null ? t : ""}`, u = n[l];
|
|
1025
1025
|
if (u)
|
|
@@ -1044,7 +1044,7 @@ class mt extends G {
|
|
|
1044
1044
|
return {
|
|
1045
1045
|
formula1: void 0,
|
|
1046
1046
|
formula2: void 0,
|
|
1047
|
-
isFormulaValid:
|
|
1047
|
+
isFormulaValid: C(String(s))
|
|
1048
1048
|
};
|
|
1049
1049
|
}
|
|
1050
1050
|
async isValidType(e, t, r) {
|
|
@@ -1059,22 +1059,22 @@ class mt extends G {
|
|
|
1059
1059
|
return this.localeService.t("dataValidation.list.error");
|
|
1060
1060
|
}
|
|
1061
1061
|
getList(e, t, r) {
|
|
1062
|
-
var m, p, _,
|
|
1063
|
-
const { formula1: i = "" } = e, s = this.injector.get(
|
|
1062
|
+
var m, p, _, R;
|
|
1063
|
+
const { formula1: i = "" } = e, s = this.injector.get(w), n = (m = t ? s.getUniverSheetInstance(t) : void 0) != null ? m : s.getCurrentUnitForType(N.UNIVER_SHEET);
|
|
1064
1064
|
if (!n) return [];
|
|
1065
1065
|
const l = (p = r ? n.getSheetBySheetId(r) : void 0) != null ? p : n.getActiveSheet();
|
|
1066
1066
|
if (!l) return [];
|
|
1067
1067
|
const u = n.getUnitId(), d = l.getSheetId(), c = this.formulaService.getRuleFormulaResultSync(u, d, e.uid);
|
|
1068
|
-
return S(i) ? He((
|
|
1068
|
+
return S(i) ? He((R = (_ = c == null ? void 0 : c[0]) == null ? void 0 : _.result) == null ? void 0 : R[0][0]) : fe(i);
|
|
1069
1069
|
}
|
|
1070
1070
|
async getListAsync(e, t, r) {
|
|
1071
|
-
var m, p, _,
|
|
1072
|
-
const { formula1: i = "" } = e, s = this.injector.get(
|
|
1071
|
+
var m, p, _, R;
|
|
1072
|
+
const { formula1: i = "" } = e, s = this.injector.get(w), n = (m = t ? s.getUniverSheetInstance(t) : void 0) != null ? m : s.getCurrentUnitForType(N.UNIVER_SHEET);
|
|
1073
1073
|
if (!n) return [];
|
|
1074
1074
|
const l = (p = r ? n.getSheetBySheetId(r) : void 0) != null ? p : n.getActiveSheet();
|
|
1075
1075
|
if (!l) return [];
|
|
1076
1076
|
const u = n.getUnitId(), d = l.getSheetId(), c = await this.formulaService.getRuleFormulaResult(u, d, e.uid);
|
|
1077
|
-
return S(i) ? He((
|
|
1077
|
+
return S(i) ? He((R = (_ = c == null ? void 0 : c[0]) == null ? void 0 : _.result) == null ? void 0 : R[0][0]) : fe(i);
|
|
1078
1078
|
}
|
|
1079
1079
|
getListWithColor(e, t, r) {
|
|
1080
1080
|
const i = this.getList(e, t, r), s = (e.formula2 || "").split(",");
|
|
@@ -1107,7 +1107,7 @@ class ca extends G {
|
|
|
1107
1107
|
g(this, "_customFormulaService", this.injector.get(H));
|
|
1108
1108
|
}
|
|
1109
1109
|
_isFormulaOrInt(e) {
|
|
1110
|
-
return !
|
|
1110
|
+
return !V.isBlank(e) && (S(e) || !Number.isNaN(+e) && Number.isInteger(+e));
|
|
1111
1111
|
}
|
|
1112
1112
|
validatorFormula(e, t, r) {
|
|
1113
1113
|
const i = e.operator;
|
|
@@ -1115,7 +1115,7 @@ class ca extends G {
|
|
|
1115
1115
|
return {
|
|
1116
1116
|
success: !1
|
|
1117
1117
|
};
|
|
1118
|
-
const s =
|
|
1118
|
+
const s = V.isDefine(e.formula1) && this._isFormulaOrInt(e.formula1), n = V.isDefine(e.formula2) && this._isFormulaOrInt(e.formula2), l = Ae.includes(i), u = this.localeService.t("dataValidation.validFail.number");
|
|
1119
1119
|
return l ? {
|
|
1120
1120
|
success: s && n,
|
|
1121
1121
|
formula1: s ? void 0 : u,
|
|
@@ -1129,7 +1129,7 @@ class ca extends G {
|
|
|
1129
1129
|
return e == null ? Number.NaN : +e;
|
|
1130
1130
|
}
|
|
1131
1131
|
async parseFormula(e, t, r, i, s) {
|
|
1132
|
-
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 =
|
|
1132
|
+
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));
|
|
1133
1133
|
return {
|
|
1134
1134
|
formula1: this._parseNumber(S(u) ? n == null ? void 0 : n.v : u),
|
|
1135
1135
|
formula2: this._parseNumber(S(d) ? l == null ? void 0 : l.v : d),
|
|
@@ -1149,29 +1149,29 @@ class ca extends G {
|
|
|
1149
1149
|
generateRuleErrorMessage(e, t) {
|
|
1150
1150
|
if (!e.operator)
|
|
1151
1151
|
return this.titleStr;
|
|
1152
|
-
const { transformedFormula1: r, transformedFormula2: i } =
|
|
1153
|
-
return `${this.localeService.t(
|
|
1152
|
+
const { transformedFormula1: r, transformedFormula2: i } = De(this._lexerTreeBuilder, e, t);
|
|
1153
|
+
return `${this.localeService.t(At[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
1154
1154
|
}
|
|
1155
1155
|
}
|
|
1156
1156
|
function gt(o) {
|
|
1157
1157
|
var e, t;
|
|
1158
|
-
return o ? o.p ? !((t = (e = o.p.body) == null ? void 0 : e.dataStream) != null ? t : "").slice(0, -2).trim() :
|
|
1158
|
+
return o ? o.p ? !((t = (e = o.p.body) == null ? void 0 : e.dataStream) != null ? t : "").slice(0, -2).trim() : V.isBlank(o.v) : !0;
|
|
1159
1159
|
}
|
|
1160
|
-
function
|
|
1161
|
-
const s = t.get(Y), n = t.get(q), l = [], u = [], d = t.get(F), c = t.get(
|
|
1160
|
+
function be(o, a, e, t, r = "command", i = !0) {
|
|
1161
|
+
const s = t.get(Y), n = t.get(q), l = [], u = [], d = t.get(F), c = t.get(w), m = Ye(c, { unitId: o, subUnitId: a });
|
|
1162
1162
|
if (!m)
|
|
1163
1163
|
return {
|
|
1164
1164
|
redoMutations: l,
|
|
1165
1165
|
undoMutations: u
|
|
1166
1166
|
};
|
|
1167
1167
|
const { worksheet: p } = m, _ = new Se();
|
|
1168
|
-
let
|
|
1169
|
-
function
|
|
1168
|
+
let R = !1;
|
|
1169
|
+
function M(f, O) {
|
|
1170
1170
|
i && f.forEach((P) => {
|
|
1171
|
-
|
|
1171
|
+
b.foreach(P, (B, $) => {
|
|
1172
1172
|
const U = p.getCellRaw(B, $), J = ct(U);
|
|
1173
|
-
(gt(U) || J ===
|
|
1174
|
-
v:
|
|
1173
|
+
(gt(U) || J === O) && !(U != null && U.p) && (R = !0, _.setValue(B, $, {
|
|
1174
|
+
v: O,
|
|
1175
1175
|
p: null
|
|
1176
1176
|
}));
|
|
1177
1177
|
});
|
|
@@ -1181,7 +1181,7 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1181
1181
|
switch (f.type) {
|
|
1182
1182
|
case "delete":
|
|
1183
1183
|
l.push({
|
|
1184
|
-
id:
|
|
1184
|
+
id: A.id,
|
|
1185
1185
|
params: {
|
|
1186
1186
|
unitId: o,
|
|
1187
1187
|
subUnitId: a,
|
|
@@ -1189,7 +1189,7 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1189
1189
|
source: r
|
|
1190
1190
|
}
|
|
1191
1191
|
}), u.unshift({
|
|
1192
|
-
id:
|
|
1192
|
+
id: L.id,
|
|
1193
1193
|
params: {
|
|
1194
1194
|
unitId: o,
|
|
1195
1195
|
subUnitId: a,
|
|
@@ -1203,13 +1203,13 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1203
1203
|
if (de(f.rule.type, n)) {
|
|
1204
1204
|
const P = f.oldRanges[0].startRow, B = f.oldRanges[0].startColumn, $ = f.newRanges[0].startRow, U = f.newRanges[0].startColumn, J = $ - P, ce = U - 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;
|
|
1205
1205
|
he !== f.rule.formula1 || me !== f.rule.formula2 || !rt(f.newRanges, f.oldRanges) ? (l.push({
|
|
1206
|
-
id:
|
|
1206
|
+
id: E.id,
|
|
1207
1207
|
params: {
|
|
1208
1208
|
unitId: o,
|
|
1209
1209
|
subUnitId: a,
|
|
1210
1210
|
ruleId: f.ruleId,
|
|
1211
1211
|
payload: {
|
|
1212
|
-
type:
|
|
1212
|
+
type: y.ALL,
|
|
1213
1213
|
payload: {
|
|
1214
1214
|
formula1: he,
|
|
1215
1215
|
formula2: me,
|
|
@@ -1218,13 +1218,13 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1218
1218
|
}
|
|
1219
1219
|
}
|
|
1220
1220
|
}), u.unshift({
|
|
1221
|
-
id:
|
|
1221
|
+
id: E.id,
|
|
1222
1222
|
params: {
|
|
1223
1223
|
unitId: o,
|
|
1224
1224
|
subUnitId: a,
|
|
1225
1225
|
ruleId: f.ruleId,
|
|
1226
1226
|
payload: {
|
|
1227
|
-
type:
|
|
1227
|
+
type: y.ALL,
|
|
1228
1228
|
payload: {
|
|
1229
1229
|
formula1: f.rule.formula1,
|
|
1230
1230
|
formula2: f.rule.formula2,
|
|
@@ -1233,25 +1233,25 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1233
1233
|
}
|
|
1234
1234
|
}
|
|
1235
1235
|
})) : (l.push({
|
|
1236
|
-
id:
|
|
1236
|
+
id: E.id,
|
|
1237
1237
|
params: {
|
|
1238
1238
|
unitId: o,
|
|
1239
1239
|
subUnitId: a,
|
|
1240
1240
|
ruleId: f.ruleId,
|
|
1241
1241
|
payload: {
|
|
1242
|
-
type:
|
|
1242
|
+
type: y.RANGE,
|
|
1243
1243
|
payload: f.newRanges
|
|
1244
1244
|
},
|
|
1245
1245
|
source: r
|
|
1246
1246
|
}
|
|
1247
1247
|
}), u.unshift({
|
|
1248
|
-
id:
|
|
1248
|
+
id: E.id,
|
|
1249
1249
|
params: {
|
|
1250
1250
|
unitId: o,
|
|
1251
1251
|
subUnitId: a,
|
|
1252
1252
|
ruleId: f.ruleId,
|
|
1253
1253
|
payload: {
|
|
1254
|
-
type:
|
|
1254
|
+
type: y.RANGE,
|
|
1255
1255
|
payload: f.oldRanges
|
|
1256
1256
|
},
|
|
1257
1257
|
source: r
|
|
@@ -1259,40 +1259,40 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1259
1259
|
}));
|
|
1260
1260
|
} else
|
|
1261
1261
|
l.push({
|
|
1262
|
-
id:
|
|
1262
|
+
id: E.id,
|
|
1263
1263
|
params: {
|
|
1264
1264
|
unitId: o,
|
|
1265
1265
|
subUnitId: a,
|
|
1266
1266
|
ruleId: f.ruleId,
|
|
1267
1267
|
payload: {
|
|
1268
|
-
type:
|
|
1268
|
+
type: y.RANGE,
|
|
1269
1269
|
payload: f.newRanges
|
|
1270
1270
|
},
|
|
1271
1271
|
source: r
|
|
1272
1272
|
}
|
|
1273
1273
|
}), u.unshift({
|
|
1274
|
-
id:
|
|
1274
|
+
id: E.id,
|
|
1275
1275
|
params: {
|
|
1276
1276
|
unitId: o,
|
|
1277
1277
|
subUnitId: a,
|
|
1278
1278
|
ruleId: f.ruleId,
|
|
1279
1279
|
payload: {
|
|
1280
|
-
type:
|
|
1280
|
+
type: y.RANGE,
|
|
1281
1281
|
payload: f.oldRanges
|
|
1282
1282
|
},
|
|
1283
1283
|
source: r
|
|
1284
1284
|
}
|
|
1285
1285
|
});
|
|
1286
|
-
const
|
|
1287
|
-
if (
|
|
1288
|
-
const B = d.getValidator(T.CHECKBOX).parseFormulaSync(
|
|
1289
|
-
|
|
1286
|
+
const O = d.getRuleById(o, a, f.ruleId);
|
|
1287
|
+
if (O && O.type === T.CHECKBOX) {
|
|
1288
|
+
const B = d.getValidator(T.CHECKBOX).parseFormulaSync(O, o, a);
|
|
1289
|
+
M(f.newRanges, B.formula2);
|
|
1290
1290
|
}
|
|
1291
1291
|
break;
|
|
1292
1292
|
}
|
|
1293
1293
|
case "add": {
|
|
1294
1294
|
if (l.push({
|
|
1295
|
-
id:
|
|
1295
|
+
id: L.id,
|
|
1296
1296
|
params: {
|
|
1297
1297
|
unitId: o,
|
|
1298
1298
|
subUnitId: a,
|
|
@@ -1300,7 +1300,7 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1300
1300
|
source: r
|
|
1301
1301
|
}
|
|
1302
1302
|
}), u.unshift({
|
|
1303
|
-
id:
|
|
1303
|
+
id: A.id,
|
|
1304
1304
|
params: {
|
|
1305
1305
|
unitId: o,
|
|
1306
1306
|
subUnitId: a,
|
|
@@ -1309,12 +1309,12 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1309
1309
|
}
|
|
1310
1310
|
}), f.rule.type === T.CHECKBOX) {
|
|
1311
1311
|
const P = d.getValidator(T.CHECKBOX).parseFormulaSync(f.rule, o, a);
|
|
1312
|
-
|
|
1312
|
+
M(f.rule.ranges, P.originFormula2);
|
|
1313
1313
|
}
|
|
1314
1314
|
break;
|
|
1315
1315
|
}
|
|
1316
1316
|
}
|
|
1317
|
-
}),
|
|
1317
|
+
}), R) {
|
|
1318
1318
|
const f = {
|
|
1319
1319
|
id: se.id,
|
|
1320
1320
|
params: {
|
|
@@ -1322,11 +1322,11 @@ function Le(o, a, e, t, r = "command", i = !0) {
|
|
|
1322
1322
|
subUnitId: a,
|
|
1323
1323
|
cellValue: _.getData()
|
|
1324
1324
|
}
|
|
1325
|
-
},
|
|
1325
|
+
}, O = {
|
|
1326
1326
|
id: se.id,
|
|
1327
1327
|
params: ot(t, f.params)
|
|
1328
1328
|
};
|
|
1329
|
-
l.push(f), u.push(
|
|
1329
|
+
l.push(f), u.push(O);
|
|
1330
1330
|
}
|
|
1331
1331
|
return {
|
|
1332
1332
|
redoMutations: l,
|
|
@@ -1344,12 +1344,12 @@ const ha = {
|
|
|
1344
1344
|
return !1;
|
|
1345
1345
|
const d = s.getRuleObjectMatrix(e, t).clone();
|
|
1346
1346
|
d.updateRange(i, r);
|
|
1347
|
-
const c = d.diff(s.getRules(e, t)), { redoMutations: m, undoMutations: p } =
|
|
1347
|
+
const c = d.diff(s.getRules(e, t)), { redoMutations: m, undoMutations: p } = be(e, t, c, o);
|
|
1348
1348
|
return l.pushUndoRedo({
|
|
1349
1349
|
undoMutations: p,
|
|
1350
1350
|
redoMutations: m,
|
|
1351
1351
|
unitID: e
|
|
1352
|
-
}),
|
|
1352
|
+
}), Ie(m, n), !0;
|
|
1353
1353
|
}
|
|
1354
1354
|
}, ma = {
|
|
1355
1355
|
type: z.COMMAND,
|
|
@@ -1366,12 +1366,12 @@ const ha = {
|
|
|
1366
1366
|
...r,
|
|
1367
1367
|
...d == null ? void 0 : d.normalizeFormula(r, e, t)
|
|
1368
1368
|
}
|
|
1369
|
-
}, { redoMutations: m, undoMutations: p } =
|
|
1369
|
+
}, { redoMutations: m, undoMutations: p } = be(e, t, u, o);
|
|
1370
1370
|
return m.push({
|
|
1371
|
-
id:
|
|
1371
|
+
id: L.id,
|
|
1372
1372
|
params: c
|
|
1373
1373
|
}), p.unshift({
|
|
1374
|
-
id:
|
|
1374
|
+
id: A.id,
|
|
1375
1375
|
params: {
|
|
1376
1376
|
unitId: e,
|
|
1377
1377
|
subUnitId: t,
|
|
@@ -1381,7 +1381,7 @@ const ha = {
|
|
|
1381
1381
|
unitID: e,
|
|
1382
1382
|
redoMutations: m,
|
|
1383
1383
|
undoMutations: p
|
|
1384
|
-
}),
|
|
1384
|
+
}), Ie(m, s), !0;
|
|
1385
1385
|
}
|
|
1386
1386
|
}, ga = {
|
|
1387
1387
|
type: z.COMMAND,
|
|
@@ -1404,44 +1404,44 @@ const ha = {
|
|
|
1404
1404
|
subUnitId: n,
|
|
1405
1405
|
ruleId: l,
|
|
1406
1406
|
payload: {
|
|
1407
|
-
type:
|
|
1407
|
+
type: y.SETTING,
|
|
1408
1408
|
payload: {
|
|
1409
1409
|
...u,
|
|
1410
1410
|
...d.normalizeFormula(m, s, n)
|
|
1411
1411
|
}
|
|
1412
1412
|
}
|
|
1413
1413
|
}, _ = [{
|
|
1414
|
-
id:
|
|
1414
|
+
id: E.id,
|
|
1415
1415
|
params: p
|
|
1416
|
-
}],
|
|
1416
|
+
}], R = {
|
|
1417
1417
|
unitId: s,
|
|
1418
1418
|
subUnitId: n,
|
|
1419
1419
|
ruleId: l,
|
|
1420
1420
|
payload: {
|
|
1421
|
-
type:
|
|
1422
|
-
payload:
|
|
1421
|
+
type: y.SETTING,
|
|
1422
|
+
payload: Dt(c)
|
|
1423
1423
|
}
|
|
1424
|
-
},
|
|
1425
|
-
id:
|
|
1426
|
-
params:
|
|
1424
|
+
}, M = [{
|
|
1425
|
+
id: E.id,
|
|
1426
|
+
params: R
|
|
1427
1427
|
}];
|
|
1428
1428
|
if (u.type === T.CHECKBOX) {
|
|
1429
|
-
const
|
|
1429
|
+
const O = c.ranges, P = o.get(w), B = Ye(P, { unitId: s, subUnitId: n });
|
|
1430
1430
|
if (B) {
|
|
1431
|
-
const $ = new Se(), { worksheet: U } = B, { formula2: J =
|
|
1432
|
-
let
|
|
1433
|
-
if (
|
|
1434
|
-
|
|
1431
|
+
const $ = new Se(), { worksheet: U } = B, { formula2: J = Me, formula1: ce = Ve } = c, { formula2: he = Me, formula1: me = Ve } = u;
|
|
1432
|
+
let Le = !1;
|
|
1433
|
+
if (O.forEach((ge) => {
|
|
1434
|
+
b.foreach(ge, (ae, xe) => {
|
|
1435
1435
|
const k = U.getCellRaw(ae, xe), Ke = ct(k);
|
|
1436
1436
|
(gt(k) || Ke === String(J)) && !(k != null && k.p) ? ($.setValue(ae, xe, {
|
|
1437
1437
|
v: he,
|
|
1438
1438
|
p: null
|
|
1439
|
-
}),
|
|
1439
|
+
}), Le = !0) : Ke === String(ce) && !(k != null && k.p) && ($.setValue(ae, xe, {
|
|
1440
1440
|
v: me,
|
|
1441
1441
|
p: null
|
|
1442
|
-
}),
|
|
1442
|
+
}), Le = !0);
|
|
1443
1443
|
});
|
|
1444
|
-
}),
|
|
1444
|
+
}), Le) {
|
|
1445
1445
|
const ge = {
|
|
1446
1446
|
id: se.id,
|
|
1447
1447
|
params: {
|
|
@@ -1453,14 +1453,14 @@ const ha = {
|
|
|
1453
1453
|
id: se.id,
|
|
1454
1454
|
params: ot(o, ge.params)
|
|
1455
1455
|
};
|
|
1456
|
-
_.push(ge),
|
|
1456
|
+
_.push(ge), M.push(ae);
|
|
1457
1457
|
}
|
|
1458
1458
|
}
|
|
1459
1459
|
}
|
|
1460
|
-
return
|
|
1460
|
+
return Ie(_, e).result ? (t.pushUndoRedo({
|
|
1461
1461
|
unitID: s,
|
|
1462
1462
|
redoMutations: _,
|
|
1463
|
-
undoMutations:
|
|
1463
|
+
undoMutations: M
|
|
1464
1464
|
}), !0) : !1;
|
|
1465
1465
|
}
|
|
1466
1466
|
}, _a = {
|
|
@@ -1477,29 +1477,29 @@ const ha = {
|
|
|
1477
1477
|
subUnitId: s,
|
|
1478
1478
|
ruleId: n,
|
|
1479
1479
|
payload: {
|
|
1480
|
-
type:
|
|
1480
|
+
type: y.OPTIONS,
|
|
1481
1481
|
payload: l
|
|
1482
1482
|
}
|
|
1483
1483
|
}, c = [{
|
|
1484
|
-
id:
|
|
1484
|
+
id: E.id,
|
|
1485
1485
|
params: d
|
|
1486
1486
|
}], m = {
|
|
1487
1487
|
unitId: i,
|
|
1488
1488
|
subUnitId: s,
|
|
1489
1489
|
ruleId: n,
|
|
1490
1490
|
payload: {
|
|
1491
|
-
type:
|
|
1492
|
-
payload:
|
|
1491
|
+
type: y.OPTIONS,
|
|
1492
|
+
payload: bt(u)
|
|
1493
1493
|
}
|
|
1494
1494
|
}, p = [{
|
|
1495
|
-
id:
|
|
1495
|
+
id: E.id,
|
|
1496
1496
|
params: m
|
|
1497
1497
|
}];
|
|
1498
1498
|
return t.pushUndoRedo({
|
|
1499
1499
|
unitID: i,
|
|
1500
1500
|
redoMutations: c,
|
|
1501
1501
|
undoMutations: p
|
|
1502
|
-
}), e.executeCommand(
|
|
1502
|
+
}), e.executeCommand(E.id, d), !0;
|
|
1503
1503
|
}
|
|
1504
1504
|
}, pa = {
|
|
1505
1505
|
type: z.COMMAND,
|
|
@@ -1507,16 +1507,16 @@ const ha = {
|
|
|
1507
1507
|
handler(o, a) {
|
|
1508
1508
|
if (!a)
|
|
1509
1509
|
return !1;
|
|
1510
|
-
const { unitId: e, subUnitId: t, ranges: r } = a, i = o.get(x), s = o.get(
|
|
1510
|
+
const { unitId: e, subUnitId: t, ranges: r } = a, i = o.get(x), s = o.get(w), n = Ye(s, { unitId: e, subUnitId: t }), l = o.get(F);
|
|
1511
1511
|
if (!n) return !1;
|
|
1512
1512
|
const u = o.get(Z), d = l.getRuleObjectMatrix(e, t).clone();
|
|
1513
1513
|
d.removeRange(r);
|
|
1514
|
-
const c = d.diff(l.getRules(e, t)), { redoMutations: m, undoMutations: p } =
|
|
1514
|
+
const c = d.diff(l.getRules(e, t)), { redoMutations: m, undoMutations: p } = be(e, t, c, o);
|
|
1515
1515
|
return u.pushUndoRedo({
|
|
1516
1516
|
unitID: e,
|
|
1517
1517
|
redoMutations: m,
|
|
1518
1518
|
undoMutations: p
|
|
1519
|
-
}),
|
|
1519
|
+
}), Ie(m, i).result;
|
|
1520
1520
|
}
|
|
1521
1521
|
}, fa = {
|
|
1522
1522
|
type: z.COMMAND,
|
|
@@ -1529,10 +1529,10 @@ const ha = {
|
|
|
1529
1529
|
subUnitId: t,
|
|
1530
1530
|
ruleId: n.map((c) => c.uid)
|
|
1531
1531
|
}, u = [{
|
|
1532
|
-
id:
|
|
1532
|
+
id: A.id,
|
|
1533
1533
|
params: l
|
|
1534
1534
|
}], d = [{
|
|
1535
|
-
id:
|
|
1535
|
+
id: L.id,
|
|
1536
1536
|
params: {
|
|
1537
1537
|
unitId: e,
|
|
1538
1538
|
subUnitId: t,
|
|
@@ -1543,14 +1543,14 @@ const ha = {
|
|
|
1543
1543
|
redoMutations: u,
|
|
1544
1544
|
undoMutations: d,
|
|
1545
1545
|
unitID: e
|
|
1546
|
-
}), r.executeCommand(
|
|
1546
|
+
}), r.executeCommand(A.id, l), !0;
|
|
1547
1547
|
}
|
|
1548
|
-
},
|
|
1548
|
+
}, Ra = (o, a) => {
|
|
1549
1549
|
const e = o.get(F), { unitId: t, subUnitId: r, ruleId: i, source: s } = a;
|
|
1550
1550
|
if (Array.isArray(i)) {
|
|
1551
1551
|
const l = i.map((u) => e.getRuleById(t, r, u)).filter(Boolean);
|
|
1552
1552
|
return [{
|
|
1553
|
-
id:
|
|
1553
|
+
id: L.id,
|
|
1554
1554
|
params: {
|
|
1555
1555
|
unitId: t,
|
|
1556
1556
|
subUnitId: r,
|
|
@@ -1560,7 +1560,7 @@ const ha = {
|
|
|
1560
1560
|
}];
|
|
1561
1561
|
}
|
|
1562
1562
|
return [{
|
|
1563
|
-
id:
|
|
1563
|
+
id: L.id,
|
|
1564
1564
|
params: {
|
|
1565
1565
|
unitId: t,
|
|
1566
1566
|
subUnitId: r,
|
|
@@ -1570,17 +1570,17 @@ const ha = {
|
|
|
1570
1570
|
index: e.getRuleIndex(t, r, i)
|
|
1571
1571
|
}
|
|
1572
1572
|
}];
|
|
1573
|
-
},
|
|
1573
|
+
}, va = {
|
|
1574
1574
|
type: z.COMMAND,
|
|
1575
1575
|
id: "sheet.command.remove-data-validation-rule",
|
|
1576
1576
|
handler(o, a) {
|
|
1577
1577
|
if (!a)
|
|
1578
1578
|
return !1;
|
|
1579
1579
|
const { unitId: e, subUnitId: t, ruleId: r } = a, i = o.get(x), s = o.get(Z), n = o.get(F), l = [{
|
|
1580
|
-
id:
|
|
1580
|
+
id: A.id,
|
|
1581
1581
|
params: a
|
|
1582
1582
|
}], u = [{
|
|
1583
|
-
id:
|
|
1583
|
+
id: L.id,
|
|
1584
1584
|
params: {
|
|
1585
1585
|
unitId: e,
|
|
1586
1586
|
subUnitId: t,
|
|
@@ -1594,15 +1594,15 @@ const ha = {
|
|
|
1594
1594
|
undoMutations: u,
|
|
1595
1595
|
redoMutations: l,
|
|
1596
1596
|
unitID: a.unitId
|
|
1597
|
-
}), i.executeCommand(
|
|
1597
|
+
}), i.executeCommand(A.id, a), !0;
|
|
1598
1598
|
}
|
|
1599
1599
|
}, Sa = "sheets-data-validation.config", tt = {};
|
|
1600
|
-
var
|
|
1601
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1600
|
+
var Va = Object.getOwnPropertyDescriptor, Ma = (o, a, e, t) => {
|
|
1601
|
+
for (var r = t > 1 ? void 0 : t ? Va(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1602
1602
|
(s = o[i]) && (r = s(r) || r);
|
|
1603
1603
|
return r;
|
|
1604
1604
|
}, We = (o, a) => (e, t) => a(e, t, o);
|
|
1605
|
-
let
|
|
1605
|
+
let Ee = class extends W {
|
|
1606
1606
|
constructor(a, e, t) {
|
|
1607
1607
|
super();
|
|
1608
1608
|
g(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
@@ -1620,7 +1620,7 @@ let ye = class extends W {
|
|
|
1620
1620
|
if (u.length === 0)
|
|
1621
1621
|
return {
|
|
1622
1622
|
undos: [{
|
|
1623
|
-
id:
|
|
1623
|
+
id: L.id,
|
|
1624
1624
|
params: {
|
|
1625
1625
|
unitId: a,
|
|
1626
1626
|
subUnitId: e,
|
|
@@ -1629,7 +1629,7 @@ let ye = class extends W {
|
|
|
1629
1629
|
}
|
|
1630
1630
|
}],
|
|
1631
1631
|
redos: [{
|
|
1632
|
-
id:
|
|
1632
|
+
id: A.id,
|
|
1633
1633
|
params: {
|
|
1634
1634
|
unitId: a,
|
|
1635
1635
|
subUnitId: e,
|
|
@@ -1640,13 +1640,13 @@ let ye = class extends W {
|
|
|
1640
1640
|
};
|
|
1641
1641
|
const d = [], c = [], m = u[0];
|
|
1642
1642
|
d.push({
|
|
1643
|
-
id:
|
|
1643
|
+
id: E.id,
|
|
1644
1644
|
params: {
|
|
1645
1645
|
unitId: a,
|
|
1646
1646
|
subUnitId: e,
|
|
1647
1647
|
ruleId: t.uid,
|
|
1648
1648
|
payload: {
|
|
1649
|
-
type:
|
|
1649
|
+
type: y.ALL,
|
|
1650
1650
|
payload: {
|
|
1651
1651
|
ranges: m.ranges,
|
|
1652
1652
|
formula1: m.formulas[0],
|
|
@@ -1656,13 +1656,13 @@ let ye = class extends W {
|
|
|
1656
1656
|
source: "patched"
|
|
1657
1657
|
}
|
|
1658
1658
|
}), c.push({
|
|
1659
|
-
id:
|
|
1659
|
+
id: E.id,
|
|
1660
1660
|
params: {
|
|
1661
1661
|
unitId: a,
|
|
1662
1662
|
subUnitId: e,
|
|
1663
1663
|
ruleId: t.uid,
|
|
1664
1664
|
payload: {
|
|
1665
|
-
type:
|
|
1665
|
+
type: y.ALL,
|
|
1666
1666
|
payload: {
|
|
1667
1667
|
ranges: r,
|
|
1668
1668
|
formula1: i,
|
|
@@ -1673,15 +1673,15 @@ let ye = class extends W {
|
|
|
1673
1673
|
}
|
|
1674
1674
|
});
|
|
1675
1675
|
for (let p = 1; p < u.length; p++) {
|
|
1676
|
-
const _ = u[p],
|
|
1676
|
+
const _ = u[p], R = Mt();
|
|
1677
1677
|
d.push({
|
|
1678
|
-
id:
|
|
1678
|
+
id: L.id,
|
|
1679
1679
|
params: {
|
|
1680
1680
|
unitId: a,
|
|
1681
1681
|
subUnitId: e,
|
|
1682
1682
|
rule: {
|
|
1683
1683
|
...t,
|
|
1684
|
-
uid:
|
|
1684
|
+
uid: R,
|
|
1685
1685
|
formula1: _.formulas[0],
|
|
1686
1686
|
formula2: _.formulas[1],
|
|
1687
1687
|
ranges: _.ranges
|
|
@@ -1689,11 +1689,11 @@ let ye = class extends W {
|
|
|
1689
1689
|
source: "patched"
|
|
1690
1690
|
}
|
|
1691
1691
|
}), c.push({
|
|
1692
|
-
id:
|
|
1692
|
+
id: A.id,
|
|
1693
1693
|
params: {
|
|
1694
1694
|
unitId: a,
|
|
1695
1695
|
subUnitId: e,
|
|
1696
|
-
ruleId:
|
|
1696
|
+
ruleId: R,
|
|
1697
1697
|
source: "patched"
|
|
1698
1698
|
}
|
|
1699
1699
|
});
|
|
@@ -1739,13 +1739,13 @@ let ye = class extends W {
|
|
|
1739
1739
|
}));
|
|
1740
1740
|
}
|
|
1741
1741
|
};
|
|
1742
|
-
|
|
1743
|
-
We(0,
|
|
1744
|
-
We(1,
|
|
1745
|
-
We(2,
|
|
1746
|
-
],
|
|
1747
|
-
var _t = /* @__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))(_t || {}),
|
|
1748
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1742
|
+
Ee = Ma([
|
|
1743
|
+
We(0, v(F)),
|
|
1744
|
+
We(1, v(ut)),
|
|
1745
|
+
We(2, v(q))
|
|
1746
|
+
], Ee);
|
|
1747
|
+
var _t = /* @__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))(_t || {}), ya = Object.getOwnPropertyDescriptor, Ea = (o, a, e, t) => {
|
|
1748
|
+
for (var r = t > 1 ? void 0 : t ? ya(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1749
1749
|
(s = o[i]) && (r = s(r) || r);
|
|
1750
1750
|
return r;
|
|
1751
1751
|
}, Pe = (o, a) => (e, t) => a(e, t, o);
|
|
@@ -1762,21 +1762,21 @@ let Te = class extends W {
|
|
|
1762
1762
|
const i = a[r];
|
|
1763
1763
|
if (typeof i == "string")
|
|
1764
1764
|
continue;
|
|
1765
|
-
const { token: s } = i, n = Qt(s), l = this._univerInstanceService.getCurrentUnitForType(
|
|
1765
|
+
const { token: s } = i, n = Qt(s), l = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET);
|
|
1766
1766
|
let u = l.getActiveSheet();
|
|
1767
1767
|
const d = l.getUnitId();
|
|
1768
1768
|
if (n.sheetName) {
|
|
1769
1769
|
if (u = l.getSheetBySheetName(n.sheetName), !u)
|
|
1770
1770
|
return !1;
|
|
1771
|
-
const
|
|
1772
|
-
if (!this._permissionService.getPermissionPoint(new xt(d,
|
|
1771
|
+
const R = u == null ? void 0 : u.getSheetId();
|
|
1772
|
+
if (!this._permissionService.getPermissionPoint(new xt(d, R).id)) return !1;
|
|
1773
1773
|
}
|
|
1774
1774
|
if (!u)
|
|
1775
1775
|
return !1;
|
|
1776
1776
|
const { startRow: c, endRow: m, startColumn: p, endColumn: _ } = n.range;
|
|
1777
|
-
for (let
|
|
1778
|
-
for (let
|
|
1779
|
-
const f = (t = (e = u.getCell(
|
|
1777
|
+
for (let R = c; R <= m; R++)
|
|
1778
|
+
for (let M = p; M <= _; M++) {
|
|
1779
|
+
const f = (t = (e = u.getCell(R, M)) == null ? void 0 : e.selectionProtection) == null ? void 0 : t[0];
|
|
1780
1780
|
if ((f == null ? void 0 : f[_t.View]) === !1)
|
|
1781
1781
|
return !1;
|
|
1782
1782
|
}
|
|
@@ -1784,10 +1784,10 @@ let Te = class extends W {
|
|
|
1784
1784
|
return !0;
|
|
1785
1785
|
}
|
|
1786
1786
|
};
|
|
1787
|
-
Te =
|
|
1788
|
-
Pe(0,
|
|
1789
|
-
Pe(1,
|
|
1790
|
-
Pe(2,
|
|
1787
|
+
Te = Ea([
|
|
1788
|
+
Pe(0, w),
|
|
1789
|
+
Pe(1, yt),
|
|
1790
|
+
Pe(2, v(Y))
|
|
1791
1791
|
], Te);
|
|
1792
1792
|
var Ta = Object.getOwnPropertyDescriptor, Fa = (o, a, e, t) => {
|
|
1793
1793
|
for (var r = t > 1 ? void 0 : t ? Ta(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
@@ -1821,7 +1821,7 @@ let Fe = class extends W {
|
|
|
1821
1821
|
subUnitId: e,
|
|
1822
1822
|
ruleId: t.uid,
|
|
1823
1823
|
payload: {
|
|
1824
|
-
type:
|
|
1824
|
+
type: y.SETTING,
|
|
1825
1825
|
payload: {
|
|
1826
1826
|
type: m.type,
|
|
1827
1827
|
formula1: m.formula1,
|
|
@@ -1830,12 +1830,12 @@ let Fe = class extends W {
|
|
|
1830
1830
|
}
|
|
1831
1831
|
},
|
|
1832
1832
|
source: "patched"
|
|
1833
|
-
},
|
|
1833
|
+
}, R = {
|
|
1834
1834
|
unitId: a,
|
|
1835
1835
|
subUnitId: e,
|
|
1836
1836
|
ruleId: t.uid,
|
|
1837
1837
|
payload: {
|
|
1838
|
-
type:
|
|
1838
|
+
type: y.SETTING,
|
|
1839
1839
|
payload: {
|
|
1840
1840
|
type: m.type,
|
|
1841
1841
|
formula1: m.formula1,
|
|
@@ -1843,18 +1843,18 @@ let Fe = class extends W {
|
|
|
1843
1843
|
}
|
|
1844
1844
|
},
|
|
1845
1845
|
source: "patched"
|
|
1846
|
-
},
|
|
1846
|
+
}, M = [
|
|
1847
1847
|
{
|
|
1848
|
-
id:
|
|
1848
|
+
id: E.id,
|
|
1849
1849
|
params: _
|
|
1850
1850
|
}
|
|
1851
1851
|
], f = [
|
|
1852
1852
|
{
|
|
1853
|
-
id:
|
|
1854
|
-
params:
|
|
1853
|
+
id: E.id,
|
|
1854
|
+
params: R
|
|
1855
1855
|
}
|
|
1856
1856
|
];
|
|
1857
|
-
return { redos:
|
|
1857
|
+
return { redos: M, undos: f };
|
|
1858
1858
|
}, l = this._dataValidationFormulaService.getRuleFormulaInfo(a, e, r);
|
|
1859
1859
|
if (l) {
|
|
1860
1860
|
const [d, c] = l;
|
|
@@ -1890,27 +1890,27 @@ let Fe = class extends W {
|
|
|
1890
1890
|
subUnitId: e,
|
|
1891
1891
|
ruleId: t.uid,
|
|
1892
1892
|
payload: {
|
|
1893
|
-
type:
|
|
1893
|
+
type: y.RANGE,
|
|
1894
1894
|
payload: m
|
|
1895
1895
|
},
|
|
1896
1896
|
source: "patched"
|
|
1897
|
-
},
|
|
1898
|
-
id:
|
|
1897
|
+
}, R = [{ id: E.id, params: _ }], M = [{
|
|
1898
|
+
id: E.id,
|
|
1899
1899
|
params: {
|
|
1900
1900
|
unitId: a,
|
|
1901
1901
|
subUnitId: e,
|
|
1902
1902
|
ruleId: t.uid,
|
|
1903
1903
|
payload: {
|
|
1904
|
-
type:
|
|
1904
|
+
type: y.RANGE,
|
|
1905
1905
|
payload: d
|
|
1906
1906
|
},
|
|
1907
1907
|
source: "patched"
|
|
1908
1908
|
}
|
|
1909
1909
|
}];
|
|
1910
|
-
return { redos:
|
|
1910
|
+
return { redos: R, undos: M };
|
|
1911
1911
|
} else {
|
|
1912
|
-
const _ = { unitId: a, subUnitId: e, ruleId: t.uid },
|
|
1913
|
-
return { redos:
|
|
1912
|
+
const _ = { unitId: a, subUnitId: e, ruleId: t.uid }, R = [{ id: A.id, params: _ }], M = Ra(this._injector, _);
|
|
1913
|
+
return { redos: R, undos: M };
|
|
1914
1914
|
}
|
|
1915
1915
|
}, i = [];
|
|
1916
1916
|
t.ranges.forEach((u) => {
|
|
@@ -1955,19 +1955,19 @@ let Fe = class extends W {
|
|
|
1955
1955
|
}
|
|
1956
1956
|
};
|
|
1957
1957
|
Fe = Fa([
|
|
1958
|
-
ee(0,
|
|
1959
|
-
ee(1,
|
|
1960
|
-
ee(2,
|
|
1961
|
-
ee(3,
|
|
1962
|
-
ee(4,
|
|
1963
|
-
ee(5,
|
|
1958
|
+
ee(0, v(F)),
|
|
1959
|
+
ee(1, v(qe)),
|
|
1960
|
+
ee(2, v(Bt)),
|
|
1961
|
+
ee(3, v(K)),
|
|
1962
|
+
ee(4, v(ut)),
|
|
1963
|
+
ee(5, v(q))
|
|
1964
1964
|
], Fe);
|
|
1965
|
-
var
|
|
1966
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1965
|
+
var Na = Object.getOwnPropertyDescriptor, Ca = (o, a, e, t) => {
|
|
1966
|
+
for (var r = t > 1 ? void 0 : t ? Na(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1967
1967
|
(s = o[i]) && (r = s(r) || r);
|
|
1968
1968
|
return r;
|
|
1969
1969
|
}, $e = (o, a) => (e, t) => a(e, t, o);
|
|
1970
|
-
let
|
|
1970
|
+
let Ne = class extends W {
|
|
1971
1971
|
constructor(o, a, e) {
|
|
1972
1972
|
super(), this._sheetInterceptorService = o, this._univerInstanceService = a, this._sheetDataValidationModel = e, this._initSheetChange();
|
|
1973
1973
|
}
|
|
@@ -1977,7 +1977,7 @@ let Ce = class extends W {
|
|
|
1977
1977
|
getMutations: (o) => {
|
|
1978
1978
|
var a;
|
|
1979
1979
|
if (o.id === Ht.id) {
|
|
1980
|
-
const e = o.params, t = e.unitId || this._univerInstanceService.getCurrentUnitForType(
|
|
1980
|
+
const e = o.params, t = e.unitId || this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET).getUnitId(), r = this._univerInstanceService.getUniverSheetInstance(t);
|
|
1981
1981
|
if (!r)
|
|
1982
1982
|
return { redos: [], undos: [] };
|
|
1983
1983
|
const i = e.subUnitId || ((a = r.getActiveSheet()) == null ? void 0 : a.getSheetId());
|
|
@@ -1999,11 +1999,11 @@ let Ce = class extends W {
|
|
|
1999
1999
|
};
|
|
2000
2000
|
return {
|
|
2001
2001
|
redos: [{
|
|
2002
|
-
id:
|
|
2002
|
+
id: A.id,
|
|
2003
2003
|
params: l
|
|
2004
2004
|
}],
|
|
2005
2005
|
undos: [{
|
|
2006
|
-
id:
|
|
2006
|
+
id: L.id,
|
|
2007
2007
|
params: u
|
|
2008
2008
|
}]
|
|
2009
2009
|
};
|
|
@@ -2014,12 +2014,12 @@ let Ce = class extends W {
|
|
|
2014
2014
|
);
|
|
2015
2015
|
}
|
|
2016
2016
|
};
|
|
2017
|
-
|
|
2018
|
-
$e(0,
|
|
2019
|
-
$e(1,
|
|
2020
|
-
$e(2,
|
|
2021
|
-
],
|
|
2022
|
-
class
|
|
2017
|
+
Ne = Ca([
|
|
2018
|
+
$e(0, v(st)),
|
|
2019
|
+
$e(1, v(w)),
|
|
2020
|
+
$e(2, v(F))
|
|
2021
|
+
], Ne);
|
|
2022
|
+
class wa extends G {
|
|
2023
2023
|
constructor() {
|
|
2024
2024
|
super(...arguments);
|
|
2025
2025
|
g(this, "id", T.ANY);
|
|
@@ -2047,7 +2047,7 @@ class Oa extends G {
|
|
|
2047
2047
|
return this.localeService.t("dataValidation.any.error");
|
|
2048
2048
|
}
|
|
2049
2049
|
}
|
|
2050
|
-
class
|
|
2050
|
+
class Oa extends G {
|
|
2051
2051
|
constructor() {
|
|
2052
2052
|
super(...arguments);
|
|
2053
2053
|
g(this, "id", T.CUSTOM);
|
|
@@ -2074,7 +2074,7 @@ class Ia extends G {
|
|
|
2074
2074
|
}
|
|
2075
2075
|
async isValidType(e, t, r) {
|
|
2076
2076
|
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;
|
|
2077
|
-
return
|
|
2077
|
+
return C(String(d)) && V.isDefine(d) && d !== "" ? u.t === Et.BOOLEAN ? !!d : typeof d == "boolean" ? d : typeof d == "number" ? !!d : typeof d == "string" ? C(d) : !!d : !1;
|
|
2078
2078
|
}
|
|
2079
2079
|
generateRuleErrorMessage(e) {
|
|
2080
2080
|
return this.localeService.t("dataValidation.custom.error");
|
|
@@ -2084,7 +2084,7 @@ class Ia extends G {
|
|
|
2084
2084
|
return this.localeService.t("dataValidation.custom.ruleName").replace("{FORMULA1}", (t = e.formula1) != null ? t : "");
|
|
2085
2085
|
}
|
|
2086
2086
|
}
|
|
2087
|
-
class
|
|
2087
|
+
class Ia extends mt {
|
|
2088
2088
|
constructor() {
|
|
2089
2089
|
super(...arguments);
|
|
2090
2090
|
g(this, "id", T.LIST_MULTIPLE);
|
|
@@ -2093,7 +2093,7 @@ class Aa extends mt {
|
|
|
2093
2093
|
g(this, "skipDefaultFontRender", () => !0);
|
|
2094
2094
|
}
|
|
2095
2095
|
}
|
|
2096
|
-
class
|
|
2096
|
+
class Aa extends G {
|
|
2097
2097
|
constructor() {
|
|
2098
2098
|
super(...arguments);
|
|
2099
2099
|
g(this, "_customFormulaService", this.injector.get(H));
|
|
@@ -2113,24 +2113,24 @@ class Da extends G {
|
|
|
2113
2113
|
g(this, "scopes", ["sheet"]);
|
|
2114
2114
|
}
|
|
2115
2115
|
_isFormulaOrInt(e) {
|
|
2116
|
-
return !
|
|
2116
|
+
return !V.isBlank(e) && (S(e) || !Number.isNaN(+e) && Number.isInteger(+e));
|
|
2117
2117
|
}
|
|
2118
2118
|
async isValidType(e, t, r) {
|
|
2119
|
-
const { value: i } = e, s =
|
|
2119
|
+
const { value: i } = e, s = ye(i);
|
|
2120
2120
|
return !Number.isNaN(s) && Number.isInteger(s);
|
|
2121
2121
|
}
|
|
2122
2122
|
transform(e, t, r) {
|
|
2123
2123
|
const { value: i } = e;
|
|
2124
2124
|
return {
|
|
2125
2125
|
...e,
|
|
2126
|
-
value:
|
|
2126
|
+
value: ye(i)
|
|
2127
2127
|
};
|
|
2128
2128
|
}
|
|
2129
2129
|
_parseNumber(e) {
|
|
2130
2130
|
return e == null ? Number.NaN : +e;
|
|
2131
2131
|
}
|
|
2132
2132
|
async parseFormula(e, t, r, i, s) {
|
|
2133
|
-
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, m = S(d) ? l == null ? void 0 : l.v : d, p =
|
|
2133
|
+
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, m = S(d) ? l == null ? void 0 : l.v : d, p = C(`${c}`) && C(`${m}`);
|
|
2134
2134
|
return {
|
|
2135
2135
|
formula1: this._parseNumber(c),
|
|
2136
2136
|
formula2: this._parseNumber(m),
|
|
@@ -2143,7 +2143,7 @@ class Da extends G {
|
|
|
2143
2143
|
return {
|
|
2144
2144
|
success: !1
|
|
2145
2145
|
};
|
|
2146
|
-
const s =
|
|
2146
|
+
const s = V.isDefine(e.formula1) && this._isFormulaOrInt(e.formula1), n = V.isDefine(e.formula2) && this._isFormulaOrInt(e.formula2), l = Ae.includes(i), u = this.localeService.t("dataValidation.validFail.number");
|
|
2147
2147
|
return l ? {
|
|
2148
2148
|
success: s && n,
|
|
2149
2149
|
formula1: s ? void 0 : u,
|
|
@@ -2156,16 +2156,16 @@ class Da extends G {
|
|
|
2156
2156
|
generateRuleErrorMessage(e, t) {
|
|
2157
2157
|
if (!e.operator)
|
|
2158
2158
|
return this.titleStr;
|
|
2159
|
-
const { transformedFormula1: r, transformedFormula2: i } =
|
|
2159
|
+
const { transformedFormula1: r, transformedFormula2: i } = De(this._lexerTreeBuilder, e, t);
|
|
2160
2160
|
return `${this.localeService.t(ht[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
2161
2161
|
}
|
|
2162
2162
|
}
|
|
2163
|
-
var
|
|
2164
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2163
|
+
var Da = Object.getOwnPropertyDescriptor, ba = (o, a, e, t) => {
|
|
2164
|
+
for (var r = t > 1 ? void 0 : t ? Da(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
2165
2165
|
(s = o[i]) && (r = s(r) || r);
|
|
2166
2166
|
return r;
|
|
2167
2167
|
}, te = (o, a) => (e, t) => a(e, t, o);
|
|
2168
|
-
let
|
|
2168
|
+
let Ce = class extends Tt {
|
|
2169
2169
|
constructor(o, a, e, t, r, i) {
|
|
2170
2170
|
super(), this._univerInstanceService = o, this._dataValidatorRegistryService = a, this._injector = e, this._selectionManagerService = t, this._sheetInterceptorService = r, this._sheetDataValidationModel = i, this._init();
|
|
2171
2171
|
}
|
|
@@ -2174,15 +2174,15 @@ let we = class extends Tt {
|
|
|
2174
2174
|
}
|
|
2175
2175
|
_registerValidators() {
|
|
2176
2176
|
[
|
|
2177
|
-
|
|
2177
|
+
wa,
|
|
2178
2178
|
na,
|
|
2179
|
-
|
|
2179
|
+
Aa,
|
|
2180
2180
|
ca,
|
|
2181
2181
|
sa,
|
|
2182
2182
|
aa,
|
|
2183
2183
|
mt,
|
|
2184
|
-
|
|
2185
|
-
|
|
2184
|
+
Ia,
|
|
2185
|
+
Oa
|
|
2186
2186
|
].forEach((o) => {
|
|
2187
2187
|
const a = this._injector.createInstance(o);
|
|
2188
2188
|
this.disposeWithMe(this._dataValidatorRegistryService.register(a)), this.disposeWithMe(Qe(() => this._injector.delete(o)));
|
|
@@ -2193,12 +2193,12 @@ let we = class extends Tt {
|
|
|
2193
2193
|
getMutations: (o) => {
|
|
2194
2194
|
var a;
|
|
2195
2195
|
if (o.id === Wt.id) {
|
|
2196
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
2196
|
+
const e = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET), t = e.getUnitId(), r = e.getActiveSheet();
|
|
2197
2197
|
if (!r)
|
|
2198
2198
|
throw new Error("No active sheet found");
|
|
2199
2199
|
const i = r.getSheetId(), s = (a = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : a.map((c) => c.range), n = this._sheetDataValidationModel.getRuleObjectMatrix(t, i).clone();
|
|
2200
2200
|
s && n.removeRange(s);
|
|
2201
|
-
const l = n.diff(this._sheetDataValidationModel.getRules(t, i)), { redoMutations: u, undoMutations: d } =
|
|
2201
|
+
const l = n.diff(this._sheetDataValidationModel.getRules(t, i)), { redoMutations: u, undoMutations: d } = be(t, i, l, this._injector, "patched");
|
|
2202
2202
|
return {
|
|
2203
2203
|
undos: d,
|
|
2204
2204
|
redos: u
|
|
@@ -2212,20 +2212,20 @@ let we = class extends Tt {
|
|
|
2212
2212
|
});
|
|
2213
2213
|
}
|
|
2214
2214
|
};
|
|
2215
|
-
|
|
2216
|
-
te(0,
|
|
2217
|
-
te(1,
|
|
2218
|
-
te(2,
|
|
2219
|
-
te(3,
|
|
2220
|
-
te(4,
|
|
2221
|
-
te(5,
|
|
2222
|
-
],
|
|
2223
|
-
var
|
|
2224
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2215
|
+
Ce = ba([
|
|
2216
|
+
te(0, w),
|
|
2217
|
+
te(1, v(q)),
|
|
2218
|
+
te(2, v(qe)),
|
|
2219
|
+
te(3, v(nt)),
|
|
2220
|
+
te(4, v(st)),
|
|
2221
|
+
te(5, v(F))
|
|
2222
|
+
], Ce);
|
|
2223
|
+
var La = Object.getOwnPropertyDescriptor, xa = (o, a, e, t) => {
|
|
2224
|
+
for (var r = t > 1 ? void 0 : t ? La(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
2225
2225
|
(s = o[i]) && (r = s(r) || r);
|
|
2226
2226
|
return r;
|
|
2227
|
-
},
|
|
2228
|
-
let
|
|
2227
|
+
}, Re = (o, a) => (e, t) => a(e, t, o);
|
|
2228
|
+
let we = class extends W {
|
|
2229
2229
|
constructor(o, a, e, t) {
|
|
2230
2230
|
super(), this._univerInstanceService = o, this._sheetDataValidationModel = a, this._dataValidationCacheService = e, this._lifecycleService = t, this._initRecalculate();
|
|
2231
2231
|
}
|
|
@@ -2233,11 +2233,11 @@ let Oe = class extends W {
|
|
|
2233
2233
|
const o = (a) => {
|
|
2234
2234
|
if (a.length === 0)
|
|
2235
2235
|
return;
|
|
2236
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
2236
|
+
const e = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET), t = e == null ? void 0 : e.getActiveSheet(), r = {};
|
|
2237
2237
|
a.flat().forEach((i) => {
|
|
2238
2238
|
r[i.unitId] || (r[i.unitId] = {}), r[i.unitId][i.subUnitId] || (r[i.unitId][i.subUnitId] = []);
|
|
2239
|
-
const s = this._univerInstanceService.getUnit(i.unitId,
|
|
2240
|
-
n && r[i.unitId][i.subUnitId].push(...i.ranges.map((l) =>
|
|
2239
|
+
const s = this._univerInstanceService.getUnit(i.unitId, N.UNIVER_SHEET), n = s == null ? void 0 : s.getSheetBySheetId(i.subUnitId);
|
|
2240
|
+
n && r[i.unitId][i.subUnitId].push(...i.ranges.map((l) => b.transformRange(l, n)));
|
|
2241
2241
|
}), Object.entries(r).forEach(([i, s]) => {
|
|
2242
2242
|
Object.entries(s).forEach(([n, l]) => {
|
|
2243
2243
|
(e == null ? void 0 : e.getUnitId()) === i && (t == null ? void 0 : t.getSheetId()) === n ? this.validatorRanges(i, n, l) : requestIdleCallback(() => {
|
|
@@ -2246,21 +2246,21 @@ let Oe = class extends W {
|
|
|
2246
2246
|
});
|
|
2247
2247
|
});
|
|
2248
2248
|
};
|
|
2249
|
-
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(Pt(() => this._lifecycleService.lifecycle$.pipe(Ze((a) => a === ze.Rendered)))).subscribe(o)), this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(Ze(() => this._lifecycleService.stage >= ze.Rendered),
|
|
2249
|
+
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(Pt(() => this._lifecycleService.lifecycle$.pipe(Ze((a) => a === ze.Rendered)))).subscribe(o)), this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(Ze(() => this._lifecycleService.stage >= ze.Rendered), Nt(20)).subscribe(o));
|
|
2250
2250
|
}
|
|
2251
2251
|
async _validatorByCell(o, a, e, t) {
|
|
2252
2252
|
const r = o.getUnitId(), i = a.getSheetId();
|
|
2253
|
-
if (!
|
|
2253
|
+
if (!V.isDefine(e) || !V.isDefine(t))
|
|
2254
2254
|
throw new Error(`row or col is not defined, row: ${e}, col: ${t}`);
|
|
2255
2255
|
const s = this._sheetDataValidationModel.getRuleByLocation(r, i, e, t);
|
|
2256
2256
|
return s ? new Promise((n) => {
|
|
2257
2257
|
this._sheetDataValidationModel.validator(s, { unitId: r, subUnitId: i, row: e, col: t, worksheet: a, workbook: o }, (l) => {
|
|
2258
2258
|
n(l);
|
|
2259
2259
|
});
|
|
2260
|
-
}) :
|
|
2260
|
+
}) : D.VALID;
|
|
2261
2261
|
}
|
|
2262
2262
|
async validatorCell(o, a, e, t) {
|
|
2263
|
-
const r = this._univerInstanceService.getUnit(o,
|
|
2263
|
+
const r = this._univerInstanceService.getUnit(o, N.UNIVER_SHEET);
|
|
2264
2264
|
if (!r)
|
|
2265
2265
|
throw new Error(`cannot find current workbook, unitId: ${o}`);
|
|
2266
2266
|
const i = r.getSheetBySheetId(a);
|
|
@@ -2271,7 +2271,7 @@ let Oe = class extends W {
|
|
|
2271
2271
|
validatorRanges(o, a, e) {
|
|
2272
2272
|
if (!e.length)
|
|
2273
2273
|
return Promise.resolve([]);
|
|
2274
|
-
const t = this._univerInstanceService.getUnit(o,
|
|
2274
|
+
const t = this._univerInstanceService.getUnit(o, N.UNIVER_SHEET);
|
|
2275
2275
|
if (!t)
|
|
2276
2276
|
throw new Error(`cannot find current workbook, unitId: ${o}`);
|
|
2277
2277
|
const r = t.getSheetBySheetId(a);
|
|
@@ -2279,13 +2279,13 @@ let Oe = class extends W {
|
|
|
2279
2279
|
throw new Error(`cannot find current worksheet, sheetId: ${a}`);
|
|
2280
2280
|
return Promise.all(e.map((i) => {
|
|
2281
2281
|
const s = [];
|
|
2282
|
-
return
|
|
2282
|
+
return b.foreach(i, (n, l) => {
|
|
2283
2283
|
s.push(this._validatorByCell(t, r, n, l));
|
|
2284
2284
|
}), Promise.all(s);
|
|
2285
2285
|
}));
|
|
2286
2286
|
}
|
|
2287
2287
|
async validatorWorksheet(o, a) {
|
|
2288
|
-
const e = this._univerInstanceService.getUnit(o,
|
|
2288
|
+
const e = this._univerInstanceService.getUnit(o, N.UNIVER_SHEET);
|
|
2289
2289
|
if (!e)
|
|
2290
2290
|
throw new Error(`cannot find current workbook, unitId: ${o}`);
|
|
2291
2291
|
const t = e.getSheetBySheetId(a);
|
|
@@ -2294,7 +2294,7 @@ let Oe = class extends W {
|
|
|
2294
2294
|
const r = this._sheetDataValidationModel.getRules(o, a);
|
|
2295
2295
|
return await Promise.all(r.map((i) => Promise.all(i.ranges.map((s) => {
|
|
2296
2296
|
const n = [];
|
|
2297
|
-
return
|
|
2297
|
+
return b.foreach(s, (l, u) => {
|
|
2298
2298
|
n.push(this._validatorByCell(e, t, l, u));
|
|
2299
2299
|
}), n;
|
|
2300
2300
|
})))), this._dataValidationCacheService.ensureCache(o, a);
|
|
@@ -2308,7 +2308,7 @@ let Oe = class extends W {
|
|
|
2308
2308
|
getDataValidations(o, a, e) {
|
|
2309
2309
|
const t = this._sheetDataValidationModel.getRuleObjectMatrix(o, a), r = /* @__PURE__ */ new Set();
|
|
2310
2310
|
return e.forEach((s) => {
|
|
2311
|
-
|
|
2311
|
+
b.foreach(s, (n, l) => {
|
|
2312
2312
|
const u = t.getValue(n, l);
|
|
2313
2313
|
u && r.add(u);
|
|
2314
2314
|
});
|
|
@@ -2318,21 +2318,21 @@ let Oe = class extends W {
|
|
|
2318
2318
|
return this.getDataValidations(o, a, e)[0];
|
|
2319
2319
|
}
|
|
2320
2320
|
};
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
],
|
|
2321
|
+
we = xa([
|
|
2322
|
+
Re(0, w),
|
|
2323
|
+
Re(1, v(F)),
|
|
2324
|
+
Re(2, v(Q)),
|
|
2325
|
+
Re(3, v(Ft))
|
|
2326
|
+
], we);
|
|
2327
2327
|
var Ba = Object.defineProperty, Ua = Object.getOwnPropertyDescriptor, Ha = (o, a, e) => a in o ? Ba(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e, Wa = (o, a, e, t) => {
|
|
2328
2328
|
for (var r = t > 1 ? void 0 : t ? Ua(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
2329
2329
|
(s = o[i]) && (r = s(r) || r);
|
|
2330
2330
|
return r;
|
|
2331
2331
|
}, ke = (o, a) => (e, t) => a(e, t, o), pt = (o, a, e) => Ha(o, typeof a != "symbol" ? a + "" : a, e);
|
|
2332
|
-
let
|
|
2332
|
+
let Oe = class extends Ot {
|
|
2333
2333
|
constructor(o = tt, a, e, t) {
|
|
2334
2334
|
super(), this._config = o, this._injector = a, this._commandService = e, this._configService = t;
|
|
2335
|
-
const { ...r } =
|
|
2335
|
+
const { ...r } = It(
|
|
2336
2336
|
{},
|
|
2337
2337
|
tt,
|
|
2338
2338
|
this._config
|
|
@@ -2344,13 +2344,13 @@ let Ie = class extends It {
|
|
|
2344
2344
|
[Q],
|
|
2345
2345
|
[K],
|
|
2346
2346
|
[H],
|
|
2347
|
-
[Oe],
|
|
2348
|
-
[F],
|
|
2349
2347
|
[we],
|
|
2350
|
-
[
|
|
2348
|
+
[F],
|
|
2351
2349
|
[Ce],
|
|
2350
|
+
[Te],
|
|
2351
|
+
[Ne],
|
|
2352
2352
|
[Fe],
|
|
2353
|
-
[
|
|
2353
|
+
[Ee]
|
|
2354
2354
|
].forEach((o) => {
|
|
2355
2355
|
this._injector.add(o);
|
|
2356
2356
|
}), [
|
|
@@ -2358,32 +2358,32 @@ let Ie = class extends It {
|
|
|
2358
2358
|
ha,
|
|
2359
2359
|
ga,
|
|
2360
2360
|
_a,
|
|
2361
|
-
|
|
2361
|
+
va,
|
|
2362
2362
|
fa,
|
|
2363
2363
|
pa
|
|
2364
2364
|
].forEach((o) => {
|
|
2365
2365
|
this._commandService.registerCommand(o);
|
|
2366
|
-
}), this._injector.get(Q), this._injector.get(
|
|
2366
|
+
}), this._injector.get(Q), this._injector.get(we), this._injector.get(Ce), this._injector.get(Ee), this._injector.get(Fe);
|
|
2367
2367
|
}
|
|
2368
2368
|
onReady() {
|
|
2369
|
-
this._injector.get(
|
|
2369
|
+
this._injector.get(Ne);
|
|
2370
2370
|
}
|
|
2371
2371
|
onRendered() {
|
|
2372
2372
|
this._injector.get(Te);
|
|
2373
2373
|
}
|
|
2374
2374
|
};
|
|
2375
|
-
pt(
|
|
2376
|
-
pt(
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
ke(1,
|
|
2375
|
+
pt(Oe, "pluginName", Gt);
|
|
2376
|
+
pt(Oe, "type", N.UNIVER_SHEET);
|
|
2377
|
+
Oe = Wa([
|
|
2378
|
+
Ct(Lt),
|
|
2379
|
+
ke(1, v(qe)),
|
|
2380
2380
|
ke(2, x),
|
|
2381
|
-
ke(3,
|
|
2382
|
-
],
|
|
2381
|
+
ke(3, wt)
|
|
2382
|
+
], Oe);
|
|
2383
2383
|
function Ka(o) {
|
|
2384
2384
|
const e = o.get(nt).getCurrentSelections().map((i) => i.range);
|
|
2385
2385
|
return {
|
|
2386
|
-
uid:
|
|
2386
|
+
uid: V.generateRandomId(6),
|
|
2387
2387
|
type: T.DECIMAL,
|
|
2388
2388
|
operator: h.EQUAL,
|
|
2389
2389
|
formula1: "100",
|
|
@@ -2392,8 +2392,8 @@ function Ka(o) {
|
|
|
2392
2392
|
}
|
|
2393
2393
|
export {
|
|
2394
2394
|
ma as AddSheetDataValidationCommand,
|
|
2395
|
-
|
|
2396
|
-
|
|
2395
|
+
Ve as CHECKBOX_FORMULA_1,
|
|
2396
|
+
Me as CHECKBOX_FORMULA_2,
|
|
2397
2397
|
aa as CheckboxValidator,
|
|
2398
2398
|
pa as ClearRangeDataValidationCommand,
|
|
2399
2399
|
Gt as DATA_VALIDATION_PLUGIN_NAME,
|
|
@@ -2402,13 +2402,13 @@ export {
|
|
|
2402
2402
|
Te as DataValidationFormulaController,
|
|
2403
2403
|
K as DataValidationFormulaService,
|
|
2404
2404
|
sa as DateValidator,
|
|
2405
|
-
|
|
2405
|
+
Ia as ListMultipleValidator,
|
|
2406
2406
|
mt as ListValidator,
|
|
2407
2407
|
fa as RemoveSheetAllDataValidationCommand,
|
|
2408
|
-
|
|
2408
|
+
va as RemoveSheetDataValidationCommand,
|
|
2409
2409
|
F as SheetDataValidationModel,
|
|
2410
|
-
|
|
2411
|
-
|
|
2410
|
+
we as SheetsDataValidationValidatorService,
|
|
2411
|
+
Oe as UniverSheetsDataValidationPlugin,
|
|
2412
2412
|
_a as UpdateSheetDataValidationOptionsCommand,
|
|
2413
2413
|
ha as UpdateSheetDataValidationRangeCommand,
|
|
2414
2414
|
ga as UpdateSheetDataValidationSettingCommand,
|
|
@@ -2416,10 +2416,10 @@ export {
|
|
|
2416
2416
|
fe as deserializeListOptions,
|
|
2417
2417
|
ne as getCellValueOrigin,
|
|
2418
2418
|
Xa as getDataValidationCellValue,
|
|
2419
|
-
|
|
2419
|
+
be as getDataValidationDiffMutations,
|
|
2420
2420
|
_e as getFormulaCellData,
|
|
2421
2421
|
oe as getFormulaResult,
|
|
2422
|
-
|
|
2422
|
+
C as isLegalFormulaResult,
|
|
2423
2423
|
Ya as serializeListOptions,
|
|
2424
2424
|
pe as transformCheckboxValue
|
|
2425
2425
|
};
|