@univerjs/sheets-data-validation 0.10.12 → 0.10.13-nightly.202510290902
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/index.js +1 -1
- package/lib/es/index.js +395 -361
- package/lib/index.js +395 -361
- package/lib/umd/index.js +1 -1
- package/package.json +9 -9
- package/LICENSE +0 -176
package/lib/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
var St = Object.defineProperty;
|
|
2
2
|
var Et = (o, a, e) => a in o ? St(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e;
|
|
3
3
|
var m = (o, a, e) => Et(o, typeof a != "symbol" ? a + "" : a, e);
|
|
4
|
-
import { Inject as v, ICommandService as
|
|
5
|
-
import { DataValidationModel as
|
|
4
|
+
import { Inject as v, ICommandService as U, IUniverInstanceService as O, Disposable as W, ObjectMatrix as Se, getIntersectRange as ot, UniverInstanceType as N, Range as L, Rectangle as I, isFormulaString as S, DataValidationType as T, getOriginCellValue as Vt, RBush as Mt, debounce as yt, Tools as E, DataValidationStatus as b, WrapStrategy as ve, DataValidationOperator as h, numfmt as P, dayjs as st, DataValidationRenderMode as Pe, CommandType as z, IUndoRedoService as Z, sequenceExecute as Ae, isRangesEqual as nt, IPermissionService as Tt, generateRandomId as Ye, toDisposable as Xe, Injector as Ke, CellValueType as Ft, RxDisposable as Nt, LifecycleService as Ct, LifecycleStages as et, bufferDebounceTime as Ot, DependentOn as wt, IConfigService as It, Plugin as At, merge as Dt } from "@univerjs/core";
|
|
5
|
+
import { DataValidationModel as De, DataValidatorRegistryService as q, UpdateRuleType as M, BaseDataValidator as G, TextLengthErrorTitleMap as bt, AddDataValidationMutation as D, RemoveDataValidationMutation as A, UpdateDataValidationMutation as y, getRuleSetting as Lt, getRuleOptions as Ut, UniverDataValidationPlugin as Bt } from "@univerjs/data-validation";
|
|
6
6
|
import { ERROR_TYPE_SET as xt, LexerTreeBuilder as Y, isReferenceString as lt, sequenceNodeType as Pt, deserializeRangeWithSheet as Ht, deserializeRangeWithSheetWithCache as Wt, operatorToken as $t } from "@univerjs/engine-formula";
|
|
7
|
-
import { SetRangeValuesMutation as se, RemoveSheetMutation as ut, getSheetCommandTarget as
|
|
8
|
-
import { Subject as Ge, bufferWhen as
|
|
7
|
+
import { SetRangeValuesMutation as se, RemoveSheetMutation as ut, getSheetCommandTarget as ze, SetRangeValuesUndoMutationFactory as dt, WorksheetViewPermission as kt, RefRangeService as jt, handleCommonDefaultRangeChangeWithEffectRefCommands as Qt, SheetInterceptorService as ct, RemoveSheetCommand as qt, CopySheetCommand as Gt, SheetsSelectionsService as ht, ClearSelectionAllCommand as Yt } from "@univerjs/sheets";
|
|
8
|
+
import { Subject as Ge, bufferWhen as Xt, filter as tt } from "rxjs";
|
|
9
9
|
import { RegisterOtherFormulaService as mt, FormulaRefRangeService as gt } from "@univerjs/sheets-formula";
|
|
10
|
-
var
|
|
11
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
10
|
+
var Kt = Object.getOwnPropertyDescriptor, zt = (o, a, e, t) => {
|
|
11
|
+
for (var r = t > 1 ? void 0 : t ? Kt(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
12
12
|
(s = o[i]) && (r = s(r) || r);
|
|
13
13
|
return r;
|
|
14
14
|
}, He = (o, a) => (e, t) => a(e, t, o);
|
|
@@ -27,7 +27,7 @@ let Q = class extends W {
|
|
|
27
27
|
if (e) {
|
|
28
28
|
const i = new Se(e).getDataRange();
|
|
29
29
|
if (i.endRow === -1) return;
|
|
30
|
-
const l = this._sheetDataValidationModel.getRules(t, r).map((u) => u.ranges).flat().map((u) =>
|
|
30
|
+
const l = this._sheetDataValidationModel.getRules(t, r).map((u) => u.ranges).flat().map((u) => ot(u, i)).filter(Boolean);
|
|
31
31
|
l.length && this.markRangeDirty(t, r, l, !0);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -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
|
+
L.foreach(s, (n, l) => {
|
|
66
66
|
i.getValue(n, l) !== void 0 && 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
|
+
L.foreach(i, (s, n) => {
|
|
74
74
|
r.realDeleteValue(s, n);
|
|
75
75
|
});
|
|
76
76
|
}), this._dirtyRanges$.next({ unitId: a, subUnitId: e, ranges: t });
|
|
@@ -79,20 +79,20 @@ let Q = class extends W {
|
|
|
79
79
|
return this._ensureCache(a, e).getValue(t, r);
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
-
Q =
|
|
83
|
-
He(0, v(
|
|
84
|
-
He(1, v(
|
|
85
|
-
He(2, v(
|
|
82
|
+
Q = zt([
|
|
83
|
+
He(0, v(U)),
|
|
84
|
+
He(1, v(O)),
|
|
85
|
+
He(2, v(De))
|
|
86
86
|
], Q);
|
|
87
87
|
function oe(o) {
|
|
88
88
|
var a, e;
|
|
89
89
|
return (e = (a = o == null ? void 0 : o[0]) == null ? void 0 : a[0]) == null ? void 0 : e.v;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function pe(o) {
|
|
92
92
|
var a;
|
|
93
93
|
return (a = o == null ? void 0 : o[0]) == null ? void 0 : a[0];
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function C(o) {
|
|
96
96
|
return !xt.has(o);
|
|
97
97
|
}
|
|
98
98
|
function de(o, a) {
|
|
@@ -100,8 +100,8 @@ function de(o, a) {
|
|
|
100
100
|
const e = a.getValidatorItem(o);
|
|
101
101
|
return (t = e == null ? void 0 : e.offsetFormulaByRange) != null ? t : !1;
|
|
102
102
|
}
|
|
103
|
-
var
|
|
104
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
103
|
+
var Zt = Object.getOwnPropertyDescriptor, Jt = (o, a, e, t) => {
|
|
104
|
+
for (var r = t > 1 ? void 0 : t ? Zt(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
105
105
|
(s = o[i]) && (r = s(r) || r);
|
|
106
106
|
return r;
|
|
107
107
|
}, re = (o, a) => (e, t) => a(e, t, o);
|
|
@@ -122,7 +122,7 @@ let H = class extends W {
|
|
|
122
122
|
this.disposeWithMe(this._registerOtherFormulaService.formulaResult$.subscribe((a) => {
|
|
123
123
|
for (const e in a) {
|
|
124
124
|
const t = a[e];
|
|
125
|
-
if (this._instanceSrv.getUnitType(e) ===
|
|
125
|
+
if (this._instanceSrv.getUnitType(e) === N.UNIVER_SHEET)
|
|
126
126
|
for (const i in t) {
|
|
127
127
|
const s = t[i], { ruleFormulaMap: n } = this._ensureMaps(e, i);
|
|
128
128
|
s.forEach((l) => {
|
|
@@ -193,36 +193,36 @@ let H = class extends W {
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
async getCellFormulaValue(a, e, t, r, i) {
|
|
196
|
-
var
|
|
196
|
+
var f, p;
|
|
197
197
|
const { ruleFormulaMap: s } = this._ensureMaps(a, e), n = s.get(t);
|
|
198
198
|
if (!n)
|
|
199
199
|
return Promise.resolve(void 0);
|
|
200
200
|
const l = await this._registerOtherFormulaService.getFormulaValue(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, g = i - d;
|
|
201
|
-
return
|
|
201
|
+
return pe((p = (f = l == null ? void 0 : l.result) == null ? void 0 : f[c]) == null ? void 0 : p[g]);
|
|
202
202
|
}
|
|
203
203
|
async getCellFormula2Value(a, e, t, r, i) {
|
|
204
|
-
var
|
|
204
|
+
var f, p;
|
|
205
205
|
const { ruleFormulaMap2: s } = this._ensureMaps(a, e), n = s.get(t);
|
|
206
206
|
if (!n)
|
|
207
207
|
return Promise.resolve(void 0);
|
|
208
208
|
const l = await this._registerOtherFormulaService.getFormulaValue(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, g = i - d;
|
|
209
|
-
return
|
|
209
|
+
return pe((p = (f = l == null ? void 0 : l.result) == null ? void 0 : f[c]) == null ? void 0 : p[g]);
|
|
210
210
|
}
|
|
211
211
|
getCellFormulaValueSync(a, e, t, r, i) {
|
|
212
|
-
var
|
|
212
|
+
var f, p;
|
|
213
213
|
const { ruleFormulaMap: s } = this._ensureMaps(a, e), n = s.get(t);
|
|
214
214
|
if (!n)
|
|
215
215
|
return;
|
|
216
216
|
const l = this._registerOtherFormulaService.getFormulaValueSync(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, g = i - d;
|
|
217
|
-
return
|
|
217
|
+
return pe((p = (f = l == null ? void 0 : l.result) == null ? void 0 : f[c]) == null ? void 0 : p[g]);
|
|
218
218
|
}
|
|
219
219
|
getCellFormula2ValueSync(a, e, t, r, i) {
|
|
220
|
-
var
|
|
220
|
+
var f, p;
|
|
221
221
|
const { ruleFormulaMap2: s } = this._ensureMaps(a, e), n = s.get(t);
|
|
222
222
|
if (!n)
|
|
223
223
|
return;
|
|
224
224
|
const l = this._registerOtherFormulaService.getFormulaValueSync(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, g = i - d;
|
|
225
|
-
return
|
|
225
|
+
return pe((p = (f = l == null ? void 0 : l.result) == null ? void 0 : f[c]) == null ? void 0 : p[g]);
|
|
226
226
|
}
|
|
227
227
|
getRuleFormulaInfo(a, e, t) {
|
|
228
228
|
const { ruleFormulaMap: r } = this._ensureMaps(a, e);
|
|
@@ -234,15 +234,15 @@ let H = class extends W {
|
|
|
234
234
|
r && this._registerOtherFormulaService.markFormulaDirty(a, e, r.formulaId), i && this._registerOtherFormulaService.markFormulaDirty(a, e, i.formulaId);
|
|
235
235
|
}
|
|
236
236
|
};
|
|
237
|
-
H =
|
|
238
|
-
re(0,
|
|
237
|
+
H = Jt([
|
|
238
|
+
re(0, O),
|
|
239
239
|
re(1, v(mt)),
|
|
240
|
-
re(2, v(
|
|
240
|
+
re(2, v(De)),
|
|
241
241
|
re(3, v(Q)),
|
|
242
242
|
re(4, v(q))
|
|
243
243
|
], H);
|
|
244
|
-
var
|
|
245
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
244
|
+
var ea = Object.getOwnPropertyDescriptor, ta = (o, a, e, t) => {
|
|
245
|
+
for (var r = t > 1 ? void 0 : t ? ea(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
246
246
|
(s = o[i]) && (r = s(r) || r);
|
|
247
247
|
return r;
|
|
248
248
|
}, ie = (o, a) => (e, t) => a(e, t, o);
|
|
@@ -256,7 +256,7 @@ let K = class extends W {
|
|
|
256
256
|
this.disposeWithMe(this._registerOtherFormulaService.formulaResult$.subscribe((a) => {
|
|
257
257
|
for (const e in a) {
|
|
258
258
|
const t = a[e];
|
|
259
|
-
if (this._instanceService.getUnitType(e) ===
|
|
259
|
+
if (this._instanceService.getUnitType(e) === N.UNIVER_SHEET)
|
|
260
260
|
for (const i in t) {
|
|
261
261
|
const s = t[i], n = this._ensureRuleFormulaMap(e, i);
|
|
262
262
|
s.forEach((l) => {
|
|
@@ -326,21 +326,21 @@ let K = class extends W {
|
|
|
326
326
|
return this._ensureRuleFormulaMap(a, e).get(t);
|
|
327
327
|
}
|
|
328
328
|
};
|
|
329
|
-
K =
|
|
330
|
-
ie(0,
|
|
329
|
+
K = ta([
|
|
330
|
+
ie(0, O),
|
|
331
331
|
ie(1, v(mt)),
|
|
332
332
|
ie(2, v(Q)),
|
|
333
|
-
ie(3, v(
|
|
333
|
+
ie(3, v(De)),
|
|
334
334
|
ie(4, v(q))
|
|
335
335
|
], K);
|
|
336
336
|
function ne(o) {
|
|
337
337
|
return Vt(o);
|
|
338
338
|
}
|
|
339
|
-
function
|
|
339
|
+
function pt(o) {
|
|
340
340
|
var a;
|
|
341
341
|
return String((a = ne(o)) != null ? a : "");
|
|
342
342
|
}
|
|
343
|
-
class
|
|
343
|
+
class Ze {
|
|
344
344
|
constructor(a, e, t, r, i = !1) {
|
|
345
345
|
m(this, "_map");
|
|
346
346
|
m(this, "_tree", new Mt());
|
|
@@ -367,12 +367,12 @@ class ze {
|
|
|
367
367
|
}
|
|
368
368
|
get _worksheet() {
|
|
369
369
|
var a;
|
|
370
|
-
return (a = this._univerInstanceService.getUnit(this._unitId,
|
|
370
|
+
return (a = this._univerInstanceService.getUnit(this._unitId, N.UNIVER_SHEET)) == null ? void 0 : a.getSheetBySheetId(this._subUnitId);
|
|
371
371
|
}
|
|
372
372
|
_addRule(a, e) {
|
|
373
373
|
if (!this._worksheet)
|
|
374
374
|
return;
|
|
375
|
-
const t = I.mergeRanges(e.map((r) =>
|
|
375
|
+
const t = I.mergeRanges(e.map((r) => L.transformRange(r, this._worksheet)));
|
|
376
376
|
this._map.forEach((r, i) => {
|
|
377
377
|
const s = I.subtractMulti(r, t);
|
|
378
378
|
s.length === 0 ? this._map.delete(i) : this._map.set(i, s);
|
|
@@ -384,7 +384,7 @@ class ze {
|
|
|
384
384
|
removeRange(a) {
|
|
385
385
|
if (!this._worksheet)
|
|
386
386
|
return;
|
|
387
|
-
const e = a.map((t) =>
|
|
387
|
+
const e = a.map((t) => L.transformRange(t, this._worksheet));
|
|
388
388
|
this._map.forEach((t, r) => {
|
|
389
389
|
const i = I.subtractMulti(t, e);
|
|
390
390
|
i.length === 0 ? this._map.delete(r) : this._map.set(r, i);
|
|
@@ -461,7 +461,7 @@ class ze {
|
|
|
461
461
|
}), t;
|
|
462
462
|
}
|
|
463
463
|
clone() {
|
|
464
|
-
return new
|
|
464
|
+
return new Ze(
|
|
465
465
|
new Map(E.deepClone(Array.from(this._map.entries()))),
|
|
466
466
|
this._unitId,
|
|
467
467
|
this._subUnitId,
|
|
@@ -481,8 +481,8 @@ class ze {
|
|
|
481
481
|
return t.length > 0 ? t[0].ruleId : void 0;
|
|
482
482
|
}
|
|
483
483
|
}
|
|
484
|
-
var
|
|
485
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
484
|
+
var aa = Object.getOwnPropertyDescriptor, ra = (o, a, e, t) => {
|
|
485
|
+
for (var r = t > 1 ? void 0 : t ? aa(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
486
486
|
(s = o[i]) && (r = s(r) || r);
|
|
487
487
|
return r;
|
|
488
488
|
}, X = (o, a) => (e, t) => a(e, t, o);
|
|
@@ -545,7 +545,7 @@ let F = class extends W {
|
|
|
545
545
|
let t = this._ruleMatrixMap.get(a);
|
|
546
546
|
t || (t = /* @__PURE__ */ new Map(), this._ruleMatrixMap.set(a, t));
|
|
547
547
|
let r = t.get(e);
|
|
548
|
-
return r || (r = new
|
|
548
|
+
return r || (r = new Ze(/* @__PURE__ */ new Map(), a, e, this._univerInstanceService), t.set(e, r)), r;
|
|
549
549
|
}
|
|
550
550
|
_addRuleSideEffect(a, e, t) {
|
|
551
551
|
this._ensureRuleMatrix(a, e).addRule(t), this._dataValidationCacheService.addRule(a, e, t), this._dataValidationFormulaService.addRule(a, e, t), this._dataValidationCustomFormulaService.addRule(a, e, t);
|
|
@@ -577,21 +577,21 @@ let F = class extends W {
|
|
|
577
577
|
return this._dataValidationModel.getRuleById(a, e, i);
|
|
578
578
|
}
|
|
579
579
|
validator(a, e, t) {
|
|
580
|
-
const { col: r, row: i, unitId: s, subUnitId: n, worksheet: l } = e, u = (
|
|
581
|
-
t && t(
|
|
580
|
+
const { col: r, row: i, unitId: s, subUnitId: n, worksheet: l } = e, u = (p, R) => {
|
|
581
|
+
t && t(p, R), R && this._validStatusChange$.next({
|
|
582
582
|
unitId: s,
|
|
583
583
|
subUnitId: n,
|
|
584
584
|
ruleId: a.uid,
|
|
585
|
-
status:
|
|
585
|
+
status: p,
|
|
586
586
|
row: i,
|
|
587
587
|
col: r
|
|
588
588
|
});
|
|
589
|
-
}, d = l.getCellValueOnly(i, r), c = this.getValidator(a.type), g = l.getCellRaw(i, r),
|
|
589
|
+
}, d = l.getCellValueOnly(i, r), c = this.getValidator(a.type), g = l.getCellRaw(i, r), f = ne(g);
|
|
590
590
|
if (c) {
|
|
591
|
-
const
|
|
592
|
-
return R == null ? (
|
|
591
|
+
const p = this._dataValidationCacheService.ensureCache(s, n), R = p.getValue(i, r);
|
|
592
|
+
return R == null ? (p.setValue(i, r, b.VALIDATING), c.validator(
|
|
593
593
|
{
|
|
594
|
-
value:
|
|
594
|
+
value: f,
|
|
595
595
|
unitId: s,
|
|
596
596
|
subUnitId: n,
|
|
597
597
|
row: i,
|
|
@@ -603,11 +603,11 @@ let F = class extends W {
|
|
|
603
603
|
},
|
|
604
604
|
a
|
|
605
605
|
).then((V) => {
|
|
606
|
-
const
|
|
607
|
-
|
|
608
|
-
}),
|
|
606
|
+
const _ = V ? b.VALID : b.INVALID, w = p.getValue(i, r);
|
|
607
|
+
_ === b.VALID ? p.realDeleteValue(i, r) : p.setValue(i, r, _), u(_, R !== w);
|
|
608
|
+
}), b.VALIDATING) : (u(R != null ? R : b.VALID, !1), R != null ? R : b.VALID);
|
|
609
609
|
} else
|
|
610
|
-
return u(
|
|
610
|
+
return u(b.VALID, !1), b.VALID;
|
|
611
611
|
}
|
|
612
612
|
getRuleObjectMatrix(a, e) {
|
|
613
613
|
return this._ensureRuleMatrix(a, e);
|
|
@@ -634,21 +634,21 @@ let F = class extends W {
|
|
|
634
634
|
return this._dataValidationModel.getAll();
|
|
635
635
|
}
|
|
636
636
|
};
|
|
637
|
-
F =
|
|
638
|
-
X(0, v(
|
|
639
|
-
X(1,
|
|
637
|
+
F = ra([
|
|
638
|
+
X(0, v(De)),
|
|
639
|
+
X(1, O),
|
|
640
640
|
X(2, v(q)),
|
|
641
641
|
X(3, v(Q)),
|
|
642
642
|
X(4, v(K)),
|
|
643
643
|
X(5, v(H)),
|
|
644
|
-
X(6,
|
|
644
|
+
X(6, U)
|
|
645
645
|
], F);
|
|
646
646
|
const Ee = 1, Ve = 0;
|
|
647
|
-
function
|
|
647
|
+
function at(o, a) {
|
|
648
648
|
return E.isBlank(o) ? a.t("dataValidation.validFail.value") : S(o) ? a.t("dataValidation.validFail.primitive") : "";
|
|
649
649
|
}
|
|
650
|
-
const
|
|
651
|
-
class
|
|
650
|
+
const fe = (o) => E.isDefine(o) && String(o).toLowerCase() === "true" ? "1" : String(o).toLowerCase() === "false" ? "0" : o;
|
|
651
|
+
class ia extends G {
|
|
652
652
|
constructor() {
|
|
653
653
|
super(...arguments);
|
|
654
654
|
m(this, "id", T.CHECKBOX);
|
|
@@ -675,7 +675,7 @@ class ra extends G {
|
|
|
675
675
|
formula1: this.localeService.t("dataValidation.validFail.checkboxEqual"),
|
|
676
676
|
formula2: this.localeService.t("dataValidation.validFail.checkboxEqual")
|
|
677
677
|
};
|
|
678
|
-
const l =
|
|
678
|
+
const l = at(i, this.localeService), u = at(s, this.localeService);
|
|
679
679
|
return {
|
|
680
680
|
success: !l && !u,
|
|
681
681
|
formula1: l,
|
|
@@ -683,11 +683,11 @@ class ra extends G {
|
|
|
683
683
|
};
|
|
684
684
|
}
|
|
685
685
|
async parseFormula(e, t, r) {
|
|
686
|
-
var c, g,
|
|
687
|
-
const { formula1: i = Ee, formula2: s = Ve } = e, n = await this._formulaService.getRuleFormulaResult(t, r, e.uid), l = S(i) ? oe((g = (c = n == null ? void 0 : n[0]) == null ? void 0 : c.result) == null ? void 0 : g[0][0]) : i, u = S(s) ? oe((
|
|
686
|
+
var c, g, f, p;
|
|
687
|
+
const { formula1: i = Ee, formula2: s = Ve } = e, n = await this._formulaService.getRuleFormulaResult(t, r, e.uid), l = S(i) ? oe((g = (c = n == null ? void 0 : n[0]) == null ? void 0 : c.result) == null ? void 0 : g[0][0]) : i, u = S(s) ? oe((p = (f = n == null ? void 0 : n[1]) == null ? void 0 : f.result) == null ? void 0 : p[0][0]) : s, d = C(String(l)) && C(String(u));
|
|
688
688
|
return {
|
|
689
|
-
formula1:
|
|
690
|
-
formula2:
|
|
689
|
+
formula1: fe(l),
|
|
690
|
+
formula2: fe(u),
|
|
691
691
|
originFormula1: l,
|
|
692
692
|
originFormula2: u,
|
|
693
693
|
isFormulaValid: d
|
|
@@ -699,11 +699,11 @@ class ra extends G {
|
|
|
699
699
|
};
|
|
700
700
|
}
|
|
701
701
|
parseFormulaSync(e, t, r) {
|
|
702
|
-
var c, g,
|
|
703
|
-
const { formula1: i = Ee, formula2: s = Ve } = e, n = this._formulaService.getRuleFormulaResultSync(t, r, e.uid), l = S(i) ? oe((g = (c = n == null ? void 0 : n[0]) == null ? void 0 : c.result) == null ? void 0 : g[0][0]) : i, u = S(s) ? oe((
|
|
702
|
+
var c, g, f, p;
|
|
703
|
+
const { formula1: i = Ee, formula2: s = Ve } = e, n = this._formulaService.getRuleFormulaResultSync(t, r, e.uid), l = S(i) ? oe((g = (c = n == null ? void 0 : n[0]) == null ? void 0 : c.result) == null ? void 0 : g[0][0]) : i, u = S(s) ? oe((p = (f = n == null ? void 0 : n[1]) == null ? void 0 : f.result) == null ? void 0 : p[0][0]) : s, d = C(String(l)) && C(String(u));
|
|
704
704
|
return {
|
|
705
|
-
formula1:
|
|
706
|
-
formula2:
|
|
705
|
+
formula1: fe(l),
|
|
706
|
+
formula2: fe(u),
|
|
707
707
|
originFormula1: l,
|
|
708
708
|
originFormula2: u,
|
|
709
709
|
isFormulaValid: d
|
|
@@ -720,7 +720,7 @@ class ra extends G {
|
|
|
720
720
|
return this.titleStr;
|
|
721
721
|
}
|
|
722
722
|
}
|
|
723
|
-
const
|
|
723
|
+
const oa = {
|
|
724
724
|
[h.BETWEEN]: "dataValidation.date.operators.between",
|
|
725
725
|
[h.EQUAL]: "dataValidation.date.operators.equal",
|
|
726
726
|
[h.GREATER_THAN]: "dataValidation.date.operators.greaterThan",
|
|
@@ -731,7 +731,7 @@ const ia = {
|
|
|
731
731
|
[h.NOT_EQUAL]: "dataValidation.date.operators.notEqual"
|
|
732
732
|
};
|
|
733
733
|
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 + "";
|
|
734
|
-
const
|
|
734
|
+
const rt = {
|
|
735
735
|
[h.BETWEEN]: "dataValidation.date.ruleName.between",
|
|
736
736
|
[h.EQUAL]: "dataValidation.date.ruleName.equal",
|
|
737
737
|
[h.GREATER_THAN]: "dataValidation.date.ruleName.greaterThan",
|
|
@@ -741,7 +741,7 @@ const at = {
|
|
|
741
741
|
[h.NOT_BETWEEN]: "dataValidation.date.ruleName.notBetween",
|
|
742
742
|
[h.NOT_EQUAL]: "dataValidation.date.ruleName.notEqual",
|
|
743
743
|
NONE: "dataValidation.date.ruleName.legal"
|
|
744
|
-
},
|
|
744
|
+
}, sa = {
|
|
745
745
|
[h.BETWEEN]: "dataValidation.date.errorMsg.between",
|
|
746
746
|
[h.EQUAL]: "dataValidation.date.errorMsg.equal",
|
|
747
747
|
[h.GREATER_THAN]: "dataValidation.date.errorMsg.greaterThan",
|
|
@@ -755,13 +755,13 @@ const at = {
|
|
|
755
755
|
h.BETWEEN,
|
|
756
756
|
h.NOT_BETWEEN
|
|
757
757
|
], le = "{FORMULA1}", ue = "{FORMULA2}";
|
|
758
|
-
function
|
|
758
|
+
function Ka(o) {
|
|
759
759
|
return o.filter(Boolean).join(",");
|
|
760
760
|
}
|
|
761
|
-
function
|
|
761
|
+
function _e(o) {
|
|
762
762
|
return o.split(",").filter(Boolean);
|
|
763
763
|
}
|
|
764
|
-
function
|
|
764
|
+
function za(o) {
|
|
765
765
|
const a = ne(o);
|
|
766
766
|
return a == null ? "" : a.toString();
|
|
767
767
|
}
|
|
@@ -779,9 +779,9 @@ const We = (o) => {
|
|
|
779
779
|
if (typeof o == "number" || !Number.isNaN(+o))
|
|
780
780
|
return +o;
|
|
781
781
|
const a = (e = P.parseDate(o)) == null ? void 0 : e.v;
|
|
782
|
-
return E.isDefine(a) ? a : (t = P.parseDate(
|
|
782
|
+
return E.isDefine(a) ? a : (t = P.parseDate(st(o).format("YYYY-MM-DD HH:mm:ss"))) == null ? void 0 : t.v;
|
|
783
783
|
};
|
|
784
|
-
class
|
|
784
|
+
class na extends G {
|
|
785
785
|
constructor() {
|
|
786
786
|
super(...arguments);
|
|
787
787
|
m(this, "id", T.DATE);
|
|
@@ -802,7 +802,7 @@ class sa extends G {
|
|
|
802
802
|
m(this, "_lexerTreeBuilder", this.injector.get(Y));
|
|
803
803
|
}
|
|
804
804
|
async parseFormula(e, t, r, i, s) {
|
|
805
|
-
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c =
|
|
805
|
+
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c = C(String(n == null ? void 0 : n.v)) && C(String(l == null ? void 0 : l.v));
|
|
806
806
|
return {
|
|
807
807
|
formula1: We(S(u) ? n == null ? void 0 : n.v : u),
|
|
808
808
|
formula2: We(S(d) ? l == null ? void 0 : l.v : d),
|
|
@@ -850,7 +850,7 @@ class sa extends G {
|
|
|
850
850
|
return "";
|
|
851
851
|
d = P.dateFromSerial(g);
|
|
852
852
|
}
|
|
853
|
-
return
|
|
853
|
+
return st(`${d[0]}/${d[1]}/${d[2]} ${d[3]}:${d[4]}:${d[5]}`).format(n != null && n.showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD");
|
|
854
854
|
};
|
|
855
855
|
return {
|
|
856
856
|
formula1: S(i) ? i : l(`${i}`),
|
|
@@ -865,20 +865,20 @@ class sa extends G {
|
|
|
865
865
|
};
|
|
866
866
|
}
|
|
867
867
|
get operatorNames() {
|
|
868
|
-
return this.operators.map((e) => this.localeService.t(
|
|
868
|
+
return this.operators.map((e) => this.localeService.t(oa[e]));
|
|
869
869
|
}
|
|
870
870
|
generateRuleName(e) {
|
|
871
871
|
var r, i;
|
|
872
872
|
if (!e.operator)
|
|
873
|
-
return this.localeService.t(
|
|
874
|
-
const t = this.localeService.t(
|
|
873
|
+
return this.localeService.t(rt.NONE);
|
|
874
|
+
const t = this.localeService.t(rt[e.operator]).replace(le, (r = e.formula1) != null ? r : "").replace(ue, (i = e.formula2) != null ? i : "");
|
|
875
875
|
return `${this.titleStr} ${t}`;
|
|
876
876
|
}
|
|
877
877
|
generateRuleErrorMessage(e, t) {
|
|
878
878
|
if (!e.operator)
|
|
879
879
|
return this.titleStr;
|
|
880
880
|
const { transformedFormula1: r, transformedFormula2: i } = Le(this._lexerTreeBuilder, e, t);
|
|
881
|
-
return `${this.localeService.t(
|
|
881
|
+
return `${this.localeService.t(sa[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
882
882
|
}
|
|
883
883
|
}
|
|
884
884
|
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 + "";
|
|
@@ -897,7 +897,7 @@ const Me = {
|
|
|
897
897
|
function ye(o) {
|
|
898
898
|
return +o;
|
|
899
899
|
}
|
|
900
|
-
class
|
|
900
|
+
class la extends G {
|
|
901
901
|
constructor() {
|
|
902
902
|
super(...arguments);
|
|
903
903
|
m(this, "_customFormulaService", this.injector.get(H));
|
|
@@ -935,7 +935,7 @@ class na extends G {
|
|
|
935
935
|
return e == null ? Number.NaN : +e;
|
|
936
936
|
}
|
|
937
937
|
async parseFormula(e, t, r, i, s) {
|
|
938
|
-
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c =
|
|
938
|
+
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c = C(String(n == null ? void 0 : n.v)) && C(String(l == null ? void 0 : l.v));
|
|
939
939
|
return {
|
|
940
940
|
formula1: this._parseNumber(S(u) ? n == null ? void 0 : n.v : u),
|
|
941
941
|
formula2: this._parseNumber(S(d) ? l == null ? void 0 : l.v : d),
|
|
@@ -979,25 +979,25 @@ function $e(o) {
|
|
|
979
979
|
a.add(P.format(t.s.n.pattern, r, { throws: !1 }));
|
|
980
980
|
return;
|
|
981
981
|
}
|
|
982
|
-
|
|
982
|
+
C(r.toString()) && a.add(r.toString());
|
|
983
983
|
}
|
|
984
984
|
});
|
|
985
985
|
}
|
|
986
986
|
), [...a];
|
|
987
987
|
}
|
|
988
|
-
const
|
|
988
|
+
const ua = [
|
|
989
989
|
"if",
|
|
990
990
|
"indirect",
|
|
991
991
|
"choose",
|
|
992
992
|
"offset"
|
|
993
993
|
];
|
|
994
|
-
function
|
|
994
|
+
function da(o, a) {
|
|
995
995
|
if (!S(o) || lt(o.slice(1)))
|
|
996
996
|
return !0;
|
|
997
997
|
const t = a.sequenceNodesBuilder(o);
|
|
998
|
-
return t && t.some((r) => typeof r == "object" && r.nodeType === Pt.FUNCTION &&
|
|
998
|
+
return t && t.some((r) => typeof r == "object" && r.nodeType === Pt.FUNCTION && ua.indexOf(r.token.toLowerCase()) > -1);
|
|
999
999
|
}
|
|
1000
|
-
function
|
|
1000
|
+
function ca(o, a) {
|
|
1001
1001
|
const { formula1: e = "", ranges: t } = o;
|
|
1002
1002
|
if (lt(e.slice(1))) {
|
|
1003
1003
|
const i = Ht(e.slice(1));
|
|
@@ -1006,12 +1006,12 @@ function da(o, a) {
|
|
|
1006
1006
|
}
|
|
1007
1007
|
return !1;
|
|
1008
1008
|
}
|
|
1009
|
-
class
|
|
1009
|
+
class ft extends G {
|
|
1010
1010
|
constructor() {
|
|
1011
1011
|
super(...arguments);
|
|
1012
1012
|
m(this, "formulaService", this.injector.get(K));
|
|
1013
1013
|
m(this, "_lexer", this.injector.get(Y));
|
|
1014
|
-
m(this, "_univerInstanceService", this.injector.get(
|
|
1014
|
+
m(this, "_univerInstanceService", this.injector.get(O));
|
|
1015
1015
|
m(this, "order", 50);
|
|
1016
1016
|
m(this, "offsetFormulaByRange", !1);
|
|
1017
1017
|
m(this, "id", T.LIST);
|
|
@@ -1022,7 +1022,7 @@ class pt extends G {
|
|
|
1022
1022
|
}
|
|
1023
1023
|
validatorFormula(e, t, r) {
|
|
1024
1024
|
var u, d, c;
|
|
1025
|
-
const i = !E.isBlank(e.formula1), s =
|
|
1025
|
+
const i = !E.isBlank(e.formula1), s = da((u = e.formula1) != null ? u : "", this._lexer), n = (c = (d = this._univerInstanceService.getUnit(t, N.UNIVER_SHEET)) == null ? void 0 : d.getSheetBySheetId(r)) == null ? void 0 : c.getName(), l = ca(e, n != null ? n : "");
|
|
1026
1026
|
return {
|
|
1027
1027
|
success: !!(i && s && !l),
|
|
1028
1028
|
formula1: i ? s ? l ? this.localeService.t("dataValidation.validFail.listIntersects") : void 0 : this.localeService.t("dataValidation.validFail.listInvalid") : this.localeService.t("dataValidation.validFail.list")
|
|
@@ -1047,7 +1047,7 @@ class pt extends G {
|
|
|
1047
1047
|
}
|
|
1048
1048
|
parseCellValue(e) {
|
|
1049
1049
|
const t = e.toString();
|
|
1050
|
-
return
|
|
1050
|
+
return _e(t);
|
|
1051
1051
|
}
|
|
1052
1052
|
async parseFormula(e, t, r) {
|
|
1053
1053
|
var l, u;
|
|
@@ -1055,13 +1055,13 @@ class pt extends G {
|
|
|
1055
1055
|
return {
|
|
1056
1056
|
formula1: void 0,
|
|
1057
1057
|
formula2: void 0,
|
|
1058
|
-
isFormulaValid:
|
|
1058
|
+
isFormulaValid: C(String(s))
|
|
1059
1059
|
};
|
|
1060
1060
|
}
|
|
1061
1061
|
async isValidType(e, t, r) {
|
|
1062
|
-
var g,
|
|
1063
|
-
const { value: i, unitId: s, subUnitId: n } = e, { formula1: l = "" } = r, u = await this.formulaService.getRuleFormulaResult(s, n, r.uid), d = S(l) ? $e((
|
|
1064
|
-
return this.parseCellValue(i).every((
|
|
1062
|
+
var g, f;
|
|
1063
|
+
const { value: i, unitId: s, subUnitId: n } = e, { formula1: l = "" } = r, u = await this.formulaService.getRuleFormulaResult(s, n, r.uid), d = S(l) ? $e((f = (g = u == null ? void 0 : u[0]) == null ? void 0 : g.result) == null ? void 0 : f[0][0]) : _e(l);
|
|
1064
|
+
return this.parseCellValue(i).every((p) => d.includes(p));
|
|
1065
1065
|
}
|
|
1066
1066
|
generateRuleName() {
|
|
1067
1067
|
return this.localeService.t("dataValidation.list.name");
|
|
@@ -1070,22 +1070,22 @@ class pt extends G {
|
|
|
1070
1070
|
return this.localeService.t("dataValidation.list.error");
|
|
1071
1071
|
}
|
|
1072
1072
|
getList(e, t, r) {
|
|
1073
|
-
var g,
|
|
1074
|
-
const { formula1: i = "" } = e, s = this.injector.get(
|
|
1073
|
+
var g, f, p, R;
|
|
1074
|
+
const { formula1: i = "" } = e, s = this.injector.get(O), n = (g = t ? s.getUniverSheetInstance(t) : void 0) != null ? g : s.getCurrentUnitForType(N.UNIVER_SHEET);
|
|
1075
1075
|
if (!n) return [];
|
|
1076
|
-
const l = (
|
|
1076
|
+
const l = (f = r ? n.getSheetBySheetId(r) : void 0) != null ? f : n.getActiveSheet();
|
|
1077
1077
|
if (!l) return [];
|
|
1078
1078
|
const u = n.getUnitId(), d = l.getSheetId(), c = this.formulaService.getRuleFormulaResultSync(u, d, e.uid);
|
|
1079
|
-
return S(i) ? $e((R = (
|
|
1079
|
+
return S(i) ? $e((R = (p = c == null ? void 0 : c[0]) == null ? void 0 : p.result) == null ? void 0 : R[0][0]) : _e(i);
|
|
1080
1080
|
}
|
|
1081
1081
|
async getListAsync(e, t, r) {
|
|
1082
|
-
var g,
|
|
1083
|
-
const { formula1: i = "" } = e, s = this.injector.get(
|
|
1082
|
+
var g, f, p, R;
|
|
1083
|
+
const { formula1: i = "" } = e, s = this.injector.get(O), n = (g = t ? s.getUniverSheetInstance(t) : void 0) != null ? g : s.getCurrentUnitForType(N.UNIVER_SHEET);
|
|
1084
1084
|
if (!n) return [];
|
|
1085
|
-
const l = (
|
|
1085
|
+
const l = (f = r ? n.getSheetBySheetId(r) : void 0) != null ? f : n.getActiveSheet();
|
|
1086
1086
|
if (!l) return [];
|
|
1087
1087
|
const u = n.getUnitId(), d = l.getSheetId(), c = await this.formulaService.getRuleFormulaResult(u, d, e.uid);
|
|
1088
|
-
return S(i) ? $e((R = (
|
|
1088
|
+
return S(i) ? $e((R = (p = c == null ? void 0 : c[0]) == null ? void 0 : p.result) == null ? void 0 : R[0][0]) : _e(i);
|
|
1089
1089
|
}
|
|
1090
1090
|
getListWithColor(e, t, r) {
|
|
1091
1091
|
const i = this.getList(e, t, r), s = (e.formula2 || "").split(",");
|
|
@@ -1098,7 +1098,7 @@ class pt extends G {
|
|
|
1098
1098
|
}), s;
|
|
1099
1099
|
}
|
|
1100
1100
|
}
|
|
1101
|
-
class
|
|
1101
|
+
class ha extends G {
|
|
1102
1102
|
constructor() {
|
|
1103
1103
|
super(...arguments);
|
|
1104
1104
|
m(this, "id", T.TEXT_LENGTH);
|
|
@@ -1141,7 +1141,7 @@ class ca extends G {
|
|
|
1141
1141
|
return e == null ? Number.NaN : +e;
|
|
1142
1142
|
}
|
|
1143
1143
|
async parseFormula(e, t, r, i, s) {
|
|
1144
|
-
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c =
|
|
1144
|
+
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c = C(String(n == null ? void 0 : n.v)) && C(String(l == null ? void 0 : l.v));
|
|
1145
1145
|
return {
|
|
1146
1146
|
formula1: this._parseNumber(S(u) ? n == null ? void 0 : n.v : u),
|
|
1147
1147
|
formula2: this._parseNumber(S(d) ? l == null ? void 0 : l.v : d),
|
|
@@ -1165,67 +1165,67 @@ class ca extends G {
|
|
|
1165
1165
|
return `${this.localeService.t(bt[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
1166
1166
|
}
|
|
1167
1167
|
}
|
|
1168
|
-
function
|
|
1168
|
+
function _t(o) {
|
|
1169
1169
|
var e, t;
|
|
1170
1170
|
return o ? o.p ? !((t = (e = o.p.body) == null ? void 0 : e.dataStream) != null ? t : "").slice(0, -2).trim() : E.isBlank(o.v) : !0;
|
|
1171
1171
|
}
|
|
1172
|
-
function
|
|
1173
|
-
const s = t.get(Y), n = t.get(q), l = [], u = [], d = t.get(F), c = t.get(
|
|
1172
|
+
function Ue(o, a, e, t, r = "command", i = !0) {
|
|
1173
|
+
const s = t.get(Y), n = t.get(q), l = [], u = [], d = t.get(F), c = t.get(O), g = ze(c, { unitId: o, subUnitId: a });
|
|
1174
1174
|
if (!g)
|
|
1175
1175
|
return {
|
|
1176
1176
|
redoMutations: l,
|
|
1177
1177
|
undoMutations: u
|
|
1178
1178
|
};
|
|
1179
|
-
const { worksheet:
|
|
1179
|
+
const { worksheet: f } = g, p = new Se();
|
|
1180
1180
|
let R = !1;
|
|
1181
|
-
function V(
|
|
1182
|
-
i &&
|
|
1183
|
-
|
|
1184
|
-
const x =
|
|
1185
|
-
(
|
|
1186
|
-
v:
|
|
1181
|
+
function V(_, w) {
|
|
1182
|
+
i && _.forEach(($) => {
|
|
1183
|
+
L.foreach($, (B, k) => {
|
|
1184
|
+
const x = f.getCellRaw(B, k), J = pt(x);
|
|
1185
|
+
(_t(x) || J === w) && !(x != null && x.p) && (R = !0, p.setValue(B, k, {
|
|
1186
|
+
v: w,
|
|
1187
1187
|
p: null
|
|
1188
1188
|
}));
|
|
1189
1189
|
});
|
|
1190
1190
|
});
|
|
1191
1191
|
}
|
|
1192
|
-
if (e.forEach((
|
|
1193
|
-
switch (
|
|
1192
|
+
if (e.forEach((_) => {
|
|
1193
|
+
switch (_.type) {
|
|
1194
1194
|
case "delete":
|
|
1195
1195
|
l.push({
|
|
1196
|
-
id:
|
|
1196
|
+
id: A.id,
|
|
1197
1197
|
params: {
|
|
1198
1198
|
unitId: o,
|
|
1199
1199
|
subUnitId: a,
|
|
1200
|
-
ruleId:
|
|
1200
|
+
ruleId: _.rule.uid,
|
|
1201
1201
|
source: r
|
|
1202
1202
|
}
|
|
1203
1203
|
}), u.unshift({
|
|
1204
|
-
id:
|
|
1204
|
+
id: D.id,
|
|
1205
1205
|
params: {
|
|
1206
1206
|
unitId: o,
|
|
1207
1207
|
subUnitId: a,
|
|
1208
|
-
rule:
|
|
1209
|
-
index:
|
|
1208
|
+
rule: _.rule,
|
|
1209
|
+
index: _.index,
|
|
1210
1210
|
source: r
|
|
1211
1211
|
}
|
|
1212
1212
|
});
|
|
1213
1213
|
break;
|
|
1214
1214
|
case "update": {
|
|
1215
|
-
if (de(
|
|
1216
|
-
const $ =
|
|
1217
|
-
he !==
|
|
1215
|
+
if (de(_.rule.type, n)) {
|
|
1216
|
+
const $ = _.oldRanges[0].startRow, B = _.oldRanges[0].startColumn, k = _.newRanges[0].startRow, x = _.newRanges[0].startColumn, J = k - $, ce = x - B, he = S(_.rule.formula1) ? s.moveFormulaRefOffset(_.rule.formula1, ce, J) : _.rule.formula1, me = S(_.rule.formula2) ? s.moveFormulaRefOffset(_.rule.formula2, ce, J) : _.rule.formula2;
|
|
1217
|
+
he !== _.rule.formula1 || me !== _.rule.formula2 || !nt(_.newRanges, _.oldRanges) ? (l.push({
|
|
1218
1218
|
id: y.id,
|
|
1219
1219
|
params: {
|
|
1220
1220
|
unitId: o,
|
|
1221
1221
|
subUnitId: a,
|
|
1222
|
-
ruleId:
|
|
1222
|
+
ruleId: _.ruleId,
|
|
1223
1223
|
payload: {
|
|
1224
1224
|
type: M.ALL,
|
|
1225
1225
|
payload: {
|
|
1226
1226
|
formula1: he,
|
|
1227
1227
|
formula2: me,
|
|
1228
|
-
ranges:
|
|
1228
|
+
ranges: _.newRanges
|
|
1229
1229
|
}
|
|
1230
1230
|
}
|
|
1231
1231
|
}
|
|
@@ -1234,13 +1234,13 @@ function Be(o, a, e, t, r = "command", i = !0) {
|
|
|
1234
1234
|
params: {
|
|
1235
1235
|
unitId: o,
|
|
1236
1236
|
subUnitId: a,
|
|
1237
|
-
ruleId:
|
|
1237
|
+
ruleId: _.ruleId,
|
|
1238
1238
|
payload: {
|
|
1239
1239
|
type: M.ALL,
|
|
1240
1240
|
payload: {
|
|
1241
|
-
formula1:
|
|
1242
|
-
formula2:
|
|
1243
|
-
ranges:
|
|
1241
|
+
formula1: _.rule.formula1,
|
|
1242
|
+
formula2: _.rule.formula2,
|
|
1243
|
+
ranges: _.oldRanges
|
|
1244
1244
|
}
|
|
1245
1245
|
}
|
|
1246
1246
|
}
|
|
@@ -1249,10 +1249,10 @@ function Be(o, a, e, t, r = "command", i = !0) {
|
|
|
1249
1249
|
params: {
|
|
1250
1250
|
unitId: o,
|
|
1251
1251
|
subUnitId: a,
|
|
1252
|
-
ruleId:
|
|
1252
|
+
ruleId: _.ruleId,
|
|
1253
1253
|
payload: {
|
|
1254
1254
|
type: M.RANGE,
|
|
1255
|
-
payload:
|
|
1255
|
+
payload: _.newRanges
|
|
1256
1256
|
},
|
|
1257
1257
|
source: r
|
|
1258
1258
|
}
|
|
@@ -1261,10 +1261,10 @@ function Be(o, a, e, t, r = "command", i = !0) {
|
|
|
1261
1261
|
params: {
|
|
1262
1262
|
unitId: o,
|
|
1263
1263
|
subUnitId: a,
|
|
1264
|
-
ruleId:
|
|
1264
|
+
ruleId: _.ruleId,
|
|
1265
1265
|
payload: {
|
|
1266
1266
|
type: M.RANGE,
|
|
1267
|
-
payload:
|
|
1267
|
+
payload: _.oldRanges
|
|
1268
1268
|
},
|
|
1269
1269
|
source: r
|
|
1270
1270
|
}
|
|
@@ -1275,10 +1275,10 @@ function Be(o, a, e, t, r = "command", i = !0) {
|
|
|
1275
1275
|
params: {
|
|
1276
1276
|
unitId: o,
|
|
1277
1277
|
subUnitId: a,
|
|
1278
|
-
ruleId:
|
|
1278
|
+
ruleId: _.ruleId,
|
|
1279
1279
|
payload: {
|
|
1280
1280
|
type: M.RANGE,
|
|
1281
|
-
payload:
|
|
1281
|
+
payload: _.newRanges
|
|
1282
1282
|
},
|
|
1283
1283
|
source: r
|
|
1284
1284
|
}
|
|
@@ -1287,89 +1287,89 @@ function Be(o, a, e, t, r = "command", i = !0) {
|
|
|
1287
1287
|
params: {
|
|
1288
1288
|
unitId: o,
|
|
1289
1289
|
subUnitId: a,
|
|
1290
|
-
ruleId:
|
|
1290
|
+
ruleId: _.ruleId,
|
|
1291
1291
|
payload: {
|
|
1292
1292
|
type: M.RANGE,
|
|
1293
|
-
payload:
|
|
1293
|
+
payload: _.oldRanges
|
|
1294
1294
|
},
|
|
1295
1295
|
source: r
|
|
1296
1296
|
}
|
|
1297
1297
|
});
|
|
1298
|
-
const
|
|
1299
|
-
if (
|
|
1300
|
-
const
|
|
1301
|
-
V(
|
|
1298
|
+
const w = d.getRuleById(o, a, _.ruleId);
|
|
1299
|
+
if (w && w.type === T.CHECKBOX) {
|
|
1300
|
+
const B = d.getValidator(T.CHECKBOX).parseFormulaSync(w, o, a);
|
|
1301
|
+
V(_.newRanges, B.formula2);
|
|
1302
1302
|
}
|
|
1303
1303
|
break;
|
|
1304
1304
|
}
|
|
1305
1305
|
case "add": {
|
|
1306
1306
|
if (l.push({
|
|
1307
|
-
id:
|
|
1307
|
+
id: D.id,
|
|
1308
1308
|
params: {
|
|
1309
1309
|
unitId: o,
|
|
1310
1310
|
subUnitId: a,
|
|
1311
|
-
rule:
|
|
1311
|
+
rule: _.rule,
|
|
1312
1312
|
source: r
|
|
1313
1313
|
}
|
|
1314
1314
|
}), u.unshift({
|
|
1315
|
-
id:
|
|
1315
|
+
id: A.id,
|
|
1316
1316
|
params: {
|
|
1317
1317
|
unitId: o,
|
|
1318
1318
|
subUnitId: a,
|
|
1319
|
-
ruleId:
|
|
1319
|
+
ruleId: _.rule.uid,
|
|
1320
1320
|
source: r
|
|
1321
1321
|
}
|
|
1322
|
-
}),
|
|
1323
|
-
const $ = d.getValidator(T.CHECKBOX).parseFormulaSync(
|
|
1324
|
-
V(
|
|
1322
|
+
}), _.rule.type === T.CHECKBOX) {
|
|
1323
|
+
const $ = d.getValidator(T.CHECKBOX).parseFormulaSync(_.rule, o, a);
|
|
1324
|
+
V(_.rule.ranges, $.originFormula2);
|
|
1325
1325
|
}
|
|
1326
1326
|
break;
|
|
1327
1327
|
}
|
|
1328
1328
|
}
|
|
1329
1329
|
}), R) {
|
|
1330
|
-
const
|
|
1330
|
+
const _ = {
|
|
1331
1331
|
id: se.id,
|
|
1332
1332
|
params: {
|
|
1333
1333
|
unitId: o,
|
|
1334
1334
|
subUnitId: a,
|
|
1335
|
-
cellValue:
|
|
1335
|
+
cellValue: p.getData()
|
|
1336
1336
|
}
|
|
1337
|
-
},
|
|
1337
|
+
}, w = {
|
|
1338
1338
|
id: se.id,
|
|
1339
|
-
params: dt(t,
|
|
1339
|
+
params: dt(t, _.params)
|
|
1340
1340
|
};
|
|
1341
|
-
l.push(
|
|
1341
|
+
l.push(_), u.push(w);
|
|
1342
1342
|
}
|
|
1343
1343
|
return {
|
|
1344
1344
|
redoMutations: l,
|
|
1345
1345
|
undoMutations: u
|
|
1346
1346
|
};
|
|
1347
1347
|
}
|
|
1348
|
-
const
|
|
1348
|
+
const ma = {
|
|
1349
1349
|
type: z.COMMAND,
|
|
1350
1350
|
id: "sheet.command.updateDataValidationRuleRange",
|
|
1351
1351
|
handler(o, a) {
|
|
1352
1352
|
if (!a)
|
|
1353
1353
|
return !1;
|
|
1354
|
-
const { unitId: e, subUnitId: t, ranges: r, ruleId: i } = a, s = o.get(F), n = o.get(
|
|
1354
|
+
const { unitId: e, subUnitId: t, ranges: r, ruleId: i } = a, s = o.get(F), n = o.get(U), l = o.get(Z);
|
|
1355
1355
|
if (!s.getRuleById(e, t, i))
|
|
1356
1356
|
return !1;
|
|
1357
1357
|
const d = s.getRuleObjectMatrix(e, t).clone();
|
|
1358
1358
|
d.updateRange(i, r);
|
|
1359
|
-
const c = d.diff(s.getRules(e, t)), { redoMutations: g, undoMutations:
|
|
1359
|
+
const c = d.diff(s.getRules(e, t)), { redoMutations: g, undoMutations: f } = Ue(e, t, c, o);
|
|
1360
1360
|
return l.pushUndoRedo({
|
|
1361
|
-
undoMutations:
|
|
1361
|
+
undoMutations: f,
|
|
1362
1362
|
redoMutations: g,
|
|
1363
1363
|
unitID: e
|
|
1364
|
-
}),
|
|
1364
|
+
}), Ae(g, n), !0;
|
|
1365
1365
|
}
|
|
1366
|
-
},
|
|
1366
|
+
}, ga = {
|
|
1367
1367
|
type: z.COMMAND,
|
|
1368
1368
|
id: "sheet.command.addDataValidation",
|
|
1369
1369
|
handler(o, a) {
|
|
1370
1370
|
if (!a)
|
|
1371
1371
|
return !1;
|
|
1372
|
-
const { unitId: e, subUnitId: t, rule: r } = a, i = o.get(F), s = o.get(
|
|
1372
|
+
const { unitId: e, subUnitId: t, rule: r } = a, i = o.get(F), s = o.get(U), n = o.get(Z), l = i.getRuleObjectMatrix(e, t).clone();
|
|
1373
1373
|
l.addRule(r);
|
|
1374
1374
|
const u = l.diff(i.getRules(e, t)), d = i.getValidator(r.type), c = {
|
|
1375
1375
|
unitId: e,
|
|
@@ -1378,12 +1378,12 @@ const ha = {
|
|
|
1378
1378
|
...r,
|
|
1379
1379
|
...d == null ? void 0 : d.normalizeFormula(r, e, t)
|
|
1380
1380
|
}
|
|
1381
|
-
}, { redoMutations: g, undoMutations:
|
|
1381
|
+
}, { redoMutations: g, undoMutations: f } = Ue(e, t, u, o);
|
|
1382
1382
|
return g.push({
|
|
1383
|
-
id: L.id,
|
|
1384
|
-
params: c
|
|
1385
|
-
}), p.unshift({
|
|
1386
1383
|
id: D.id,
|
|
1384
|
+
params: c
|
|
1385
|
+
}), f.unshift({
|
|
1386
|
+
id: A.id,
|
|
1387
1387
|
params: {
|
|
1388
1388
|
unitId: e,
|
|
1389
1389
|
subUnitId: t,
|
|
@@ -1392,17 +1392,17 @@ const ha = {
|
|
|
1392
1392
|
}), n.pushUndoRedo({
|
|
1393
1393
|
unitID: e,
|
|
1394
1394
|
redoMutations: g,
|
|
1395
|
-
undoMutations:
|
|
1396
|
-
}),
|
|
1395
|
+
undoMutations: f
|
|
1396
|
+
}), Ae(g, s), !0;
|
|
1397
1397
|
}
|
|
1398
|
-
},
|
|
1398
|
+
}, pa = {
|
|
1399
1399
|
type: z.COMMAND,
|
|
1400
1400
|
id: "sheets.command.update-data-validation-setting",
|
|
1401
1401
|
// eslint-disable-next-line max-lines-per-function
|
|
1402
1402
|
handler(o, a) {
|
|
1403
1403
|
if (!a)
|
|
1404
1404
|
return !1;
|
|
1405
|
-
const e = o.get(
|
|
1405
|
+
const e = o.get(U), t = o.get(Z), r = o.get(F), i = o.get(q), { unitId: s, subUnitId: n, ruleId: l, setting: u } = a, d = i.getValidatorItem(u.type);
|
|
1406
1406
|
if (!d)
|
|
1407
1407
|
return !1;
|
|
1408
1408
|
const c = r.getRuleById(s, n, l);
|
|
@@ -1411,7 +1411,7 @@ const ha = {
|
|
|
1411
1411
|
const g = { ...c, ...u };
|
|
1412
1412
|
if (!d.validatorFormula(g, s, n).success)
|
|
1413
1413
|
return !1;
|
|
1414
|
-
const
|
|
1414
|
+
const f = {
|
|
1415
1415
|
unitId: s,
|
|
1416
1416
|
subUnitId: n,
|
|
1417
1417
|
ruleId: l,
|
|
@@ -1422,9 +1422,9 @@ const ha = {
|
|
|
1422
1422
|
...d.normalizeFormula(g, s, n)
|
|
1423
1423
|
}
|
|
1424
1424
|
}
|
|
1425
|
-
},
|
|
1425
|
+
}, p = [{
|
|
1426
1426
|
id: y.id,
|
|
1427
|
-
params:
|
|
1427
|
+
params: f
|
|
1428
1428
|
}], R = {
|
|
1429
1429
|
unitId: s,
|
|
1430
1430
|
subUnitId: n,
|
|
@@ -1438,22 +1438,22 @@ const ha = {
|
|
|
1438
1438
|
params: R
|
|
1439
1439
|
}];
|
|
1440
1440
|
if (u.type === T.CHECKBOX) {
|
|
1441
|
-
const
|
|
1442
|
-
if (
|
|
1443
|
-
const k = new Se(), { worksheet: x } =
|
|
1444
|
-
let
|
|
1445
|
-
if (
|
|
1446
|
-
|
|
1447
|
-
const j = x.getCellRaw(ae, xe),
|
|
1448
|
-
(
|
|
1441
|
+
const w = c.ranges, $ = o.get(O), B = ze($, { unitId: s, subUnitId: n });
|
|
1442
|
+
if (B) {
|
|
1443
|
+
const k = new Se(), { worksheet: x } = B, { formula2: J = Ve, formula1: ce = Ee } = c, { formula2: he = Ve, formula1: me = Ee } = u;
|
|
1444
|
+
let Be = !1;
|
|
1445
|
+
if (w.forEach((ge) => {
|
|
1446
|
+
L.foreach(ge, (ae, xe) => {
|
|
1447
|
+
const j = x.getCellRaw(ae, xe), Je = pt(j);
|
|
1448
|
+
(_t(j) || Je === String(J)) && !(j != null && j.p) ? (k.setValue(ae, xe, {
|
|
1449
1449
|
v: he,
|
|
1450
1450
|
p: null
|
|
1451
|
-
}),
|
|
1451
|
+
}), Be = !0) : Je === String(ce) && !(j != null && j.p) && (k.setValue(ae, xe, {
|
|
1452
1452
|
v: me,
|
|
1453
1453
|
p: null
|
|
1454
|
-
}),
|
|
1454
|
+
}), Be = !0);
|
|
1455
1455
|
});
|
|
1456
|
-
}),
|
|
1456
|
+
}), Be) {
|
|
1457
1457
|
const ge = {
|
|
1458
1458
|
id: se.id,
|
|
1459
1459
|
params: {
|
|
@@ -1465,23 +1465,23 @@ const ha = {
|
|
|
1465
1465
|
id: se.id,
|
|
1466
1466
|
params: dt(o, ge.params)
|
|
1467
1467
|
};
|
|
1468
|
-
|
|
1468
|
+
p.push(ge), V.push(ae);
|
|
1469
1469
|
}
|
|
1470
1470
|
}
|
|
1471
1471
|
}
|
|
1472
|
-
return
|
|
1472
|
+
return Ae(p, e).result ? (t.pushUndoRedo({
|
|
1473
1473
|
unitID: s,
|
|
1474
|
-
redoMutations:
|
|
1474
|
+
redoMutations: p,
|
|
1475
1475
|
undoMutations: V
|
|
1476
1476
|
}), !0) : !1;
|
|
1477
1477
|
}
|
|
1478
|
-
},
|
|
1478
|
+
}, fa = {
|
|
1479
1479
|
type: z.COMMAND,
|
|
1480
1480
|
id: "sheets.command.update-data-validation-options",
|
|
1481
1481
|
handler(o, a) {
|
|
1482
1482
|
if (!a)
|
|
1483
1483
|
return !1;
|
|
1484
|
-
const e = o.get(
|
|
1484
|
+
const e = o.get(U), t = o.get(Z), r = o.get(F), { unitId: i, subUnitId: s, ruleId: n, options: l } = a, u = r.getRuleById(i, s, n);
|
|
1485
1485
|
if (!u)
|
|
1486
1486
|
return !1;
|
|
1487
1487
|
const d = {
|
|
@@ -1501,50 +1501,50 @@ const ha = {
|
|
|
1501
1501
|
ruleId: n,
|
|
1502
1502
|
payload: {
|
|
1503
1503
|
type: M.OPTIONS,
|
|
1504
|
-
payload:
|
|
1504
|
+
payload: Ut(u)
|
|
1505
1505
|
}
|
|
1506
|
-
},
|
|
1506
|
+
}, f = [{
|
|
1507
1507
|
id: y.id,
|
|
1508
1508
|
params: g
|
|
1509
1509
|
}];
|
|
1510
1510
|
return t.pushUndoRedo({
|
|
1511
1511
|
unitID: i,
|
|
1512
1512
|
redoMutations: c,
|
|
1513
|
-
undoMutations:
|
|
1513
|
+
undoMutations: f
|
|
1514
1514
|
}), e.executeCommand(y.id, d), !0;
|
|
1515
1515
|
}
|
|
1516
|
-
},
|
|
1516
|
+
}, _a = {
|
|
1517
1517
|
type: z.COMMAND,
|
|
1518
1518
|
id: "sheets.command.clear-range-data-validation",
|
|
1519
1519
|
handler(o, a) {
|
|
1520
1520
|
if (!a)
|
|
1521
1521
|
return !1;
|
|
1522
|
-
const { unitId: e, subUnitId: t, ranges: r } = a, i = o.get(
|
|
1522
|
+
const { unitId: e, subUnitId: t, ranges: r } = a, i = o.get(U), s = o.get(O), n = ze(s, { unitId: e, subUnitId: t }), l = o.get(F);
|
|
1523
1523
|
if (!n) return !1;
|
|
1524
1524
|
const u = o.get(Z), d = l.getRuleObjectMatrix(e, t).clone();
|
|
1525
1525
|
d.removeRange(r);
|
|
1526
|
-
const c = d.diff(l.getRules(e, t)), { redoMutations: g, undoMutations:
|
|
1526
|
+
const c = d.diff(l.getRules(e, t)), { redoMutations: g, undoMutations: f } = Ue(e, t, c, o);
|
|
1527
1527
|
return u.pushUndoRedo({
|
|
1528
1528
|
unitID: e,
|
|
1529
1529
|
redoMutations: g,
|
|
1530
|
-
undoMutations:
|
|
1531
|
-
}),
|
|
1530
|
+
undoMutations: f
|
|
1531
|
+
}), Ae(g, i).result;
|
|
1532
1532
|
}
|
|
1533
|
-
},
|
|
1533
|
+
}, Ra = {
|
|
1534
1534
|
type: z.COMMAND,
|
|
1535
1535
|
id: "sheet.command.remove-all-data-validation",
|
|
1536
1536
|
handler(o, a) {
|
|
1537
1537
|
if (!a)
|
|
1538
1538
|
return !1;
|
|
1539
|
-
const { unitId: e, subUnitId: t } = a, r = o.get(
|
|
1539
|
+
const { unitId: e, subUnitId: t } = a, r = o.get(U), i = o.get(F), s = o.get(Z), n = [...i.getRules(e, t)], l = {
|
|
1540
1540
|
unitId: e,
|
|
1541
1541
|
subUnitId: t,
|
|
1542
1542
|
ruleId: n.map((c) => c.uid)
|
|
1543
1543
|
}, u = [{
|
|
1544
|
-
id:
|
|
1544
|
+
id: A.id,
|
|
1545
1545
|
params: l
|
|
1546
1546
|
}], d = [{
|
|
1547
|
-
id:
|
|
1547
|
+
id: D.id,
|
|
1548
1548
|
params: {
|
|
1549
1549
|
unitId: e,
|
|
1550
1550
|
subUnitId: t,
|
|
@@ -1555,14 +1555,14 @@ const ha = {
|
|
|
1555
1555
|
redoMutations: u,
|
|
1556
1556
|
undoMutations: d,
|
|
1557
1557
|
unitID: e
|
|
1558
|
-
}), r.executeCommand(
|
|
1558
|
+
}), r.executeCommand(A.id, l), !0;
|
|
1559
1559
|
}
|
|
1560
|
-
},
|
|
1560
|
+
}, va = (o, a) => {
|
|
1561
1561
|
const e = o.get(F), { unitId: t, subUnitId: r, ruleId: i, source: s } = a;
|
|
1562
1562
|
if (Array.isArray(i)) {
|
|
1563
1563
|
const l = i.map((u) => e.getRuleById(t, r, u)).filter(Boolean);
|
|
1564
1564
|
return [{
|
|
1565
|
-
id:
|
|
1565
|
+
id: D.id,
|
|
1566
1566
|
params: {
|
|
1567
1567
|
unitId: t,
|
|
1568
1568
|
subUnitId: r,
|
|
@@ -1572,7 +1572,7 @@ const ha = {
|
|
|
1572
1572
|
}];
|
|
1573
1573
|
}
|
|
1574
1574
|
return [{
|
|
1575
|
-
id:
|
|
1575
|
+
id: D.id,
|
|
1576
1576
|
params: {
|
|
1577
1577
|
unitId: t,
|
|
1578
1578
|
subUnitId: r,
|
|
@@ -1582,17 +1582,17 @@ const ha = {
|
|
|
1582
1582
|
index: e.getRuleIndex(t, r, i)
|
|
1583
1583
|
}
|
|
1584
1584
|
}];
|
|
1585
|
-
},
|
|
1585
|
+
}, Sa = {
|
|
1586
1586
|
type: z.COMMAND,
|
|
1587
1587
|
id: "sheet.command.remove-data-validation-rule",
|
|
1588
1588
|
handler(o, a) {
|
|
1589
1589
|
if (!a)
|
|
1590
1590
|
return !1;
|
|
1591
|
-
const { unitId: e, subUnitId: t, ruleId: r } = a, i = o.get(
|
|
1592
|
-
id:
|
|
1591
|
+
const { unitId: e, subUnitId: t, ruleId: r } = a, i = o.get(U), s = o.get(Z), n = o.get(F), l = [{
|
|
1592
|
+
id: A.id,
|
|
1593
1593
|
params: a
|
|
1594
1594
|
}], u = [{
|
|
1595
|
-
id:
|
|
1595
|
+
id: D.id,
|
|
1596
1596
|
params: {
|
|
1597
1597
|
unitId: e,
|
|
1598
1598
|
subUnitId: t,
|
|
@@ -1606,11 +1606,11 @@ const ha = {
|
|
|
1606
1606
|
undoMutations: u,
|
|
1607
1607
|
redoMutations: l,
|
|
1608
1608
|
unitID: a.unitId
|
|
1609
|
-
}), i.executeCommand(
|
|
1609
|
+
}), i.executeCommand(A.id, a), !0;
|
|
1610
1610
|
}
|
|
1611
|
-
},
|
|
1612
|
-
var Rt = /* @__PURE__ */ ((o) => (o[o.View = 0] = "View", o[o.Edit = 1] = "Edit", o[o.ManageCollaborator = 2] = "ManageCollaborator", o[o.Print = 3] = "Print", o[o.Duplicate = 4] = "Duplicate", o[o.Comment = 5] = "Comment", o[o.Copy = 6] = "Copy", o[o.Share = 7] = "Share", o[o.Export = 8] = "Export", o[o.MoveWorksheet = 9] = "MoveWorksheet", o[o.DeleteWorksheet = 10] = "DeleteWorksheet", o[o.HideWorksheet = 11] = "HideWorksheet", o[o.RenameWorksheet = 12] = "RenameWorksheet", o[o.CreateWorksheet = 13] = "CreateWorksheet", o[o.SetWorksheetStyle = 14] = "SetWorksheetStyle", o[o.EditWorksheetCell = 15] = "EditWorksheetCell", o[o.InsertHyperlink = 16] = "InsertHyperlink", o[o.Sort = 17] = "Sort", o[o.Filter = 18] = "Filter", o[o.PivotTable = 19] = "PivotTable", o[o.FloatImg = 20] = "FloatImg", o[o.History = 21] = "History", o[o.RwHgtClWdt = 22] = "RwHgtClWdt", o[o.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", o[o.ViewFilter = 24] = "ViewFilter", o[o.MoveSheet = 25] = "MoveSheet", o[o.DeleteSheet = 26] = "DeleteSheet", o[o.HideSheet = 27] = "HideSheet", o[o.CopySheet = 28] = "CopySheet", o[o.RenameSheet = 29] = "RenameSheet", o[o.CreateSheet = 30] = "CreateSheet", o[o.SelectProtectedCells = 31] = "SelectProtectedCells", o[o.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", o[o.SetCellStyle = 33] = "SetCellStyle", o[o.SetCellValue = 34] = "SetCellValue", o[o.SetRowStyle = 35] = "SetRowStyle", o[o.SetColumnStyle = 36] = "SetColumnStyle", o[o.InsertRow = 37] = "InsertRow", o[o.InsertColumn = 38] = "InsertColumn", o[o.DeleteRow = 39] = "DeleteRow", o[o.DeleteColumn = 40] = "DeleteColumn", o[o.EditExtraObject = 41] = "EditExtraObject", o[o.Delete = 42] = "Delete", o[o.RecoverHistory = 43] = "RecoverHistory", o[o.ViewHistory = 44] = "ViewHistory", o[o.CreatePermissionObject = 45] = "CreatePermissionObject", o[o.UNRECOGNIZED = -1] = "UNRECOGNIZED", o))(Rt || {}),
|
|
1613
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1611
|
+
}, Ea = "SHEET_DATA_VALIDATION_PLUGIN";
|
|
1612
|
+
var Rt = /* @__PURE__ */ ((o) => (o[o.View = 0] = "View", o[o.Edit = 1] = "Edit", o[o.ManageCollaborator = 2] = "ManageCollaborator", o[o.Print = 3] = "Print", o[o.Duplicate = 4] = "Duplicate", o[o.Comment = 5] = "Comment", o[o.Copy = 6] = "Copy", o[o.Share = 7] = "Share", o[o.Export = 8] = "Export", o[o.MoveWorksheet = 9] = "MoveWorksheet", o[o.DeleteWorksheet = 10] = "DeleteWorksheet", o[o.HideWorksheet = 11] = "HideWorksheet", o[o.RenameWorksheet = 12] = "RenameWorksheet", o[o.CreateWorksheet = 13] = "CreateWorksheet", o[o.SetWorksheetStyle = 14] = "SetWorksheetStyle", o[o.EditWorksheetCell = 15] = "EditWorksheetCell", o[o.InsertHyperlink = 16] = "InsertHyperlink", o[o.Sort = 17] = "Sort", o[o.Filter = 18] = "Filter", o[o.PivotTable = 19] = "PivotTable", o[o.FloatImg = 20] = "FloatImg", o[o.History = 21] = "History", o[o.RwHgtClWdt = 22] = "RwHgtClWdt", o[o.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", o[o.ViewFilter = 24] = "ViewFilter", o[o.MoveSheet = 25] = "MoveSheet", o[o.DeleteSheet = 26] = "DeleteSheet", o[o.HideSheet = 27] = "HideSheet", o[o.CopySheet = 28] = "CopySheet", o[o.RenameSheet = 29] = "RenameSheet", o[o.CreateSheet = 30] = "CreateSheet", o[o.SelectProtectedCells = 31] = "SelectProtectedCells", o[o.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", o[o.SetCellStyle = 33] = "SetCellStyle", o[o.SetCellValue = 34] = "SetCellValue", o[o.SetRowStyle = 35] = "SetRowStyle", o[o.SetColumnStyle = 36] = "SetColumnStyle", o[o.InsertRow = 37] = "InsertRow", o[o.InsertColumn = 38] = "InsertColumn", o[o.DeleteRow = 39] = "DeleteRow", o[o.DeleteColumn = 40] = "DeleteColumn", o[o.EditExtraObject = 41] = "EditExtraObject", o[o.Delete = 42] = "Delete", o[o.RecoverHistory = 43] = "RecoverHistory", o[o.ViewHistory = 44] = "ViewHistory", o[o.CreatePermissionObject = 45] = "CreatePermissionObject", o[o.UNRECOGNIZED = -1] = "UNRECOGNIZED", o))(Rt || {}), Va = Object.getOwnPropertyDescriptor, Ma = (o, a, e, t) => {
|
|
1613
|
+
for (var r = t > 1 ? void 0 : t ? Va(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1614
1614
|
(s = o[i]) && (r = s(r) || r);
|
|
1615
1615
|
return r;
|
|
1616
1616
|
}, ke = (o, a) => (e, t) => a(e, t, o);
|
|
@@ -1627,7 +1627,7 @@ let Te = class extends W {
|
|
|
1627
1627
|
const i = a[r];
|
|
1628
1628
|
if (typeof i == "string")
|
|
1629
1629
|
continue;
|
|
1630
|
-
const { token: s } = i, n = Wt(s), l = this._univerInstanceService.getCurrentUnitForType(
|
|
1630
|
+
const { token: s } = i, n = Wt(s), l = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET);
|
|
1631
1631
|
let u = l.getActiveSheet();
|
|
1632
1632
|
const d = l.getUnitId();
|
|
1633
1633
|
if (n.sheetName) {
|
|
@@ -1638,25 +1638,25 @@ let Te = class extends W {
|
|
|
1638
1638
|
}
|
|
1639
1639
|
if (!u)
|
|
1640
1640
|
return !1;
|
|
1641
|
-
const { startRow: c, endRow: g, startColumn:
|
|
1641
|
+
const { startRow: c, endRow: g, startColumn: f, endColumn: p } = n.range;
|
|
1642
1642
|
for (let R = c; R <= g; R++)
|
|
1643
|
-
for (let V =
|
|
1644
|
-
const
|
|
1645
|
-
if ((
|
|
1643
|
+
for (let V = f; V <= p; V++) {
|
|
1644
|
+
const _ = (t = (e = u.getCell(R, V)) == null ? void 0 : e.selectionProtection) == null ? void 0 : t[0];
|
|
1645
|
+
if ((_ == null ? void 0 : _[Rt.View]) === !1)
|
|
1646
1646
|
return !1;
|
|
1647
1647
|
}
|
|
1648
1648
|
}
|
|
1649
1649
|
return !0;
|
|
1650
1650
|
}
|
|
1651
1651
|
};
|
|
1652
|
-
Te =
|
|
1653
|
-
ke(0,
|
|
1652
|
+
Te = Ma([
|
|
1653
|
+
ke(0, O),
|
|
1654
1654
|
ke(1, Tt),
|
|
1655
1655
|
ke(2, v(Y))
|
|
1656
1656
|
], Te);
|
|
1657
|
-
const
|
|
1658
|
-
var
|
|
1659
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1657
|
+
const ya = "sheets-data-validation.config", it = {};
|
|
1658
|
+
var Ta = Object.getOwnPropertyDescriptor, Fa = (o, a, e, t) => {
|
|
1659
|
+
for (var r = t > 1 ? void 0 : t ? Ta(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1660
1660
|
(s = o[i]) && (r = s(r) || r);
|
|
1661
1661
|
return r;
|
|
1662
1662
|
}, je = (o, a) => (e, t) => a(e, t, o);
|
|
@@ -1678,7 +1678,7 @@ let Fe = class extends W {
|
|
|
1678
1678
|
if (u.length === 0)
|
|
1679
1679
|
return {
|
|
1680
1680
|
undos: [{
|
|
1681
|
-
id:
|
|
1681
|
+
id: D.id,
|
|
1682
1682
|
params: {
|
|
1683
1683
|
unitId: a,
|
|
1684
1684
|
subUnitId: e,
|
|
@@ -1687,7 +1687,7 @@ let Fe = class extends W {
|
|
|
1687
1687
|
}
|
|
1688
1688
|
}],
|
|
1689
1689
|
redos: [{
|
|
1690
|
-
id:
|
|
1690
|
+
id: A.id,
|
|
1691
1691
|
params: {
|
|
1692
1692
|
unitId: a,
|
|
1693
1693
|
subUnitId: e,
|
|
@@ -1730,24 +1730,24 @@ let Fe = class extends W {
|
|
|
1730
1730
|
source: "patched"
|
|
1731
1731
|
}
|
|
1732
1732
|
});
|
|
1733
|
-
for (let
|
|
1734
|
-
const
|
|
1733
|
+
for (let f = 1; f < u.length; f++) {
|
|
1734
|
+
const p = u[f], R = Ye();
|
|
1735
1735
|
d.push({
|
|
1736
|
-
id:
|
|
1736
|
+
id: D.id,
|
|
1737
1737
|
params: {
|
|
1738
1738
|
unitId: a,
|
|
1739
1739
|
subUnitId: e,
|
|
1740
1740
|
rule: {
|
|
1741
1741
|
...t,
|
|
1742
1742
|
uid: R,
|
|
1743
|
-
formula1:
|
|
1744
|
-
formula2:
|
|
1745
|
-
ranges:
|
|
1743
|
+
formula1: p.formulas[0],
|
|
1744
|
+
formula2: p.formulas[1],
|
|
1745
|
+
ranges: p.ranges
|
|
1746
1746
|
},
|
|
1747
1747
|
source: "patched"
|
|
1748
1748
|
}
|
|
1749
1749
|
}), c.push({
|
|
1750
|
-
id:
|
|
1750
|
+
id: A.id,
|
|
1751
1751
|
params: {
|
|
1752
1752
|
unitId: a,
|
|
1753
1753
|
subUnitId: e,
|
|
@@ -1790,24 +1790,24 @@ let Fe = class extends W {
|
|
|
1790
1790
|
}
|
|
1791
1791
|
}
|
|
1792
1792
|
})
|
|
1793
|
-
), this.disposeWithMe(
|
|
1793
|
+
), this.disposeWithMe(Xe(() => {
|
|
1794
1794
|
this._disposableMap.forEach((e) => {
|
|
1795
1795
|
e.dispose();
|
|
1796
1796
|
}), this._disposableMap.clear();
|
|
1797
1797
|
}));
|
|
1798
1798
|
}
|
|
1799
1799
|
};
|
|
1800
|
-
Fe =
|
|
1800
|
+
Fe = Fa([
|
|
1801
1801
|
je(0, v(F)),
|
|
1802
1802
|
je(1, v(gt)),
|
|
1803
1803
|
je(2, v(q))
|
|
1804
1804
|
], Fe);
|
|
1805
|
-
var
|
|
1806
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1805
|
+
var Na = Object.getOwnPropertyDescriptor, Ca = (o, a, e, t) => {
|
|
1806
|
+
for (var r = t > 1 ? void 0 : t ? Na(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1807
1807
|
(s = o[i]) && (r = s(r) || r);
|
|
1808
1808
|
return r;
|
|
1809
1809
|
}, ee = (o, a) => (e, t) => a(e, t, o);
|
|
1810
|
-
let
|
|
1810
|
+
let Ne = class extends W {
|
|
1811
1811
|
constructor(a, e, t, r, i, s) {
|
|
1812
1812
|
super();
|
|
1813
1813
|
m(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
@@ -1826,10 +1826,10 @@ let Ce = class extends W {
|
|
|
1826
1826
|
const g = this._dataValidationModel.getRuleById(a, e, r);
|
|
1827
1827
|
if (!g)
|
|
1828
1828
|
return { redos: [], undos: [] };
|
|
1829
|
-
const
|
|
1830
|
-
if (!
|
|
1829
|
+
const f = g[d];
|
|
1830
|
+
if (!f || f === c)
|
|
1831
1831
|
return { redos: [], undos: [] };
|
|
1832
|
-
const
|
|
1832
|
+
const p = {
|
|
1833
1833
|
unitId: a,
|
|
1834
1834
|
subUnitId: e,
|
|
1835
1835
|
ruleId: t.uid,
|
|
@@ -1859,15 +1859,15 @@ let Ce = class extends W {
|
|
|
1859
1859
|
}, V = [
|
|
1860
1860
|
{
|
|
1861
1861
|
id: y.id,
|
|
1862
|
-
params:
|
|
1862
|
+
params: p
|
|
1863
1863
|
}
|
|
1864
|
-
],
|
|
1864
|
+
], _ = [
|
|
1865
1865
|
{
|
|
1866
1866
|
id: y.id,
|
|
1867
1867
|
params: R
|
|
1868
1868
|
}
|
|
1869
1869
|
];
|
|
1870
|
-
return { redos: V, undos:
|
|
1870
|
+
return { redos: V, undos: _ };
|
|
1871
1871
|
}, l = this._dataValidationFormulaService.getRuleFormulaInfo(a, e, r);
|
|
1872
1872
|
if (l) {
|
|
1873
1873
|
const [d, c] = l;
|
|
@@ -1876,7 +1876,7 @@ let Ce = class extends W {
|
|
|
1876
1876
|
a,
|
|
1877
1877
|
e,
|
|
1878
1878
|
d.text,
|
|
1879
|
-
(
|
|
1879
|
+
(f) => n("formula1", f)
|
|
1880
1880
|
);
|
|
1881
1881
|
s.add(() => g.dispose());
|
|
1882
1882
|
}
|
|
@@ -1885,7 +1885,7 @@ let Ce = class extends W {
|
|
|
1885
1885
|
a,
|
|
1886
1886
|
e,
|
|
1887
1887
|
c.text,
|
|
1888
|
-
(
|
|
1888
|
+
(f) => n("formula2", f)
|
|
1889
1889
|
);
|
|
1890
1890
|
s.add(() => g.dispose());
|
|
1891
1891
|
}
|
|
@@ -1894,11 +1894,11 @@ let Ce = class extends W {
|
|
|
1894
1894
|
register(a, e, t) {
|
|
1895
1895
|
var l;
|
|
1896
1896
|
const r = (u) => {
|
|
1897
|
-
const d = [...t.ranges], g = d.map((
|
|
1898
|
-
if (
|
|
1897
|
+
const d = [...t.ranges], g = d.map((p) => Qt(p, u)).filter((p) => !!p).flat();
|
|
1898
|
+
if (nt(g, d))
|
|
1899
1899
|
return { redos: [], undos: [] };
|
|
1900
1900
|
if (g.length) {
|
|
1901
|
-
const
|
|
1901
|
+
const p = {
|
|
1902
1902
|
unitId: a,
|
|
1903
1903
|
subUnitId: e,
|
|
1904
1904
|
ruleId: t.uid,
|
|
@@ -1907,7 +1907,7 @@ let Ce = class extends W {
|
|
|
1907
1907
|
payload: g
|
|
1908
1908
|
},
|
|
1909
1909
|
source: "patched"
|
|
1910
|
-
}, R = [{ id: y.id, params:
|
|
1910
|
+
}, R = [{ id: y.id, params: p }], V = [{
|
|
1911
1911
|
id: y.id,
|
|
1912
1912
|
params: {
|
|
1913
1913
|
unitId: a,
|
|
@@ -1922,7 +1922,7 @@ let Ce = class extends W {
|
|
|
1922
1922
|
}];
|
|
1923
1923
|
return { redos: R, undos: V };
|
|
1924
1924
|
} else {
|
|
1925
|
-
const
|
|
1925
|
+
const p = { unitId: a, subUnitId: e, ruleId: t.uid }, R = [{ id: A.id, params: p }], V = va(this._injector, p);
|
|
1926
1926
|
return { redos: R, undos: V };
|
|
1927
1927
|
}
|
|
1928
1928
|
}, i = [];
|
|
@@ -1960,37 +1960,39 @@ let Ce = class extends W {
|
|
|
1960
1960
|
}
|
|
1961
1961
|
}
|
|
1962
1962
|
})
|
|
1963
|
-
), this.disposeWithMe(
|
|
1963
|
+
), this.disposeWithMe(Xe(() => {
|
|
1964
1964
|
this._disposableMap.forEach((e) => {
|
|
1965
1965
|
e.forEach((t) => t());
|
|
1966
1966
|
}), this._disposableMap.clear();
|
|
1967
1967
|
}));
|
|
1968
1968
|
}
|
|
1969
1969
|
};
|
|
1970
|
-
|
|
1970
|
+
Ne = Ca([
|
|
1971
1971
|
ee(0, v(F)),
|
|
1972
|
-
ee(1, v(
|
|
1972
|
+
ee(1, v(Ke)),
|
|
1973
1973
|
ee(2, v(jt)),
|
|
1974
1974
|
ee(3, v(K)),
|
|
1975
1975
|
ee(4, v(gt)),
|
|
1976
1976
|
ee(5, v(q))
|
|
1977
|
-
],
|
|
1977
|
+
], Ne);
|
|
1978
1978
|
var Oa = Object.getOwnPropertyDescriptor, wa = (o, a, e, t) => {
|
|
1979
1979
|
for (var r = t > 1 ? void 0 : t ? Oa(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1980
1980
|
(s = o[i]) && (r = s(r) || r);
|
|
1981
1981
|
return r;
|
|
1982
1982
|
}, Qe = (o, a) => (e, t) => a(e, t, o);
|
|
1983
|
-
let
|
|
1983
|
+
let Ce = class extends W {
|
|
1984
1984
|
constructor(o, a, e) {
|
|
1985
1985
|
super(), this._sheetInterceptorService = o, this._univerInstanceService = a, this._sheetDataValidationModel = e, this._initSheetChange();
|
|
1986
1986
|
}
|
|
1987
|
+
// eslint-disable-next-line max-lines-per-function
|
|
1987
1988
|
_initSheetChange() {
|
|
1988
1989
|
this.disposeWithMe(
|
|
1989
1990
|
this._sheetInterceptorService.interceptCommand({
|
|
1991
|
+
// eslint-disable-next-line max-lines-per-function
|
|
1990
1992
|
getMutations: (o) => {
|
|
1991
1993
|
var a;
|
|
1992
1994
|
if (o.id === qt.id) {
|
|
1993
|
-
const e = o.params, t = e.unitId || this._univerInstanceService.getCurrentUnitForType(
|
|
1995
|
+
const e = o.params, t = e.unitId || this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET).getUnitId(), r = this._univerInstanceService.getUniverSheetInstance(t);
|
|
1994
1996
|
if (!r)
|
|
1995
1997
|
return { redos: [], undos: [] };
|
|
1996
1998
|
const i = e.subUnitId || ((a = r.getActiveSheet()) == null ? void 0 : a.getSheetId());
|
|
@@ -2012,14 +2014,46 @@ let Oe = class extends W {
|
|
|
2012
2014
|
};
|
|
2013
2015
|
return {
|
|
2014
2016
|
redos: [{
|
|
2015
|
-
id:
|
|
2017
|
+
id: A.id,
|
|
2016
2018
|
params: l
|
|
2017
2019
|
}],
|
|
2018
2020
|
undos: [{
|
|
2019
|
-
id:
|
|
2021
|
+
id: D.id,
|
|
2020
2022
|
params: u
|
|
2021
2023
|
}]
|
|
2022
2024
|
};
|
|
2025
|
+
} else if (o.id === Gt.id) {
|
|
2026
|
+
const e = o.params, { unitId: t, subUnitId: r, targetSubUnitId: i } = e;
|
|
2027
|
+
if (!t || !r || !i)
|
|
2028
|
+
return { redos: [], undos: [] };
|
|
2029
|
+
const s = this._sheetDataValidationModel.getRules(t, r);
|
|
2030
|
+
if (s.length === 0)
|
|
2031
|
+
return { redos: [], undos: [] };
|
|
2032
|
+
const n = s.map((l) => ({ ...l, uid: Ye(6) }));
|
|
2033
|
+
return {
|
|
2034
|
+
redos: [
|
|
2035
|
+
{
|
|
2036
|
+
id: D.id,
|
|
2037
|
+
params: {
|
|
2038
|
+
unitId: t,
|
|
2039
|
+
subUnitId: i,
|
|
2040
|
+
rule: n,
|
|
2041
|
+
source: "patched"
|
|
2042
|
+
}
|
|
2043
|
+
}
|
|
2044
|
+
],
|
|
2045
|
+
undos: [
|
|
2046
|
+
{
|
|
2047
|
+
id: A.id,
|
|
2048
|
+
params: {
|
|
2049
|
+
unitId: t,
|
|
2050
|
+
subUnitId: i,
|
|
2051
|
+
ruleId: n.map((l) => l.uid),
|
|
2052
|
+
source: "patched"
|
|
2053
|
+
}
|
|
2054
|
+
}
|
|
2055
|
+
]
|
|
2056
|
+
};
|
|
2023
2057
|
}
|
|
2024
2058
|
return { redos: [], undos: [] };
|
|
2025
2059
|
}
|
|
@@ -2027,12 +2061,12 @@ let Oe = class extends W {
|
|
|
2027
2061
|
);
|
|
2028
2062
|
}
|
|
2029
2063
|
};
|
|
2030
|
-
|
|
2064
|
+
Ce = wa([
|
|
2031
2065
|
Qe(0, v(ct)),
|
|
2032
|
-
Qe(1, v(
|
|
2066
|
+
Qe(1, v(O)),
|
|
2033
2067
|
Qe(2, v(F))
|
|
2034
|
-
],
|
|
2035
|
-
class
|
|
2068
|
+
], Ce);
|
|
2069
|
+
class Ia extends G {
|
|
2036
2070
|
constructor() {
|
|
2037
2071
|
super(...arguments);
|
|
2038
2072
|
m(this, "id", T.ANY);
|
|
@@ -2061,7 +2095,7 @@ class Aa extends G {
|
|
|
2061
2095
|
return this.localeService.t("dataValidation.any.error");
|
|
2062
2096
|
}
|
|
2063
2097
|
}
|
|
2064
|
-
class
|
|
2098
|
+
class Aa extends G {
|
|
2065
2099
|
constructor() {
|
|
2066
2100
|
super(...arguments);
|
|
2067
2101
|
m(this, "id", T.CUSTOM);
|
|
@@ -2089,7 +2123,7 @@ class Ia extends G {
|
|
|
2089
2123
|
}
|
|
2090
2124
|
async isValidType(e, t, r) {
|
|
2091
2125
|
const { column: i, row: s, unitId: n, subUnitId: l } = e, u = await this._customFormulaService.getCellFormulaValue(n, l, r.uid, s, i), d = u == null ? void 0 : u.v;
|
|
2092
|
-
return
|
|
2126
|
+
return C(String(d)) && E.isDefine(d) && d !== "" ? u.t === Ft.BOOLEAN ? !!d : typeof d == "boolean" ? d : typeof d == "number" ? !!d : typeof d == "string" ? C(d) : !!d : !1;
|
|
2093
2127
|
}
|
|
2094
2128
|
generateRuleErrorMessage(e) {
|
|
2095
2129
|
return this.localeService.t("dataValidation.custom.error");
|
|
@@ -2099,7 +2133,7 @@ class Ia extends G {
|
|
|
2099
2133
|
return this.localeService.t("dataValidation.custom.ruleName").replace("{FORMULA1}", (t = e.formula1) != null ? t : "");
|
|
2100
2134
|
}
|
|
2101
2135
|
}
|
|
2102
|
-
class Da extends
|
|
2136
|
+
class Da extends ft {
|
|
2103
2137
|
constructor() {
|
|
2104
2138
|
super(...arguments);
|
|
2105
2139
|
m(this, "id", T.LIST_MULTIPLE);
|
|
@@ -2108,7 +2142,7 @@ class Da extends pt {
|
|
|
2108
2142
|
m(this, "skipDefaultFontRender", () => !0);
|
|
2109
2143
|
}
|
|
2110
2144
|
}
|
|
2111
|
-
class
|
|
2145
|
+
class ba extends G {
|
|
2112
2146
|
constructor() {
|
|
2113
2147
|
super(...arguments);
|
|
2114
2148
|
m(this, "_customFormulaService", this.injector.get(H));
|
|
@@ -2146,11 +2180,11 @@ class Na extends G {
|
|
|
2146
2180
|
return e == null ? Number.NaN : +e;
|
|
2147
2181
|
}
|
|
2148
2182
|
async parseFormula(e, t, r, i, s) {
|
|
2149
|
-
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c = S(u) ? n == null ? void 0 : n.v : u, g = S(d) ? l == null ? void 0 : l.v : d,
|
|
2183
|
+
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c = S(u) ? n == null ? void 0 : n.v : u, g = S(d) ? l == null ? void 0 : l.v : d, f = C(`${c}`) && C(`${g}`);
|
|
2150
2184
|
return {
|
|
2151
2185
|
formula1: this._parseNumber(c),
|
|
2152
2186
|
formula2: this._parseNumber(g),
|
|
2153
|
-
isFormulaValid:
|
|
2187
|
+
isFormulaValid: f
|
|
2154
2188
|
};
|
|
2155
2189
|
}
|
|
2156
2190
|
validatorFormula(e, t, r) {
|
|
@@ -2176,12 +2210,12 @@ class Na extends G {
|
|
|
2176
2210
|
return `${this.localeService.t(Me[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
2177
2211
|
}
|
|
2178
2212
|
}
|
|
2179
|
-
var
|
|
2180
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2213
|
+
var La = Object.getOwnPropertyDescriptor, Ua = (o, a, e, t) => {
|
|
2214
|
+
for (var r = t > 1 ? void 0 : t ? La(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
2181
2215
|
(s = o[i]) && (r = s(r) || r);
|
|
2182
2216
|
return r;
|
|
2183
2217
|
}, te = (o, a) => (e, t) => a(e, t, o);
|
|
2184
|
-
let
|
|
2218
|
+
let Oe = class extends Nt {
|
|
2185
2219
|
constructor(o, a, e, t, r, i) {
|
|
2186
2220
|
super(), this._univerInstanceService = o, this._dataValidatorRegistryService = a, this._injector = e, this._selectionManagerService = t, this._sheetInterceptorService = r, this._sheetDataValidationModel = i, this._init();
|
|
2187
2221
|
}
|
|
@@ -2190,31 +2224,31 @@ let we = class extends Ct {
|
|
|
2190
2224
|
}
|
|
2191
2225
|
_registerValidators() {
|
|
2192
2226
|
[
|
|
2193
|
-
|
|
2227
|
+
Ia,
|
|
2228
|
+
la,
|
|
2229
|
+
ba,
|
|
2230
|
+
ha,
|
|
2194
2231
|
na,
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
sa,
|
|
2198
|
-
ra,
|
|
2199
|
-
pt,
|
|
2232
|
+
ia,
|
|
2233
|
+
ft,
|
|
2200
2234
|
Da,
|
|
2201
|
-
|
|
2235
|
+
Aa
|
|
2202
2236
|
].forEach((o) => {
|
|
2203
2237
|
const a = this._injector.createInstance(o);
|
|
2204
|
-
this.disposeWithMe(this._dataValidatorRegistryService.register(a)), this.disposeWithMe(
|
|
2238
|
+
this.disposeWithMe(this._dataValidatorRegistryService.register(a)), this.disposeWithMe(Xe(() => this._injector.delete(o)));
|
|
2205
2239
|
});
|
|
2206
2240
|
}
|
|
2207
2241
|
_initCommandInterceptor() {
|
|
2208
2242
|
this._sheetInterceptorService.interceptCommand({
|
|
2209
2243
|
getMutations: (o) => {
|
|
2210
2244
|
var a;
|
|
2211
|
-
if (o.id ===
|
|
2212
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
2245
|
+
if (o.id === Yt.id) {
|
|
2246
|
+
const e = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET), t = e.getUnitId(), r = e.getActiveSheet();
|
|
2213
2247
|
if (!r)
|
|
2214
2248
|
throw new Error("No active sheet found");
|
|
2215
2249
|
const i = r.getSheetId(), s = (a = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : a.map((c) => c.range), n = this._sheetDataValidationModel.getRuleObjectMatrix(t, i).clone();
|
|
2216
2250
|
s && n.removeRange(s);
|
|
2217
|
-
const l = n.diff(this._sheetDataValidationModel.getRules(t, i)), { redoMutations: u, undoMutations: d } =
|
|
2251
|
+
const l = n.diff(this._sheetDataValidationModel.getRules(t, i)), { redoMutations: u, undoMutations: d } = Ue(t, i, l, this._injector, "patched");
|
|
2218
2252
|
return {
|
|
2219
2253
|
undos: d,
|
|
2220
2254
|
redos: u
|
|
@@ -2228,20 +2262,20 @@ let we = class extends Ct {
|
|
|
2228
2262
|
});
|
|
2229
2263
|
}
|
|
2230
2264
|
};
|
|
2231
|
-
|
|
2232
|
-
te(0,
|
|
2265
|
+
Oe = Ua([
|
|
2266
|
+
te(0, O),
|
|
2233
2267
|
te(1, v(q)),
|
|
2234
|
-
te(2, v(
|
|
2268
|
+
te(2, v(Ke)),
|
|
2235
2269
|
te(3, v(ht)),
|
|
2236
2270
|
te(4, v(ct)),
|
|
2237
2271
|
te(5, v(F))
|
|
2238
|
-
],
|
|
2239
|
-
var Ba = Object.getOwnPropertyDescriptor,
|
|
2272
|
+
], Oe);
|
|
2273
|
+
var Ba = Object.getOwnPropertyDescriptor, xa = (o, a, e, t) => {
|
|
2240
2274
|
for (var r = t > 1 ? void 0 : t ? Ba(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
2241
2275
|
(s = o[i]) && (r = s(r) || r);
|
|
2242
2276
|
return r;
|
|
2243
2277
|
}, Re = (o, a) => (e, t) => a(e, t, o);
|
|
2244
|
-
let
|
|
2278
|
+
let we = class extends W {
|
|
2245
2279
|
constructor(o, a, e, t) {
|
|
2246
2280
|
super(), this._univerInstanceService = o, this._sheetDataValidationModel = a, this._dataValidationCacheService = e, this._lifecycleService = t, this._initRecalculate();
|
|
2247
2281
|
}
|
|
@@ -2249,11 +2283,11 @@ let Ae = class extends W {
|
|
|
2249
2283
|
const o = (a) => {
|
|
2250
2284
|
if (a.length === 0)
|
|
2251
2285
|
return;
|
|
2252
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
2286
|
+
const e = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET), t = e == null ? void 0 : e.getActiveSheet(), r = {};
|
|
2253
2287
|
a.flat().forEach((i) => {
|
|
2254
2288
|
r[i.unitId] || (r[i.unitId] = {}), r[i.unitId][i.subUnitId] || (r[i.unitId][i.subUnitId] = []);
|
|
2255
|
-
const s = this._univerInstanceService.getUnit(i.unitId,
|
|
2256
|
-
n && r[i.unitId][i.subUnitId].push(...i.ranges.map((l) =>
|
|
2289
|
+
const s = this._univerInstanceService.getUnit(i.unitId, N.UNIVER_SHEET), n = s == null ? void 0 : s.getSheetBySheetId(i.subUnitId);
|
|
2290
|
+
n && r[i.unitId][i.subUnitId].push(...i.ranges.map((l) => L.transformRange(l, n)));
|
|
2257
2291
|
}), Object.entries(r).forEach(([i, s]) => {
|
|
2258
2292
|
Object.entries(s).forEach(([n, l]) => {
|
|
2259
2293
|
(e == null ? void 0 : e.getUnitId()) === i && (t == null ? void 0 : t.getSheetId()) === n ? this.validatorRanges(i, n, l) : requestIdleCallback(() => {
|
|
@@ -2262,7 +2296,7 @@ let Ae = class extends W {
|
|
|
2262
2296
|
});
|
|
2263
2297
|
});
|
|
2264
2298
|
};
|
|
2265
|
-
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(
|
|
2299
|
+
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(Xt(() => this._lifecycleService.lifecycle$.pipe(tt((a) => a === et.Rendered)))).subscribe(o)), this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(tt(() => this._lifecycleService.stage >= et.Rendered), Ot(20)).subscribe(o));
|
|
2266
2300
|
}
|
|
2267
2301
|
async _validatorByCell(o, a, e, t) {
|
|
2268
2302
|
const r = o.getUnitId(), i = a.getSheetId();
|
|
@@ -2273,10 +2307,10 @@ let Ae = class extends W {
|
|
|
2273
2307
|
this._sheetDataValidationModel.validator(s, { unitId: r, subUnitId: i, row: e, col: t, worksheet: a, workbook: o }, (l) => {
|
|
2274
2308
|
n(l);
|
|
2275
2309
|
});
|
|
2276
|
-
}) :
|
|
2310
|
+
}) : b.VALID;
|
|
2277
2311
|
}
|
|
2278
2312
|
async validatorCell(o, a, e, t) {
|
|
2279
|
-
const r = this._univerInstanceService.getUnit(o,
|
|
2313
|
+
const r = this._univerInstanceService.getUnit(o, N.UNIVER_SHEET);
|
|
2280
2314
|
if (!r)
|
|
2281
2315
|
throw new Error(`cannot find current workbook, unitId: ${o}`);
|
|
2282
2316
|
const i = r.getSheetBySheetId(a);
|
|
@@ -2287,22 +2321,22 @@ let Ae = class extends W {
|
|
|
2287
2321
|
validatorRanges(o, a, e) {
|
|
2288
2322
|
if (!e.length)
|
|
2289
2323
|
return Promise.resolve([]);
|
|
2290
|
-
const t = this._univerInstanceService.getUnit(o,
|
|
2324
|
+
const t = this._univerInstanceService.getUnit(o, N.UNIVER_SHEET);
|
|
2291
2325
|
if (!t)
|
|
2292
2326
|
throw new Error(`cannot find current workbook, unitId: ${o}`);
|
|
2293
2327
|
const r = t.getSheetBySheetId(a);
|
|
2294
2328
|
if (!r)
|
|
2295
2329
|
throw new Error(`cannot find current worksheet, sheetId: ${a}`);
|
|
2296
|
-
const s = this._sheetDataValidationModel.getRules(o, a).map((l) => l.ranges).flat(), n = e.map((l) => s.map((u) =>
|
|
2330
|
+
const s = this._sheetDataValidationModel.getRules(o, a).map((l) => l.ranges).flat(), n = e.map((l) => s.map((u) => ot(l, u))).flat().filter(Boolean);
|
|
2297
2331
|
return Promise.all(n.map((l) => {
|
|
2298
2332
|
const u = [];
|
|
2299
|
-
return
|
|
2333
|
+
return L.foreach(l, (d, c) => {
|
|
2300
2334
|
u.push(this._validatorByCell(t, r, d, c));
|
|
2301
2335
|
}), Promise.all(u);
|
|
2302
2336
|
}));
|
|
2303
2337
|
}
|
|
2304
2338
|
async validatorWorksheet(o, a) {
|
|
2305
|
-
const e = this._univerInstanceService.getUnit(o,
|
|
2339
|
+
const e = this._univerInstanceService.getUnit(o, N.UNIVER_SHEET);
|
|
2306
2340
|
if (!e)
|
|
2307
2341
|
throw new Error(`cannot find current workbook, unitId: ${o}`);
|
|
2308
2342
|
const t = e.getSheetBySheetId(a);
|
|
@@ -2313,7 +2347,7 @@ let Ae = class extends W {
|
|
|
2313
2347
|
r.map((i) => Promise.all(
|
|
2314
2348
|
i.ranges.map((s) => {
|
|
2315
2349
|
const n = [];
|
|
2316
|
-
return
|
|
2350
|
+
return L.foreach(s, (l, u) => {
|
|
2317
2351
|
n.push(this._validatorByCell(e, t, l, u));
|
|
2318
2352
|
}), Promise.all(n);
|
|
2319
2353
|
})
|
|
@@ -2329,7 +2363,7 @@ let Ae = class extends W {
|
|
|
2329
2363
|
getDataValidations(o, a, e) {
|
|
2330
2364
|
const t = this._sheetDataValidationModel.getRuleObjectMatrix(o, a), r = /* @__PURE__ */ new Set();
|
|
2331
2365
|
return e.forEach((s) => {
|
|
2332
|
-
|
|
2366
|
+
L.foreach(s, (n, l) => {
|
|
2333
2367
|
const u = t.getValue(n, l);
|
|
2334
2368
|
u && r.add(u);
|
|
2335
2369
|
});
|
|
@@ -2339,115 +2373,115 @@ let Ae = class extends W {
|
|
|
2339
2373
|
return this.getDataValidations(o, a, e)[0];
|
|
2340
2374
|
}
|
|
2341
2375
|
};
|
|
2342
|
-
|
|
2343
|
-
Re(0,
|
|
2376
|
+
we = xa([
|
|
2377
|
+
Re(0, O),
|
|
2344
2378
|
Re(1, v(F)),
|
|
2345
2379
|
Re(2, v(Q)),
|
|
2346
|
-
Re(3, v(
|
|
2347
|
-
],
|
|
2348
|
-
var
|
|
2349
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2380
|
+
Re(3, v(Ct))
|
|
2381
|
+
], we);
|
|
2382
|
+
var Pa = Object.defineProperty, Ha = Object.getOwnPropertyDescriptor, Wa = (o, a, e) => a in o ? Pa(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e, $a = (o, a, e, t) => {
|
|
2383
|
+
for (var r = t > 1 ? void 0 : t ? Ha(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
2350
2384
|
(s = o[i]) && (r = s(r) || r);
|
|
2351
2385
|
return r;
|
|
2352
|
-
}, qe = (o, a) => (e, t) => a(e, t, o), vt = (o, a, e) =>
|
|
2353
|
-
let Ie = class extends
|
|
2354
|
-
constructor(o =
|
|
2386
|
+
}, qe = (o, a) => (e, t) => a(e, t, o), vt = (o, a, e) => Wa(o, typeof a != "symbol" ? a + "" : a, e);
|
|
2387
|
+
let Ie = class extends At {
|
|
2388
|
+
constructor(o = it, a, e, t) {
|
|
2355
2389
|
super(), this._config = o, this._injector = a, this._commandService = e, this._configService = t;
|
|
2356
|
-
const { ...r } =
|
|
2390
|
+
const { ...r } = Dt(
|
|
2357
2391
|
{},
|
|
2358
|
-
|
|
2392
|
+
it,
|
|
2359
2393
|
this._config
|
|
2360
2394
|
);
|
|
2361
|
-
this._configService.setConfig(
|
|
2395
|
+
this._configService.setConfig(ya, r);
|
|
2362
2396
|
}
|
|
2363
2397
|
onStarting() {
|
|
2364
2398
|
[
|
|
2365
2399
|
[Q],
|
|
2366
2400
|
[K],
|
|
2367
2401
|
[H],
|
|
2368
|
-
[Ae],
|
|
2369
|
-
[F],
|
|
2370
2402
|
[we],
|
|
2371
|
-
[
|
|
2403
|
+
[F],
|
|
2372
2404
|
[Oe],
|
|
2405
|
+
[Te],
|
|
2373
2406
|
[Ce],
|
|
2407
|
+
[Ne],
|
|
2374
2408
|
[Fe]
|
|
2375
2409
|
].forEach((o) => {
|
|
2376
2410
|
this._injector.add(o);
|
|
2377
2411
|
}), [
|
|
2378
|
-
ma,
|
|
2379
|
-
ha,
|
|
2380
2412
|
ga,
|
|
2381
|
-
|
|
2382
|
-
|
|
2413
|
+
ma,
|
|
2414
|
+
pa,
|
|
2383
2415
|
fa,
|
|
2384
|
-
|
|
2416
|
+
Sa,
|
|
2417
|
+
Ra,
|
|
2418
|
+
_a
|
|
2385
2419
|
].forEach((o) => {
|
|
2386
2420
|
this._commandService.registerCommand(o);
|
|
2387
|
-
}), this._injector.get(Q), this._injector.get(
|
|
2421
|
+
}), this._injector.get(Q), this._injector.get(we), this._injector.get(Oe), this._injector.get(Fe), this._injector.get(Ne);
|
|
2388
2422
|
}
|
|
2389
2423
|
onReady() {
|
|
2390
|
-
this._injector.get(
|
|
2424
|
+
this._injector.get(Ce);
|
|
2391
2425
|
}
|
|
2392
2426
|
onRendered() {
|
|
2393
2427
|
this._injector.get(Te);
|
|
2394
2428
|
}
|
|
2395
2429
|
};
|
|
2396
|
-
vt(Ie, "pluginName",
|
|
2397
|
-
vt(Ie, "type",
|
|
2398
|
-
Ie =
|
|
2399
|
-
|
|
2400
|
-
qe(1, v(
|
|
2401
|
-
qe(2,
|
|
2430
|
+
vt(Ie, "pluginName", Ea);
|
|
2431
|
+
vt(Ie, "type", N.UNIVER_SHEET);
|
|
2432
|
+
Ie = $a([
|
|
2433
|
+
wt(Bt),
|
|
2434
|
+
qe(1, v(Ke)),
|
|
2435
|
+
qe(2, U),
|
|
2402
2436
|
qe(3, It)
|
|
2403
2437
|
], Ie);
|
|
2404
|
-
function
|
|
2438
|
+
function Za(o) {
|
|
2405
2439
|
const e = o.get(ht).getCurrentSelections().map((i) => i.range);
|
|
2406
2440
|
return {
|
|
2407
|
-
uid:
|
|
2441
|
+
uid: Ye(6),
|
|
2408
2442
|
type: T.DECIMAL,
|
|
2409
2443
|
operator: h.EQUAL,
|
|
2410
2444
|
formula1: "100",
|
|
2411
2445
|
ranges: e != null ? e : [{ startColumn: 0, endColumn: 0, startRow: 0, endRow: 0 }]
|
|
2412
2446
|
};
|
|
2413
2447
|
}
|
|
2414
|
-
const
|
|
2448
|
+
const Ja = "data-validation.custom-formula-input", er = "data-validation.formula-input", tr = "data-validation.list-formula-input", ar = "data-validation.checkbox-formula-input";
|
|
2415
2449
|
export {
|
|
2416
|
-
|
|
2417
|
-
|
|
2450
|
+
ga as AddSheetDataValidationCommand,
|
|
2451
|
+
er as BASE_FORMULA_INPUT_NAME,
|
|
2418
2452
|
Ee as CHECKBOX_FORMULA_1,
|
|
2419
2453
|
Ve as CHECKBOX_FORMULA_2,
|
|
2420
|
-
|
|
2421
|
-
|
|
2422
|
-
|
|
2423
|
-
|
|
2424
|
-
|
|
2454
|
+
ar as CHECKBOX_FORMULA_INPUT_NAME,
|
|
2455
|
+
Ja as CUSTOM_FORMULA_INPUT_NAME,
|
|
2456
|
+
ia as CheckboxValidator,
|
|
2457
|
+
_a as ClearRangeDataValidationCommand,
|
|
2458
|
+
Ea as DATA_VALIDATION_PLUGIN_NAME,
|
|
2425
2459
|
Q as DataValidationCacheService,
|
|
2426
2460
|
H as DataValidationCustomFormulaService,
|
|
2427
2461
|
Te as DataValidationFormulaController,
|
|
2428
2462
|
K as DataValidationFormulaService,
|
|
2429
|
-
|
|
2430
|
-
|
|
2463
|
+
na as DateValidator,
|
|
2464
|
+
tr as LIST_FORMULA_INPUT_NAME,
|
|
2431
2465
|
Da as ListMultipleValidator,
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2466
|
+
ft as ListValidator,
|
|
2467
|
+
Ra as RemoveSheetAllDataValidationCommand,
|
|
2468
|
+
Sa as RemoveSheetDataValidationCommand,
|
|
2435
2469
|
F as SheetDataValidationModel,
|
|
2436
|
-
|
|
2470
|
+
we as SheetsDataValidationValidatorService,
|
|
2437
2471
|
Ie as UniverSheetsDataValidationPlugin,
|
|
2438
|
-
|
|
2439
|
-
|
|
2440
|
-
|
|
2441
|
-
|
|
2442
|
-
|
|
2472
|
+
fa as UpdateSheetDataValidationOptionsCommand,
|
|
2473
|
+
ma as UpdateSheetDataValidationRangeCommand,
|
|
2474
|
+
pa as UpdateSheetDataValidationSettingCommand,
|
|
2475
|
+
Za as createDefaultNewRule,
|
|
2476
|
+
_e as deserializeListOptions,
|
|
2443
2477
|
ye as getCellValueNumber,
|
|
2444
2478
|
ne as getCellValueOrigin,
|
|
2445
|
-
|
|
2446
|
-
|
|
2447
|
-
|
|
2479
|
+
za as getDataValidationCellValue,
|
|
2480
|
+
Ue as getDataValidationDiffMutations,
|
|
2481
|
+
pe as getFormulaCellData,
|
|
2448
2482
|
oe as getFormulaResult,
|
|
2449
2483
|
Le as getTransformedFormula,
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2484
|
+
C as isLegalFormulaResult,
|
|
2485
|
+
Ka as serializeListOptions,
|
|
2486
|
+
fe as transformCheckboxValue
|
|
2453
2487
|
};
|