@univerjs/sheets-data-validation 0.5.1 → 0.5.2
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/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/es/facade.js +71 -71
- package/lib/es/index.js +415 -400
- package/lib/types/facade/f-data-validation-builder.d.ts +2 -2
- package/lib/types/facade/f-data-validation.d.ts +5 -4
- package/lib/types/facade/f-univer.d.ts +4 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +9 -9
package/lib/es/index.js
CHANGED
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
var vt = Object.defineProperty;
|
|
2
2
|
var Rt = (o, a, e) => a in o ? vt(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e;
|
|
3
3
|
var g = (o, a, e) => Rt(o, typeof a != "symbol" ? a + "" : a, e);
|
|
4
|
-
import { Inject as R, ICommandService as x, IUniverInstanceService as O, Disposable as
|
|
5
|
-
import { DataValidationModel as
|
|
6
|
-
import { SetRangeValuesMutation as
|
|
7
|
-
import { Subject as
|
|
8
|
-
import { RegisterOtherFormulaService as
|
|
9
|
-
import { ERROR_TYPE_SET as
|
|
10
|
-
const
|
|
11
|
-
var
|
|
12
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
4
|
+
import { Inject as R, ICommandService as x, IUniverInstanceService as O, Disposable as $, ObjectMatrix as Se, UniverInstanceType as N, Range as b, isFormulaString as S, DataValidationType as T, getOriginCellValue as St, RBush as Vt, debounce as Mt, Rectangle as I, Tools as V, DataValidationStatus as D, WrapStrategy as Re, DataValidationOperator as h, numfmt as Q, dayjs as at, DataValidationRenderMode as Be, CommandType as K, IUndoRedoService as z, sequenceExecute as Ie, isRangesEqual as rt, generateRandomId as yt, toDisposable as qe, IPermissionService as Et, Injector as Ge, CellValueType as Tt, RxDisposable as Ft, LifecycleService as Nt, LifecycleStages as ze, bufferDebounceTime as Ct, DependentOn as Ot, Plugin as wt, merge as It, IConfigService as At } from "@univerjs/core";
|
|
5
|
+
import { DataValidationModel as ke, DataValidatorRegistryService as G, UpdateRuleType as y, BaseDataValidator as k, TextLengthErrorTitleMap as Dt, AddDataValidationMutation as L, RemoveDataValidationMutation as A, UpdateDataValidationMutation as E, getRuleSetting as bt, getRuleOptions as Lt, UniverDataValidationPlugin as xt } from "@univerjs/data-validation";
|
|
6
|
+
import { SetRangeValuesMutation as se, RemoveSheetMutation as it, getSheetCommandTarget as Ye, SetRangeValuesUndoMutationFactory as ot, WorksheetViewPermission as Bt, RefRangeService as Ut, handleCommonDefaultRangeChangeWithEffectRefCommands as Pt, SheetInterceptorService as st, RemoveSheetCommand as $t, SheetsSelectionsService as nt, ClearSelectionAllCommand as Ht } from "@univerjs/sheets";
|
|
7
|
+
import { Subject as Qe, bufferWhen as Wt, filter as Ze } from "rxjs";
|
|
8
|
+
import { RegisterOtherFormulaService as lt, FormulaRefRangeService as ut } from "@univerjs/sheets-formula";
|
|
9
|
+
import { ERROR_TYPE_SET as jt, LexerTreeBuilder as Z, isReferenceString as dt, sequenceNodeType as Qt, deserializeRangeWithSheet as qt, deserializeRangeWithSheetWithCache as Gt } from "@univerjs/engine-formula";
|
|
10
|
+
const kt = "SHEET_DATA_VALIDATION_PLUGIN";
|
|
11
|
+
var Yt = Object.defineProperty, Xt = Object.getOwnPropertyDescriptor, Kt = (o, a, e, t) => {
|
|
12
|
+
for (var r = t > 1 ? void 0 : t ? Xt(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
13
13
|
(s = o[i]) && (r = (t ? s(a, e, r) : s(r)) || r);
|
|
14
|
-
return t && r &&
|
|
15
|
-
},
|
|
16
|
-
let
|
|
14
|
+
return t && r && Yt(a, e, r), r;
|
|
15
|
+
}, Je = (o, a) => (e, t) => a(e, t, o);
|
|
16
|
+
let q = class extends $ {
|
|
17
17
|
constructor(a, e) {
|
|
18
18
|
super();
|
|
19
19
|
g(this, "_cacheMatrix", /* @__PURE__ */ new Map());
|
|
20
|
-
g(this, "_dirtyRanges$", new
|
|
20
|
+
g(this, "_dirtyRanges$", new Qe());
|
|
21
21
|
g(this, "dirtyRanges$", this._dirtyRanges$.asObservable());
|
|
22
22
|
this._commandService = a, this._univerInstanceService = e, this._initDirtyRanges(), this._initSheetRemove();
|
|
23
23
|
}
|
|
24
24
|
_initDirtyRanges() {
|
|
25
25
|
this.disposeWithMe(this._commandService.onCommandExecuted((a) => {
|
|
26
|
-
if (a.id ===
|
|
26
|
+
if (a.id === se.id) {
|
|
27
27
|
const { cellValue: e, unitId: t, subUnitId: r } = a.params;
|
|
28
28
|
if (e) {
|
|
29
|
-
const i = new
|
|
29
|
+
const i = new Se(e).getDataRange();
|
|
30
30
|
if (i.endRow === -1) return;
|
|
31
31
|
this.markRangeDirty(t, r, [i]);
|
|
32
32
|
}
|
|
@@ -36,7 +36,7 @@ let j = class extends P {
|
|
|
36
36
|
_initSheetRemove() {
|
|
37
37
|
this.disposeWithMe(this._commandService.onCommandExecuted((a) => {
|
|
38
38
|
var e;
|
|
39
|
-
if (a.id ===
|
|
39
|
+
if (a.id === it.id) {
|
|
40
40
|
const { unitId: t, subUnitId: r } = a.params;
|
|
41
41
|
(e = this._cacheMatrix.get(t)) == null || e.delete(r);
|
|
42
42
|
}
|
|
@@ -48,7 +48,7 @@ let j = class extends P {
|
|
|
48
48
|
let t = this._cacheMatrix.get(a);
|
|
49
49
|
t || (t = /* @__PURE__ */ new Map(), this._cacheMatrix.set(a, t));
|
|
50
50
|
let r = t.get(e);
|
|
51
|
-
return r || (r = new
|
|
51
|
+
return r || (r = new Se(), t.set(e, r)), r;
|
|
52
52
|
}
|
|
53
53
|
ensureCache(a, e) {
|
|
54
54
|
return this._ensureCache(a, e);
|
|
@@ -79,32 +79,32 @@ let j = class extends P {
|
|
|
79
79
|
return this._ensureCache(a, e).getValue(t, r);
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
],
|
|
86
|
-
function
|
|
82
|
+
q = Kt([
|
|
83
|
+
Je(0, R(x)),
|
|
84
|
+
Je(1, R(O))
|
|
85
|
+
], q);
|
|
86
|
+
function oe(o) {
|
|
87
87
|
var a, e;
|
|
88
88
|
return (e = (a = o == null ? void 0 : o[0]) == null ? void 0 : a[0]) == null ? void 0 : e.v;
|
|
89
89
|
}
|
|
90
|
-
function
|
|
90
|
+
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
94
|
function C(o) {
|
|
95
|
-
return !
|
|
95
|
+
return !jt.has(o);
|
|
96
96
|
}
|
|
97
|
-
function
|
|
97
|
+
function de(o, a) {
|
|
98
98
|
var t;
|
|
99
99
|
const e = a.getValidatorItem(o);
|
|
100
100
|
return (t = e == null ? void 0 : e.offsetFormulaByRange) != null ? t : !1;
|
|
101
101
|
}
|
|
102
|
-
var
|
|
103
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
102
|
+
var zt = Object.defineProperty, Zt = Object.getOwnPropertyDescriptor, Jt = (o, a, e, t) => {
|
|
103
|
+
for (var r = t > 1 ? void 0 : t ? Zt(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
104
104
|
(s = o[i]) && (r = (t ? s(a, e, r) : s(r)) || r);
|
|
105
|
-
return t && r &&
|
|
106
|
-
},
|
|
107
|
-
let
|
|
105
|
+
return t && r && zt(a, e, r), r;
|
|
106
|
+
}, re = (o, a) => (e, t) => a(e, t, o);
|
|
107
|
+
let P = class extends $ {
|
|
108
108
|
constructor(a, e, t, r, i) {
|
|
109
109
|
super();
|
|
110
110
|
/**
|
|
@@ -172,7 +172,7 @@ let U = class extends P {
|
|
|
172
172
|
}
|
|
173
173
|
}
|
|
174
174
|
addRule(a, e, t) {
|
|
175
|
-
if (
|
|
175
|
+
if (de(t.type, this._validatorRegistryService)) {
|
|
176
176
|
const { ranges: r, formula1: i, formula2: s, uid: n } = t;
|
|
177
177
|
this._addFormulaByRange(a, e, n, i, s, r);
|
|
178
178
|
}
|
|
@@ -183,7 +183,7 @@ let U = class extends P {
|
|
|
183
183
|
if (!n)
|
|
184
184
|
return Promise.resolve(void 0);
|
|
185
185
|
const l = await this._registerOtherFormulaService.getFormulaValue(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, m = i - d;
|
|
186
|
-
return
|
|
186
|
+
return _e((_ = (p = l == null ? void 0 : l.result) == null ? void 0 : p[c]) == null ? void 0 : _[m]);
|
|
187
187
|
}
|
|
188
188
|
async getCellFormula2Value(a, e, t, r, i) {
|
|
189
189
|
var p, _;
|
|
@@ -191,7 +191,7 @@ let U = class extends P {
|
|
|
191
191
|
if (!n)
|
|
192
192
|
return Promise.resolve(void 0);
|
|
193
193
|
const l = await this._registerOtherFormulaService.getFormulaValue(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, m = i - d;
|
|
194
|
-
return
|
|
194
|
+
return _e((_ = (p = l == null ? void 0 : l.result) == null ? void 0 : p[c]) == null ? void 0 : _[m]);
|
|
195
195
|
}
|
|
196
196
|
getCellFormulaValueSync(a, e, t, r, i) {
|
|
197
197
|
var p, _;
|
|
@@ -199,7 +199,7 @@ let U = class extends P {
|
|
|
199
199
|
if (!n)
|
|
200
200
|
return;
|
|
201
201
|
const l = this._registerOtherFormulaService.getFormulaValueSync(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, m = i - d;
|
|
202
|
-
return
|
|
202
|
+
return _e((_ = (p = l == null ? void 0 : l.result) == null ? void 0 : p[c]) == null ? void 0 : _[m]);
|
|
203
203
|
}
|
|
204
204
|
getCellFormula2ValueSync(a, e, t, r, i) {
|
|
205
205
|
var p, _;
|
|
@@ -207,26 +207,26 @@ let U = class extends P {
|
|
|
207
207
|
if (!n)
|
|
208
208
|
return;
|
|
209
209
|
const l = this._registerOtherFormulaService.getFormulaValueSync(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, m = i - d;
|
|
210
|
-
return
|
|
210
|
+
return _e((_ = (p = l == null ? void 0 : l.result) == null ? void 0 : p[c]) == null ? void 0 : _[m]);
|
|
211
211
|
}
|
|
212
212
|
getRuleFormulaInfo(a, e, t) {
|
|
213
213
|
const { ruleFormulaMap: r } = this._ensureMaps(a, e);
|
|
214
214
|
return r.get(t);
|
|
215
215
|
}
|
|
216
216
|
};
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
],
|
|
224
|
-
var
|
|
225
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
217
|
+
P = Jt([
|
|
218
|
+
re(0, O),
|
|
219
|
+
re(1, R(lt)),
|
|
220
|
+
re(2, R(ke)),
|
|
221
|
+
re(3, R(q)),
|
|
222
|
+
re(4, R(G))
|
|
223
|
+
], P);
|
|
224
|
+
var ea = Object.defineProperty, ta = Object.getOwnPropertyDescriptor, aa = (o, a, e, t) => {
|
|
225
|
+
for (var r = t > 1 ? void 0 : t ? ta(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
226
226
|
(s = o[i]) && (r = (t ? s(a, e, r) : s(r)) || r);
|
|
227
|
-
return t && r &&
|
|
228
|
-
},
|
|
229
|
-
let
|
|
227
|
+
return t && r && ea(a, e, r), r;
|
|
228
|
+
}, ie = (o, a) => (e, t) => a(e, t, o);
|
|
229
|
+
let X = class extends $ {
|
|
230
230
|
constructor(a, e, t, r, i) {
|
|
231
231
|
super();
|
|
232
232
|
g(this, "_formulaRuleMap", /* @__PURE__ */ new Map());
|
|
@@ -261,7 +261,7 @@ let k = class extends P {
|
|
|
261
261
|
return this._registerOtherFormulaService.registerFormulaWithRange(a, e, t, i, { ruleId: r });
|
|
262
262
|
}
|
|
263
263
|
addRule(a, e, t) {
|
|
264
|
-
if (!
|
|
264
|
+
if (!de(t.type, this._validatorRegistryService) && t.type !== T.CHECKBOX) {
|
|
265
265
|
const { formula1: r, formula2: i, uid: s } = t, n = S(r), l = S(i);
|
|
266
266
|
if (!n && !l)
|
|
267
267
|
return;
|
|
@@ -306,21 +306,21 @@ let k = class extends P {
|
|
|
306
306
|
return this._ensureRuleFormulaMap(a, e).get(t);
|
|
307
307
|
}
|
|
308
308
|
};
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
],
|
|
316
|
-
function
|
|
309
|
+
X = aa([
|
|
310
|
+
ie(0, O),
|
|
311
|
+
ie(1, R(lt)),
|
|
312
|
+
ie(2, R(q)),
|
|
313
|
+
ie(3, R(ke)),
|
|
314
|
+
ie(4, R(G))
|
|
315
|
+
], X);
|
|
316
|
+
function ne(o) {
|
|
317
317
|
return St(o);
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function ct(o) {
|
|
320
320
|
var a;
|
|
321
|
-
return String((a =
|
|
321
|
+
return String((a = ne(o)) != null ? a : "");
|
|
322
322
|
}
|
|
323
|
-
class
|
|
323
|
+
class Xe {
|
|
324
324
|
constructor(a, e, t, r, i = !1) {
|
|
325
325
|
g(this, "_map");
|
|
326
326
|
g(this, "_tree", new Vt());
|
|
@@ -352,9 +352,9 @@ class Ge {
|
|
|
352
352
|
_addRule(a, e) {
|
|
353
353
|
if (!this._worksheet)
|
|
354
354
|
return;
|
|
355
|
-
const t = e.map((r) => b.transformRange(r, this._worksheet));
|
|
355
|
+
const t = I.mergeRanges(e.map((r) => b.transformRange(r, this._worksheet)));
|
|
356
356
|
this._map.forEach((r, i) => {
|
|
357
|
-
const s =
|
|
357
|
+
const s = I.subtractMulti(r, t);
|
|
358
358
|
s.length === 0 ? this._map.delete(i) : this._map.set(i, s);
|
|
359
359
|
}), this._dirty = !0, this._map.set(a, t), this._debonceBuildTree();
|
|
360
360
|
}
|
|
@@ -366,7 +366,7 @@ class Ge {
|
|
|
366
366
|
return;
|
|
367
367
|
const e = a.map((t) => b.transformRange(t, this._worksheet));
|
|
368
368
|
this._map.forEach((t, r) => {
|
|
369
|
-
const i =
|
|
369
|
+
const i = I.subtractMulti(t, e);
|
|
370
370
|
i.length === 0 ? this._map.delete(r) : this._map.set(r, i);
|
|
371
371
|
}), this._dirty = !0, this._debonceBuildTree();
|
|
372
372
|
}
|
|
@@ -384,10 +384,10 @@ class Ge {
|
|
|
384
384
|
if (!t.length)
|
|
385
385
|
return;
|
|
386
386
|
let r = this._map.get(e);
|
|
387
|
-
r ? (this._map.set(e,
|
|
387
|
+
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) => {
|
|
388
388
|
if (s === e)
|
|
389
389
|
return;
|
|
390
|
-
const n =
|
|
390
|
+
const n = I.subtractMulti(i, t);
|
|
391
391
|
n.length === 0 ? this._map.delete(s) : this._map.set(s, n);
|
|
392
392
|
});
|
|
393
393
|
}), this._dirty = !0, this._debonceBuildTree();
|
|
@@ -398,11 +398,11 @@ class Ge {
|
|
|
398
398
|
return a.forEach((r, i) => {
|
|
399
399
|
var l;
|
|
400
400
|
const s = (l = this._map.get(r.uid)) != null ? l : [], n = r.ranges;
|
|
401
|
-
s.length !== 0 && (s.length !== n.length || s.some((u, d) => !
|
|
401
|
+
s.length !== 0 && (s.length !== n.length || s.some((u, d) => !I.equals(u, n[d]))) && e.push({
|
|
402
402
|
type: "update",
|
|
403
403
|
ruleId: r.uid,
|
|
404
404
|
oldRanges: n,
|
|
405
|
-
newRanges:
|
|
405
|
+
newRanges: I.sort(s),
|
|
406
406
|
rule: r
|
|
407
407
|
}), s.length === 0 && (e.push({
|
|
408
408
|
type: "delete",
|
|
@@ -417,11 +417,11 @@ class Ge {
|
|
|
417
417
|
return a.forEach((i, s) => {
|
|
418
418
|
var u;
|
|
419
419
|
const n = (u = this._map.get(i.uid)) != null ? u : [], l = i.ranges;
|
|
420
|
-
n.length !== 0 && (n.length !== l.length || n.some((d, c) => !
|
|
420
|
+
n.length !== 0 && (n.length !== l.length || n.some((d, c) => !I.equals(d, l[c]))) && t.push({
|
|
421
421
|
type: "update",
|
|
422
422
|
ruleId: i.uid,
|
|
423
423
|
oldRanges: l,
|
|
424
|
-
newRanges:
|
|
424
|
+
newRanges: I.sort(n),
|
|
425
425
|
rule: i
|
|
426
426
|
}), n.length === 0 && (t.push({
|
|
427
427
|
type: "delete",
|
|
@@ -435,13 +435,13 @@ class Ge {
|
|
|
435
435
|
type: "add",
|
|
436
436
|
rule: {
|
|
437
437
|
...i,
|
|
438
|
-
ranges:
|
|
438
|
+
ranges: I.sort(s)
|
|
439
439
|
}
|
|
440
440
|
});
|
|
441
441
|
}), t;
|
|
442
442
|
}
|
|
443
443
|
clone() {
|
|
444
|
-
return new
|
|
444
|
+
return new Xe(
|
|
445
445
|
new Map(V.deepClone(Array.from(this._map.entries()))),
|
|
446
446
|
this._unitId,
|
|
447
447
|
this._subUnitId,
|
|
@@ -461,17 +461,17 @@ class Ge {
|
|
|
461
461
|
return t.length > 0 ? t[0].ruleId : void 0;
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
|
-
var
|
|
465
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
464
|
+
var ra = Object.defineProperty, ia = Object.getOwnPropertyDescriptor, oa = (o, a, e, t) => {
|
|
465
|
+
for (var r = t > 1 ? void 0 : t ? ia(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
466
466
|
(s = o[i]) && (r = (t ? s(a, e, r) : s(r)) || r);
|
|
467
|
-
return t && r &&
|
|
468
|
-
},
|
|
469
|
-
let F = class extends
|
|
467
|
+
return t && r && ra(a, e, r), r;
|
|
468
|
+
}, Y = (o, a) => (e, t) => a(e, t, o);
|
|
469
|
+
let F = class extends $ {
|
|
470
470
|
constructor(a, e, t, r, i, s, n) {
|
|
471
471
|
super();
|
|
472
472
|
g(this, "_ruleMatrixMap", /* @__PURE__ */ new Map());
|
|
473
|
-
g(this, "_validStatusChange$", new
|
|
474
|
-
g(this, "_ruleChange$", new
|
|
473
|
+
g(this, "_validStatusChange$", new Qe());
|
|
474
|
+
g(this, "_ruleChange$", new Qe());
|
|
475
475
|
g(this, "ruleChange$", this._ruleChange$.asObservable());
|
|
476
476
|
g(this, "validStatusChange$", this._validStatusChange$.asObservable());
|
|
477
477
|
this._dataValidationModel = a, this._univerInstanceService = e, this._dataValidatorRegistryService = t, this._dataValidationCacheService = r, this._dataValidationFormulaService = i, this._dataValidationCustomFormulaService = s, this._commandService = n, this._initRuleUpdateListener(), this.disposeWithMe(() => {
|
|
@@ -485,7 +485,7 @@ let F = class extends P {
|
|
|
485
485
|
})
|
|
486
486
|
), this.disposeWithMe(
|
|
487
487
|
this._commandService.onCommandExecuted((a) => {
|
|
488
|
-
if (a.id ===
|
|
488
|
+
if (a.id === it.id) {
|
|
489
489
|
const { unitId: e, subUnitId: t } = a.params, r = this._ruleMatrixMap.get(e);
|
|
490
490
|
r && r.delete(t);
|
|
491
491
|
}
|
|
@@ -525,7 +525,7 @@ let F = class extends P {
|
|
|
525
525
|
let t = this._ruleMatrixMap.get(a);
|
|
526
526
|
t || (t = /* @__PURE__ */ new Map(), this._ruleMatrixMap.set(a, t));
|
|
527
527
|
let r = t.get(e);
|
|
528
|
-
return r || (r = new
|
|
528
|
+
return r || (r = new Xe(/* @__PURE__ */ new Map(), a, e, this._univerInstanceService), t.set(e, r)), r;
|
|
529
529
|
}
|
|
530
530
|
_addRuleSideEffect(a, e, t) {
|
|
531
531
|
this._ensureRuleMatrix(a, e).addRule(t), this._dataValidationCacheService.addRule(a, e, t), this._dataValidationFormulaService.addRule(a, e, t), this._dataValidationCustomFormulaService.addRule(a, e, t);
|
|
@@ -566,7 +566,7 @@ let F = class extends P {
|
|
|
566
566
|
row: i,
|
|
567
567
|
col: r
|
|
568
568
|
});
|
|
569
|
-
}, d = l.getCellValueOnly(i, r), c = this.getValidator(a.type), m = l.getCellRaw(i, r), p =
|
|
569
|
+
}, d = l.getCellValueOnly(i, r), c = this.getValidator(a.type), m = l.getCellRaw(i, r), p = ne(m);
|
|
570
570
|
if (c) {
|
|
571
571
|
const _ = this._dataValidationCacheService.ensureCache(s, n), v = _.getValue(i, r);
|
|
572
572
|
return v == null ? (_.setValue(i, r, D.VALIDATING), c.validator(
|
|
@@ -578,7 +578,7 @@ let F = class extends P {
|
|
|
578
578
|
column: r,
|
|
579
579
|
worksheet: e.worksheet,
|
|
580
580
|
workbook: e.workbook,
|
|
581
|
-
interceptValue:
|
|
581
|
+
interceptValue: ne(d),
|
|
582
582
|
t: m == null ? void 0 : m.t
|
|
583
583
|
},
|
|
584
584
|
a
|
|
@@ -616,21 +616,21 @@ let F = class extends P {
|
|
|
616
616
|
return this._dataValidationModel.getAll();
|
|
617
617
|
}
|
|
618
618
|
};
|
|
619
|
-
F =
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
|
|
626
|
-
|
|
619
|
+
F = oa([
|
|
620
|
+
Y(0, R(ke)),
|
|
621
|
+
Y(1, O),
|
|
622
|
+
Y(2, R(G)),
|
|
623
|
+
Y(3, R(q)),
|
|
624
|
+
Y(4, R(X)),
|
|
625
|
+
Y(5, R(P)),
|
|
626
|
+
Y(6, x)
|
|
627
627
|
], F);
|
|
628
|
-
const
|
|
629
|
-
function
|
|
628
|
+
const Ve = 1, Me = 0;
|
|
629
|
+
function et(o, a) {
|
|
630
630
|
return V.isBlank(o) ? a.t("dataValidation.validFail.value") : S(o) ? a.t("dataValidation.validFail.primitive") : "";
|
|
631
631
|
}
|
|
632
|
-
const
|
|
633
|
-
class
|
|
632
|
+
const pe = (o) => V.isDefine(o) && String(o).toLowerCase() === "true" ? "1" : String(o).toLowerCase() === "false" ? "0" : o;
|
|
633
|
+
class sa extends k {
|
|
634
634
|
constructor() {
|
|
635
635
|
super(...arguments);
|
|
636
636
|
g(this, "id", T.CHECKBOX);
|
|
@@ -638,7 +638,7 @@ class oa extends q {
|
|
|
638
638
|
g(this, "operators", []);
|
|
639
639
|
g(this, "scopes", ["sheet"]);
|
|
640
640
|
g(this, "offsetFormulaByRange", !1);
|
|
641
|
-
g(this, "_formulaService", this.injector.get(
|
|
641
|
+
g(this, "_formulaService", this.injector.get(X));
|
|
642
642
|
g(this, "skipDefaultFontRender", (e, t, r) => {
|
|
643
643
|
const { unitId: i, subUnitId: s } = r, { formula1: n, formula2: l } = this.parseFormulaSync(e, i, s), u = `${t != null ? t : ""}`;
|
|
644
644
|
return !u || u === `${n}` || u === `${l}`;
|
|
@@ -656,7 +656,7 @@ class oa extends q {
|
|
|
656
656
|
formula1: this.localeService.t("dataValidation.validFail.checkboxEqual"),
|
|
657
657
|
formula2: this.localeService.t("dataValidation.validFail.checkboxEqual")
|
|
658
658
|
};
|
|
659
|
-
const l =
|
|
659
|
+
const l = et(i, this.localeService), u = et(s, this.localeService);
|
|
660
660
|
return {
|
|
661
661
|
success: !l && !u,
|
|
662
662
|
formula1: l,
|
|
@@ -665,10 +665,10 @@ class oa extends q {
|
|
|
665
665
|
}
|
|
666
666
|
async parseFormula(e, t, r) {
|
|
667
667
|
var c, m, p, _;
|
|
668
|
-
const { formula1: i =
|
|
668
|
+
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));
|
|
669
669
|
return {
|
|
670
|
-
formula1:
|
|
671
|
-
formula2:
|
|
670
|
+
formula1: pe(l),
|
|
671
|
+
formula2: pe(u),
|
|
672
672
|
originFormula1: l,
|
|
673
673
|
originFormula2: u,
|
|
674
674
|
isFormulaValid: d
|
|
@@ -676,15 +676,15 @@ class oa extends q {
|
|
|
676
676
|
}
|
|
677
677
|
getExtraStyle(e, t) {
|
|
678
678
|
return {
|
|
679
|
-
tb:
|
|
679
|
+
tb: Re.CLIP
|
|
680
680
|
};
|
|
681
681
|
}
|
|
682
682
|
parseFormulaSync(e, t, r) {
|
|
683
683
|
var c, m, p, _;
|
|
684
|
-
const { formula1: i =
|
|
684
|
+
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));
|
|
685
685
|
return {
|
|
686
|
-
formula1:
|
|
687
|
-
formula2:
|
|
686
|
+
formula1: pe(l),
|
|
687
|
+
formula2: pe(u),
|
|
688
688
|
originFormula1: l,
|
|
689
689
|
originFormula2: u,
|
|
690
690
|
isFormulaValid: d
|
|
@@ -698,7 +698,7 @@ class oa extends q {
|
|
|
698
698
|
return this.localeService.t("dataValidation.checkbox.error");
|
|
699
699
|
}
|
|
700
700
|
}
|
|
701
|
-
const
|
|
701
|
+
const na = {
|
|
702
702
|
[h.BETWEEN]: "dataValidation.date.operators.between",
|
|
703
703
|
[h.EQUAL]: "dataValidation.date.operators.equal",
|
|
704
704
|
[h.GREATER_THAN]: "dataValidation.date.operators.greaterThan",
|
|
@@ -709,7 +709,7 @@ const sa = {
|
|
|
709
709
|
[h.NOT_EQUAL]: "dataValidation.date.operators.notEqual"
|
|
710
710
|
};
|
|
711
711
|
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 + "";
|
|
712
|
-
const
|
|
712
|
+
const la = {
|
|
713
713
|
[h.BETWEEN]: "dataValidation.date.ruleName.between",
|
|
714
714
|
[h.EQUAL]: "dataValidation.date.ruleName.equal",
|
|
715
715
|
[h.GREATER_THAN]: "dataValidation.date.ruleName.greaterThan",
|
|
@@ -718,7 +718,7 @@ const na = {
|
|
|
718
718
|
[h.LESS_THAN_OR_EQUAL]: "dataValidation.date.ruleName.lessThanOrEqual",
|
|
719
719
|
[h.NOT_BETWEEN]: "dataValidation.date.ruleName.notBetween",
|
|
720
720
|
[h.NOT_EQUAL]: "dataValidation.date.ruleName.notEqual"
|
|
721
|
-
},
|
|
721
|
+
}, ua = {
|
|
722
722
|
[h.BETWEEN]: "dataValidation.date.errorMsg.between",
|
|
723
723
|
[h.EQUAL]: "dataValidation.date.errorMsg.equal",
|
|
724
724
|
[h.GREATER_THAN]: "dataValidation.date.errorMsg.greaterThan",
|
|
@@ -727,37 +727,37 @@ const na = {
|
|
|
727
727
|
[h.LESS_THAN_OR_EQUAL]: "dataValidation.date.errorMsg.lessThanOrEqual",
|
|
728
728
|
[h.NOT_BETWEEN]: "dataValidation.date.errorMsg.notBetween",
|
|
729
729
|
[h.NOT_EQUAL]: "dataValidation.date.errorMsg.notEqual"
|
|
730
|
-
},
|
|
730
|
+
}, Ae = [
|
|
731
731
|
h.BETWEEN,
|
|
732
732
|
h.NOT_BETWEEN
|
|
733
|
-
],
|
|
733
|
+
], le = "{FORMULA1}", ue = "{FORMULA2}";
|
|
734
734
|
function rr(o) {
|
|
735
735
|
return o.filter(Boolean).join(",");
|
|
736
736
|
}
|
|
737
|
-
function
|
|
737
|
+
function fe(o) {
|
|
738
738
|
return o.split(",").filter(Boolean);
|
|
739
739
|
}
|
|
740
740
|
function ir(o) {
|
|
741
|
-
const a =
|
|
741
|
+
const a = ne(o);
|
|
742
742
|
return a == null ? "" : a.toString();
|
|
743
743
|
}
|
|
744
|
-
function
|
|
744
|
+
function De(o, a, e) {
|
|
745
745
|
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;
|
|
746
746
|
return {
|
|
747
747
|
transformedFormula1: u,
|
|
748
748
|
transformedFormula2: d
|
|
749
749
|
};
|
|
750
750
|
}
|
|
751
|
-
const
|
|
751
|
+
const Ue = (o) => {
|
|
752
752
|
var e, t;
|
|
753
753
|
if (o == null || typeof o == "boolean")
|
|
754
754
|
return;
|
|
755
755
|
if (typeof o == "number" || !Number.isNaN(+o))
|
|
756
756
|
return +o;
|
|
757
|
-
const a = (e =
|
|
758
|
-
return V.isDefine(a) ? a : (t =
|
|
757
|
+
const a = (e = Q.parseDate(o)) == null ? void 0 : e.v;
|
|
758
|
+
return V.isDefine(a) ? a : (t = Q.parseDate(at(o).format("YYYY-MM-DD HH:mm:ss"))) == null ? void 0 : t.v;
|
|
759
759
|
};
|
|
760
|
-
class
|
|
760
|
+
class da extends k {
|
|
761
761
|
constructor() {
|
|
762
762
|
super(...arguments);
|
|
763
763
|
g(this, "id", T.DATE);
|
|
@@ -773,23 +773,23 @@ class ua extends q {
|
|
|
773
773
|
h.NOT_EQUAL
|
|
774
774
|
]);
|
|
775
775
|
g(this, "scopes", ["sheet"]);
|
|
776
|
-
g(this, "_customFormulaService", this.injector.get(
|
|
777
|
-
g(this, "_lexerTreeBuilder", this.injector.get(
|
|
776
|
+
g(this, "_customFormulaService", this.injector.get(P));
|
|
777
|
+
g(this, "_lexerTreeBuilder", this.injector.get(Z));
|
|
778
778
|
}
|
|
779
779
|
async parseFormula(e, t, r, i, s) {
|
|
780
780
|
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));
|
|
781
781
|
return {
|
|
782
|
-
formula1:
|
|
783
|
-
formula2:
|
|
782
|
+
formula1: Ue(S(u) ? n == null ? void 0 : n.v : u),
|
|
783
|
+
formula2: Ue(S(d) ? l == null ? void 0 : l.v : d),
|
|
784
784
|
isFormulaValid: c
|
|
785
785
|
};
|
|
786
786
|
}
|
|
787
787
|
async isValidType(e) {
|
|
788
788
|
const { interceptValue: t, value: r } = e;
|
|
789
|
-
return typeof r == "number" && typeof t == "string" ? !0 : typeof t == "string" ? !!
|
|
789
|
+
return typeof r == "number" && typeof t == "string" ? !0 : typeof t == "string" ? !!Q.parseDate(t) : !1;
|
|
790
790
|
}
|
|
791
791
|
_validatorSingleFormula(e) {
|
|
792
|
-
return !V.isBlank(e) && (S(e) || !Number.isNaN(+e) || !!(e &&
|
|
792
|
+
return !V.isBlank(e) && (S(e) || !Number.isNaN(+e) || !!(e && Q.parseDate(e)));
|
|
793
793
|
}
|
|
794
794
|
validatorFormula(e, t, r) {
|
|
795
795
|
const i = e.operator;
|
|
@@ -798,7 +798,7 @@ class ua extends q {
|
|
|
798
798
|
success: !1
|
|
799
799
|
};
|
|
800
800
|
const s = this._validatorSingleFormula(e.formula1), n = this.localeService.t("dataValidation.validFail.date");
|
|
801
|
-
if (
|
|
801
|
+
if (Ae.includes(i)) {
|
|
802
802
|
const u = this._validatorSingleFormula(e.formula2);
|
|
803
803
|
return {
|
|
804
804
|
success: s && u,
|
|
@@ -818,14 +818,14 @@ class ua extends q {
|
|
|
818
818
|
return u;
|
|
819
819
|
let d;
|
|
820
820
|
if (!Number.isNaN(+u))
|
|
821
|
-
d =
|
|
821
|
+
d = Q.dateFromSerial(+u);
|
|
822
822
|
else {
|
|
823
|
-
const m = (c =
|
|
823
|
+
const m = (c = Q.parseDate(u)) == null ? void 0 : c.v;
|
|
824
824
|
if (m == null)
|
|
825
825
|
return "";
|
|
826
|
-
d =
|
|
826
|
+
d = Q.dateFromSerial(m);
|
|
827
827
|
}
|
|
828
|
-
return
|
|
828
|
+
return at(`${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");
|
|
829
829
|
};
|
|
830
830
|
return {
|
|
831
831
|
formula1: S(i) ? i : l(`${i}`),
|
|
@@ -836,29 +836,29 @@ class ua extends q {
|
|
|
836
836
|
const { value: i } = e;
|
|
837
837
|
return {
|
|
838
838
|
...e,
|
|
839
|
-
value:
|
|
839
|
+
value: Ue(i)
|
|
840
840
|
};
|
|
841
841
|
}
|
|
842
842
|
get operatorNames() {
|
|
843
|
-
return this.operators.map((e) => this.localeService.t(
|
|
843
|
+
return this.operators.map((e) => this.localeService.t(na[e]));
|
|
844
844
|
}
|
|
845
845
|
generateRuleName(e) {
|
|
846
846
|
var r, i;
|
|
847
847
|
if (!e.operator)
|
|
848
848
|
return this.titleStr;
|
|
849
|
-
const t = this.localeService.t(
|
|
849
|
+
const t = this.localeService.t(la[e.operator]).replace(le, (r = e.formula1) != null ? r : "").replace(ue, (i = e.formula2) != null ? i : "");
|
|
850
850
|
return `${this.titleStr} ${t}`;
|
|
851
851
|
}
|
|
852
852
|
generateRuleErrorMessage(e, t) {
|
|
853
853
|
if (!e.operator)
|
|
854
854
|
return this.titleStr;
|
|
855
|
-
const { transformedFormula1: r, transformedFormula2: i } =
|
|
856
|
-
return `${this.localeService.t(
|
|
855
|
+
const { transformedFormula1: r, transformedFormula2: i } = De(this._lexerTreeBuilder, e, t);
|
|
856
|
+
return `${this.localeService.t(ua[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
857
857
|
}
|
|
858
858
|
}
|
|
859
859
|
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 + "";
|
|
860
860
|
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 + "";
|
|
861
|
-
const
|
|
861
|
+
const ht = {
|
|
862
862
|
[h.BETWEEN]: "dataValidation.errorMsg.between",
|
|
863
863
|
[h.EQUAL]: "dataValidation.errorMsg.equal",
|
|
864
864
|
[h.GREATER_THAN]: "dataValidation.errorMsg.greaterThan",
|
|
@@ -868,16 +868,16 @@ const dt = {
|
|
|
868
868
|
[h.NOT_BETWEEN]: "dataValidation.errorMsg.notBetween",
|
|
869
869
|
[h.NOT_EQUAL]: "dataValidation.errorMsg.notEqual"
|
|
870
870
|
};
|
|
871
|
-
function
|
|
871
|
+
function ye(o) {
|
|
872
872
|
let a = o;
|
|
873
873
|
return typeof o == "string" ? ((o.startsWith("¥") || o.startsWith("$")) && (a = o.slice(1)), +a) : +o;
|
|
874
874
|
}
|
|
875
|
-
class
|
|
875
|
+
class ca extends k {
|
|
876
876
|
constructor() {
|
|
877
877
|
super(...arguments);
|
|
878
|
-
g(this, "_customFormulaService", this.injector.get(
|
|
878
|
+
g(this, "_customFormulaService", this.injector.get(P));
|
|
879
879
|
g(this, "id", T.DECIMAL);
|
|
880
|
-
g(this, "_lexerTreeBuilder", this.injector.get(
|
|
880
|
+
g(this, "_lexerTreeBuilder", this.injector.get(Z));
|
|
881
881
|
g(this, "title", "dataValidation.decimal.title");
|
|
882
882
|
g(this, "operators", [
|
|
883
883
|
h.BETWEEN,
|
|
@@ -896,13 +896,13 @@ class da extends q {
|
|
|
896
896
|
}
|
|
897
897
|
async isValidType(e, t, r) {
|
|
898
898
|
const { value: i } = e;
|
|
899
|
-
return !Number.isNaN(
|
|
899
|
+
return !Number.isNaN(ye(i));
|
|
900
900
|
}
|
|
901
901
|
transform(e, t, r) {
|
|
902
902
|
const { value: i } = e;
|
|
903
903
|
return {
|
|
904
904
|
...e,
|
|
905
|
-
value:
|
|
905
|
+
value: ye(i)
|
|
906
906
|
};
|
|
907
907
|
}
|
|
908
908
|
_parseNumber(e) {
|
|
@@ -922,7 +922,7 @@ class da extends q {
|
|
|
922
922
|
return {
|
|
923
923
|
success: !1
|
|
924
924
|
};
|
|
925
|
-
const s = V.isDefine(e.formula1) && this._isFormulaOrNumber(e.formula1), n = V.isDefine(e.formula2) && this._isFormulaOrNumber(e.formula2), l =
|
|
925
|
+
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");
|
|
926
926
|
return l ? {
|
|
927
927
|
success: s && n,
|
|
928
928
|
formula1: s ? void 0 : u,
|
|
@@ -935,11 +935,11 @@ class da extends q {
|
|
|
935
935
|
generateRuleErrorMessage(e, t) {
|
|
936
936
|
if (!e.operator)
|
|
937
937
|
return this.titleStr;
|
|
938
|
-
const { transformedFormula1: r, transformedFormula2: i } =
|
|
939
|
-
return `${this.localeService.t(
|
|
938
|
+
const { transformedFormula1: r, transformedFormula2: i } = De(this._lexerTreeBuilder, e, t);
|
|
939
|
+
return `${this.localeService.t(ht[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
940
940
|
}
|
|
941
941
|
}
|
|
942
|
-
function
|
|
942
|
+
function Pe(o) {
|
|
943
943
|
if (!o)
|
|
944
944
|
return [];
|
|
945
945
|
const a = /* @__PURE__ */ new Set();
|
|
@@ -947,10 +947,10 @@ function xe(o) {
|
|
|
947
947
|
(e) => {
|
|
948
948
|
e.forEach((t) => {
|
|
949
949
|
var i, s;
|
|
950
|
-
const r =
|
|
950
|
+
const r = ne(t);
|
|
951
951
|
if (r != null) {
|
|
952
952
|
if (typeof r != "string" && typeof (t == null ? void 0 : t.s) == "object" && ((s = (i = t.s) == null ? void 0 : i.n) != null && s.pattern)) {
|
|
953
|
-
a.add(
|
|
953
|
+
a.add(Q.format(t.s.n.pattern, r, { throws: !1 }));
|
|
954
954
|
return;
|
|
955
955
|
}
|
|
956
956
|
C(r.toString()) && a.add(r.toString());
|
|
@@ -959,43 +959,43 @@ function xe(o) {
|
|
|
959
959
|
}
|
|
960
960
|
), [...a];
|
|
961
961
|
}
|
|
962
|
-
const
|
|
962
|
+
const ha = [
|
|
963
963
|
"if",
|
|
964
964
|
"indirect",
|
|
965
965
|
"choose",
|
|
966
966
|
"offset"
|
|
967
967
|
];
|
|
968
|
-
function
|
|
969
|
-
if (!S(o) ||
|
|
968
|
+
function ma(o, a) {
|
|
969
|
+
if (!S(o) || dt(o.slice(1)))
|
|
970
970
|
return !0;
|
|
971
971
|
const t = a.sequenceNodesBuilder(o);
|
|
972
|
-
return t && t.some((r) => typeof r == "object" && r.nodeType ===
|
|
972
|
+
return t && t.some((r) => typeof r == "object" && r.nodeType === Qt.FUNCTION && ha.indexOf(r.token.toLowerCase()) > -1);
|
|
973
973
|
}
|
|
974
|
-
function
|
|
974
|
+
function ga(o, a) {
|
|
975
975
|
const { formula1: e = "", ranges: t } = o;
|
|
976
|
-
if (
|
|
977
|
-
const i =
|
|
978
|
-
if ((!i.sheetName || i.sheetName === a) && t.some((s) =>
|
|
976
|
+
if (dt(e.slice(1))) {
|
|
977
|
+
const i = qt(e.slice(1));
|
|
978
|
+
if ((!i.sheetName || i.sheetName === a) && t.some((s) => I.intersects(s, i.range)))
|
|
979
979
|
return !0;
|
|
980
980
|
}
|
|
981
981
|
return !1;
|
|
982
982
|
}
|
|
983
|
-
class
|
|
983
|
+
class mt extends k {
|
|
984
984
|
constructor() {
|
|
985
985
|
super(...arguments);
|
|
986
|
-
g(this, "formulaService", this.injector.get(
|
|
987
|
-
g(this, "_lexer", this.injector.get(
|
|
986
|
+
g(this, "formulaService", this.injector.get(X));
|
|
987
|
+
g(this, "_lexer", this.injector.get(Z));
|
|
988
988
|
g(this, "_univerInstanceService", this.injector.get(O));
|
|
989
989
|
g(this, "offsetFormulaByRange", !1);
|
|
990
990
|
g(this, "id", T.LIST);
|
|
991
991
|
g(this, "title", "dataValidation.list.title");
|
|
992
992
|
g(this, "operators", []);
|
|
993
993
|
g(this, "scopes", ["sheet"]);
|
|
994
|
-
g(this, "skipDefaultFontRender", (e) => e.renderMode !==
|
|
994
|
+
g(this, "skipDefaultFontRender", (e) => e.renderMode !== Be.TEXT);
|
|
995
995
|
}
|
|
996
996
|
validatorFormula(e, t, r) {
|
|
997
997
|
var u, d, c;
|
|
998
|
-
const i = !V.isBlank(e.formula1), s =
|
|
998
|
+
const i = !V.isBlank(e.formula1), s = ma((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 = ga(e, n != null ? n : "");
|
|
999
999
|
return {
|
|
1000
1000
|
success: !!(i && s && !l),
|
|
1001
1001
|
formula1: i ? s ? l ? this.localeService.t("dataValidation.validFail.listIntersects") : void 0 : this.localeService.t("dataValidation.validFail.listInvalid") : this.localeService.t("dataValidation.validFail.list")
|
|
@@ -1003,8 +1003,8 @@ class ct extends q {
|
|
|
1003
1003
|
}
|
|
1004
1004
|
getExtraStyle(e, t, { style: r }) {
|
|
1005
1005
|
var s;
|
|
1006
|
-
const i = (s = r.tb !==
|
|
1007
|
-
if (e.type === T.LIST && (e.renderMode ===
|
|
1006
|
+
const i = (s = r.tb !== Re.OVERFLOW ? r.tb : Re.CLIP) != null ? s : Re.WRAP;
|
|
1007
|
+
if (e.type === T.LIST && (e.renderMode === Be.ARROW || e.renderMode === Be.TEXT)) {
|
|
1008
1008
|
const n = this.getListWithColorMap(e), l = `${t != null ? t : ""}`, u = n[l];
|
|
1009
1009
|
if (u)
|
|
1010
1010
|
return {
|
|
@@ -1020,11 +1020,11 @@ class ct extends q {
|
|
|
1020
1020
|
}
|
|
1021
1021
|
parseCellValue(e) {
|
|
1022
1022
|
const t = e.toString();
|
|
1023
|
-
return
|
|
1023
|
+
return fe(t);
|
|
1024
1024
|
}
|
|
1025
1025
|
async parseFormula(e, t, r) {
|
|
1026
1026
|
var l, u;
|
|
1027
|
-
const i = await this.formulaService.getRuleFormulaResult(t, r, e.uid), s =
|
|
1027
|
+
const i = await this.formulaService.getRuleFormulaResult(t, r, e.uid), s = oe((u = (l = i == null ? void 0 : i[0]) == null ? void 0 : l.result) == null ? void 0 : u[0][0]);
|
|
1028
1028
|
return {
|
|
1029
1029
|
formula1: void 0,
|
|
1030
1030
|
formula2: void 0,
|
|
@@ -1033,7 +1033,7 @@ class ct extends q {
|
|
|
1033
1033
|
}
|
|
1034
1034
|
async isValidType(e, t, r) {
|
|
1035
1035
|
var m, p;
|
|
1036
|
-
const { value: i, unitId: s, subUnitId: n } = e, { formula1: l = "" } = r, u = await this.formulaService.getRuleFormulaResult(s, n, r.uid), d = S(l) ?
|
|
1036
|
+
const { value: i, unitId: s, subUnitId: n } = e, { formula1: l = "" } = r, u = await this.formulaService.getRuleFormulaResult(s, n, r.uid), d = S(l) ? Pe((p = (m = u == null ? void 0 : u[0]) == null ? void 0 : m.result) == null ? void 0 : p[0][0]) : fe(l);
|
|
1037
1037
|
return this.parseCellValue(i).every((_) => d.includes(_));
|
|
1038
1038
|
}
|
|
1039
1039
|
generateRuleName() {
|
|
@@ -1049,7 +1049,7 @@ class ct extends q {
|
|
|
1049
1049
|
const l = (p = r ? n.getSheetBySheetId(r) : void 0) != null ? p : n.getActiveSheet();
|
|
1050
1050
|
if (!l) return [];
|
|
1051
1051
|
const u = n.getUnitId(), d = l.getSheetId(), c = this.formulaService.getRuleFormulaResultSync(u, d, e.uid);
|
|
1052
|
-
return S(i) ?
|
|
1052
|
+
return S(i) ? Pe((v = (_ = c == null ? void 0 : c[0]) == null ? void 0 : _.result) == null ? void 0 : v[0][0]) : fe(i);
|
|
1053
1053
|
}
|
|
1054
1054
|
async getListAsync(e, t, r) {
|
|
1055
1055
|
var m, p, _, v;
|
|
@@ -1058,7 +1058,7 @@ class ct extends q {
|
|
|
1058
1058
|
const l = (p = r ? n.getSheetBySheetId(r) : void 0) != null ? p : n.getActiveSheet();
|
|
1059
1059
|
if (!l) return [];
|
|
1060
1060
|
const u = n.getUnitId(), d = l.getSheetId(), c = await this.formulaService.getRuleFormulaResult(u, d, e.uid);
|
|
1061
|
-
return S(i) ?
|
|
1061
|
+
return S(i) ? Pe((v = (_ = c == null ? void 0 : c[0]) == null ? void 0 : _.result) == null ? void 0 : v[0][0]) : fe(i);
|
|
1062
1062
|
}
|
|
1063
1063
|
getListWithColor(e, t, r) {
|
|
1064
1064
|
const i = this.getList(e, t, r), s = (e.formula2 || "").split(",");
|
|
@@ -1071,12 +1071,12 @@ class ct extends q {
|
|
|
1071
1071
|
}), s;
|
|
1072
1072
|
}
|
|
1073
1073
|
}
|
|
1074
|
-
class
|
|
1074
|
+
class _a extends k {
|
|
1075
1075
|
constructor() {
|
|
1076
1076
|
super(...arguments);
|
|
1077
1077
|
g(this, "id", T.TEXT_LENGTH);
|
|
1078
1078
|
g(this, "title", "dataValidation.textLength.title");
|
|
1079
|
-
g(this, "_lexerTreeBuilder", this.injector.get(
|
|
1079
|
+
g(this, "_lexerTreeBuilder", this.injector.get(Z));
|
|
1080
1080
|
g(this, "operators", [
|
|
1081
1081
|
h.BETWEEN,
|
|
1082
1082
|
h.EQUAL,
|
|
@@ -1088,7 +1088,7 @@ class ga extends q {
|
|
|
1088
1088
|
h.NOT_EQUAL
|
|
1089
1089
|
]);
|
|
1090
1090
|
g(this, "scopes", ["sheet"]);
|
|
1091
|
-
g(this, "_customFormulaService", this.injector.get(
|
|
1091
|
+
g(this, "_customFormulaService", this.injector.get(P));
|
|
1092
1092
|
}
|
|
1093
1093
|
_isFormulaOrInt(e) {
|
|
1094
1094
|
return !V.isBlank(e) && (S(e) || !Number.isNaN(+e) && Number.isInteger(+e));
|
|
@@ -1099,7 +1099,7 @@ class ga extends q {
|
|
|
1099
1099
|
return {
|
|
1100
1100
|
success: !1
|
|
1101
1101
|
};
|
|
1102
|
-
const s = V.isDefine(e.formula1) && this._isFormulaOrInt(e.formula1), n = V.isDefine(e.formula2) && this._isFormulaOrInt(e.formula2), l =
|
|
1102
|
+
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");
|
|
1103
1103
|
return l ? {
|
|
1104
1104
|
success: s && n,
|
|
1105
1105
|
formula1: s ? void 0 : u,
|
|
@@ -1133,28 +1133,28 @@ class ga extends q {
|
|
|
1133
1133
|
generateRuleErrorMessage(e, t) {
|
|
1134
1134
|
if (!e.operator)
|
|
1135
1135
|
return this.titleStr;
|
|
1136
|
-
const { transformedFormula1: r, transformedFormula2: i } =
|
|
1137
|
-
return `${this.localeService.t(
|
|
1136
|
+
const { transformedFormula1: r, transformedFormula2: i } = De(this._lexerTreeBuilder, e, t);
|
|
1137
|
+
return `${this.localeService.t(Dt[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
1138
1138
|
}
|
|
1139
1139
|
}
|
|
1140
|
-
function
|
|
1140
|
+
function gt(o) {
|
|
1141
1141
|
var e, t;
|
|
1142
1142
|
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;
|
|
1143
1143
|
}
|
|
1144
|
-
function
|
|
1145
|
-
const s = t.get(
|
|
1144
|
+
function be(o, a, e, t, r = "command", i = !0) {
|
|
1145
|
+
const s = t.get(Z), n = t.get(G), l = [], u = [], d = t.get(F), c = t.get(O), m = Ye(c, { unitId: o, subUnitId: a });
|
|
1146
1146
|
if (!m)
|
|
1147
1147
|
return {
|
|
1148
1148
|
redoMutations: l,
|
|
1149
1149
|
undoMutations: u
|
|
1150
1150
|
};
|
|
1151
|
-
const { worksheet: p } = m, _ = new
|
|
1151
|
+
const { worksheet: p } = m, _ = new Se();
|
|
1152
1152
|
let v = !1;
|
|
1153
1153
|
function M(f, w) {
|
|
1154
|
-
i && f.forEach((
|
|
1155
|
-
b.foreach(
|
|
1156
|
-
const
|
|
1157
|
-
(
|
|
1154
|
+
i && f.forEach((H) => {
|
|
1155
|
+
b.foreach(H, (B, W) => {
|
|
1156
|
+
const U = p.getCellRaw(B, W), J = ct(U);
|
|
1157
|
+
(gt(U) || J === w) && !(U != null && U.p) && (v = !0, _.setValue(B, W, {
|
|
1158
1158
|
v: w,
|
|
1159
1159
|
p: null
|
|
1160
1160
|
}));
|
|
@@ -1165,7 +1165,7 @@ function Ie(o, a, e, t, r = "command", i = !0) {
|
|
|
1165
1165
|
switch (f.type) {
|
|
1166
1166
|
case "delete":
|
|
1167
1167
|
l.push({
|
|
1168
|
-
id:
|
|
1168
|
+
id: A.id,
|
|
1169
1169
|
params: {
|
|
1170
1170
|
unitId: o,
|
|
1171
1171
|
subUnitId: a,
|
|
@@ -1184,9 +1184,9 @@ function Ie(o, a, e, t, r = "command", i = !0) {
|
|
|
1184
1184
|
});
|
|
1185
1185
|
break;
|
|
1186
1186
|
case "update": {
|
|
1187
|
-
if (
|
|
1188
|
-
const
|
|
1189
|
-
|
|
1187
|
+
if (de(f.rule.type, n)) {
|
|
1188
|
+
const H = f.oldRanges[0].startRow, B = f.oldRanges[0].startColumn, W = f.newRanges[0].startRow, U = f.newRanges[0].startColumn, J = W - H, 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;
|
|
1189
|
+
he !== f.rule.formula1 || me !== f.rule.formula2 || !rt(f.newRanges, f.oldRanges) ? (l.push({
|
|
1190
1190
|
id: E.id,
|
|
1191
1191
|
params: {
|
|
1192
1192
|
unitId: o,
|
|
@@ -1195,8 +1195,8 @@ function Ie(o, a, e, t, r = "command", i = !0) {
|
|
|
1195
1195
|
payload: {
|
|
1196
1196
|
type: y.ALL,
|
|
1197
1197
|
payload: {
|
|
1198
|
-
formula1:
|
|
1199
|
-
formula2:
|
|
1198
|
+
formula1: he,
|
|
1199
|
+
formula2: me,
|
|
1200
1200
|
ranges: f.newRanges
|
|
1201
1201
|
}
|
|
1202
1202
|
}
|
|
@@ -1284,7 +1284,7 @@ function Ie(o, a, e, t, r = "command", i = !0) {
|
|
|
1284
1284
|
source: r
|
|
1285
1285
|
}
|
|
1286
1286
|
}), u.unshift({
|
|
1287
|
-
id:
|
|
1287
|
+
id: A.id,
|
|
1288
1288
|
params: {
|
|
1289
1289
|
unitId: o,
|
|
1290
1290
|
subUnitId: a,
|
|
@@ -1292,23 +1292,23 @@ function Ie(o, a, e, t, r = "command", i = !0) {
|
|
|
1292
1292
|
source: r
|
|
1293
1293
|
}
|
|
1294
1294
|
}), f.rule.type === T.CHECKBOX) {
|
|
1295
|
-
const
|
|
1296
|
-
M(f.rule.ranges,
|
|
1295
|
+
const H = d.getValidator(T.CHECKBOX).parseFormulaSync(f.rule, o, a);
|
|
1296
|
+
M(f.rule.ranges, H.originFormula2);
|
|
1297
1297
|
}
|
|
1298
1298
|
break;
|
|
1299
1299
|
}
|
|
1300
1300
|
}
|
|
1301
1301
|
}), v) {
|
|
1302
1302
|
const f = {
|
|
1303
|
-
id:
|
|
1303
|
+
id: se.id,
|
|
1304
1304
|
params: {
|
|
1305
1305
|
unitId: o,
|
|
1306
1306
|
subUnitId: a,
|
|
1307
1307
|
cellValue: _.getData()
|
|
1308
1308
|
}
|
|
1309
1309
|
}, w = {
|
|
1310
|
-
id:
|
|
1311
|
-
params:
|
|
1310
|
+
id: se.id,
|
|
1311
|
+
params: ot(t, f.params)
|
|
1312
1312
|
};
|
|
1313
1313
|
l.push(f), u.push(w);
|
|
1314
1314
|
}
|
|
@@ -1317,31 +1317,31 @@ function Ie(o, a, e, t, r = "command", i = !0) {
|
|
|
1317
1317
|
undoMutations: u
|
|
1318
1318
|
};
|
|
1319
1319
|
}
|
|
1320
|
-
const
|
|
1321
|
-
type:
|
|
1320
|
+
const pa = {
|
|
1321
|
+
type: K.COMMAND,
|
|
1322
1322
|
id: "sheet.command.updateDataValidationRuleRange",
|
|
1323
1323
|
handler(o, a) {
|
|
1324
1324
|
if (!a)
|
|
1325
1325
|
return !1;
|
|
1326
|
-
const { unitId: e, subUnitId: t, ranges: r, ruleId: i } = a, s = o.get(F), n = o.get(x), l = o.get(
|
|
1326
|
+
const { unitId: e, subUnitId: t, ranges: r, ruleId: i } = a, s = o.get(F), n = o.get(x), l = o.get(z);
|
|
1327
1327
|
if (!s.getRuleById(e, t, i))
|
|
1328
1328
|
return !1;
|
|
1329
1329
|
const d = s.getRuleObjectMatrix(e, t).clone();
|
|
1330
1330
|
d.updateRange(i, r);
|
|
1331
|
-
const c = d.diff(s.getRules(e, t)), { redoMutations: m, undoMutations: p } =
|
|
1331
|
+
const c = d.diff(s.getRules(e, t)), { redoMutations: m, undoMutations: p } = be(e, t, c, o);
|
|
1332
1332
|
return l.pushUndoRedo({
|
|
1333
1333
|
undoMutations: p,
|
|
1334
1334
|
redoMutations: m,
|
|
1335
1335
|
unitID: e
|
|
1336
|
-
}),
|
|
1336
|
+
}), Ie(m, n), !0;
|
|
1337
1337
|
}
|
|
1338
|
-
},
|
|
1339
|
-
type:
|
|
1338
|
+
}, fa = {
|
|
1339
|
+
type: K.COMMAND,
|
|
1340
1340
|
id: "sheet.command.addDataValidation",
|
|
1341
1341
|
handler(o, a) {
|
|
1342
1342
|
if (!a)
|
|
1343
1343
|
return !1;
|
|
1344
|
-
const { unitId: e, subUnitId: t, rule: r } = a, i = o.get(F), s = o.get(x), n = o.get(
|
|
1344
|
+
const { unitId: e, subUnitId: t, rule: r } = a, i = o.get(F), s = o.get(x), n = o.get(z), l = i.getRuleObjectMatrix(e, t).clone();
|
|
1345
1345
|
l.addRule(r);
|
|
1346
1346
|
const u = l.diff(i.getRules(e, t)), d = i.getValidator(r.type), c = {
|
|
1347
1347
|
unitId: e,
|
|
@@ -1350,12 +1350,12 @@ const _a = {
|
|
|
1350
1350
|
...r,
|
|
1351
1351
|
...d == null ? void 0 : d.normalizeFormula(r, e, t)
|
|
1352
1352
|
}
|
|
1353
|
-
}, { redoMutations: m, undoMutations: p } =
|
|
1353
|
+
}, { redoMutations: m, undoMutations: p } = be(e, t, u, o);
|
|
1354
1354
|
return m.push({
|
|
1355
1355
|
id: L.id,
|
|
1356
1356
|
params: c
|
|
1357
1357
|
}), p.unshift({
|
|
1358
|
-
id:
|
|
1358
|
+
id: A.id,
|
|
1359
1359
|
params: {
|
|
1360
1360
|
unitId: e,
|
|
1361
1361
|
subUnitId: t,
|
|
@@ -1365,16 +1365,16 @@ const _a = {
|
|
|
1365
1365
|
unitID: e,
|
|
1366
1366
|
redoMutations: m,
|
|
1367
1367
|
undoMutations: p
|
|
1368
|
-
}),
|
|
1368
|
+
}), Ie(m, s), !0;
|
|
1369
1369
|
}
|
|
1370
|
-
},
|
|
1371
|
-
type:
|
|
1370
|
+
}, va = {
|
|
1371
|
+
type: K.COMMAND,
|
|
1372
1372
|
id: "sheets.command.update-data-validation-setting",
|
|
1373
1373
|
// eslint-disable-next-line max-lines-per-function
|
|
1374
1374
|
handler(o, a) {
|
|
1375
1375
|
if (!a)
|
|
1376
1376
|
return !1;
|
|
1377
|
-
const e = o.get(x), t = o.get(
|
|
1377
|
+
const e = o.get(x), t = o.get(z), r = o.get(F), i = o.get(G), { unitId: s, subUnitId: n, ruleId: l, setting: u } = a, d = i.getValidatorItem(u.type);
|
|
1378
1378
|
if (!d)
|
|
1379
1379
|
return !1;
|
|
1380
1380
|
const c = r.getRuleById(s, n, l);
|
|
@@ -1403,55 +1403,57 @@ const _a = {
|
|
|
1403
1403
|
ruleId: l,
|
|
1404
1404
|
payload: {
|
|
1405
1405
|
type: y.SETTING,
|
|
1406
|
-
payload:
|
|
1406
|
+
payload: bt(c)
|
|
1407
1407
|
}
|
|
1408
1408
|
}, M = [{
|
|
1409
1409
|
id: E.id,
|
|
1410
1410
|
params: v
|
|
1411
1411
|
}];
|
|
1412
1412
|
if (u.type === T.CHECKBOX) {
|
|
1413
|
-
const w = c.ranges,
|
|
1413
|
+
const w = c.ranges, H = o.get(O), B = Ye(H, { unitId: s, subUnitId: n });
|
|
1414
1414
|
if (B) {
|
|
1415
|
-
const
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1415
|
+
const W = new Se(), { worksheet: U } = B, { formula2: J = Me, formula1: ce = Ve } = c, { formula2: he = Me, formula1: me = Ve } = u;
|
|
1416
|
+
let Le = !1;
|
|
1417
|
+
if (w.forEach((ge) => {
|
|
1418
|
+
b.foreach(ge, (ae, xe) => {
|
|
1419
|
+
const j = U.getCellRaw(ae, xe), Ke = ct(j);
|
|
1420
|
+
(gt(j) || Ke === String(J)) && !(j != null && j.p) ? (W.setValue(ae, xe, {
|
|
1421
|
+
v: he,
|
|
1421
1422
|
p: null
|
|
1422
|
-
}) :
|
|
1423
|
-
v:
|
|
1423
|
+
}), Le = !0) : Ke === String(ce) && !(j != null && j.p) && (W.setValue(ae, xe, {
|
|
1424
|
+
v: me,
|
|
1424
1425
|
p: null
|
|
1425
|
-
});
|
|
1426
|
+
}), Le = !0);
|
|
1426
1427
|
});
|
|
1427
|
-
})
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1428
|
+
}), Le) {
|
|
1429
|
+
const ge = {
|
|
1430
|
+
id: se.id,
|
|
1431
|
+
params: {
|
|
1432
|
+
unitId: s,
|
|
1433
|
+
subUnitId: n,
|
|
1434
|
+
cellValue: W.getData()
|
|
1435
|
+
}
|
|
1436
|
+
}, ae = {
|
|
1437
|
+
id: se.id,
|
|
1438
|
+
params: ot(o, ge.params)
|
|
1439
|
+
};
|
|
1440
|
+
_.push(ge), M.push(ae);
|
|
1441
|
+
}
|
|
1440
1442
|
}
|
|
1441
1443
|
}
|
|
1442
|
-
return
|
|
1444
|
+
return Ie(_, e).result ? (t.pushUndoRedo({
|
|
1443
1445
|
unitID: s,
|
|
1444
1446
|
redoMutations: _,
|
|
1445
1447
|
undoMutations: M
|
|
1446
1448
|
}), !0) : !1;
|
|
1447
1449
|
}
|
|
1448
|
-
},
|
|
1449
|
-
type:
|
|
1450
|
+
}, Ra = {
|
|
1451
|
+
type: K.COMMAND,
|
|
1450
1452
|
id: "sheets.command.update-data-validation-options",
|
|
1451
1453
|
handler(o, a) {
|
|
1452
1454
|
if (!a)
|
|
1453
1455
|
return !1;
|
|
1454
|
-
const e = o.get(x), t = o.get(
|
|
1456
|
+
const e = o.get(x), t = o.get(z), r = o.get(F), { unitId: i, subUnitId: s, ruleId: n, options: l } = a, u = r.getRuleById(i, s, n);
|
|
1455
1457
|
if (!u)
|
|
1456
1458
|
return !1;
|
|
1457
1459
|
const d = {
|
|
@@ -1471,7 +1473,7 @@ const _a = {
|
|
|
1471
1473
|
ruleId: n,
|
|
1472
1474
|
payload: {
|
|
1473
1475
|
type: y.OPTIONS,
|
|
1474
|
-
payload:
|
|
1476
|
+
payload: Lt(u)
|
|
1475
1477
|
}
|
|
1476
1478
|
}, p = [{
|
|
1477
1479
|
id: E.id,
|
|
@@ -1483,35 +1485,35 @@ const _a = {
|
|
|
1483
1485
|
undoMutations: p
|
|
1484
1486
|
}), e.executeCommand(E.id, d), !0;
|
|
1485
1487
|
}
|
|
1486
|
-
},
|
|
1487
|
-
type:
|
|
1488
|
+
}, Sa = {
|
|
1489
|
+
type: K.COMMAND,
|
|
1488
1490
|
id: "sheets.command.clear-range-data-validation",
|
|
1489
1491
|
handler(o, a) {
|
|
1490
1492
|
if (!a)
|
|
1491
1493
|
return !1;
|
|
1492
|
-
const { unitId: e, subUnitId: t, ranges: r } = a, i = o.get(x), s = o.get(O), n =
|
|
1494
|
+
const { unitId: e, subUnitId: t, ranges: r } = a, i = o.get(x), s = o.get(O), n = Ye(s, { unitId: e, subUnitId: t }), l = o.get(F);
|
|
1493
1495
|
if (!n) return !1;
|
|
1494
|
-
const u = o.get(
|
|
1496
|
+
const u = o.get(z), d = l.getRuleObjectMatrix(e, t).clone();
|
|
1495
1497
|
d.removeRange(r);
|
|
1496
|
-
const c = d.diff(l.getRules(e, t)), { redoMutations: m, undoMutations: p } =
|
|
1498
|
+
const c = d.diff(l.getRules(e, t)), { redoMutations: m, undoMutations: p } = be(e, t, c, o);
|
|
1497
1499
|
return u.pushUndoRedo({
|
|
1498
1500
|
unitID: e,
|
|
1499
1501
|
redoMutations: m,
|
|
1500
1502
|
undoMutations: p
|
|
1501
|
-
}),
|
|
1503
|
+
}), Ie(m, i).result;
|
|
1502
1504
|
}
|
|
1503
|
-
},
|
|
1504
|
-
type:
|
|
1505
|
+
}, Va = {
|
|
1506
|
+
type: K.COMMAND,
|
|
1505
1507
|
id: "sheet.command.remove-all-data-validation",
|
|
1506
1508
|
handler(o, a) {
|
|
1507
1509
|
if (!a)
|
|
1508
1510
|
return !1;
|
|
1509
|
-
const { unitId: e, subUnitId: t } = a, r = o.get(x), i = o.get(F), s = o.get(
|
|
1511
|
+
const { unitId: e, subUnitId: t } = a, r = o.get(x), i = o.get(F), s = o.get(z), n = [...i.getRules(e, t)], l = {
|
|
1510
1512
|
unitId: e,
|
|
1511
1513
|
subUnitId: t,
|
|
1512
1514
|
ruleId: n.map((c) => c.uid)
|
|
1513
1515
|
}, u = [{
|
|
1514
|
-
id:
|
|
1516
|
+
id: A.id,
|
|
1515
1517
|
params: l
|
|
1516
1518
|
}], d = [{
|
|
1517
1519
|
id: L.id,
|
|
@@ -1525,9 +1527,9 @@ const _a = {
|
|
|
1525
1527
|
redoMutations: u,
|
|
1526
1528
|
undoMutations: d,
|
|
1527
1529
|
unitID: e
|
|
1528
|
-
}), r.executeCommand(
|
|
1530
|
+
}), r.executeCommand(A.id, l), !0;
|
|
1529
1531
|
}
|
|
1530
|
-
},
|
|
1532
|
+
}, Ma = (o, a) => {
|
|
1531
1533
|
const e = o.get(F), { unitId: t, subUnitId: r, ruleId: i, source: s } = a;
|
|
1532
1534
|
if (Array.isArray(i)) {
|
|
1533
1535
|
const l = i.map((u) => e.getRuleById(t, r, u)).filter(Boolean);
|
|
@@ -1552,14 +1554,14 @@ const _a = {
|
|
|
1552
1554
|
index: e.getRuleIndex(t, r, i)
|
|
1553
1555
|
}
|
|
1554
1556
|
}];
|
|
1555
|
-
},
|
|
1556
|
-
type:
|
|
1557
|
+
}, ya = {
|
|
1558
|
+
type: K.COMMAND,
|
|
1557
1559
|
id: "sheet.command.remove-data-validation-rule",
|
|
1558
1560
|
handler(o, a) {
|
|
1559
1561
|
if (!a)
|
|
1560
1562
|
return !1;
|
|
1561
|
-
const { unitId: e, subUnitId: t, ruleId: r } = a, i = o.get(x), s = o.get(
|
|
1562
|
-
id:
|
|
1563
|
+
const { unitId: e, subUnitId: t, ruleId: r } = a, i = o.get(x), s = o.get(z), n = o.get(F), l = [{
|
|
1564
|
+
id: A.id,
|
|
1563
1565
|
params: a
|
|
1564
1566
|
}], u = [{
|
|
1565
1567
|
id: L.id,
|
|
@@ -1576,20 +1578,20 @@ const _a = {
|
|
|
1576
1578
|
undoMutations: u,
|
|
1577
1579
|
redoMutations: l,
|
|
1578
1580
|
unitID: a.unitId
|
|
1579
|
-
}), i.executeCommand(
|
|
1581
|
+
}), i.executeCommand(A.id, a), !0;
|
|
1580
1582
|
}
|
|
1581
|
-
},
|
|
1583
|
+
}, Ea = "sheets-data-validation.config", tt = {};
|
|
1582
1584
|
var Ta = Object.defineProperty, Fa = Object.getOwnPropertyDescriptor, Na = (o, a, e, t) => {
|
|
1583
1585
|
for (var r = t > 1 ? void 0 : t ? Fa(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1584
1586
|
(s = o[i]) && (r = (t ? s(a, e, r) : s(r)) || r);
|
|
1585
1587
|
return t && r && Ta(a, e, r), r;
|
|
1586
|
-
},
|
|
1587
|
-
let
|
|
1588
|
+
}, $e = (o, a) => (e, t) => a(e, t, o);
|
|
1589
|
+
let Ee = class extends $ {
|
|
1588
1590
|
constructor(a, e, t) {
|
|
1589
1591
|
super();
|
|
1590
1592
|
g(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
1591
1593
|
g(this, "registerRule", (a, e, t) => {
|
|
1592
|
-
|
|
1594
|
+
de(t.type, this._validatorRegistryService) && this.register(a, e, t);
|
|
1593
1595
|
});
|
|
1594
1596
|
this._dataValidationModel = a, this._formulaRefRangeService = e, this._validatorRegistryService = t, this._initRefRange();
|
|
1595
1597
|
}
|
|
@@ -1606,15 +1608,17 @@ let Ve = class extends P {
|
|
|
1606
1608
|
params: {
|
|
1607
1609
|
unitId: a,
|
|
1608
1610
|
subUnitId: e,
|
|
1609
|
-
rule: t
|
|
1611
|
+
rule: t,
|
|
1612
|
+
source: "patched"
|
|
1610
1613
|
}
|
|
1611
1614
|
}],
|
|
1612
1615
|
redos: [{
|
|
1613
|
-
id:
|
|
1616
|
+
id: A.id,
|
|
1614
1617
|
params: {
|
|
1615
1618
|
unitId: a,
|
|
1616
1619
|
subUnitId: e,
|
|
1617
|
-
ruleId: t.uid
|
|
1620
|
+
ruleId: t.uid,
|
|
1621
|
+
source: "patched"
|
|
1618
1622
|
}
|
|
1619
1623
|
}]
|
|
1620
1624
|
};
|
|
@@ -1632,7 +1636,8 @@ let Ve = class extends P {
|
|
|
1632
1636
|
formula1: m.formulas[0],
|
|
1633
1637
|
formula2: m.formulas[1]
|
|
1634
1638
|
}
|
|
1635
|
-
}
|
|
1639
|
+
},
|
|
1640
|
+
source: "patched"
|
|
1636
1641
|
}
|
|
1637
1642
|
}), c.push({
|
|
1638
1643
|
id: E.id,
|
|
@@ -1647,7 +1652,8 @@ let Ve = class extends P {
|
|
|
1647
1652
|
formula1: i,
|
|
1648
1653
|
formula2: s
|
|
1649
1654
|
}
|
|
1650
|
-
}
|
|
1655
|
+
},
|
|
1656
|
+
source: "patched"
|
|
1651
1657
|
}
|
|
1652
1658
|
});
|
|
1653
1659
|
for (let p = 1; p < u.length; p++) {
|
|
@@ -1663,14 +1669,16 @@ let Ve = class extends P {
|
|
|
1663
1669
|
formula1: _.formulas[0],
|
|
1664
1670
|
formula2: _.formulas[1],
|
|
1665
1671
|
ranges: _.ranges
|
|
1666
|
-
}
|
|
1672
|
+
},
|
|
1673
|
+
source: "patched"
|
|
1667
1674
|
}
|
|
1668
1675
|
}), c.push({
|
|
1669
|
-
id:
|
|
1676
|
+
id: A.id,
|
|
1670
1677
|
params: {
|
|
1671
1678
|
unitId: a,
|
|
1672
1679
|
subUnitId: e,
|
|
1673
|
-
ruleId: v
|
|
1680
|
+
ruleId: v,
|
|
1681
|
+
source: "patched"
|
|
1674
1682
|
}
|
|
1675
1683
|
});
|
|
1676
1684
|
}
|
|
@@ -1708,24 +1716,24 @@ let Ve = class extends P {
|
|
|
1708
1716
|
}
|
|
1709
1717
|
}
|
|
1710
1718
|
})
|
|
1711
|
-
), this.disposeWithMe(
|
|
1719
|
+
), this.disposeWithMe(qe(() => {
|
|
1712
1720
|
this._disposableMap.forEach((e) => {
|
|
1713
1721
|
e.dispose();
|
|
1714
1722
|
}), this._disposableMap.clear();
|
|
1715
1723
|
}));
|
|
1716
1724
|
}
|
|
1717
1725
|
};
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
],
|
|
1723
|
-
var
|
|
1726
|
+
Ee = Na([
|
|
1727
|
+
$e(0, R(F)),
|
|
1728
|
+
$e(1, R(ut)),
|
|
1729
|
+
$e(2, R(G))
|
|
1730
|
+
], Ee);
|
|
1731
|
+
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 || {}), Ca = Object.defineProperty, Oa = Object.getOwnPropertyDescriptor, wa = (o, a, e, t) => {
|
|
1724
1732
|
for (var r = t > 1 ? void 0 : t ? Oa(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1725
1733
|
(s = o[i]) && (r = (t ? s(a, e, r) : s(r)) || r);
|
|
1726
1734
|
return t && r && Ca(a, e, r), r;
|
|
1727
|
-
},
|
|
1728
|
-
let
|
|
1735
|
+
}, He = (o, a) => (e, t) => a(e, t, o);
|
|
1736
|
+
let Te = class extends $ {
|
|
1729
1737
|
constructor(o, a, e) {
|
|
1730
1738
|
super(), this._univerInstanceService = o, this._permissionService = a, this._lexerTreeBuilder = e;
|
|
1731
1739
|
}
|
|
@@ -1738,14 +1746,14 @@ let Me = class extends P {
|
|
|
1738
1746
|
const i = a[r];
|
|
1739
1747
|
if (typeof i == "string")
|
|
1740
1748
|
continue;
|
|
1741
|
-
const { token: s } = i, n =
|
|
1749
|
+
const { token: s } = i, n = Gt(s), l = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET);
|
|
1742
1750
|
let u = l.getActiveSheet();
|
|
1743
1751
|
const d = l.getUnitId();
|
|
1744
1752
|
if (n.sheetName) {
|
|
1745
1753
|
if (u = l.getSheetBySheetName(n.sheetName), !u)
|
|
1746
1754
|
return !1;
|
|
1747
1755
|
const v = u == null ? void 0 : u.getSheetId();
|
|
1748
|
-
if (!this._permissionService.getPermissionPoint(new
|
|
1756
|
+
if (!this._permissionService.getPermissionPoint(new Bt(d, v).id)) return !1;
|
|
1749
1757
|
}
|
|
1750
1758
|
if (!u)
|
|
1751
1759
|
return !1;
|
|
@@ -1753,35 +1761,36 @@ let Me = class extends P {
|
|
|
1753
1761
|
for (let v = c; v <= m; v++)
|
|
1754
1762
|
for (let M = p; M <= _; M++) {
|
|
1755
1763
|
const f = (t = (e = u.getCell(v, M)) == null ? void 0 : e.selectionProtection) == null ? void 0 : t[0];
|
|
1756
|
-
if ((f == null ? void 0 : f[
|
|
1764
|
+
if ((f == null ? void 0 : f[_t.View]) === !1)
|
|
1757
1765
|
return !1;
|
|
1758
1766
|
}
|
|
1759
1767
|
}
|
|
1760
1768
|
return !0;
|
|
1761
1769
|
}
|
|
1762
1770
|
};
|
|
1763
|
-
|
|
1764
|
-
|
|
1765
|
-
|
|
1766
|
-
|
|
1767
|
-
],
|
|
1771
|
+
Te = wa([
|
|
1772
|
+
He(0, O),
|
|
1773
|
+
He(1, Et),
|
|
1774
|
+
He(2, R(Z))
|
|
1775
|
+
], Te);
|
|
1768
1776
|
var Ia = Object.defineProperty, Aa = Object.getOwnPropertyDescriptor, Da = (o, a, e, t) => {
|
|
1769
1777
|
for (var r = t > 1 ? void 0 : t ? Aa(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1770
1778
|
(s = o[i]) && (r = (t ? s(a, e, r) : s(r)) || r);
|
|
1771
1779
|
return t && r && Ia(a, e, r), r;
|
|
1772
|
-
},
|
|
1773
|
-
let
|
|
1780
|
+
}, ee = (o, a) => (e, t) => a(e, t, o);
|
|
1781
|
+
let Fe = class extends $ {
|
|
1774
1782
|
constructor(a, e, t, r, i, s) {
|
|
1775
1783
|
super();
|
|
1776
1784
|
g(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
1777
1785
|
g(this, "registerRule", (a, e, t) => {
|
|
1778
|
-
|
|
1786
|
+
de(t.type, this._validatorRegistryService) || (this.register(a, e, t), this.registerFormula(a, e, t));
|
|
1779
1787
|
});
|
|
1780
1788
|
this._dataValidationModel = a, this._injector = e, this._refRangeService = t, this._dataValidationFormulaService = r, this._formulaRefRangeService = i, this._validatorRegistryService = s, this._initRefRange();
|
|
1781
1789
|
}
|
|
1782
1790
|
_getIdWithUnitId(a, e, t) {
|
|
1783
1791
|
return `${a}_${e}_${t}`;
|
|
1784
1792
|
}
|
|
1793
|
+
// eslint-disable-next-line max-lines-per-function
|
|
1785
1794
|
registerFormula(a, e, t) {
|
|
1786
1795
|
var u;
|
|
1787
1796
|
const r = t.uid, i = this._getIdWithUnitId(a, e, r), s = (u = this._disposableMap.get(i)) != null ? u : /* @__PURE__ */ new Set(), n = (d, c) => {
|
|
@@ -1803,7 +1812,8 @@ let ye = class extends P {
|
|
|
1803
1812
|
formula2: m.formula2,
|
|
1804
1813
|
[d]: c
|
|
1805
1814
|
}
|
|
1806
|
-
}
|
|
1815
|
+
},
|
|
1816
|
+
source: "patched"
|
|
1807
1817
|
}, v = {
|
|
1808
1818
|
unitId: a,
|
|
1809
1819
|
subUnitId: e,
|
|
@@ -1815,7 +1825,8 @@ let ye = class extends P {
|
|
|
1815
1825
|
formula1: m.formula1,
|
|
1816
1826
|
formula2: m.formula2
|
|
1817
1827
|
}
|
|
1818
|
-
}
|
|
1828
|
+
},
|
|
1829
|
+
source: "patched"
|
|
1819
1830
|
}, M = [
|
|
1820
1831
|
{
|
|
1821
1832
|
id: E.id,
|
|
@@ -1854,8 +1865,8 @@ let ye = class extends P {
|
|
|
1854
1865
|
register(a, e, t) {
|
|
1855
1866
|
var l;
|
|
1856
1867
|
const r = (u) => {
|
|
1857
|
-
const d = [...t.ranges], m = d.map((_) =>
|
|
1858
|
-
if (
|
|
1868
|
+
const d = [...t.ranges], m = d.map((_) => Pt(_, u)).filter((_) => !!_).flat();
|
|
1869
|
+
if (rt(m, d))
|
|
1859
1870
|
return { redos: [], undos: [] };
|
|
1860
1871
|
if (m.length) {
|
|
1861
1872
|
const _ = {
|
|
@@ -1882,7 +1893,7 @@ let ye = class extends P {
|
|
|
1882
1893
|
}];
|
|
1883
1894
|
return { redos: v, undos: M };
|
|
1884
1895
|
} else {
|
|
1885
|
-
const _ = { unitId: a, subUnitId: e, ruleId: t.uid }, v = [{ id:
|
|
1896
|
+
const _ = { unitId: a, subUnitId: e, ruleId: t.uid }, v = [{ id: A.id, params: _ }], M = Ma(this._injector, _);
|
|
1886
1897
|
return { redos: v, undos: M };
|
|
1887
1898
|
}
|
|
1888
1899
|
}, i = [];
|
|
@@ -1920,27 +1931,27 @@ let ye = class extends P {
|
|
|
1920
1931
|
}
|
|
1921
1932
|
}
|
|
1922
1933
|
})
|
|
1923
|
-
), this.disposeWithMe(
|
|
1934
|
+
), this.disposeWithMe(qe(() => {
|
|
1924
1935
|
this._disposableMap.forEach((e) => {
|
|
1925
1936
|
e.forEach((t) => t());
|
|
1926
1937
|
}), this._disposableMap.clear();
|
|
1927
1938
|
}));
|
|
1928
1939
|
}
|
|
1929
1940
|
};
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
],
|
|
1941
|
+
Fe = Da([
|
|
1942
|
+
ee(0, R(F)),
|
|
1943
|
+
ee(1, R(Ge)),
|
|
1944
|
+
ee(2, R(Ut)),
|
|
1945
|
+
ee(3, R(X)),
|
|
1946
|
+
ee(4, R(ut)),
|
|
1947
|
+
ee(5, R(G))
|
|
1948
|
+
], Fe);
|
|
1938
1949
|
var ba = Object.defineProperty, La = Object.getOwnPropertyDescriptor, xa = (o, a, e, t) => {
|
|
1939
1950
|
for (var r = t > 1 ? void 0 : t ? La(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1940
1951
|
(s = o[i]) && (r = (t ? s(a, e, r) : s(r)) || r);
|
|
1941
1952
|
return t && r && ba(a, e, r), r;
|
|
1942
|
-
},
|
|
1943
|
-
let
|
|
1953
|
+
}, We = (o, a) => (e, t) => a(e, t, o);
|
|
1954
|
+
let Ne = class extends $ {
|
|
1944
1955
|
constructor(o, a, e) {
|
|
1945
1956
|
super(), this._sheetInterceptorService = o, this._univerInstanceService = a, this._sheetDataValidationModel = e, this._initSheetChange();
|
|
1946
1957
|
}
|
|
@@ -1949,7 +1960,7 @@ let Ee = class extends P {
|
|
|
1949
1960
|
this._sheetInterceptorService.interceptCommand({
|
|
1950
1961
|
getMutations: (o) => {
|
|
1951
1962
|
var a;
|
|
1952
|
-
if (o.id ===
|
|
1963
|
+
if (o.id === $t.id) {
|
|
1953
1964
|
const e = o.params, t = e.unitId || this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET).getUnitId(), r = this._univerInstanceService.getUniverSheetInstance(t);
|
|
1954
1965
|
if (!r)
|
|
1955
1966
|
return { redos: [], undos: [] };
|
|
@@ -1972,7 +1983,7 @@ let Ee = class extends P {
|
|
|
1972
1983
|
};
|
|
1973
1984
|
return {
|
|
1974
1985
|
redos: [{
|
|
1975
|
-
id:
|
|
1986
|
+
id: A.id,
|
|
1976
1987
|
params: l
|
|
1977
1988
|
}],
|
|
1978
1989
|
undos: [{
|
|
@@ -1987,12 +1998,12 @@ let Ee = class extends P {
|
|
|
1987
1998
|
);
|
|
1988
1999
|
}
|
|
1989
2000
|
};
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
],
|
|
1995
|
-
class Ba extends
|
|
2001
|
+
Ne = xa([
|
|
2002
|
+
We(0, R(st)),
|
|
2003
|
+
We(1, R(O)),
|
|
2004
|
+
We(2, R(F))
|
|
2005
|
+
], Ne);
|
|
2006
|
+
class Ba extends k {
|
|
1996
2007
|
constructor() {
|
|
1997
2008
|
super(...arguments);
|
|
1998
2009
|
g(this, "id", T.ANY);
|
|
@@ -2020,14 +2031,14 @@ class Ba extends q {
|
|
|
2020
2031
|
return this.localeService.t("dataValidation.any.error");
|
|
2021
2032
|
}
|
|
2022
2033
|
}
|
|
2023
|
-
class Ua extends
|
|
2034
|
+
class Ua extends k {
|
|
2024
2035
|
constructor() {
|
|
2025
2036
|
super(...arguments);
|
|
2026
2037
|
g(this, "id", T.CUSTOM);
|
|
2027
2038
|
g(this, "title", "dataValidation.custom.title");
|
|
2028
2039
|
g(this, "operators", []);
|
|
2029
2040
|
g(this, "scopes", ["sheet"]);
|
|
2030
|
-
g(this, "_customFormulaService", this.injector.get(
|
|
2041
|
+
g(this, "_customFormulaService", this.injector.get(P));
|
|
2031
2042
|
}
|
|
2032
2043
|
validatorFormula(e, t, r) {
|
|
2033
2044
|
const i = S(e.formula1);
|
|
@@ -2055,7 +2066,7 @@ class Ua extends q {
|
|
|
2055
2066
|
return this.localeService.t("dataValidation.custom.ruleName").replace("{FORMULA1}", (t = e.formula1) != null ? t : "");
|
|
2056
2067
|
}
|
|
2057
2068
|
}
|
|
2058
|
-
class Pa extends
|
|
2069
|
+
class Pa extends mt {
|
|
2059
2070
|
constructor() {
|
|
2060
2071
|
super(...arguments);
|
|
2061
2072
|
g(this, "id", T.LIST_MULTIPLE);
|
|
@@ -2064,11 +2075,11 @@ class Pa extends ct {
|
|
|
2064
2075
|
g(this, "skipDefaultFontRender", () => !0);
|
|
2065
2076
|
}
|
|
2066
2077
|
}
|
|
2067
|
-
class $a extends
|
|
2078
|
+
class $a extends k {
|
|
2068
2079
|
constructor() {
|
|
2069
2080
|
super(...arguments);
|
|
2070
|
-
g(this, "_customFormulaService", this.injector.get(
|
|
2071
|
-
g(this, "_lexerTreeBuilder", this.injector.get(
|
|
2081
|
+
g(this, "_customFormulaService", this.injector.get(P));
|
|
2082
|
+
g(this, "_lexerTreeBuilder", this.injector.get(Z));
|
|
2072
2083
|
g(this, "id", T.WHOLE);
|
|
2073
2084
|
g(this, "title", "dataValidation.whole.title");
|
|
2074
2085
|
g(this, "operators", [
|
|
@@ -2087,14 +2098,14 @@ class $a extends q {
|
|
|
2087
2098
|
return !V.isBlank(e) && (S(e) || !Number.isNaN(+e) && Number.isInteger(+e));
|
|
2088
2099
|
}
|
|
2089
2100
|
async isValidType(e, t, r) {
|
|
2090
|
-
const { value: i } = e, s =
|
|
2101
|
+
const { value: i } = e, s = ye(i);
|
|
2091
2102
|
return !Number.isNaN(s) && Number.isInteger(s);
|
|
2092
2103
|
}
|
|
2093
2104
|
transform(e, t, r) {
|
|
2094
2105
|
const { value: i } = e;
|
|
2095
2106
|
return {
|
|
2096
2107
|
...e,
|
|
2097
|
-
value:
|
|
2108
|
+
value: ye(i)
|
|
2098
2109
|
};
|
|
2099
2110
|
}
|
|
2100
2111
|
_parseNumber(e) {
|
|
@@ -2114,7 +2125,7 @@ class $a extends q {
|
|
|
2114
2125
|
return {
|
|
2115
2126
|
success: !1
|
|
2116
2127
|
};
|
|
2117
|
-
const s = V.isDefine(e.formula1) && this._isFormulaOrInt(e.formula1), n = V.isDefine(e.formula2) && this._isFormulaOrInt(e.formula2), l =
|
|
2128
|
+
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");
|
|
2118
2129
|
return l ? {
|
|
2119
2130
|
success: s && n,
|
|
2120
2131
|
formula1: s ? void 0 : u,
|
|
@@ -2127,16 +2138,16 @@ class $a extends q {
|
|
|
2127
2138
|
generateRuleErrorMessage(e, t) {
|
|
2128
2139
|
if (!e.operator)
|
|
2129
2140
|
return this.titleStr;
|
|
2130
|
-
const { transformedFormula1: r, transformedFormula2: i } =
|
|
2131
|
-
return `${this.localeService.t(
|
|
2141
|
+
const { transformedFormula1: r, transformedFormula2: i } = De(this._lexerTreeBuilder, e, t);
|
|
2142
|
+
return `${this.localeService.t(ht[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
2132
2143
|
}
|
|
2133
2144
|
}
|
|
2134
2145
|
var Ha = Object.defineProperty, Wa = Object.getOwnPropertyDescriptor, ja = (o, a, e, t) => {
|
|
2135
2146
|
for (var r = t > 1 ? void 0 : t ? Wa(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
2136
2147
|
(s = o[i]) && (r = (t ? s(a, e, r) : s(r)) || r);
|
|
2137
2148
|
return t && r && Ha(a, e, r), r;
|
|
2138
|
-
},
|
|
2139
|
-
let
|
|
2149
|
+
}, te = (o, a) => (e, t) => a(e, t, o);
|
|
2150
|
+
let Ce = class extends Ft {
|
|
2140
2151
|
constructor(o, a, e, t, r, i) {
|
|
2141
2152
|
super(), this._univerInstanceService = o, this._dataValidatorRegistryService = a, this._injector = e, this._selectionManagerService = t, this._sheetInterceptorService = r, this._sheetDataValidationModel = i, this._init();
|
|
2142
2153
|
}
|
|
@@ -2146,30 +2157,30 @@ let Te = class extends Ft {
|
|
|
2146
2157
|
_registerValidators() {
|
|
2147
2158
|
[
|
|
2148
2159
|
Ba,
|
|
2149
|
-
|
|
2160
|
+
ca,
|
|
2150
2161
|
$a,
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2162
|
+
_a,
|
|
2163
|
+
da,
|
|
2164
|
+
sa,
|
|
2165
|
+
mt,
|
|
2155
2166
|
Pa,
|
|
2156
2167
|
Ua
|
|
2157
2168
|
].forEach((o) => {
|
|
2158
2169
|
const a = this._injector.createInstance(o);
|
|
2159
|
-
this.disposeWithMe(this._dataValidatorRegistryService.register(a)), this.disposeWithMe(
|
|
2170
|
+
this.disposeWithMe(this._dataValidatorRegistryService.register(a)), this.disposeWithMe(qe(() => this._injector.delete(o)));
|
|
2160
2171
|
});
|
|
2161
2172
|
}
|
|
2162
2173
|
_initCommandInterceptor() {
|
|
2163
2174
|
this._sheetInterceptorService.interceptCommand({
|
|
2164
2175
|
getMutations: (o) => {
|
|
2165
2176
|
var a;
|
|
2166
|
-
if (o.id ===
|
|
2177
|
+
if (o.id === Ht.id) {
|
|
2167
2178
|
const e = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET), t = e.getUnitId(), r = e.getActiveSheet();
|
|
2168
2179
|
if (!r)
|
|
2169
2180
|
throw new Error("No active sheet found");
|
|
2170
2181
|
const i = r.getSheetId(), s = (a = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : a.map((c) => c.range), n = this._sheetDataValidationModel.getRuleObjectMatrix(t, i).clone();
|
|
2171
2182
|
s && n.removeRange(s);
|
|
2172
|
-
const l = n.diff(this._sheetDataValidationModel.getRules(t, i)), { redoMutations: u, undoMutations: d } =
|
|
2183
|
+
const l = n.diff(this._sheetDataValidationModel.getRules(t, i)), { redoMutations: u, undoMutations: d } = be(t, i, l, this._injector, "patched");
|
|
2173
2184
|
return {
|
|
2174
2185
|
undos: d,
|
|
2175
2186
|
redos: u
|
|
@@ -2183,20 +2194,20 @@ let Te = class extends Ft {
|
|
|
2183
2194
|
});
|
|
2184
2195
|
}
|
|
2185
2196
|
};
|
|
2186
|
-
|
|
2187
|
-
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
|
|
2191
|
-
|
|
2192
|
-
|
|
2193
|
-
],
|
|
2197
|
+
Ce = ja([
|
|
2198
|
+
te(0, O),
|
|
2199
|
+
te(1, R(G)),
|
|
2200
|
+
te(2, R(Ge)),
|
|
2201
|
+
te(3, R(nt)),
|
|
2202
|
+
te(4, R(st)),
|
|
2203
|
+
te(5, R(F))
|
|
2204
|
+
], Ce);
|
|
2194
2205
|
var Qa = Object.defineProperty, qa = Object.getOwnPropertyDescriptor, Ga = (o, a, e, t) => {
|
|
2195
2206
|
for (var r = t > 1 ? void 0 : t ? qa(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
2196
2207
|
(s = o[i]) && (r = (t ? s(a, e, r) : s(r)) || r);
|
|
2197
2208
|
return t && r && Qa(a, e, r), r;
|
|
2198
|
-
},
|
|
2199
|
-
let
|
|
2209
|
+
}, ve = (o, a) => (e, t) => a(e, t, o);
|
|
2210
|
+
let Oe = class extends $ {
|
|
2200
2211
|
constructor(o, a, e, t) {
|
|
2201
2212
|
super(), this._univerInstanceService = o, this._sheetDataValidationModel = a, this._dataValidationCacheService = e, this._lifecycleService = t, this._initRecalculate();
|
|
2202
2213
|
}
|
|
@@ -2217,7 +2228,7 @@ let Fe = class extends P {
|
|
|
2217
2228
|
});
|
|
2218
2229
|
});
|
|
2219
2230
|
};
|
|
2220
|
-
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(
|
|
2231
|
+
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(Wt(() => this._lifecycleService.lifecycle$.pipe(Ze((a) => a === ze.Rendered)))).subscribe(o)), this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(Ze(() => this._lifecycleService.stage >= ze.Rendered), Ct(20)).subscribe(o));
|
|
2221
2232
|
}
|
|
2222
2233
|
async _validatorByCell(o, a, e, t) {
|
|
2223
2234
|
const r = o.getUnitId(), i = a.getSheetId();
|
|
@@ -2289,66 +2300,70 @@ let Fe = class extends P {
|
|
|
2289
2300
|
return this.getDataValidations(o, a, e)[0];
|
|
2290
2301
|
}
|
|
2291
2302
|
};
|
|
2292
|
-
|
|
2293
|
-
|
|
2294
|
-
|
|
2295
|
-
|
|
2296
|
-
|
|
2297
|
-
],
|
|
2298
|
-
var
|
|
2303
|
+
Oe = Ga([
|
|
2304
|
+
ve(0, O),
|
|
2305
|
+
ve(1, R(F)),
|
|
2306
|
+
ve(2, R(q)),
|
|
2307
|
+
ve(3, R(Nt))
|
|
2308
|
+
], Oe);
|
|
2309
|
+
var pt = Object.defineProperty, ka = Object.getOwnPropertyDescriptor, Ya = (o, a, e) => a in o ? pt(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e, Xa = (o, a, e, t) => {
|
|
2299
2310
|
for (var r = t > 1 ? void 0 : t ? ka(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
2300
2311
|
(s = o[i]) && (r = (t ? s(a, e, r) : s(r)) || r);
|
|
2301
|
-
return t && r &&
|
|
2302
|
-
},
|
|
2303
|
-
let
|
|
2304
|
-
constructor(o =
|
|
2312
|
+
return t && r && pt(a, e, r), r;
|
|
2313
|
+
}, je = (o, a) => (e, t) => a(e, t, o), ft = (o, a, e) => Ya(o, typeof a != "symbol" ? a + "" : a, e);
|
|
2314
|
+
let we = class extends wt {
|
|
2315
|
+
constructor(o = tt, a, e, t) {
|
|
2305
2316
|
super(), this._config = o, this._injector = a, this._commandService = e, this._configService = t;
|
|
2306
|
-
const { ...r } =
|
|
2307
|
-
|
|
2317
|
+
const { ...r } = It(
|
|
2318
|
+
{},
|
|
2319
|
+
tt,
|
|
2320
|
+
this._config
|
|
2321
|
+
);
|
|
2322
|
+
this._configService.setConfig(Ea, r);
|
|
2308
2323
|
}
|
|
2309
2324
|
onStarting() {
|
|
2310
2325
|
[
|
|
2311
|
-
[
|
|
2312
|
-
[
|
|
2313
|
-
[
|
|
2314
|
-
[
|
|
2326
|
+
[q],
|
|
2327
|
+
[X],
|
|
2328
|
+
[P],
|
|
2329
|
+
[Oe],
|
|
2315
2330
|
[F],
|
|
2331
|
+
[Ce],
|
|
2316
2332
|
[Te],
|
|
2317
|
-
[
|
|
2318
|
-
[
|
|
2319
|
-
[
|
|
2320
|
-
[Ve]
|
|
2333
|
+
[Ne],
|
|
2334
|
+
[Fe],
|
|
2335
|
+
[Ee]
|
|
2321
2336
|
].forEach((o) => {
|
|
2322
2337
|
this._injector.add(o);
|
|
2323
2338
|
}), [
|
|
2324
|
-
pa,
|
|
2325
|
-
_a,
|
|
2326
2339
|
fa,
|
|
2340
|
+
pa,
|
|
2327
2341
|
va,
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2342
|
+
Ra,
|
|
2343
|
+
ya,
|
|
2344
|
+
Va,
|
|
2345
|
+
Sa
|
|
2331
2346
|
].forEach((o) => {
|
|
2332
2347
|
this._commandService.registerCommand(o);
|
|
2333
|
-
}), this._injector.get(
|
|
2348
|
+
}), this._injector.get(q), this._injector.get(Oe), this._injector.get(Ee), this._injector.get(Fe);
|
|
2334
2349
|
}
|
|
2335
2350
|
onReady() {
|
|
2336
|
-
this._injector.get(
|
|
2351
|
+
this._injector.get(Ne);
|
|
2337
2352
|
}
|
|
2338
2353
|
onRendered() {
|
|
2339
|
-
this._injector.get(
|
|
2354
|
+
this._injector.get(Ce), this._injector.get(Te);
|
|
2340
2355
|
}
|
|
2341
2356
|
};
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
|
|
2345
|
-
Ot(
|
|
2346
|
-
|
|
2347
|
-
|
|
2348
|
-
|
|
2349
|
-
],
|
|
2357
|
+
ft(we, "pluginName", kt);
|
|
2358
|
+
ft(we, "type", N.UNIVER_SHEET);
|
|
2359
|
+
we = Xa([
|
|
2360
|
+
Ot(xt),
|
|
2361
|
+
je(1, R(Ge)),
|
|
2362
|
+
je(2, x),
|
|
2363
|
+
je(3, At)
|
|
2364
|
+
], we);
|
|
2350
2365
|
function or(o) {
|
|
2351
|
-
const e = o.get(
|
|
2366
|
+
const e = o.get(nt).getCurrentSelections().map((i) => i.range);
|
|
2352
2367
|
return {
|
|
2353
2368
|
uid: V.generateRandomId(6),
|
|
2354
2369
|
type: T.DECIMAL,
|
|
@@ -2358,35 +2373,35 @@ function or(o) {
|
|
|
2358
2373
|
};
|
|
2359
2374
|
}
|
|
2360
2375
|
export {
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2376
|
+
fa as AddSheetDataValidationCommand,
|
|
2377
|
+
Ve as CHECKBOX_FORMULA_1,
|
|
2378
|
+
Me as CHECKBOX_FORMULA_2,
|
|
2379
|
+
sa as CheckboxValidator,
|
|
2380
|
+
Sa as ClearRangeDataValidationCommand,
|
|
2381
|
+
kt as DATA_VALIDATION_PLUGIN_NAME,
|
|
2382
|
+
q as DataValidationCacheService,
|
|
2383
|
+
P as DataValidationCustomFormulaService,
|
|
2384
|
+
Te as DataValidationFormulaController,
|
|
2385
|
+
X as DataValidationFormulaService,
|
|
2386
|
+
da as DateValidator,
|
|
2372
2387
|
Pa as ListMultipleValidator,
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2388
|
+
mt as ListValidator,
|
|
2389
|
+
Va as RemoveSheetAllDataValidationCommand,
|
|
2390
|
+
ya as RemoveSheetDataValidationCommand,
|
|
2376
2391
|
F as SheetDataValidationModel,
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2392
|
+
Oe as SheetsDataValidationValidatorService,
|
|
2393
|
+
we as UniverSheetsDataValidationPlugin,
|
|
2394
|
+
Ra as UpdateSheetDataValidationOptionsCommand,
|
|
2395
|
+
pa as UpdateSheetDataValidationRangeCommand,
|
|
2396
|
+
va as UpdateSheetDataValidationSettingCommand,
|
|
2382
2397
|
or as createDefaultNewRule,
|
|
2383
|
-
|
|
2384
|
-
|
|
2398
|
+
fe as deserializeListOptions,
|
|
2399
|
+
ne as getCellValueOrigin,
|
|
2385
2400
|
ir as getDataValidationCellValue,
|
|
2386
|
-
|
|
2387
|
-
|
|
2388
|
-
|
|
2401
|
+
be as getDataValidationDiffMutations,
|
|
2402
|
+
_e as getFormulaCellData,
|
|
2403
|
+
oe as getFormulaResult,
|
|
2389
2404
|
C as isLegalFormulaResult,
|
|
2390
2405
|
rr as serializeListOptions,
|
|
2391
|
-
|
|
2406
|
+
pe as transformCheckboxValue
|
|
2392
2407
|
};
|