@univerjs/sheets-data-validation 0.16.1 → 0.17.0
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 +327 -322
- package/lib/index.js +327 -322
- package/lib/types/index.d.ts +1 -1
- package/lib/types/plugin.d.ts +3 -1
- package/lib/umd/index.js +1 -1
- package/package.json +7 -7
- /package/lib/types/{controllers/config.schema.d.ts → config/config.d.ts} +0 -0
package/lib/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var m = (s, a, e) =>
|
|
4
|
-
import { Inject as v, ICommandService as U, IUniverInstanceService as D, Disposable as B, ObjectMatrix as
|
|
5
|
-
import { DataValidationModel as
|
|
6
|
-
import { ERROR_TYPE_SET as
|
|
7
|
-
import { SetRangeValuesMutation as
|
|
8
|
-
import { Subject as
|
|
9
|
-
import { FormulaRefRangeService as
|
|
10
|
-
var
|
|
11
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1
|
+
var Vt = Object.defineProperty;
|
|
2
|
+
var yt = (s, a, e) => a in s ? Vt(s, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[a] = e;
|
|
3
|
+
var m = (s, a, e) => yt(s, typeof a != "symbol" ? a + "" : a, e);
|
|
4
|
+
import { Inject as v, ICommandService as U, IUniverInstanceService as D, Disposable as B, ObjectMatrix as Ve, getIntersectRange as nt, UniverInstanceType as N, Range as H, Rectangle as w, isFormulaString as S, getOriginCellValue as Tt, Injector as be, numfmt as L, DataValidationType as T, RBush as Ct, debounce as Ft, Tools as M, DataValidationStatus as A, WrapStrategy as Ee, DataValidationOperator as h, dayjs as lt, DataValidationRenderMode as $e, CommandType as z, IUndoRedoService as Z, sequenceExecute as Le, isRangesEqual as ut, IPermissionService as Nt, generateRandomId as Ke, toDisposable as ze, CellValueType as Ot, RxDisposable as wt, LifecycleService as At, LifecycleStages as tt, bufferDebounceTime as It, DependentOn as Dt, IConfigService as bt, Plugin as Lt, merge as Ut } from "@univerjs/core";
|
|
5
|
+
import { DataValidationModel as he, DataValidatorRegistryService as q, UpdateRuleType as V, BaseDataValidator as Y, TextLengthErrorTitleMap as Bt, AddDataValidationMutation as b, RemoveDataValidationMutation as I, UpdateDataValidationMutation as y, getRuleSetting as xt, getRuleOptions as Pt, UniverDataValidationPlugin as Ht } from "@univerjs/data-validation";
|
|
6
|
+
import { ERROR_TYPE_SET as Wt, RegisterOtherFormulaService as ct, OtherFormulaBizType as dt, LexerTreeBuilder as X, isReferenceString as ht, sequenceNodeType as $t, deserializeRangeWithSheet as kt, deserializeRangeWithSheetWithCache as jt, operatorToken as Qt } from "@univerjs/engine-formula";
|
|
7
|
+
import { SetRangeValuesMutation as le, RemoveSheetMutation as mt, getSheetCommandTarget as Ze, SetRangeValuesUndoMutationFactory as gt, WorksheetViewPermission as Gt, RefRangeService as qt, handleCommonDefaultRangeChangeWithEffectRefCommands as Yt, SheetInterceptorService as pt, RemoveSheetCommand as Xt, CopySheetCommand as Kt, SheetsSelectionsService as ft, ClearSelectionAllCommand as zt } from "@univerjs/sheets";
|
|
8
|
+
import { Subject as Xe, bufferWhen as Zt, filter as at } from "rxjs";
|
|
9
|
+
import { FormulaRefRangeService as _t, UniverSheetsFormulaPlugin as Jt } from "@univerjs/sheets-formula";
|
|
10
|
+
var ea = Object.getOwnPropertyDescriptor, ta = (s, a, e, t) => {
|
|
11
|
+
for (var r = t > 1 ? void 0 : t ? ea(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
12
12
|
(o = s[i]) && (r = o(r) || r);
|
|
13
13
|
return r;
|
|
14
|
-
},
|
|
14
|
+
}, ke = (s, a) => (e, t) => a(e, t, s);
|
|
15
15
|
let Q = class extends B {
|
|
16
16
|
constructor(a, e, t) {
|
|
17
17
|
super();
|
|
18
18
|
m(this, "_cacheMatrix", /* @__PURE__ */ new Map());
|
|
19
|
-
m(this, "_dirtyRanges$", new
|
|
19
|
+
m(this, "_dirtyRanges$", new Xe());
|
|
20
20
|
m(this, "dirtyRanges$", this._dirtyRanges$.asObservable());
|
|
21
21
|
this._commandService = a, this._univerInstanceService = e, this._sheetDataValidationModel = t, this._initDirtyRanges(), this._initSheetRemove();
|
|
22
22
|
}
|
|
23
23
|
_initDirtyRanges() {
|
|
24
24
|
this.disposeWithMe(this._commandService.onCommandExecuted((a, e) => {
|
|
25
|
-
if (a.id ===
|
|
25
|
+
if (a.id === le.id && !(e != null && e.onlyLocal)) {
|
|
26
26
|
const { cellValue: t, unitId: r, subUnitId: i } = a.params;
|
|
27
27
|
if (t) {
|
|
28
|
-
const o = new
|
|
28
|
+
const o = new Ve(t).getDataRange();
|
|
29
29
|
if (o.endRow === -1) return;
|
|
30
|
-
const u = this._sheetDataValidationModel.getRules(r, i).map((c) => c.ranges).flat().map((c) =>
|
|
30
|
+
const u = this._sheetDataValidationModel.getRules(r, i).map((c) => c.ranges).flat().map((c) => nt(c, o)).filter(Boolean);
|
|
31
31
|
u.length && this.markRangeDirty(r, i, u, !0);
|
|
32
32
|
}
|
|
33
33
|
}
|
|
@@ -36,7 +36,7 @@ let Q = class extends B {
|
|
|
36
36
|
_initSheetRemove() {
|
|
37
37
|
this.disposeWithMe(this._commandService.onCommandExecuted((a) => {
|
|
38
38
|
var e;
|
|
39
|
-
if (a.id ===
|
|
39
|
+
if (a.id === mt.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 Q = class extends B {
|
|
|
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 Ve(), t.set(e, r)), r;
|
|
52
52
|
}
|
|
53
53
|
ensureCache(a, e) {
|
|
54
54
|
return this._ensureCache(a, e);
|
|
@@ -79,32 +79,32 @@ let Q = class extends B {
|
|
|
79
79
|
return this._ensureCache(a, e).getValue(t, r);
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
-
Q =
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
Q = ta([
|
|
83
|
+
ke(0, v(U)),
|
|
84
|
+
ke(1, v(D)),
|
|
85
|
+
ke(2, v(he))
|
|
86
86
|
], Q);
|
|
87
|
-
function
|
|
87
|
+
function ne(s) {
|
|
88
88
|
var a, e;
|
|
89
89
|
return (e = (a = s == null ? void 0 : s[0]) == null ? void 0 : a[0]) == null ? void 0 : e.v;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function ve(s) {
|
|
92
92
|
var a;
|
|
93
93
|
return (a = s == null ? void 0 : s[0]) == null ? void 0 : a[0];
|
|
94
94
|
}
|
|
95
95
|
function C(s) {
|
|
96
|
-
return !
|
|
96
|
+
return !Wt.has(s);
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function me(s, a) {
|
|
99
99
|
var t;
|
|
100
100
|
const e = a.getValidatorItem(s);
|
|
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 aa = Object.getOwnPropertyDescriptor, ra = (s, a, e, t) => {
|
|
104
|
+
for (var r = t > 1 ? void 0 : t ? aa(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
105
105
|
(o = s[i]) && (r = o(r) || r);
|
|
106
106
|
return r;
|
|
107
|
-
},
|
|
107
|
+
}, oe = (s, a) => (e, t) => a(e, t, s);
|
|
108
108
|
let W = class extends B {
|
|
109
109
|
constructor(a, e, t, r, i) {
|
|
110
110
|
super();
|
|
@@ -143,7 +143,7 @@ let W = class extends B {
|
|
|
143
143
|
return o || (o = /* @__PURE__ */ new Map(), r.set(e, o)), { ruleFormulaMap: i, ruleFormulaMap2: o };
|
|
144
144
|
}
|
|
145
145
|
_registerFormula(a, e, t, r, i) {
|
|
146
|
-
return this._registerOtherFormulaService.registerFormulaWithRange(a, e, r, i, { ruleId: t },
|
|
146
|
+
return this._registerOtherFormulaService.registerFormulaWithRange(a, e, r, i, { ruleId: t }, dt.DATA_VALIDATION_CUSTOM, t);
|
|
147
147
|
}
|
|
148
148
|
_handleDirtyRanges(a, e, t) {
|
|
149
149
|
this._dataValidationModel.getRules(a, e).forEach((i) => {
|
|
@@ -187,7 +187,7 @@ let W = class extends B {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
addRule(a, e, t) {
|
|
190
|
-
if (
|
|
190
|
+
if (me(t.type, this._validatorRegistryService)) {
|
|
191
191
|
const { ranges: r, formula1: i, formula2: o, uid: n } = t;
|
|
192
192
|
this._addFormulaByRange(a, e, n, i, o, r);
|
|
193
193
|
}
|
|
@@ -198,7 +198,7 @@ let W = class extends B {
|
|
|
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: c } = n, d = r - u, g = i - c;
|
|
201
|
-
return
|
|
201
|
+
return ve((p = (f = l == null ? void 0 : l.result) == null ? void 0 : f[d]) == null ? void 0 : p[g]);
|
|
202
202
|
}
|
|
203
203
|
async getCellFormula2Value(a, e, t, r, i) {
|
|
204
204
|
var f, p;
|
|
@@ -206,7 +206,7 @@ let W = class extends B {
|
|
|
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: c } = n, d = r - u, g = i - c;
|
|
209
|
-
return
|
|
209
|
+
return ve((p = (f = l == null ? void 0 : l.result) == null ? void 0 : f[d]) == null ? void 0 : p[g]);
|
|
210
210
|
}
|
|
211
211
|
getCellFormulaValueSync(a, e, t, r, i) {
|
|
212
212
|
var f, p;
|
|
@@ -214,7 +214,7 @@ let W = class extends B {
|
|
|
214
214
|
if (!n)
|
|
215
215
|
return;
|
|
216
216
|
const l = this._registerOtherFormulaService.getFormulaValueSync(a, e, n.formulaId), { originRow: u, originCol: c } = n, d = r - u, g = i - c;
|
|
217
|
-
return
|
|
217
|
+
return ve((p = (f = l == null ? void 0 : l.result) == null ? void 0 : f[d]) == null ? void 0 : p[g]);
|
|
218
218
|
}
|
|
219
219
|
getCellFormula2ValueSync(a, e, t, r, i) {
|
|
220
220
|
var f, p;
|
|
@@ -222,7 +222,7 @@ let W = class extends B {
|
|
|
222
222
|
if (!n)
|
|
223
223
|
return;
|
|
224
224
|
const l = this._registerOtherFormulaService.getFormulaValueSync(a, e, n.formulaId), { originRow: u, originCol: c } = n, d = r - u, g = i - c;
|
|
225
|
-
return
|
|
225
|
+
return ve((p = (f = l == null ? void 0 : l.result) == null ? void 0 : f[d]) == null ? void 0 : p[g]);
|
|
226
226
|
}
|
|
227
227
|
getRuleFormulaInfo(a, e, t) {
|
|
228
228
|
const { ruleFormulaMap: r } = this._ensureMaps(a, e);
|
|
@@ -234,27 +234,27 @@ let W = class extends B {
|
|
|
234
234
|
r && this._registerOtherFormulaService.markFormulaDirty(a, e, r.formulaId), i && this._registerOtherFormulaService.markFormulaDirty(a, e, i.formulaId);
|
|
235
235
|
}
|
|
236
236
|
};
|
|
237
|
-
W =
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
237
|
+
W = ra([
|
|
238
|
+
oe(0, D),
|
|
239
|
+
oe(1, v(ct)),
|
|
240
|
+
oe(2, v(he)),
|
|
241
|
+
oe(3, v(Q)),
|
|
242
|
+
oe(4, v(q))
|
|
243
243
|
], W);
|
|
244
244
|
function re(s) {
|
|
245
|
-
return
|
|
245
|
+
return Tt(s);
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function vt(s) {
|
|
248
248
|
var a;
|
|
249
249
|
return String((a = re(s)) != null ? a : "");
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function sr(s) {
|
|
252
252
|
return s.filter(Boolean).join(",");
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function Me(s) {
|
|
255
255
|
return s.split(",").filter(Boolean);
|
|
256
256
|
}
|
|
257
|
-
function
|
|
257
|
+
function or(s) {
|
|
258
258
|
const a = re(s);
|
|
259
259
|
return a == null ? "" : a.toString();
|
|
260
260
|
}
|
|
@@ -265,12 +265,12 @@ function Ue(s, a, e) {
|
|
|
265
265
|
transformedFormula2: c
|
|
266
266
|
};
|
|
267
267
|
}
|
|
268
|
-
var
|
|
269
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
268
|
+
var ia = Object.getOwnPropertyDescriptor, sa = (s, a, e, t) => {
|
|
269
|
+
for (var r = t > 1 ? void 0 : t ? ia(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
270
270
|
(o = s[i]) && (r = o(r) || r);
|
|
271
271
|
return r;
|
|
272
|
-
},
|
|
273
|
-
let
|
|
272
|
+
}, rt = (s, a) => (e, t) => a(e, t, s);
|
|
273
|
+
let ue = class extends B {
|
|
274
274
|
constructor(a, e) {
|
|
275
275
|
super();
|
|
276
276
|
// Cache structure: unitId -> subUnitId -> ruleId -> cache item
|
|
@@ -332,7 +332,7 @@ let le = class extends B {
|
|
|
332
332
|
*/
|
|
333
333
|
computeAndCache(a, e, t, r) {
|
|
334
334
|
var f, p, R;
|
|
335
|
-
const { formula1: i = "", formula2: o = "" } = t, n = S(i) ? this._getRuleFormulaResultSet((R = (p = (f = r == null ? void 0 : r[0]) == null ? void 0 : f.result) == null ? void 0 : p[0]) == null ? void 0 : R[0]) :
|
|
335
|
+
const { formula1: i = "", formula2: o = "" } = t, n = S(i) ? this._getRuleFormulaResultSet((R = (p = (f = r == null ? void 0 : r[0]) == null ? void 0 : f.result) == null ? void 0 : p[0]) == null ? void 0 : R[0]) : Me(i), l = o.split(","), u = n.map((E, _) => ({ label: E, color: l[_] || "" })), c = {};
|
|
336
336
|
for (const E of u)
|
|
337
337
|
E.color && (c[E.label] = E.color);
|
|
338
338
|
const d = new Set(n), g = { list: n, listWithColor: u, colorMap: c, set: d };
|
|
@@ -364,12 +364,12 @@ let le = class extends B {
|
|
|
364
364
|
return [...e];
|
|
365
365
|
}
|
|
366
366
|
};
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
],
|
|
371
|
-
var
|
|
372
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
367
|
+
ue = sa([
|
|
368
|
+
rt(0, v(be)),
|
|
369
|
+
rt(1, v(he))
|
|
370
|
+
], ue);
|
|
371
|
+
var oa = Object.getOwnPropertyDescriptor, na = (s, a, e, t) => {
|
|
372
|
+
for (var r = t > 1 ? void 0 : t ? oa(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
373
373
|
(o = s[i]) && (r = o(r) || r);
|
|
374
374
|
return r;
|
|
375
375
|
}, ee = (s, a) => (e, t) => a(e, t, s);
|
|
@@ -406,10 +406,10 @@ let G = class extends B {
|
|
|
406
406
|
}
|
|
407
407
|
_registerSingleFormula(a, e, t, r) {
|
|
408
408
|
const i = [{ startColumn: 0, endColumn: 0, startRow: 0, endRow: 0 }];
|
|
409
|
-
return this._registerOtherFormulaService.registerFormulaWithRange(a, e, t, i, { ruleId: r },
|
|
409
|
+
return this._registerOtherFormulaService.registerFormulaWithRange(a, e, t, i, { ruleId: r }, dt.DATA_VALIDATION, r);
|
|
410
410
|
}
|
|
411
411
|
addRule(a, e, t) {
|
|
412
|
-
if (!
|
|
412
|
+
if (!me(t.type, this._validatorRegistryService) && t.type !== T.CHECKBOX) {
|
|
413
413
|
const { formula1: r, formula2: i, uid: o } = t, n = S(r), l = S(i);
|
|
414
414
|
if (!n && !l)
|
|
415
415
|
return;
|
|
@@ -454,18 +454,18 @@ let G = class extends B {
|
|
|
454
454
|
return this._ensureRuleFormulaMap(a, e).get(t);
|
|
455
455
|
}
|
|
456
456
|
};
|
|
457
|
-
G =
|
|
457
|
+
G = na([
|
|
458
458
|
ee(0, D),
|
|
459
|
-
ee(1, v(
|
|
459
|
+
ee(1, v(ct)),
|
|
460
460
|
ee(2, v(Q)),
|
|
461
|
-
ee(3, v(
|
|
461
|
+
ee(3, v(he)),
|
|
462
462
|
ee(4, v(q)),
|
|
463
|
-
ee(5, v(
|
|
463
|
+
ee(5, v(ue))
|
|
464
464
|
], G);
|
|
465
|
-
class
|
|
465
|
+
class Je {
|
|
466
466
|
constructor(a, e, t, r, i = !1) {
|
|
467
467
|
m(this, "_map");
|
|
468
|
-
m(this, "_tree", new
|
|
468
|
+
m(this, "_tree", new Ct());
|
|
469
469
|
m(this, "_dirty", !0);
|
|
470
470
|
m(this, "_buildTree", () => {
|
|
471
471
|
if (!this._dirty || this._disableTree)
|
|
@@ -484,7 +484,7 @@ class Ze {
|
|
|
484
484
|
});
|
|
485
485
|
}), this._tree.load(a), this._dirty = !1;
|
|
486
486
|
});
|
|
487
|
-
m(this, "_debonceBuildTree",
|
|
487
|
+
m(this, "_debonceBuildTree", Ft(this._buildTree, 0));
|
|
488
488
|
this._unitId = e, this._subUnitId = t, this._univerInstanceService = r, this._disableTree = i, this._map = a, this._buildTree();
|
|
489
489
|
}
|
|
490
490
|
get _worksheet() {
|
|
@@ -583,7 +583,7 @@ class Ze {
|
|
|
583
583
|
}), t;
|
|
584
584
|
}
|
|
585
585
|
clone() {
|
|
586
|
-
return new
|
|
586
|
+
return new Je(
|
|
587
587
|
new Map(M.deepClone(Array.from(this._map.entries()))),
|
|
588
588
|
this._unitId,
|
|
589
589
|
this._subUnitId,
|
|
@@ -603,8 +603,8 @@ class Ze {
|
|
|
603
603
|
return t.length > 0 ? t[0].ruleId : void 0;
|
|
604
604
|
}
|
|
605
605
|
}
|
|
606
|
-
var
|
|
607
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
606
|
+
var la = Object.getOwnPropertyDescriptor, ua = (s, a, e, t) => {
|
|
607
|
+
for (var r = t > 1 ? void 0 : t ? la(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
608
608
|
(o = s[i]) && (r = o(r) || r);
|
|
609
609
|
return r;
|
|
610
610
|
}, K = (s, a) => (e, t) => a(e, t, s);
|
|
@@ -612,8 +612,8 @@ let F = class extends B {
|
|
|
612
612
|
constructor(a, e, t, r, i, o, n) {
|
|
613
613
|
super();
|
|
614
614
|
m(this, "_ruleMatrixMap", /* @__PURE__ */ new Map());
|
|
615
|
-
m(this, "_validStatusChange$", new
|
|
616
|
-
m(this, "_ruleChange$", new
|
|
615
|
+
m(this, "_validStatusChange$", new Xe());
|
|
616
|
+
m(this, "_ruleChange$", new Xe());
|
|
617
617
|
m(this, "ruleChange$", this._ruleChange$.asObservable());
|
|
618
618
|
m(this, "validStatusChange$", this._validStatusChange$.asObservable());
|
|
619
619
|
this._dataValidationModel = a, this._univerInstanceService = e, this._dataValidatorRegistryService = t, this._dataValidationCacheService = r, this._dataValidationFormulaService = i, this._dataValidationCustomFormulaService = o, this._commandService = n, this._initRuleUpdateListener(), this.disposeWithMe(() => {
|
|
@@ -627,7 +627,7 @@ let F = class extends B {
|
|
|
627
627
|
})
|
|
628
628
|
), this.disposeWithMe(
|
|
629
629
|
this._commandService.onCommandExecuted((a) => {
|
|
630
|
-
if (a.id ===
|
|
630
|
+
if (a.id === mt.id) {
|
|
631
631
|
const { unitId: e, subUnitId: t } = a.params, r = this._ruleMatrixMap.get(e);
|
|
632
632
|
r && r.delete(t);
|
|
633
633
|
}
|
|
@@ -667,7 +667,7 @@ let F = class extends B {
|
|
|
667
667
|
let t = this._ruleMatrixMap.get(a);
|
|
668
668
|
t || (t = /* @__PURE__ */ new Map(), this._ruleMatrixMap.set(a, t));
|
|
669
669
|
let r = t.get(e);
|
|
670
|
-
return r || (r = new
|
|
670
|
+
return r || (r = new Je(/* @__PURE__ */ new Map(), a, e, this._univerInstanceService), t.set(e, r)), r;
|
|
671
671
|
}
|
|
672
672
|
_addRuleSideEffect(a, e, t) {
|
|
673
673
|
this._ensureRuleMatrix(a, e).addRule(t), this._dataValidationCacheService.addRule(a, e, t), this._dataValidationFormulaService.addRule(a, e, t), this._dataValidationCustomFormulaService.addRule(a, e, t);
|
|
@@ -756,8 +756,8 @@ let F = class extends B {
|
|
|
756
756
|
return this._dataValidationModel.getAll();
|
|
757
757
|
}
|
|
758
758
|
};
|
|
759
|
-
F =
|
|
760
|
-
K(0, v(
|
|
759
|
+
F = ua([
|
|
760
|
+
K(0, v(he)),
|
|
761
761
|
K(1, D),
|
|
762
762
|
K(2, v(q)),
|
|
763
763
|
K(3, v(Q)),
|
|
@@ -765,12 +765,12 @@ F = la([
|
|
|
765
765
|
K(5, v(W)),
|
|
766
766
|
K(6, U)
|
|
767
767
|
], F);
|
|
768
|
-
const
|
|
769
|
-
function
|
|
768
|
+
const ye = 1, Te = 0;
|
|
769
|
+
function it(s, a) {
|
|
770
770
|
return M.isBlank(s) ? a.t("dataValidation.validFail.value") : S(s) ? a.t("dataValidation.validFail.primitive") : "";
|
|
771
771
|
}
|
|
772
|
-
const
|
|
773
|
-
class
|
|
772
|
+
const Re = (s) => M.isDefine(s) && String(s).toLowerCase() === "true" ? "1" : String(s).toLowerCase() === "false" ? "0" : s;
|
|
773
|
+
class ca extends Y {
|
|
774
774
|
constructor() {
|
|
775
775
|
super(...arguments);
|
|
776
776
|
m(this, "id", T.CHECKBOX);
|
|
@@ -797,7 +797,7 @@ class ua extends Y {
|
|
|
797
797
|
formula1: this.localeService.t("dataValidation.validFail.checkboxEqual"),
|
|
798
798
|
formula2: this.localeService.t("dataValidation.validFail.checkboxEqual")
|
|
799
799
|
};
|
|
800
|
-
const l =
|
|
800
|
+
const l = it(i, this.localeService), u = it(o, this.localeService);
|
|
801
801
|
return {
|
|
802
802
|
success: !l && !u,
|
|
803
803
|
formula1: l,
|
|
@@ -806,10 +806,10 @@ class ua extends Y {
|
|
|
806
806
|
}
|
|
807
807
|
async parseFormula(e, t, r) {
|
|
808
808
|
var d, g, f, p;
|
|
809
|
-
const { formula1: i =
|
|
809
|
+
const { formula1: i = ye, formula2: o = Te } = e, n = await this._formulaService.getRuleFormulaResult(t, r, e.uid), l = S(i) ? ne((g = (d = n == null ? void 0 : n[0]) == null ? void 0 : d.result) == null ? void 0 : g[0][0]) : i, u = S(o) ? ne((p = (f = n == null ? void 0 : n[1]) == null ? void 0 : f.result) == null ? void 0 : p[0][0]) : o, c = C(String(l)) && C(String(u));
|
|
810
810
|
return {
|
|
811
|
-
formula1:
|
|
812
|
-
formula2:
|
|
811
|
+
formula1: Re(l),
|
|
812
|
+
formula2: Re(u),
|
|
813
813
|
originFormula1: l,
|
|
814
814
|
originFormula2: u,
|
|
815
815
|
isFormulaValid: c
|
|
@@ -817,15 +817,15 @@ class ua extends Y {
|
|
|
817
817
|
}
|
|
818
818
|
getExtraStyle(e, t) {
|
|
819
819
|
return {
|
|
820
|
-
tb:
|
|
820
|
+
tb: Ee.CLIP
|
|
821
821
|
};
|
|
822
822
|
}
|
|
823
823
|
parseFormulaSync(e, t, r) {
|
|
824
824
|
var d, g, f, p;
|
|
825
|
-
const { formula1: i =
|
|
825
|
+
const { formula1: i = ye, formula2: o = Te } = e, n = this._formulaService.getRuleFormulaResultSync(t, r, e.uid), l = S(i) ? ne((g = (d = n == null ? void 0 : n[0]) == null ? void 0 : d.result) == null ? void 0 : g[0][0]) : i, u = S(o) ? ne((p = (f = n == null ? void 0 : n[1]) == null ? void 0 : f.result) == null ? void 0 : p[0][0]) : o, c = C(String(l)) && C(String(u));
|
|
826
826
|
return {
|
|
827
|
-
formula1:
|
|
828
|
-
formula2:
|
|
827
|
+
formula1: Re(l),
|
|
828
|
+
formula2: Re(u),
|
|
829
829
|
originFormula1: l,
|
|
830
830
|
originFormula2: u,
|
|
831
831
|
isFormulaValid: c
|
|
@@ -842,7 +842,7 @@ class ua extends Y {
|
|
|
842
842
|
return this.titleStr;
|
|
843
843
|
}
|
|
844
844
|
}
|
|
845
|
-
const
|
|
845
|
+
const da = {
|
|
846
846
|
[h.BETWEEN]: "dataValidation.date.operators.between",
|
|
847
847
|
[h.EQUAL]: "dataValidation.date.operators.equal",
|
|
848
848
|
[h.GREATER_THAN]: "dataValidation.date.operators.greaterThan",
|
|
@@ -853,7 +853,7 @@ const ca = {
|
|
|
853
853
|
[h.NOT_EQUAL]: "dataValidation.date.operators.notEqual"
|
|
854
854
|
};
|
|
855
855
|
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 + "";
|
|
856
|
-
const
|
|
856
|
+
const st = {
|
|
857
857
|
[h.BETWEEN]: "dataValidation.date.ruleName.between",
|
|
858
858
|
[h.EQUAL]: "dataValidation.date.ruleName.equal",
|
|
859
859
|
[h.GREATER_THAN]: "dataValidation.date.ruleName.greaterThan",
|
|
@@ -863,7 +863,7 @@ const it = {
|
|
|
863
863
|
[h.NOT_BETWEEN]: "dataValidation.date.ruleName.notBetween",
|
|
864
864
|
[h.NOT_EQUAL]: "dataValidation.date.ruleName.notEqual",
|
|
865
865
|
NONE: "dataValidation.date.ruleName.legal"
|
|
866
|
-
},
|
|
866
|
+
}, ha = {
|
|
867
867
|
[h.BETWEEN]: "dataValidation.date.errorMsg.between",
|
|
868
868
|
[h.EQUAL]: "dataValidation.date.errorMsg.equal",
|
|
869
869
|
[h.GREATER_THAN]: "dataValidation.date.errorMsg.greaterThan",
|
|
@@ -876,16 +876,16 @@ const it = {
|
|
|
876
876
|
}, Be = [
|
|
877
877
|
h.BETWEEN,
|
|
878
878
|
h.NOT_BETWEEN
|
|
879
|
-
],
|
|
879
|
+
], ce = "{FORMULA1}", de = "{FORMULA2}", je = (s) => {
|
|
880
880
|
var e, t;
|
|
881
881
|
if (s == null || typeof s == "boolean")
|
|
882
882
|
return;
|
|
883
883
|
if (typeof s == "number" || !Number.isNaN(+s))
|
|
884
884
|
return +s;
|
|
885
885
|
const a = (e = L.parseDate(s)) == null ? void 0 : e.v;
|
|
886
|
-
return M.isDefine(a) ? a : (t = L.parseDate(
|
|
886
|
+
return M.isDefine(a) ? a : (t = L.parseDate(lt(s).format("YYYY-MM-DD HH:mm:ss"))) == null ? void 0 : t.v;
|
|
887
887
|
};
|
|
888
|
-
class
|
|
888
|
+
class ma extends Y {
|
|
889
889
|
constructor() {
|
|
890
890
|
super(...arguments);
|
|
891
891
|
m(this, "id", T.DATE);
|
|
@@ -908,8 +908,8 @@ class ha extends Y {
|
|
|
908
908
|
async parseFormula(e, t, r, i, o) {
|
|
909
909
|
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, o), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, o), { formula1: u, formula2: c } = e, d = C(String(n == null ? void 0 : n.v)) && C(String(l == null ? void 0 : l.v));
|
|
910
910
|
return {
|
|
911
|
-
formula1:
|
|
912
|
-
formula2:
|
|
911
|
+
formula1: je(S(u) ? n == null ? void 0 : n.v : u),
|
|
912
|
+
formula2: je(S(c) ? l == null ? void 0 : l.v : c),
|
|
913
913
|
isFormulaValid: d
|
|
914
914
|
};
|
|
915
915
|
}
|
|
@@ -954,7 +954,7 @@ class ha extends Y {
|
|
|
954
954
|
return "";
|
|
955
955
|
c = L.dateFromSerial(g);
|
|
956
956
|
}
|
|
957
|
-
return
|
|
957
|
+
return lt(`${c[0]}/${c[1]}/${c[2]} ${c[3]}:${c[4]}:${c[5]}`).format(n != null && n.showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD");
|
|
958
958
|
};
|
|
959
959
|
return {
|
|
960
960
|
formula1: S(i) ? i : l(`${i}`),
|
|
@@ -965,29 +965,29 @@ class ha extends Y {
|
|
|
965
965
|
const { value: i } = e;
|
|
966
966
|
return {
|
|
967
967
|
...e,
|
|
968
|
-
value:
|
|
968
|
+
value: je(i)
|
|
969
969
|
};
|
|
970
970
|
}
|
|
971
971
|
get operatorNames() {
|
|
972
|
-
return this.operators.map((e) => this.localeService.t(
|
|
972
|
+
return this.operators.map((e) => this.localeService.t(da[e]));
|
|
973
973
|
}
|
|
974
974
|
generateRuleName(e) {
|
|
975
975
|
var r, i;
|
|
976
976
|
if (!e.operator)
|
|
977
|
-
return this.localeService.t(
|
|
978
|
-
const t = this.localeService.t(
|
|
977
|
+
return this.localeService.t(st.NONE);
|
|
978
|
+
const t = this.localeService.t(st[e.operator]).replace(ce, (r = e.formula1) != null ? r : "").replace(de, (i = e.formula2) != null ? i : "");
|
|
979
979
|
return `${this.titleStr} ${t}`;
|
|
980
980
|
}
|
|
981
981
|
generateRuleErrorMessage(e, t) {
|
|
982
982
|
if (!e.operator)
|
|
983
983
|
return this.titleStr;
|
|
984
984
|
const { transformedFormula1: r, transformedFormula2: i } = Ue(this._lexerTreeBuilder, e, t);
|
|
985
|
-
return `${this.localeService.t(
|
|
985
|
+
return `${this.localeService.t(ha[e.operator]).replace(ce, r != null ? r : "").replace(de, i != null ? i : "")}`;
|
|
986
986
|
}
|
|
987
987
|
}
|
|
988
988
|
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 + "";
|
|
989
989
|
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 + "";
|
|
990
|
-
const
|
|
990
|
+
const Ce = {
|
|
991
991
|
[h.BETWEEN]: "dataValidation.errorMsg.between",
|
|
992
992
|
[h.EQUAL]: "dataValidation.errorMsg.equal",
|
|
993
993
|
[h.GREATER_THAN]: "dataValidation.errorMsg.greaterThan",
|
|
@@ -998,10 +998,10 @@ const Te = {
|
|
|
998
998
|
[h.NOT_EQUAL]: "dataValidation.errorMsg.notEqual",
|
|
999
999
|
NONE: "dataValidation.errorMsg.legal"
|
|
1000
1000
|
};
|
|
1001
|
-
function
|
|
1001
|
+
function Fe(s) {
|
|
1002
1002
|
return +s;
|
|
1003
1003
|
}
|
|
1004
|
-
class
|
|
1004
|
+
class ga extends Y {
|
|
1005
1005
|
constructor() {
|
|
1006
1006
|
super(...arguments);
|
|
1007
1007
|
m(this, "_customFormulaService", this.injector.get(W));
|
|
@@ -1026,13 +1026,13 @@ class ma extends Y {
|
|
|
1026
1026
|
}
|
|
1027
1027
|
async isValidType(e, t, r) {
|
|
1028
1028
|
const { value: i } = e;
|
|
1029
|
-
return !Number.isNaN(
|
|
1029
|
+
return !Number.isNaN(Fe(i));
|
|
1030
1030
|
}
|
|
1031
1031
|
transform(e, t, r) {
|
|
1032
1032
|
const { value: i } = e;
|
|
1033
1033
|
return {
|
|
1034
1034
|
...e,
|
|
1035
|
-
value:
|
|
1035
|
+
value: Fe(i)
|
|
1036
1036
|
};
|
|
1037
1037
|
}
|
|
1038
1038
|
_parseNumber(e) {
|
|
@@ -1064,12 +1064,12 @@ class ma extends Y {
|
|
|
1064
1064
|
}
|
|
1065
1065
|
generateRuleErrorMessage(e, t) {
|
|
1066
1066
|
if (!e.operator)
|
|
1067
|
-
return this.localeService.t(
|
|
1067
|
+
return this.localeService.t(Ce.NONE).replace("{TYPE}", this.titleStr);
|
|
1068
1068
|
const { transformedFormula1: r, transformedFormula2: i } = Ue(this._lexerTreeBuilder, e, t);
|
|
1069
|
-
return `${this.localeService.t(
|
|
1069
|
+
return `${this.localeService.t(Ce[e.operator]).replace(ce, r != null ? r : "").replace(de, i != null ? i : "")}`;
|
|
1070
1070
|
}
|
|
1071
1071
|
}
|
|
1072
|
-
function
|
|
1072
|
+
function pa(s) {
|
|
1073
1073
|
var e, t;
|
|
1074
1074
|
if (!s)
|
|
1075
1075
|
return [];
|
|
@@ -1091,45 +1091,45 @@ function ga(s) {
|
|
|
1091
1091
|
}
|
|
1092
1092
|
return [...a];
|
|
1093
1093
|
}
|
|
1094
|
-
const
|
|
1094
|
+
const fa = [
|
|
1095
1095
|
"if",
|
|
1096
1096
|
"indirect",
|
|
1097
1097
|
"choose",
|
|
1098
1098
|
"offset"
|
|
1099
1099
|
];
|
|
1100
|
-
function
|
|
1101
|
-
if (!S(s) ||
|
|
1100
|
+
function _a(s, a) {
|
|
1101
|
+
if (!S(s) || ht(s.slice(1)))
|
|
1102
1102
|
return !0;
|
|
1103
1103
|
const t = a.sequenceNodesBuilder(s);
|
|
1104
|
-
return t && t.some((r) => typeof r == "object" && r.nodeType ===
|
|
1104
|
+
return t && t.some((r) => typeof r == "object" && r.nodeType === $t.FUNCTION && fa.indexOf(r.token.toLowerCase()) > -1);
|
|
1105
1105
|
}
|
|
1106
|
-
function
|
|
1106
|
+
function va(s, a) {
|
|
1107
1107
|
const { formula1: e = "", ranges: t } = s;
|
|
1108
|
-
if (
|
|
1109
|
-
const i =
|
|
1108
|
+
if (ht(e.slice(1))) {
|
|
1109
|
+
const i = kt(e.slice(1));
|
|
1110
1110
|
if ((!i.sheetName || i.sheetName === a) && t.some((o) => w.intersects(o, i.range)))
|
|
1111
1111
|
return !0;
|
|
1112
1112
|
}
|
|
1113
1113
|
return !1;
|
|
1114
1114
|
}
|
|
1115
|
-
class
|
|
1115
|
+
class Rt extends Y {
|
|
1116
1116
|
constructor() {
|
|
1117
1117
|
super(...arguments);
|
|
1118
1118
|
m(this, "formulaService", this.injector.get(G));
|
|
1119
1119
|
m(this, "_lexer", this.injector.get(X));
|
|
1120
1120
|
m(this, "_univerInstanceService", this.injector.get(D));
|
|
1121
|
-
m(this, "_listCacheService", this.injector.get(
|
|
1121
|
+
m(this, "_listCacheService", this.injector.get(ue));
|
|
1122
1122
|
m(this, "order", 50);
|
|
1123
1123
|
m(this, "offsetFormulaByRange", !1);
|
|
1124
1124
|
m(this, "id", T.LIST);
|
|
1125
1125
|
m(this, "title", "dataValidation.list.title");
|
|
1126
1126
|
m(this, "operators", []);
|
|
1127
1127
|
m(this, "scopes", ["sheet"]);
|
|
1128
|
-
m(this, "skipDefaultFontRender", (e) => e.renderMode !==
|
|
1128
|
+
m(this, "skipDefaultFontRender", (e) => e.renderMode !== $e.TEXT);
|
|
1129
1129
|
}
|
|
1130
1130
|
validatorFormula(e, t, r) {
|
|
1131
1131
|
var u, c, d;
|
|
1132
|
-
const i = !M.isBlank(e.formula1), o =
|
|
1132
|
+
const i = !M.isBlank(e.formula1), o = _a((u = e.formula1) != null ? u : "", this._lexer), n = (d = (c = this._univerInstanceService.getUnit(t, N.UNIVER_SHEET)) == null ? void 0 : c.getSheetBySheetId(r)) == null ? void 0 : d.getName(), l = va(e, n != null ? n : "");
|
|
1133
1133
|
return {
|
|
1134
1134
|
success: !!(i && o && !l),
|
|
1135
1135
|
formula1: i ? o ? l ? this.localeService.t("dataValidation.validFail.listIntersects") : void 0 : this.localeService.t("dataValidation.validFail.listInvalid") : this.localeService.t("dataValidation.validFail.list")
|
|
@@ -1137,8 +1137,8 @@ class vt extends Y {
|
|
|
1137
1137
|
}
|
|
1138
1138
|
getExtraStyle(e, t, { style: r }) {
|
|
1139
1139
|
var o;
|
|
1140
|
-
const i = (o = r.tb !==
|
|
1141
|
-
if (e.type === T.LIST && (e.renderMode ===
|
|
1140
|
+
const i = (o = r.tb !== Ee.OVERFLOW ? r.tb : Ee.CLIP) != null ? o : Ee.WRAP;
|
|
1141
|
+
if (e.type === T.LIST && (e.renderMode === $e.ARROW || e.renderMode === $e.TEXT)) {
|
|
1142
1142
|
const n = this.getListWithColorMap(e), l = `${t != null ? t : ""}`, u = n[l];
|
|
1143
1143
|
if (u)
|
|
1144
1144
|
return {
|
|
@@ -1154,11 +1154,11 @@ class vt extends Y {
|
|
|
1154
1154
|
}
|
|
1155
1155
|
parseCellValue(e) {
|
|
1156
1156
|
const t = e.toString();
|
|
1157
|
-
return
|
|
1157
|
+
return Me(t);
|
|
1158
1158
|
}
|
|
1159
1159
|
async parseFormula(e, t, r) {
|
|
1160
1160
|
var l, u;
|
|
1161
|
-
const i = await this.formulaService.getRuleFormulaResult(t, r, e.uid), o =
|
|
1161
|
+
const i = await this.formulaService.getRuleFormulaResult(t, r, e.uid), o = ne((u = (l = i == null ? void 0 : i[0]) == null ? void 0 : l.result) == null ? void 0 : u[0][0]);
|
|
1162
1162
|
return {
|
|
1163
1163
|
formula1: void 0,
|
|
1164
1164
|
formula2: void 0,
|
|
@@ -1170,7 +1170,7 @@ class vt extends Y {
|
|
|
1170
1170
|
o,
|
|
1171
1171
|
n,
|
|
1172
1172
|
r
|
|
1173
|
-
).list :
|
|
1173
|
+
).list : Me(l);
|
|
1174
1174
|
return this.parseCellValue(i).every((d) => u.includes(d));
|
|
1175
1175
|
}
|
|
1176
1176
|
generateRuleName() {
|
|
@@ -1204,7 +1204,7 @@ class vt extends Y {
|
|
|
1204
1204
|
const { formula1: i = "" } = e, o = this._getUnitAndSubUnit(t, r);
|
|
1205
1205
|
if (!o) return [];
|
|
1206
1206
|
const { unitId: n, subUnitId: l } = o, u = await this.formulaService.getRuleFormulaResult(n, l, e.uid);
|
|
1207
|
-
return S(i) ?
|
|
1207
|
+
return S(i) ? pa((d = (c = u == null ? void 0 : u[0]) == null ? void 0 : c.result) == null ? void 0 : d[0][0]) : Me(i);
|
|
1208
1208
|
}
|
|
1209
1209
|
getListWithColor(e, t, r) {
|
|
1210
1210
|
const i = this._getUnitAndSubUnit(t, r);
|
|
@@ -1227,7 +1227,7 @@ class vt extends Y {
|
|
|
1227
1227
|
).colorMap;
|
|
1228
1228
|
}
|
|
1229
1229
|
}
|
|
1230
|
-
class
|
|
1230
|
+
class Ra extends Y {
|
|
1231
1231
|
constructor() {
|
|
1232
1232
|
super(...arguments);
|
|
1233
1233
|
m(this, "id", T.TEXT_LENGTH);
|
|
@@ -1291,27 +1291,27 @@ class va extends Y {
|
|
|
1291
1291
|
if (!e.operator)
|
|
1292
1292
|
return this.titleStr;
|
|
1293
1293
|
const { transformedFormula1: r, transformedFormula2: i } = Ue(this._lexerTreeBuilder, e, t);
|
|
1294
|
-
return `${this.localeService.t(
|
|
1294
|
+
return `${this.localeService.t(Bt[e.operator]).replace(ce, r != null ? r : "").replace(de, i != null ? i : "")}`;
|
|
1295
1295
|
}
|
|
1296
1296
|
}
|
|
1297
|
-
function
|
|
1297
|
+
function St(s) {
|
|
1298
1298
|
var e, t;
|
|
1299
1299
|
return s ? s.p ? !((t = (e = s.p.body) == null ? void 0 : e.dataStream) != null ? t : "").slice(0, -2).trim() : M.isBlank(s.v) : !0;
|
|
1300
1300
|
}
|
|
1301
1301
|
function xe(s, a, e, t, r = "command", i = !0) {
|
|
1302
|
-
const o = t.get(X), n = t.get(q), l = [], u = [], c = t.get(F), d = t.get(D), g =
|
|
1302
|
+
const o = t.get(X), n = t.get(q), l = [], u = [], c = t.get(F), d = t.get(D), g = Ze(d, { unitId: s, subUnitId: a });
|
|
1303
1303
|
if (!g)
|
|
1304
1304
|
return {
|
|
1305
1305
|
redoMutations: l,
|
|
1306
1306
|
undoMutations: u
|
|
1307
1307
|
};
|
|
1308
|
-
const { worksheet: f } = g, p = new
|
|
1308
|
+
const { worksheet: f } = g, p = new Ve();
|
|
1309
1309
|
let R = !1;
|
|
1310
1310
|
function E(_, O) {
|
|
1311
1311
|
i && _.forEach(($) => {
|
|
1312
1312
|
H.foreach($, (x, k) => {
|
|
1313
|
-
const P = f.getCellRaw(x, k), J =
|
|
1314
|
-
(
|
|
1313
|
+
const P = f.getCellRaw(x, k), J = vt(P);
|
|
1314
|
+
(St(P) || J === O) && !(P != null && P.p) && (R = !0, p.setValue(x, k, {
|
|
1315
1315
|
v: O,
|
|
1316
1316
|
p: null
|
|
1317
1317
|
}));
|
|
@@ -1341,9 +1341,9 @@ function xe(s, a, e, t, r = "command", i = !0) {
|
|
|
1341
1341
|
});
|
|
1342
1342
|
break;
|
|
1343
1343
|
case "update": {
|
|
1344
|
-
if (
|
|
1345
|
-
const $ = _.oldRanges[0].startRow, x = _.oldRanges[0].startColumn, k = _.newRanges[0].startRow, P = _.newRanges[0].startColumn, J = k - $,
|
|
1346
|
-
|
|
1344
|
+
if (me(_.rule.type, n)) {
|
|
1345
|
+
const $ = _.oldRanges[0].startRow, x = _.oldRanges[0].startColumn, k = _.newRanges[0].startRow, P = _.newRanges[0].startColumn, J = k - $, ge = P - x, pe = S(_.rule.formula1) ? o.moveFormulaRefOffset(_.rule.formula1, ge, J) : _.rule.formula1, fe = S(_.rule.formula2) ? o.moveFormulaRefOffset(_.rule.formula2, ge, J) : _.rule.formula2;
|
|
1346
|
+
pe !== _.rule.formula1 || fe !== _.rule.formula2 || !ut(_.newRanges, _.oldRanges) ? (l.push({
|
|
1347
1347
|
id: y.id,
|
|
1348
1348
|
params: {
|
|
1349
1349
|
unitId: s,
|
|
@@ -1352,8 +1352,8 @@ function xe(s, a, e, t, r = "command", i = !0) {
|
|
|
1352
1352
|
payload: {
|
|
1353
1353
|
type: V.ALL,
|
|
1354
1354
|
payload: {
|
|
1355
|
-
formula1:
|
|
1356
|
-
formula2:
|
|
1355
|
+
formula1: pe,
|
|
1356
|
+
formula2: fe,
|
|
1357
1357
|
ranges: _.newRanges
|
|
1358
1358
|
}
|
|
1359
1359
|
}
|
|
@@ -1457,15 +1457,15 @@ function xe(s, a, e, t, r = "command", i = !0) {
|
|
|
1457
1457
|
}
|
|
1458
1458
|
}), R) {
|
|
1459
1459
|
const _ = {
|
|
1460
|
-
id:
|
|
1460
|
+
id: le.id,
|
|
1461
1461
|
params: {
|
|
1462
1462
|
unitId: s,
|
|
1463
1463
|
subUnitId: a,
|
|
1464
1464
|
cellValue: p.getData()
|
|
1465
1465
|
}
|
|
1466
1466
|
}, O = {
|
|
1467
|
-
id:
|
|
1468
|
-
params:
|
|
1467
|
+
id: le.id,
|
|
1468
|
+
params: gt(t, _.params)
|
|
1469
1469
|
};
|
|
1470
1470
|
l.push(_), u.push(O);
|
|
1471
1471
|
}
|
|
@@ -1474,7 +1474,7 @@ function xe(s, a, e, t, r = "command", i = !0) {
|
|
|
1474
1474
|
undoMutations: u
|
|
1475
1475
|
};
|
|
1476
1476
|
}
|
|
1477
|
-
const
|
|
1477
|
+
const Sa = {
|
|
1478
1478
|
type: z.COMMAND,
|
|
1479
1479
|
id: "sheet.command.updateDataValidationRuleRange",
|
|
1480
1480
|
handler(s, a) {
|
|
@@ -1492,7 +1492,7 @@ const Ra = {
|
|
|
1492
1492
|
unitID: e
|
|
1493
1493
|
}), Le(g, n), !0;
|
|
1494
1494
|
}
|
|
1495
|
-
},
|
|
1495
|
+
}, Ea = {
|
|
1496
1496
|
type: z.COMMAND,
|
|
1497
1497
|
id: "sheet.command.addDataValidation",
|
|
1498
1498
|
handler(s, a) {
|
|
@@ -1524,7 +1524,7 @@ const Ra = {
|
|
|
1524
1524
|
undoMutations: f
|
|
1525
1525
|
}), Le(g, o), !0;
|
|
1526
1526
|
}
|
|
1527
|
-
},
|
|
1527
|
+
}, Ma = {
|
|
1528
1528
|
type: z.COMMAND,
|
|
1529
1529
|
id: "sheets.command.update-data-validation-setting",
|
|
1530
1530
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -1560,41 +1560,41 @@ const Ra = {
|
|
|
1560
1560
|
ruleId: l,
|
|
1561
1561
|
payload: {
|
|
1562
1562
|
type: V.SETTING,
|
|
1563
|
-
payload:
|
|
1563
|
+
payload: xt(d)
|
|
1564
1564
|
}
|
|
1565
1565
|
}, E = [{
|
|
1566
1566
|
id: y.id,
|
|
1567
1567
|
params: R
|
|
1568
1568
|
}];
|
|
1569
1569
|
if (u.type === T.CHECKBOX) {
|
|
1570
|
-
const O = d.ranges, $ = s.get(D), x =
|
|
1570
|
+
const O = d.ranges, $ = s.get(D), x = Ze($, { unitId: o, subUnitId: n });
|
|
1571
1571
|
if (x) {
|
|
1572
|
-
const k = new
|
|
1573
|
-
let
|
|
1574
|
-
if (O.forEach((
|
|
1575
|
-
H.foreach(
|
|
1576
|
-
const j = P.getCellRaw(
|
|
1577
|
-
(
|
|
1578
|
-
v: ge,
|
|
1579
|
-
p: null
|
|
1580
|
-
}), Pe = !0) : Je === String(me) && !(j != null && j.p) && (k.setValue(ie, He, {
|
|
1572
|
+
const k = new Ve(), { worksheet: P } = x, { formula2: J = Te, formula1: ge = ye } = d, { formula2: pe = Te, formula1: fe = ye } = u;
|
|
1573
|
+
let He = !1;
|
|
1574
|
+
if (O.forEach((_e) => {
|
|
1575
|
+
H.foreach(_e, (se, We) => {
|
|
1576
|
+
const j = P.getCellRaw(se, We), et = vt(j);
|
|
1577
|
+
(St(j) || et === String(J)) && !(j != null && j.p) ? (k.setValue(se, We, {
|
|
1581
1578
|
v: pe,
|
|
1582
1579
|
p: null
|
|
1583
|
-
}),
|
|
1580
|
+
}), He = !0) : et === String(ge) && !(j != null && j.p) && (k.setValue(se, We, {
|
|
1581
|
+
v: fe,
|
|
1582
|
+
p: null
|
|
1583
|
+
}), He = !0);
|
|
1584
1584
|
});
|
|
1585
|
-
}),
|
|
1586
|
-
const
|
|
1587
|
-
id:
|
|
1585
|
+
}), He) {
|
|
1586
|
+
const _e = {
|
|
1587
|
+
id: le.id,
|
|
1588
1588
|
params: {
|
|
1589
1589
|
unitId: o,
|
|
1590
1590
|
subUnitId: n,
|
|
1591
1591
|
cellValue: k.getData()
|
|
1592
1592
|
}
|
|
1593
|
-
},
|
|
1594
|
-
id:
|
|
1595
|
-
params:
|
|
1593
|
+
}, se = {
|
|
1594
|
+
id: le.id,
|
|
1595
|
+
params: gt(s, _e.params)
|
|
1596
1596
|
};
|
|
1597
|
-
p.push(
|
|
1597
|
+
p.push(_e), E.push(se);
|
|
1598
1598
|
}
|
|
1599
1599
|
}
|
|
1600
1600
|
}
|
|
@@ -1604,7 +1604,7 @@ const Ra = {
|
|
|
1604
1604
|
undoMutations: E
|
|
1605
1605
|
}), !0) : !1;
|
|
1606
1606
|
}
|
|
1607
|
-
},
|
|
1607
|
+
}, Va = {
|
|
1608
1608
|
type: z.COMMAND,
|
|
1609
1609
|
id: "sheets.command.update-data-validation-options",
|
|
1610
1610
|
handler(s, a) {
|
|
@@ -1630,7 +1630,7 @@ const Ra = {
|
|
|
1630
1630
|
ruleId: n,
|
|
1631
1631
|
payload: {
|
|
1632
1632
|
type: V.OPTIONS,
|
|
1633
|
-
payload:
|
|
1633
|
+
payload: Pt(u)
|
|
1634
1634
|
}
|
|
1635
1635
|
}, f = [{
|
|
1636
1636
|
id: y.id,
|
|
@@ -1642,13 +1642,13 @@ const Ra = {
|
|
|
1642
1642
|
undoMutations: f
|
|
1643
1643
|
}), e.executeCommand(y.id, c), !0;
|
|
1644
1644
|
}
|
|
1645
|
-
},
|
|
1645
|
+
}, ya = {
|
|
1646
1646
|
type: z.COMMAND,
|
|
1647
1647
|
id: "sheets.command.clear-range-data-validation",
|
|
1648
1648
|
handler(s, a) {
|
|
1649
1649
|
if (!a)
|
|
1650
1650
|
return !1;
|
|
1651
|
-
const { unitId: e, subUnitId: t, ranges: r } = a, i = s.get(U), o = s.get(D), n =
|
|
1651
|
+
const { unitId: e, subUnitId: t, ranges: r } = a, i = s.get(U), o = s.get(D), n = Ze(o, { unitId: e, subUnitId: t }), l = s.get(F);
|
|
1652
1652
|
if (!n) return !1;
|
|
1653
1653
|
const u = s.get(Z), c = l.getRuleObjectMatrix(e, t).clone();
|
|
1654
1654
|
c.removeRange(r);
|
|
@@ -1659,7 +1659,7 @@ const Ra = {
|
|
|
1659
1659
|
undoMutations: f
|
|
1660
1660
|
}), Le(g, i).result;
|
|
1661
1661
|
}
|
|
1662
|
-
},
|
|
1662
|
+
}, Ta = {
|
|
1663
1663
|
type: z.COMMAND,
|
|
1664
1664
|
id: "sheet.command.remove-all-data-validation",
|
|
1665
1665
|
handler(s, a) {
|
|
@@ -1686,7 +1686,7 @@ const Ra = {
|
|
|
1686
1686
|
unitID: e
|
|
1687
1687
|
}), r.executeCommand(I.id, l), !0;
|
|
1688
1688
|
}
|
|
1689
|
-
},
|
|
1689
|
+
}, Ca = (s, a) => {
|
|
1690
1690
|
const e = s.get(F), { unitId: t, subUnitId: r, ruleId: i, source: o } = a;
|
|
1691
1691
|
if (Array.isArray(i)) {
|
|
1692
1692
|
const l = i.map((u) => e.getRuleById(t, r, u)).filter(Boolean);
|
|
@@ -1711,7 +1711,7 @@ const Ra = {
|
|
|
1711
1711
|
index: e.getRuleIndex(t, r, i)
|
|
1712
1712
|
}
|
|
1713
1713
|
}];
|
|
1714
|
-
},
|
|
1714
|
+
}, Fa = {
|
|
1715
1715
|
type: z.COMMAND,
|
|
1716
1716
|
id: "sheet.command.remove-data-validation-rule",
|
|
1717
1717
|
handler(s, a) {
|
|
@@ -1737,13 +1737,13 @@ const Ra = {
|
|
|
1737
1737
|
unitID: a.unitId
|
|
1738
1738
|
}), i.executeCommand(I.id, a), !0;
|
|
1739
1739
|
}
|
|
1740
|
-
},
|
|
1741
|
-
var
|
|
1742
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1740
|
+
}, Na = "SHEET_DATA_VALIDATION_PLUGIN";
|
|
1741
|
+
var Et = /* @__PURE__ */ ((s) => (s[s.View = 0] = "View", s[s.Edit = 1] = "Edit", s[s.ManageCollaborator = 2] = "ManageCollaborator", s[s.Print = 3] = "Print", s[s.Duplicate = 4] = "Duplicate", s[s.Comment = 5] = "Comment", s[s.Copy = 6] = "Copy", s[s.Share = 7] = "Share", s[s.Export = 8] = "Export", s[s.MoveWorksheet = 9] = "MoveWorksheet", s[s.DeleteWorksheet = 10] = "DeleteWorksheet", s[s.HideWorksheet = 11] = "HideWorksheet", s[s.RenameWorksheet = 12] = "RenameWorksheet", s[s.CreateWorksheet = 13] = "CreateWorksheet", s[s.SetWorksheetStyle = 14] = "SetWorksheetStyle", s[s.EditWorksheetCell = 15] = "EditWorksheetCell", s[s.InsertHyperlink = 16] = "InsertHyperlink", s[s.Sort = 17] = "Sort", s[s.Filter = 18] = "Filter", s[s.PivotTable = 19] = "PivotTable", s[s.FloatImg = 20] = "FloatImg", s[s.History = 21] = "History", s[s.RwHgtClWdt = 22] = "RwHgtClWdt", s[s.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", s[s.ViewFilter = 24] = "ViewFilter", s[s.MoveSheet = 25] = "MoveSheet", s[s.DeleteSheet = 26] = "DeleteSheet", s[s.HideSheet = 27] = "HideSheet", s[s.CopySheet = 28] = "CopySheet", s[s.RenameSheet = 29] = "RenameSheet", s[s.CreateSheet = 30] = "CreateSheet", s[s.SelectProtectedCells = 31] = "SelectProtectedCells", s[s.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", s[s.SetCellStyle = 33] = "SetCellStyle", s[s.SetCellValue = 34] = "SetCellValue", s[s.SetRowStyle = 35] = "SetRowStyle", s[s.SetColumnStyle = 36] = "SetColumnStyle", s[s.InsertRow = 37] = "InsertRow", s[s.InsertColumn = 38] = "InsertColumn", s[s.DeleteRow = 39] = "DeleteRow", s[s.DeleteColumn = 40] = "DeleteColumn", s[s.EditExtraObject = 41] = "EditExtraObject", s[s.Delete = 42] = "Delete", s[s.RecoverHistory = 43] = "RecoverHistory", s[s.ViewHistory = 44] = "ViewHistory", s[s.CreatePermissionObject = 45] = "CreatePermissionObject", s[s.UNRECOGNIZED = -1] = "UNRECOGNIZED", s))(Et || {}), Oa = Object.getOwnPropertyDescriptor, wa = (s, a, e, t) => {
|
|
1742
|
+
for (var r = t > 1 ? void 0 : t ? Oa(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
1743
1743
|
(o = s[i]) && (r = o(r) || r);
|
|
1744
1744
|
return r;
|
|
1745
|
-
},
|
|
1746
|
-
let
|
|
1745
|
+
}, Qe = (s, a) => (e, t) => a(e, t, s);
|
|
1746
|
+
let Ne = class extends B {
|
|
1747
1747
|
constructor(s, a, e) {
|
|
1748
1748
|
super(), this._univerInstanceService = s, this._permissionService = a, this._lexerTreeBuilder = e;
|
|
1749
1749
|
}
|
|
@@ -1756,14 +1756,14 @@ let Fe = class extends B {
|
|
|
1756
1756
|
const i = a[r];
|
|
1757
1757
|
if (typeof i == "string")
|
|
1758
1758
|
continue;
|
|
1759
|
-
const { token: o } = i, n =
|
|
1759
|
+
const { token: o } = i, n = jt(o), l = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET);
|
|
1760
1760
|
let u = l.getActiveSheet();
|
|
1761
1761
|
const c = l.getUnitId();
|
|
1762
1762
|
if (n.sheetName) {
|
|
1763
1763
|
if (u = l.getSheetBySheetName(n.sheetName), !u)
|
|
1764
1764
|
return !1;
|
|
1765
1765
|
const R = u == null ? void 0 : u.getSheetId();
|
|
1766
|
-
if (!this._permissionService.getPermissionPoint(new
|
|
1766
|
+
if (!this._permissionService.getPermissionPoint(new Gt(c, R).id)) return !1;
|
|
1767
1767
|
}
|
|
1768
1768
|
if (!u)
|
|
1769
1769
|
return !1;
|
|
@@ -1771,30 +1771,33 @@ let Fe = class extends B {
|
|
|
1771
1771
|
for (let R = d; R <= g; R++)
|
|
1772
1772
|
for (let E = f; E <= p; E++) {
|
|
1773
1773
|
const _ = (t = (e = u.getCell(R, E)) == null ? void 0 : e.selectionProtection) == null ? void 0 : t[0];
|
|
1774
|
-
if ((_ == null ? void 0 : _[
|
|
1774
|
+
if ((_ == null ? void 0 : _[Et.View]) === !1)
|
|
1775
1775
|
return !1;
|
|
1776
1776
|
}
|
|
1777
1777
|
}
|
|
1778
1778
|
return !0;
|
|
1779
1779
|
}
|
|
1780
1780
|
};
|
|
1781
|
-
|
|
1782
|
-
|
|
1783
|
-
|
|
1784
|
-
|
|
1785
|
-
],
|
|
1786
|
-
const
|
|
1787
|
-
|
|
1788
|
-
|
|
1781
|
+
Ne = wa([
|
|
1782
|
+
Qe(0, D),
|
|
1783
|
+
Qe(1, Nt),
|
|
1784
|
+
Qe(2, v(X))
|
|
1785
|
+
], Ne);
|
|
1786
|
+
const Aa = "@univerjs/sheets-data-validation", Ia = "0.17.0", Mt = {
|
|
1787
|
+
name: Aa,
|
|
1788
|
+
version: Ia
|
|
1789
|
+
}, Da = "sheets-data-validation.config", ot = {};
|
|
1790
|
+
var ba = Object.getOwnPropertyDescriptor, La = (s, a, e, t) => {
|
|
1791
|
+
for (var r = t > 1 ? void 0 : t ? ba(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
1789
1792
|
(o = s[i]) && (r = o(r) || r);
|
|
1790
1793
|
return r;
|
|
1791
|
-
},
|
|
1792
|
-
let
|
|
1794
|
+
}, Ge = (s, a) => (e, t) => a(e, t, s);
|
|
1795
|
+
let Oe = class extends B {
|
|
1793
1796
|
constructor(a, e, t) {
|
|
1794
1797
|
super();
|
|
1795
1798
|
m(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
1796
1799
|
m(this, "registerRule", (a, e, t) => {
|
|
1797
|
-
|
|
1800
|
+
me(t.type, this._validatorRegistryService) && this.register(a, e, t);
|
|
1798
1801
|
});
|
|
1799
1802
|
this._dataValidationModel = a, this._formulaRefRangeService = e, this._validatorRegistryService = t, this._initRefRange();
|
|
1800
1803
|
}
|
|
@@ -1860,7 +1863,7 @@ let Ne = class extends B {
|
|
|
1860
1863
|
}
|
|
1861
1864
|
});
|
|
1862
1865
|
for (let f = 1; f < u.length; f++) {
|
|
1863
|
-
const p = u[f], R =
|
|
1866
|
+
const p = u[f], R = Ke();
|
|
1864
1867
|
c.push({
|
|
1865
1868
|
id: b.id,
|
|
1866
1869
|
params: {
|
|
@@ -1919,29 +1922,29 @@ let Ne = class extends B {
|
|
|
1919
1922
|
}
|
|
1920
1923
|
}
|
|
1921
1924
|
})
|
|
1922
|
-
), this.disposeWithMe(
|
|
1925
|
+
), this.disposeWithMe(ze(() => {
|
|
1923
1926
|
this._disposableMap.forEach((e) => {
|
|
1924
1927
|
e.dispose();
|
|
1925
1928
|
}), this._disposableMap.clear();
|
|
1926
1929
|
}));
|
|
1927
1930
|
}
|
|
1928
1931
|
};
|
|
1929
|
-
|
|
1930
|
-
|
|
1931
|
-
|
|
1932
|
-
|
|
1933
|
-
],
|
|
1934
|
-
var
|
|
1935
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1932
|
+
Oe = La([
|
|
1933
|
+
Ge(0, v(F)),
|
|
1934
|
+
Ge(1, v(_t)),
|
|
1935
|
+
Ge(2, v(q))
|
|
1936
|
+
], Oe);
|
|
1937
|
+
var Ua = Object.getOwnPropertyDescriptor, Ba = (s, a, e, t) => {
|
|
1938
|
+
for (var r = t > 1 ? void 0 : t ? Ua(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
1936
1939
|
(o = s[i]) && (r = o(r) || r);
|
|
1937
1940
|
return r;
|
|
1938
1941
|
}, te = (s, a) => (e, t) => a(e, t, s);
|
|
1939
|
-
let
|
|
1942
|
+
let we = class extends B {
|
|
1940
1943
|
constructor(a, e, t, r, i, o) {
|
|
1941
1944
|
super();
|
|
1942
1945
|
m(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
1943
1946
|
m(this, "registerRule", (a, e, t) => {
|
|
1944
|
-
|
|
1947
|
+
me(t.type, this._validatorRegistryService) || (this.register(a, e, t), this.registerFormula(a, e, t));
|
|
1945
1948
|
});
|
|
1946
1949
|
this._dataValidationModel = a, this._injector = e, this._refRangeService = t, this._dataValidationFormulaService = r, this._formulaRefRangeService = i, this._validatorRegistryService = o, this._initRefRange();
|
|
1947
1950
|
}
|
|
@@ -2023,8 +2026,8 @@ let Oe = class extends B {
|
|
|
2023
2026
|
register(a, e, t) {
|
|
2024
2027
|
var l;
|
|
2025
2028
|
const r = (u) => {
|
|
2026
|
-
const c = [...t.ranges], g = c.map((p) =>
|
|
2027
|
-
if (
|
|
2029
|
+
const c = [...t.ranges], g = c.map((p) => Yt(p, u)).filter((p) => !!p).flat();
|
|
2030
|
+
if (ut(g, c))
|
|
2028
2031
|
return { redos: [], undos: [] };
|
|
2029
2032
|
if (g.length) {
|
|
2030
2033
|
const p = {
|
|
@@ -2051,7 +2054,7 @@ let Oe = class extends B {
|
|
|
2051
2054
|
}];
|
|
2052
2055
|
return { redos: R, undos: E };
|
|
2053
2056
|
} else {
|
|
2054
|
-
const p = { unitId: a, subUnitId: e, ruleId: t.uid }, R = [{ id: I.id, params: p }], E =
|
|
2057
|
+
const p = { unitId: a, subUnitId: e, ruleId: t.uid }, R = [{ id: I.id, params: p }], E = Ca(this._injector, p);
|
|
2055
2058
|
return { redos: R, undos: E };
|
|
2056
2059
|
}
|
|
2057
2060
|
}, i = [];
|
|
@@ -2089,27 +2092,27 @@ let Oe = class extends B {
|
|
|
2089
2092
|
}
|
|
2090
2093
|
}
|
|
2091
2094
|
})
|
|
2092
|
-
), this.disposeWithMe(
|
|
2095
|
+
), this.disposeWithMe(ze(() => {
|
|
2093
2096
|
this._disposableMap.forEach((e) => {
|
|
2094
2097
|
e.forEach((t) => t());
|
|
2095
2098
|
}), this._disposableMap.clear();
|
|
2096
2099
|
}));
|
|
2097
2100
|
}
|
|
2098
2101
|
};
|
|
2099
|
-
|
|
2102
|
+
we = Ba([
|
|
2100
2103
|
te(0, v(F)),
|
|
2101
2104
|
te(1, v(be)),
|
|
2102
|
-
te(2, v(
|
|
2105
|
+
te(2, v(qt)),
|
|
2103
2106
|
te(3, v(G)),
|
|
2104
|
-
te(4, v(
|
|
2107
|
+
te(4, v(_t)),
|
|
2105
2108
|
te(5, v(q))
|
|
2106
|
-
],
|
|
2107
|
-
var
|
|
2108
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2109
|
+
], we);
|
|
2110
|
+
var xa = Object.getOwnPropertyDescriptor, Pa = (s, a, e, t) => {
|
|
2111
|
+
for (var r = t > 1 ? void 0 : t ? xa(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
2109
2112
|
(o = s[i]) && (r = o(r) || r);
|
|
2110
2113
|
return r;
|
|
2111
|
-
},
|
|
2112
|
-
let
|
|
2114
|
+
}, qe = (s, a) => (e, t) => a(e, t, s);
|
|
2115
|
+
let Ae = class extends B {
|
|
2113
2116
|
constructor(s, a, e) {
|
|
2114
2117
|
super(), this._sheetInterceptorService = s, this._univerInstanceService = a, this._sheetDataValidationModel = e, this._initSheetChange();
|
|
2115
2118
|
}
|
|
@@ -2120,7 +2123,7 @@ let we = class extends B {
|
|
|
2120
2123
|
// eslint-disable-next-line max-lines-per-function
|
|
2121
2124
|
getMutations: (s) => {
|
|
2122
2125
|
var a;
|
|
2123
|
-
if (s.id ===
|
|
2126
|
+
if (s.id === Xt.id) {
|
|
2124
2127
|
const e = s.params, t = e.unitId || this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET).getUnitId(), r = this._univerInstanceService.getUniverSheetInstance(t);
|
|
2125
2128
|
if (!r)
|
|
2126
2129
|
return { redos: [], undos: [] };
|
|
@@ -2151,14 +2154,14 @@ let we = class extends B {
|
|
|
2151
2154
|
params: u
|
|
2152
2155
|
}]
|
|
2153
2156
|
};
|
|
2154
|
-
} else if (s.id ===
|
|
2157
|
+
} else if (s.id === Kt.id) {
|
|
2155
2158
|
const e = s.params, { unitId: t, subUnitId: r, targetSubUnitId: i } = e;
|
|
2156
2159
|
if (!t || !r || !i)
|
|
2157
2160
|
return { redos: [], undos: [] };
|
|
2158
2161
|
const o = this._sheetDataValidationModel.getRules(t, r);
|
|
2159
2162
|
if (o.length === 0)
|
|
2160
2163
|
return { redos: [], undos: [] };
|
|
2161
|
-
const n = o.map((l) => ({ ...l, uid:
|
|
2164
|
+
const n = o.map((l) => ({ ...l, uid: Ke(6) }));
|
|
2162
2165
|
return {
|
|
2163
2166
|
redos: [
|
|
2164
2167
|
{
|
|
@@ -2190,12 +2193,12 @@ let we = class extends B {
|
|
|
2190
2193
|
);
|
|
2191
2194
|
}
|
|
2192
2195
|
};
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
],
|
|
2198
|
-
class
|
|
2196
|
+
Ae = Pa([
|
|
2197
|
+
qe(0, v(pt)),
|
|
2198
|
+
qe(1, v(D)),
|
|
2199
|
+
qe(2, v(F))
|
|
2200
|
+
], Ae);
|
|
2201
|
+
class Ha extends Y {
|
|
2199
2202
|
constructor() {
|
|
2200
2203
|
super(...arguments);
|
|
2201
2204
|
m(this, "id", T.ANY);
|
|
@@ -2224,7 +2227,7 @@ class Ba extends Y {
|
|
|
2224
2227
|
return this.localeService.t("dataValidation.any.error");
|
|
2225
2228
|
}
|
|
2226
2229
|
}
|
|
2227
|
-
class
|
|
2230
|
+
class Wa extends Y {
|
|
2228
2231
|
constructor() {
|
|
2229
2232
|
super(...arguments);
|
|
2230
2233
|
m(this, "id", T.CUSTOM);
|
|
@@ -2237,7 +2240,7 @@ class xa extends Y {
|
|
|
2237
2240
|
}
|
|
2238
2241
|
validatorFormula(e, t, r) {
|
|
2239
2242
|
var u;
|
|
2240
|
-
const i = S(e.formula1), o = (u = e.formula1) != null ? u : "", l = this._lexerTreeBuilder.checkIfAddBracket(o) === 0 && o.startsWith(
|
|
2243
|
+
const i = S(e.formula1), o = (u = e.formula1) != null ? u : "", l = this._lexerTreeBuilder.checkIfAddBracket(o) === 0 && o.startsWith(Qt.EQUALS);
|
|
2241
2244
|
return {
|
|
2242
2245
|
success: i && l,
|
|
2243
2246
|
formula1: i && l ? "" : this.localeService.t("dataValidation.validFail.formula")
|
|
@@ -2252,7 +2255,7 @@ class xa extends Y {
|
|
|
2252
2255
|
}
|
|
2253
2256
|
async isValidType(e, t, r) {
|
|
2254
2257
|
const { column: i, row: o, unitId: n, subUnitId: l } = e, u = await this._customFormulaService.getCellFormulaValue(n, l, r.uid, o, i), c = u == null ? void 0 : u.v;
|
|
2255
|
-
return C(String(c)) && M.isDefine(c) && c !== "" ? u.t ===
|
|
2258
|
+
return C(String(c)) && M.isDefine(c) && c !== "" ? u.t === Ot.BOOLEAN ? !!c : typeof c == "boolean" ? c : typeof c == "number" ? !!c : typeof c == "string" ? C(c) : !!c : !1;
|
|
2256
2259
|
}
|
|
2257
2260
|
generateRuleErrorMessage(e) {
|
|
2258
2261
|
return this.localeService.t("dataValidation.custom.error");
|
|
@@ -2262,7 +2265,7 @@ class xa extends Y {
|
|
|
2262
2265
|
return this.localeService.t("dataValidation.custom.ruleName").replace("{FORMULA1}", (t = e.formula1) != null ? t : "");
|
|
2263
2266
|
}
|
|
2264
2267
|
}
|
|
2265
|
-
class
|
|
2268
|
+
class $a extends Rt {
|
|
2266
2269
|
constructor() {
|
|
2267
2270
|
super(...arguments);
|
|
2268
2271
|
m(this, "id", T.LIST_MULTIPLE);
|
|
@@ -2271,7 +2274,7 @@ class Pa extends vt {
|
|
|
2271
2274
|
m(this, "skipDefaultFontRender", () => !0);
|
|
2272
2275
|
}
|
|
2273
2276
|
}
|
|
2274
|
-
class
|
|
2277
|
+
class ka extends Y {
|
|
2275
2278
|
constructor() {
|
|
2276
2279
|
super(...arguments);
|
|
2277
2280
|
m(this, "_customFormulaService", this.injector.get(W));
|
|
@@ -2295,14 +2298,14 @@ class Ha extends Y {
|
|
|
2295
2298
|
return !M.isBlank(e) && (S(e) || !Number.isNaN(+e) && Number.isInteger(+e));
|
|
2296
2299
|
}
|
|
2297
2300
|
async isValidType(e, t, r) {
|
|
2298
|
-
const { value: i } = e, o =
|
|
2301
|
+
const { value: i } = e, o = Fe(i);
|
|
2299
2302
|
return !Number.isNaN(o) && Number.isInteger(o);
|
|
2300
2303
|
}
|
|
2301
2304
|
transform(e, t, r) {
|
|
2302
2305
|
const { value: i } = e;
|
|
2303
2306
|
return {
|
|
2304
2307
|
...e,
|
|
2305
|
-
value:
|
|
2308
|
+
value: Fe(i)
|
|
2306
2309
|
};
|
|
2307
2310
|
}
|
|
2308
2311
|
_parseNumber(e) {
|
|
@@ -2334,17 +2337,17 @@ class Ha extends Y {
|
|
|
2334
2337
|
}
|
|
2335
2338
|
generateRuleErrorMessage(e, t) {
|
|
2336
2339
|
if (!e.operator)
|
|
2337
|
-
return this.localeService.t(
|
|
2340
|
+
return this.localeService.t(Ce.NONE).replace("{TYPE}", this.titleStr);
|
|
2338
2341
|
const { transformedFormula1: r, transformedFormula2: i } = Ue(this._lexerTreeBuilder, e, t);
|
|
2339
|
-
return `${this.localeService.t(
|
|
2342
|
+
return `${this.localeService.t(Ce[e.operator]).replace(ce, r != null ? r : "").replace(de, i != null ? i : "")}`;
|
|
2340
2343
|
}
|
|
2341
2344
|
}
|
|
2342
|
-
var
|
|
2343
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2345
|
+
var ja = Object.getOwnPropertyDescriptor, Qa = (s, a, e, t) => {
|
|
2346
|
+
for (var r = t > 1 ? void 0 : t ? ja(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
2344
2347
|
(o = s[i]) && (r = o(r) || r);
|
|
2345
2348
|
return r;
|
|
2346
2349
|
}, ae = (s, a) => (e, t) => a(e, t, s);
|
|
2347
|
-
let
|
|
2350
|
+
let Ie = class extends wt {
|
|
2348
2351
|
constructor(s, a, e, t, r, i) {
|
|
2349
2352
|
super(), this._univerInstanceService = s, this._dataValidatorRegistryService = a, this._injector = e, this._selectionManagerService = t, this._sheetInterceptorService = r, this._sheetDataValidationModel = i, this._init();
|
|
2350
2353
|
}
|
|
@@ -2353,25 +2356,25 @@ let Ae = class extends Ot {
|
|
|
2353
2356
|
}
|
|
2354
2357
|
_registerValidators() {
|
|
2355
2358
|
[
|
|
2356
|
-
Ba,
|
|
2357
|
-
ma,
|
|
2358
2359
|
Ha,
|
|
2359
|
-
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2360
|
+
ga,
|
|
2361
|
+
ka,
|
|
2362
|
+
Ra,
|
|
2363
|
+
ma,
|
|
2364
|
+
ca,
|
|
2365
|
+
Rt,
|
|
2366
|
+
$a,
|
|
2367
|
+
Wa
|
|
2365
2368
|
].forEach((s) => {
|
|
2366
2369
|
const a = this._injector.createInstance(s);
|
|
2367
|
-
this.disposeWithMe(this._dataValidatorRegistryService.register(a)), this.disposeWithMe(
|
|
2370
|
+
this.disposeWithMe(this._dataValidatorRegistryService.register(a)), this.disposeWithMe(ze(() => this._injector.delete(s)));
|
|
2368
2371
|
});
|
|
2369
2372
|
}
|
|
2370
2373
|
_initCommandInterceptor() {
|
|
2371
2374
|
this._sheetInterceptorService.interceptCommand({
|
|
2372
2375
|
getMutations: (s) => {
|
|
2373
2376
|
var a;
|
|
2374
|
-
if (s.id ===
|
|
2377
|
+
if (s.id === zt.id) {
|
|
2375
2378
|
const e = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET), t = e.getUnitId(), r = e.getActiveSheet();
|
|
2376
2379
|
if (!r)
|
|
2377
2380
|
throw new Error("No active sheet found");
|
|
@@ -2391,20 +2394,20 @@ let Ae = class extends Ot {
|
|
|
2391
2394
|
});
|
|
2392
2395
|
}
|
|
2393
2396
|
};
|
|
2394
|
-
|
|
2397
|
+
Ie = Qa([
|
|
2395
2398
|
ae(0, D),
|
|
2396
2399
|
ae(1, v(q)),
|
|
2397
2400
|
ae(2, v(be)),
|
|
2398
|
-
ae(3, v(
|
|
2399
|
-
ae(4, v(
|
|
2401
|
+
ae(3, v(ft)),
|
|
2402
|
+
ae(4, v(pt)),
|
|
2400
2403
|
ae(5, v(F))
|
|
2401
|
-
],
|
|
2402
|
-
var
|
|
2403
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2404
|
+
], Ie);
|
|
2405
|
+
var Ga = Object.getOwnPropertyDescriptor, qa = (s, a, e, t) => {
|
|
2406
|
+
for (var r = t > 1 ? void 0 : t ? Ga(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
2404
2407
|
(o = s[i]) && (r = o(r) || r);
|
|
2405
2408
|
return r;
|
|
2406
|
-
},
|
|
2407
|
-
let
|
|
2409
|
+
}, Se = (s, a) => (e, t) => a(e, t, s);
|
|
2410
|
+
let De = class extends B {
|
|
2408
2411
|
constructor(s, a, e, t) {
|
|
2409
2412
|
super(), this._univerInstanceService = s, this._sheetDataValidationModel = a, this._dataValidationCacheService = e, this._lifecycleService = t, this._initRecalculate();
|
|
2410
2413
|
}
|
|
@@ -2425,7 +2428,7 @@ let Ie = class extends B {
|
|
|
2425
2428
|
});
|
|
2426
2429
|
});
|
|
2427
2430
|
};
|
|
2428
|
-
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(
|
|
2431
|
+
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(Zt(() => this._lifecycleService.lifecycle$.pipe(at((a) => a === tt.Rendered)))).subscribe(s)), this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(at(() => this._lifecycleService.stage >= tt.Rendered), It(20)).subscribe(s));
|
|
2429
2432
|
}
|
|
2430
2433
|
async _validatorByCell(s, a, e, t) {
|
|
2431
2434
|
const r = s.getUnitId(), i = a.getSheetId();
|
|
@@ -2459,7 +2462,7 @@ let Ie = class extends B {
|
|
|
2459
2462
|
const r = t.getSheetBySheetId(a);
|
|
2460
2463
|
if (!r)
|
|
2461
2464
|
throw new Error(`cannot find current worksheet, sheetId: ${a}`);
|
|
2462
|
-
const o = this._sheetDataValidationModel.getRules(s, a).map((c) => c.ranges).flat(), n = e.map((c) => o.map((d) =>
|
|
2465
|
+
const o = this._sheetDataValidationModel.getRules(s, a).map((c) => c.ranges).flat(), n = e.map((c) => o.map((d) => nt(c, d))).flat().filter(Boolean), l = [], u = await Promise.all(
|
|
2463
2466
|
n.map((c, d) => {
|
|
2464
2467
|
const g = [];
|
|
2465
2468
|
for (let f = c.startRow; f <= c.endRow; f++)
|
|
@@ -2519,117 +2522,119 @@ let Ie = class extends B {
|
|
|
2519
2522
|
return this.getDataValidations(s, a, e)[0];
|
|
2520
2523
|
}
|
|
2521
2524
|
};
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
|
|
2527
|
-
],
|
|
2528
|
-
var
|
|
2529
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2525
|
+
De = qa([
|
|
2526
|
+
Se(0, D),
|
|
2527
|
+
Se(1, v(F)),
|
|
2528
|
+
Se(2, v(Q)),
|
|
2529
|
+
Se(3, v(At))
|
|
2530
|
+
], De);
|
|
2531
|
+
var Ya = Object.defineProperty, Xa = Object.getOwnPropertyDescriptor, Ka = (s, a, e) => a in s ? Ya(s, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[a] = e, za = (s, a, e, t) => {
|
|
2532
|
+
for (var r = t > 1 ? void 0 : t ? Xa(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
2530
2533
|
(o = s[i]) && (r = o(r) || r);
|
|
2531
2534
|
return r;
|
|
2532
|
-
},
|
|
2533
|
-
let
|
|
2534
|
-
constructor(s =
|
|
2535
|
+
}, Ye = (s, a) => (e, t) => a(e, t, s), Pe = (s, a, e) => Ka(s, typeof a != "symbol" ? a + "" : a, e);
|
|
2536
|
+
let ie = class extends Lt {
|
|
2537
|
+
constructor(s = ot, a, e, t) {
|
|
2535
2538
|
super(), this._config = s, this._injector = a, this._commandService = e, this._configService = t;
|
|
2536
|
-
const { ...r } =
|
|
2539
|
+
const { ...r } = Ut(
|
|
2537
2540
|
{},
|
|
2538
|
-
|
|
2541
|
+
ot,
|
|
2539
2542
|
this._config
|
|
2540
2543
|
);
|
|
2541
|
-
this._configService.setConfig(
|
|
2544
|
+
this._configService.setConfig(Da, r);
|
|
2542
2545
|
}
|
|
2543
2546
|
onStarting() {
|
|
2544
2547
|
[
|
|
2545
2548
|
[Q],
|
|
2546
|
-
[
|
|
2549
|
+
[ue],
|
|
2547
2550
|
[G],
|
|
2548
2551
|
[W],
|
|
2549
|
-
[
|
|
2552
|
+
[De],
|
|
2550
2553
|
[F],
|
|
2554
|
+
[Ie],
|
|
2555
|
+
[Ne],
|
|
2551
2556
|
[Ae],
|
|
2552
|
-
[Fe],
|
|
2553
2557
|
[we],
|
|
2554
|
-
[Oe]
|
|
2555
|
-
[Ne]
|
|
2558
|
+
[Oe]
|
|
2556
2559
|
].forEach((s) => {
|
|
2557
2560
|
this._injector.add(s);
|
|
2558
2561
|
}), [
|
|
2559
|
-
Sa,
|
|
2560
|
-
Ra,
|
|
2561
2562
|
Ea,
|
|
2563
|
+
Sa,
|
|
2562
2564
|
Ma,
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2565
|
+
Va,
|
|
2566
|
+
Fa,
|
|
2567
|
+
Ta,
|
|
2568
|
+
ya
|
|
2566
2569
|
].forEach((s) => {
|
|
2567
2570
|
this._commandService.registerCommand(s);
|
|
2568
|
-
}), this._injector.get(Q), this._injector.get(
|
|
2571
|
+
}), this._injector.get(Q), this._injector.get(De), this._injector.get(Ie), this._injector.get(Oe), this._injector.get(we);
|
|
2569
2572
|
}
|
|
2570
2573
|
onReady() {
|
|
2571
|
-
this._injector.get(
|
|
2574
|
+
this._injector.get(Ae);
|
|
2572
2575
|
}
|
|
2573
2576
|
onRendered() {
|
|
2574
|
-
this._injector.get(
|
|
2577
|
+
this._injector.get(Ne);
|
|
2575
2578
|
}
|
|
2576
2579
|
};
|
|
2577
|
-
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
|
|
2583
|
-
|
|
2584
|
-
|
|
2585
|
-
|
|
2586
|
-
|
|
2580
|
+
Pe(ie, "pluginName", Na);
|
|
2581
|
+
Pe(ie, "packageName", Mt.name);
|
|
2582
|
+
Pe(ie, "version", Mt.version);
|
|
2583
|
+
Pe(ie, "type", N.UNIVER_SHEET);
|
|
2584
|
+
ie = za([
|
|
2585
|
+
Dt(Jt, Ht),
|
|
2586
|
+
Ye(1, v(be)),
|
|
2587
|
+
Ye(2, U),
|
|
2588
|
+
Ye(3, bt)
|
|
2589
|
+
], ie);
|
|
2590
|
+
function nr(s) {
|
|
2591
|
+
const e = s.get(ft).getCurrentSelections().map((i) => i.range);
|
|
2587
2592
|
return {
|
|
2588
|
-
uid:
|
|
2593
|
+
uid: Ke(6),
|
|
2589
2594
|
type: T.DECIMAL,
|
|
2590
2595
|
operator: h.EQUAL,
|
|
2591
2596
|
formula1: "100",
|
|
2592
2597
|
ranges: e != null ? e : [{ startColumn: 0, endColumn: 0, startRow: 0, endRow: 0 }]
|
|
2593
2598
|
};
|
|
2594
2599
|
}
|
|
2595
|
-
const
|
|
2600
|
+
const lr = "data-validation.custom-formula-input", ur = "data-validation.formula-input", cr = "data-validation.list-formula-input", dr = "data-validation.checkbox-formula-input";
|
|
2596
2601
|
export {
|
|
2597
|
-
|
|
2598
|
-
|
|
2599
|
-
|
|
2600
|
-
|
|
2601
|
-
|
|
2602
|
-
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2602
|
+
Ea as AddSheetDataValidationCommand,
|
|
2603
|
+
ur as BASE_FORMULA_INPUT_NAME,
|
|
2604
|
+
ye as CHECKBOX_FORMULA_1,
|
|
2605
|
+
Te as CHECKBOX_FORMULA_2,
|
|
2606
|
+
dr as CHECKBOX_FORMULA_INPUT_NAME,
|
|
2607
|
+
lr as CUSTOM_FORMULA_INPUT_NAME,
|
|
2608
|
+
ca as CheckboxValidator,
|
|
2609
|
+
ya as ClearRangeDataValidationCommand,
|
|
2610
|
+
Na as DATA_VALIDATION_PLUGIN_NAME,
|
|
2606
2611
|
Q as DataValidationCacheService,
|
|
2607
2612
|
W as DataValidationCustomFormulaService,
|
|
2608
|
-
|
|
2613
|
+
Ne as DataValidationFormulaController,
|
|
2609
2614
|
G as DataValidationFormulaService,
|
|
2610
|
-
|
|
2611
|
-
|
|
2612
|
-
|
|
2613
|
-
|
|
2614
|
-
|
|
2615
|
-
|
|
2616
|
-
|
|
2615
|
+
ue as DataValidationListCacheService,
|
|
2616
|
+
ma as DateValidator,
|
|
2617
|
+
cr as LIST_FORMULA_INPUT_NAME,
|
|
2618
|
+
$a as ListMultipleValidator,
|
|
2619
|
+
Rt as ListValidator,
|
|
2620
|
+
Ta as RemoveSheetAllDataValidationCommand,
|
|
2621
|
+
Fa as RemoveSheetDataValidationCommand,
|
|
2617
2622
|
F as SheetDataValidationModel,
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2623
|
+
De as SheetsDataValidationValidatorService,
|
|
2624
|
+
ie as UniverSheetsDataValidationPlugin,
|
|
2625
|
+
Va as UpdateSheetDataValidationOptionsCommand,
|
|
2626
|
+
Sa as UpdateSheetDataValidationRangeCommand,
|
|
2627
|
+
Ma as UpdateSheetDataValidationSettingCommand,
|
|
2628
|
+
nr as createDefaultNewRule,
|
|
2629
|
+
Me as deserializeListOptions,
|
|
2630
|
+
Fe as getCellValueNumber,
|
|
2626
2631
|
re as getCellValueOrigin,
|
|
2627
|
-
|
|
2632
|
+
or as getDataValidationCellValue,
|
|
2628
2633
|
xe as getDataValidationDiffMutations,
|
|
2629
|
-
|
|
2630
|
-
|
|
2634
|
+
ve as getFormulaCellData,
|
|
2635
|
+
ne as getFormulaResult,
|
|
2631
2636
|
Ue as getTransformedFormula,
|
|
2632
2637
|
C as isLegalFormulaResult,
|
|
2633
|
-
|
|
2634
|
-
|
|
2638
|
+
sr as serializeListOptions,
|
|
2639
|
+
Re as transformCheckboxValue
|
|
2635
2640
|
};
|