@univerjs/sheets-data-validation 0.12.4 → 0.13.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 +433 -416
- package/lib/index.js +433 -416
- package/lib/umd/index.js +1 -1
- package/package.json +8 -8
package/lib/es/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
var Et = Object.defineProperty;
|
|
2
2
|
var Mt = (s, a, e) => a in s ? Et(s, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[a] = e;
|
|
3
3
|
var m = (s, a, e) => Mt(s, typeof a != "symbol" ? a + "" : a, e);
|
|
4
|
-
import { Inject as v, ICommandService as
|
|
5
|
-
import { DataValidationModel as
|
|
4
|
+
import { Inject as v, ICommandService as U, IUniverInstanceService as D, Disposable as B, ObjectMatrix as Me, getIntersectRange as ot, UniverInstanceType as N, Range as H, Rectangle as O, isFormulaString as S, getOriginCellValue as Vt, Injector as be, numfmt as L, DataValidationType as C, RBush as yt, debounce as Ct, Tools as M, DataValidationStatus as A, WrapStrategy as Se, DataValidationOperator as h, dayjs as nt, DataValidationRenderMode as We, CommandType as z, IUndoRedoService as Z, sequenceExecute as Le, isRangesEqual as lt, IPermissionService as Tt, generateRandomId as Xe, toDisposable as Ke, CellValueType as Ft, RxDisposable as Nt, LifecycleService as wt, LifecycleStages as et, bufferDebounceTime as Ot, DependentOn as At, IConfigService as It, Plugin as Dt, merge as bt } from "@univerjs/core";
|
|
5
|
+
import { DataValidationModel as de, DataValidatorRegistryService as q, UpdateRuleType as V, BaseDataValidator as Y, TextLengthErrorTitleMap as Lt, AddDataValidationMutation as b, RemoveDataValidationMutation as I, UpdateDataValidationMutation as y, getRuleSetting as Ut, getRuleOptions as Bt, UniverDataValidationPlugin as xt } from "@univerjs/data-validation";
|
|
6
6
|
import { ERROR_TYPE_SET as Pt, LexerTreeBuilder as X, isReferenceString as ut, sequenceNodeType as Ht, deserializeRangeWithSheet as Wt, deserializeRangeWithSheetWithCache as $t, operatorToken as kt } from "@univerjs/engine-formula";
|
|
7
|
-
import { SetRangeValuesMutation as ne, RemoveSheetMutation as
|
|
7
|
+
import { SetRangeValuesMutation as ne, RemoveSheetMutation as ct, getSheetCommandTarget as ze, SetRangeValuesUndoMutationFactory as dt, WorksheetViewPermission as jt, RefRangeService as Qt, handleCommonDefaultRangeChangeWithEffectRefCommands as Gt, SheetInterceptorService as ht, RemoveSheetCommand as qt, CopySheetCommand as Yt, SheetsSelectionsService as mt, ClearSelectionAllCommand as Xt } from "@univerjs/sheets";
|
|
8
8
|
import { Subject as Ye, bufferWhen as Kt, filter as tt } from "rxjs";
|
|
9
9
|
import { RegisterOtherFormulaService as gt, FormulaRefRangeService as pt } from "@univerjs/sheets-formula";
|
|
10
10
|
var zt = Object.getOwnPropertyDescriptor, Zt = (s, a, e, t) => {
|
|
@@ -12,7 +12,7 @@ var zt = Object.getOwnPropertyDescriptor, Zt = (s, a, e, t) => {
|
|
|
12
12
|
(o = s[i]) && (r = o(r) || r);
|
|
13
13
|
return r;
|
|
14
14
|
}, $e = (s, a) => (e, t) => a(e, t, s);
|
|
15
|
-
let Q = class extends
|
|
15
|
+
let Q = class extends B {
|
|
16
16
|
constructor(a, e, t) {
|
|
17
17
|
super();
|
|
18
18
|
m(this, "_cacheMatrix", /* @__PURE__ */ new Map());
|
|
@@ -27,7 +27,7 @@ let Q = class extends x {
|
|
|
27
27
|
if (t) {
|
|
28
28
|
const o = new Me(t).getDataRange();
|
|
29
29
|
if (o.endRow === -1) return;
|
|
30
|
-
const u = this._sheetDataValidationModel.getRules(r, i).map((
|
|
30
|
+
const u = this._sheetDataValidationModel.getRules(r, i).map((c) => c.ranges).flat().map((c) => ot(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 x {
|
|
|
36
36
|
_initSheetRemove() {
|
|
37
37
|
this.disposeWithMe(this._commandService.onCommandExecuted((a) => {
|
|
38
38
|
var e;
|
|
39
|
-
if (a.id ===
|
|
39
|
+
if (a.id === ct.id) {
|
|
40
40
|
const { unitId: t, subUnitId: r } = a.params;
|
|
41
41
|
(e = this._cacheMatrix.get(t)) == null || e.delete(r);
|
|
42
42
|
}
|
|
@@ -62,7 +62,7 @@ let Q = class extends x {
|
|
|
62
62
|
markRangeDirty(a, e, t, r) {
|
|
63
63
|
const i = this._ensureCache(a, e);
|
|
64
64
|
t.forEach((o) => {
|
|
65
|
-
|
|
65
|
+
H.foreach(o, (n, l) => {
|
|
66
66
|
i.getValue(n, l) !== void 0 && i.setValue(n, l, void 0);
|
|
67
67
|
});
|
|
68
68
|
}), this._dirtyRanges$.next({ unitId: a, subUnitId: e, ranges: t, isSetRange: r });
|
|
@@ -70,7 +70,7 @@ let Q = class extends x {
|
|
|
70
70
|
_deleteRange(a, e, t) {
|
|
71
71
|
const r = this._ensureCache(a, e);
|
|
72
72
|
t.forEach((i) => {
|
|
73
|
-
|
|
73
|
+
H.foreach(i, (o, n) => {
|
|
74
74
|
r.realDeleteValue(o, n);
|
|
75
75
|
});
|
|
76
76
|
}), this._dirtyRanges$.next({ unitId: a, subUnitId: e, ranges: t });
|
|
@@ -80,9 +80,9 @@ let Q = class extends x {
|
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
82
|
Q = Zt([
|
|
83
|
-
$e(0, v(
|
|
84
|
-
$e(1, v(
|
|
85
|
-
$e(2, v(
|
|
83
|
+
$e(0, v(U)),
|
|
84
|
+
$e(1, v(D)),
|
|
85
|
+
$e(2, v(de))
|
|
86
86
|
], Q);
|
|
87
87
|
function oe(s) {
|
|
88
88
|
var a, e;
|
|
@@ -92,7 +92,7 @@ function _e(s) {
|
|
|
92
92
|
var a;
|
|
93
93
|
return (a = s == null ? void 0 : s[0]) == null ? void 0 : a[0];
|
|
94
94
|
}
|
|
95
|
-
function
|
|
95
|
+
function T(s) {
|
|
96
96
|
return !Pt.has(s);
|
|
97
97
|
}
|
|
98
98
|
function he(s, a) {
|
|
@@ -105,7 +105,7 @@ var Jt = Object.getOwnPropertyDescriptor, ea = (s, a, e, t) => {
|
|
|
105
105
|
(o = s[i]) && (r = o(r) || r);
|
|
106
106
|
return r;
|
|
107
107
|
}, se = (s, a) => (e, t) => a(e, t, s);
|
|
108
|
-
let W = class extends
|
|
108
|
+
let W = class extends B {
|
|
109
109
|
constructor(a, e, t, r, i) {
|
|
110
110
|
super();
|
|
111
111
|
/**
|
|
@@ -126,9 +126,9 @@ let W = class extends x {
|
|
|
126
126
|
for (const i in t) {
|
|
127
127
|
const o = t[i], { ruleFormulaMap: n } = this._ensureMaps(e, i);
|
|
128
128
|
o.forEach((l) => {
|
|
129
|
-
var
|
|
130
|
-
const u = n.get((
|
|
131
|
-
|
|
129
|
+
var d, g;
|
|
130
|
+
const u = n.get((d = l.extra) == null ? void 0 : d.ruleId), c = this._dataValidationModel.getRuleById(e, i, (g = l.extra) == null ? void 0 : g.ruleId);
|
|
131
|
+
c && u && this._dataValidationCacheService.markRangeDirty(e, i, c.ranges);
|
|
132
132
|
});
|
|
133
133
|
}
|
|
134
134
|
}
|
|
@@ -148,7 +148,7 @@ let W = class extends x {
|
|
|
148
148
|
_handleDirtyRanges(a, e, t) {
|
|
149
149
|
this._dataValidationModel.getRules(a, e).forEach((i) => {
|
|
150
150
|
const o = i.ranges;
|
|
151
|
-
|
|
151
|
+
O.doAnyRangesIntersect(o, t) && this.makeRuleDirty(a, e, i.uid);
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
_initDirtyRanges() {
|
|
@@ -166,23 +166,23 @@ let W = class extends x {
|
|
|
166
166
|
u && (i.delete(t), this._registerOtherFormulaService.deleteFormula(a, e, [u.formulaId]));
|
|
167
167
|
}
|
|
168
168
|
_addFormulaByRange(a, e, t, r, i, o) {
|
|
169
|
-
const { ruleFormulaMap: n, ruleFormulaMap2: l } = this._ensureMaps(a, e), u = o[0].startRow,
|
|
169
|
+
const { ruleFormulaMap: n, ruleFormulaMap2: l } = this._ensureMaps(a, e), u = o[0].startRow, c = o[0].startColumn;
|
|
170
170
|
if (r && S(r)) {
|
|
171
|
-
const
|
|
171
|
+
const d = this._registerFormula(a, e, t, r, o);
|
|
172
172
|
n.set(t, {
|
|
173
173
|
formula: r,
|
|
174
|
-
originCol:
|
|
174
|
+
originCol: c,
|
|
175
175
|
originRow: u,
|
|
176
|
-
formulaId:
|
|
176
|
+
formulaId: d
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
179
|
if (i && S(i)) {
|
|
180
|
-
const
|
|
180
|
+
const d = this._registerFormula(a, e, t, i, o);
|
|
181
181
|
l.set(t, {
|
|
182
182
|
formula: i,
|
|
183
|
-
originCol:
|
|
183
|
+
originCol: c,
|
|
184
184
|
originRow: u,
|
|
185
|
-
formulaId:
|
|
185
|
+
formulaId: d
|
|
186
186
|
});
|
|
187
187
|
}
|
|
188
188
|
}
|
|
@@ -193,36 +193,36 @@ let W = class extends x {
|
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
async getCellFormulaValue(a, e, t, r, i) {
|
|
196
|
-
var
|
|
196
|
+
var f, p;
|
|
197
197
|
const { ruleFormulaMap: o } = this._ensureMaps(a, e), n = o.get(t);
|
|
198
198
|
if (!n)
|
|
199
199
|
return Promise.resolve(void 0);
|
|
200
|
-
const l = await this._registerOtherFormulaService.getFormulaValue(a, e, n.formulaId), { originRow: u, originCol:
|
|
201
|
-
return _e((
|
|
200
|
+
const l = await this._registerOtherFormulaService.getFormulaValue(a, e, n.formulaId), { originRow: u, originCol: c } = n, d = r - u, g = i - c;
|
|
201
|
+
return _e((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
|
-
var
|
|
204
|
+
var f, p;
|
|
205
205
|
const { ruleFormulaMap2: o } = this._ensureMaps(a, e), n = o.get(t);
|
|
206
206
|
if (!n)
|
|
207
207
|
return Promise.resolve(void 0);
|
|
208
|
-
const l = await this._registerOtherFormulaService.getFormulaValue(a, e, n.formulaId), { originRow: u, originCol:
|
|
209
|
-
return _e((
|
|
208
|
+
const l = await this._registerOtherFormulaService.getFormulaValue(a, e, n.formulaId), { originRow: u, originCol: c } = n, d = r - u, g = i - c;
|
|
209
|
+
return _e((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
|
-
var
|
|
212
|
+
var f, p;
|
|
213
213
|
const { ruleFormulaMap: o } = this._ensureMaps(a, e), n = o.get(t);
|
|
214
214
|
if (!n)
|
|
215
215
|
return;
|
|
216
|
-
const l = this._registerOtherFormulaService.getFormulaValueSync(a, e, n.formulaId), { originRow: u, originCol:
|
|
217
|
-
return _e((
|
|
216
|
+
const l = this._registerOtherFormulaService.getFormulaValueSync(a, e, n.formulaId), { originRow: u, originCol: c } = n, d = r - u, g = i - c;
|
|
217
|
+
return _e((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
|
-
var
|
|
220
|
+
var f, p;
|
|
221
221
|
const { ruleFormulaMap2: o } = this._ensureMaps(a, e), n = o.get(t);
|
|
222
222
|
if (!n)
|
|
223
223
|
return;
|
|
224
|
-
const l = this._registerOtherFormulaService.getFormulaValueSync(a, e, n.formulaId), { originRow: u, originCol:
|
|
225
|
-
return _e((
|
|
224
|
+
const l = this._registerOtherFormulaService.getFormulaValueSync(a, e, n.formulaId), { originRow: u, originCol: c } = n, d = r - u, g = i - c;
|
|
225
|
+
return _e((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);
|
|
@@ -235,11 +235,11 @@ let W = class extends x {
|
|
|
235
235
|
}
|
|
236
236
|
};
|
|
237
237
|
W = ea([
|
|
238
|
-
se(0,
|
|
238
|
+
se(0, D),
|
|
239
239
|
se(1, v(gt)),
|
|
240
|
-
se(2, v(
|
|
240
|
+
se(2, v(de)),
|
|
241
241
|
se(3, v(Q)),
|
|
242
|
-
se(4, v(
|
|
242
|
+
se(4, v(q))
|
|
243
243
|
], W);
|
|
244
244
|
function re(s) {
|
|
245
245
|
return Vt(s);
|
|
@@ -259,10 +259,10 @@ function tr(s) {
|
|
|
259
259
|
return a == null ? "" : a.toString();
|
|
260
260
|
}
|
|
261
261
|
function Ue(s, a, e) {
|
|
262
|
-
const { formula1: t, formula2: r } = a, i = a.ranges[0].startRow, o = a.ranges[0].startColumn, n = e.row - i, l = e.col - o, u = S(t) ? s.moveFormulaRefOffset(t, l, n, !0) : t,
|
|
262
|
+
const { formula1: t, formula2: r } = a, i = a.ranges[0].startRow, o = a.ranges[0].startColumn, n = e.row - i, l = e.col - o, u = S(t) ? s.moveFormulaRefOffset(t, l, n, !0) : t, c = S(r) ? s.moveFormulaRefOffset(r, l, n, !0) : r;
|
|
263
263
|
return {
|
|
264
264
|
transformedFormula1: u,
|
|
265
|
-
transformedFormula2:
|
|
265
|
+
transformedFormula2: c
|
|
266
266
|
};
|
|
267
267
|
}
|
|
268
268
|
var ta = Object.getOwnPropertyDescriptor, aa = (s, a, e, t) => {
|
|
@@ -270,7 +270,7 @@ var ta = Object.getOwnPropertyDescriptor, aa = (s, a, e, t) => {
|
|
|
270
270
|
(o = s[i]) && (r = o(r) || r);
|
|
271
271
|
return r;
|
|
272
272
|
}, at = (s, a) => (e, t) => a(e, t, s);
|
|
273
|
-
let le = class extends
|
|
273
|
+
let le = class extends B {
|
|
274
274
|
constructor(a, e) {
|
|
275
275
|
super();
|
|
276
276
|
// Cache structure: unitId -> subUnitId -> ruleId -> cache item
|
|
@@ -291,7 +291,7 @@ let le = class extends x {
|
|
|
291
291
|
const r = this.getCache(a, e, t.uid);
|
|
292
292
|
if (r)
|
|
293
293
|
return r;
|
|
294
|
-
const o = this._injector.get(
|
|
294
|
+
const o = this._injector.get(G).getRuleFormulaResultSync(a, e, t.uid);
|
|
295
295
|
return this.computeAndCache(a, e, t, o);
|
|
296
296
|
}
|
|
297
297
|
_ensureCache(a, e) {
|
|
@@ -331,11 +331,11 @@ let le = class extends x {
|
|
|
331
331
|
* Compute list data from formula result and cache it.
|
|
332
332
|
*/
|
|
333
333
|
computeAndCache(a, e, t, r) {
|
|
334
|
-
var
|
|
335
|
-
const { formula1: i = "", formula2: o = "" } = t, n = S(i) ? this._getRuleFormulaResultSet((R = (
|
|
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]) : Ee(i), l = o.split(","), u = n.map((E, _) => ({ label: E, color: l[_] || "" })), c = {};
|
|
336
336
|
for (const E of u)
|
|
337
|
-
E.color && (
|
|
338
|
-
const
|
|
337
|
+
E.color && (c[E.label] = E.color);
|
|
338
|
+
const d = new Set(n), g = { list: n, listWithColor: u, colorMap: c, set: d };
|
|
339
339
|
return this.setCache(a, e, t.uid, g), g;
|
|
340
340
|
}
|
|
341
341
|
/**
|
|
@@ -350,14 +350,14 @@ let le = class extends x {
|
|
|
350
350
|
const n = a[i];
|
|
351
351
|
if (n)
|
|
352
352
|
for (let l = 0, u = n.length; l < u; l++) {
|
|
353
|
-
const
|
|
354
|
-
if (
|
|
355
|
-
if (typeof
|
|
356
|
-
e.add(L.format(
|
|
353
|
+
const c = n[l], d = re(c);
|
|
354
|
+
if (d != null) {
|
|
355
|
+
if (typeof d != "string" && typeof (c == null ? void 0 : c.s) == "object" && ((r = (t = c.s) == null ? void 0 : t.n) != null && r.pattern)) {
|
|
356
|
+
e.add(L.format(c.s.n.pattern, d, { throws: !1 }));
|
|
357
357
|
continue;
|
|
358
358
|
}
|
|
359
|
-
const g = typeof
|
|
360
|
-
|
|
359
|
+
const g = typeof d == "string" ? d : String(d);
|
|
360
|
+
T(g) && e.add(g);
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
363
|
}
|
|
@@ -366,14 +366,14 @@ let le = class extends x {
|
|
|
366
366
|
};
|
|
367
367
|
le = aa([
|
|
368
368
|
at(0, v(be)),
|
|
369
|
-
at(1, v(
|
|
369
|
+
at(1, v(de))
|
|
370
370
|
], le);
|
|
371
371
|
var ra = Object.getOwnPropertyDescriptor, ia = (s, a, e, t) => {
|
|
372
372
|
for (var r = t > 1 ? void 0 : t ? ra(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);
|
|
376
|
-
let
|
|
376
|
+
let G = class extends B {
|
|
377
377
|
constructor(a, e, t, r, i, o) {
|
|
378
378
|
super();
|
|
379
379
|
m(this, "_formulaRuleMap", /* @__PURE__ */ new Map());
|
|
@@ -387,11 +387,11 @@ let q = class extends x {
|
|
|
387
387
|
for (const i in t) {
|
|
388
388
|
const o = t[i], n = this._ensureRuleFormulaMap(e, i);
|
|
389
389
|
o.forEach((l) => {
|
|
390
|
-
var
|
|
391
|
-
const u = (
|
|
390
|
+
var c;
|
|
391
|
+
const u = (c = l.extra) == null ? void 0 : c.ruleId;
|
|
392
392
|
if (u && n.get(u)) {
|
|
393
|
-
const
|
|
394
|
-
|
|
393
|
+
const d = this._dataValidationModel.getRuleById(e, i, u);
|
|
394
|
+
d && (this._listCacheService.markRuleDirty(e, i, u), this._dataValidationCacheService.markRangeDirty(e, i, d.ranges));
|
|
395
395
|
}
|
|
396
396
|
});
|
|
397
397
|
}
|
|
@@ -409,20 +409,20 @@ let q = class extends x {
|
|
|
409
409
|
return this._registerOtherFormulaService.registerFormulaWithRange(a, e, t, i, { ruleId: r });
|
|
410
410
|
}
|
|
411
411
|
addRule(a, e, t) {
|
|
412
|
-
if (!he(t.type, this._validatorRegistryService) && t.type !==
|
|
412
|
+
if (!he(t.type, this._validatorRegistryService) && t.type !== C.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;
|
|
416
|
-
const u = this._ensureRuleFormulaMap(a, e),
|
|
416
|
+
const u = this._ensureRuleFormulaMap(a, e), c = [void 0, void 0];
|
|
417
417
|
if (n) {
|
|
418
|
-
const
|
|
419
|
-
|
|
418
|
+
const d = this._registerSingleFormula(a, e, r, o);
|
|
419
|
+
c[0] = { id: d, text: r };
|
|
420
420
|
}
|
|
421
421
|
if (l) {
|
|
422
|
-
const
|
|
423
|
-
|
|
422
|
+
const d = this._registerSingleFormula(a, e, i, o);
|
|
423
|
+
c[1] = { id: d, text: i };
|
|
424
424
|
}
|
|
425
|
-
u.set(o,
|
|
425
|
+
u.set(o, c);
|
|
426
426
|
}
|
|
427
427
|
}
|
|
428
428
|
removeRule(a, e, t) {
|
|
@@ -454,14 +454,14 @@ let q = class extends x {
|
|
|
454
454
|
return this._ensureRuleFormulaMap(a, e).get(t);
|
|
455
455
|
}
|
|
456
456
|
};
|
|
457
|
-
|
|
458
|
-
ee(0,
|
|
457
|
+
G = ia([
|
|
458
|
+
ee(0, D),
|
|
459
459
|
ee(1, v(gt)),
|
|
460
460
|
ee(2, v(Q)),
|
|
461
|
-
ee(3, v(
|
|
462
|
-
ee(4, v(
|
|
461
|
+
ee(3, v(de)),
|
|
462
|
+
ee(4, v(q)),
|
|
463
463
|
ee(5, v(le))
|
|
464
|
-
],
|
|
464
|
+
], G);
|
|
465
465
|
class Ze {
|
|
466
466
|
constructor(a, e, t, r, i = !1) {
|
|
467
467
|
m(this, "_map");
|
|
@@ -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", Ct(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() {
|
|
@@ -494,9 +494,9 @@ class Ze {
|
|
|
494
494
|
_addRule(a, e) {
|
|
495
495
|
if (!this._worksheet)
|
|
496
496
|
return;
|
|
497
|
-
const t =
|
|
497
|
+
const t = O.mergeRanges(e.map((r) => H.transformRange(r, this._worksheet)));
|
|
498
498
|
this._map.forEach((r, i) => {
|
|
499
|
-
const o =
|
|
499
|
+
const o = O.subtractMulti(r, t);
|
|
500
500
|
o.length === 0 ? this._map.delete(i) : this._map.set(i, o);
|
|
501
501
|
}), this._dirty = !0, this._map.set(a, t), this._debonceBuildTree();
|
|
502
502
|
}
|
|
@@ -506,9 +506,9 @@ class Ze {
|
|
|
506
506
|
removeRange(a) {
|
|
507
507
|
if (!this._worksheet)
|
|
508
508
|
return;
|
|
509
|
-
const e = a.map((t) =>
|
|
509
|
+
const e = a.map((t) => H.transformRange(t, this._worksheet));
|
|
510
510
|
this._map.forEach((t, r) => {
|
|
511
|
-
const i =
|
|
511
|
+
const i = O.subtractMulti(t, e);
|
|
512
512
|
i.length === 0 ? this._map.delete(r) : this._map.set(r, i);
|
|
513
513
|
}), this._dirty = !0, this._debonceBuildTree();
|
|
514
514
|
}
|
|
@@ -526,10 +526,10 @@ class Ze {
|
|
|
526
526
|
if (!t.length)
|
|
527
527
|
return;
|
|
528
528
|
let r = this._map.get(e);
|
|
529
|
-
r ? (this._map.set(e,
|
|
529
|
+
r ? (this._map.set(e, O.mergeRanges([...r, ...t])), r = this._map.get(e)) : (r = t, this._map.set(e, r)), this._map.forEach((i, o) => {
|
|
530
530
|
if (o === e)
|
|
531
531
|
return;
|
|
532
|
-
const n =
|
|
532
|
+
const n = O.subtractMulti(i, t);
|
|
533
533
|
n.length === 0 ? this._map.delete(o) : this._map.set(o, n);
|
|
534
534
|
});
|
|
535
535
|
}), this._dirty = !0, this._debonceBuildTree();
|
|
@@ -540,11 +540,11 @@ class Ze {
|
|
|
540
540
|
return a.forEach((r, i) => {
|
|
541
541
|
var l;
|
|
542
542
|
const o = (l = this._map.get(r.uid)) != null ? l : [], n = r.ranges;
|
|
543
|
-
o.length !== 0 && (o.length !== n.length || o.some((u,
|
|
543
|
+
o.length !== 0 && (o.length !== n.length || o.some((u, c) => !O.equals(u, n[c]))) && e.push({
|
|
544
544
|
type: "update",
|
|
545
545
|
ruleId: r.uid,
|
|
546
546
|
oldRanges: n,
|
|
547
|
-
newRanges:
|
|
547
|
+
newRanges: O.sort(o),
|
|
548
548
|
rule: r
|
|
549
549
|
}), o.length === 0 && (e.push({
|
|
550
550
|
type: "delete",
|
|
@@ -559,11 +559,11 @@ class Ze {
|
|
|
559
559
|
return a.forEach((i, o) => {
|
|
560
560
|
var u;
|
|
561
561
|
const n = (u = this._map.get(i.uid)) != null ? u : [], l = i.ranges;
|
|
562
|
-
n.length !== 0 && (n.length !== l.length || n.some((
|
|
562
|
+
n.length !== 0 && (n.length !== l.length || n.some((c, d) => !O.equals(c, l[d]))) && t.push({
|
|
563
563
|
type: "update",
|
|
564
564
|
ruleId: i.uid,
|
|
565
565
|
oldRanges: l,
|
|
566
|
-
newRanges:
|
|
566
|
+
newRanges: O.sort(n),
|
|
567
567
|
rule: i
|
|
568
568
|
}), n.length === 0 && (t.push({
|
|
569
569
|
type: "delete",
|
|
@@ -577,7 +577,7 @@ class Ze {
|
|
|
577
577
|
type: "add",
|
|
578
578
|
rule: {
|
|
579
579
|
...i,
|
|
580
|
-
ranges:
|
|
580
|
+
ranges: O.sort(o)
|
|
581
581
|
}
|
|
582
582
|
});
|
|
583
583
|
}), t;
|
|
@@ -608,7 +608,7 @@ var sa = Object.getOwnPropertyDescriptor, oa = (s, a, e, t) => {
|
|
|
608
608
|
(o = s[i]) && (r = o(r) || r);
|
|
609
609
|
return r;
|
|
610
610
|
}, K = (s, a) => (e, t) => a(e, t, s);
|
|
611
|
-
let
|
|
611
|
+
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());
|
|
@@ -627,7 +627,7 @@ let C = class extends x {
|
|
|
627
627
|
})
|
|
628
628
|
), this.disposeWithMe(
|
|
629
629
|
this._commandService.onCommandExecuted((a) => {
|
|
630
|
-
if (a.id ===
|
|
630
|
+
if (a.id === ct.id) {
|
|
631
631
|
const { unitId: e, subUnitId: t } = a.params, r = this._ruleMatrixMap.get(e);
|
|
632
632
|
r && r.delete(t);
|
|
633
633
|
}
|
|
@@ -699,37 +699,37 @@ let C = class extends x {
|
|
|
699
699
|
return this._dataValidationModel.getRuleById(a, e, i);
|
|
700
700
|
}
|
|
701
701
|
validator(a, e, t) {
|
|
702
|
-
const { col: r, row: i, unitId: o, subUnitId: n, worksheet: l } = e, u = (
|
|
703
|
-
t && t(
|
|
702
|
+
const { col: r, row: i, unitId: o, subUnitId: n, worksheet: l } = e, u = (p, R) => {
|
|
703
|
+
t && t(p, R), R && this._validStatusChange$.next({
|
|
704
704
|
unitId: o,
|
|
705
705
|
subUnitId: n,
|
|
706
706
|
ruleId: a.uid,
|
|
707
|
-
status:
|
|
707
|
+
status: p,
|
|
708
708
|
row: i,
|
|
709
709
|
col: r
|
|
710
710
|
});
|
|
711
|
-
},
|
|
712
|
-
if (
|
|
713
|
-
const
|
|
714
|
-
return R == null ? (
|
|
711
|
+
}, c = l.getCellValueOnly(i, r), d = this.getValidator(a.type), g = l.getCellRaw(i, r), f = re(g);
|
|
712
|
+
if (d) {
|
|
713
|
+
const p = this._dataValidationCacheService.ensureCache(o, n), R = p.getValue(i, r);
|
|
714
|
+
return R == null ? (p.setValue(i, r, A.VALIDATING), d.validator(
|
|
715
715
|
{
|
|
716
|
-
value:
|
|
716
|
+
value: f,
|
|
717
717
|
unitId: o,
|
|
718
718
|
subUnitId: n,
|
|
719
719
|
row: i,
|
|
720
720
|
column: r,
|
|
721
721
|
worksheet: e.worksheet,
|
|
722
722
|
workbook: e.workbook,
|
|
723
|
-
interceptValue: re(
|
|
723
|
+
interceptValue: re(c),
|
|
724
724
|
t: g == null ? void 0 : g.t
|
|
725
725
|
},
|
|
726
726
|
a
|
|
727
727
|
).then((E) => {
|
|
728
|
-
const
|
|
729
|
-
|
|
730
|
-
}),
|
|
728
|
+
const _ = E ? A.VALID : A.INVALID, w = p.getValue(i, r);
|
|
729
|
+
_ === A.VALID ? p.realDeleteValue(i, r) : p.setValue(i, r, _), u(_, R !== w);
|
|
730
|
+
}), A.VALIDATING) : (u(R != null ? R : A.VALID, !1), R != null ? R : A.VALID);
|
|
731
731
|
} else
|
|
732
|
-
return u(
|
|
732
|
+
return u(A.VALID, !1), A.VALID;
|
|
733
733
|
}
|
|
734
734
|
getRuleObjectMatrix(a, e) {
|
|
735
735
|
return this._ensureRuleMatrix(a, e);
|
|
@@ -756,15 +756,15 @@ let C = class extends x {
|
|
|
756
756
|
return this._dataValidationModel.getAll();
|
|
757
757
|
}
|
|
758
758
|
};
|
|
759
|
-
|
|
760
|
-
K(0, v(
|
|
761
|
-
K(1,
|
|
762
|
-
K(2, v(
|
|
759
|
+
F = oa([
|
|
760
|
+
K(0, v(de)),
|
|
761
|
+
K(1, D),
|
|
762
|
+
K(2, v(q)),
|
|
763
763
|
K(3, v(Q)),
|
|
764
|
-
K(4, v(
|
|
764
|
+
K(4, v(G)),
|
|
765
765
|
K(5, v(W)),
|
|
766
|
-
K(6,
|
|
767
|
-
],
|
|
766
|
+
K(6, U)
|
|
767
|
+
], F);
|
|
768
768
|
const Ve = 1, ye = 0;
|
|
769
769
|
function rt(s, a) {
|
|
770
770
|
return M.isBlank(s) ? a.t("dataValidation.validFail.value") : S(s) ? a.t("dataValidation.validFail.primitive") : "";
|
|
@@ -773,13 +773,13 @@ const ve = (s) => M.isDefine(s) && String(s).toLowerCase() === "true" ? "1" : St
|
|
|
773
773
|
class na extends Y {
|
|
774
774
|
constructor() {
|
|
775
775
|
super(...arguments);
|
|
776
|
-
m(this, "id",
|
|
776
|
+
m(this, "id", C.CHECKBOX);
|
|
777
777
|
m(this, "title", "dataValidation.checkbox.title");
|
|
778
778
|
m(this, "operators", []);
|
|
779
779
|
m(this, "scopes", ["sheet"]);
|
|
780
780
|
m(this, "order", 41);
|
|
781
781
|
m(this, "offsetFormulaByRange", !1);
|
|
782
|
-
m(this, "_formulaService", this.injector.get(
|
|
782
|
+
m(this, "_formulaService", this.injector.get(G));
|
|
783
783
|
m(this, "skipDefaultFontRender", (e, t, r) => {
|
|
784
784
|
const { unitId: i, subUnitId: o } = r, { formula1: n, formula2: l } = this.parseFormulaSync(e, i, o), u = `${t != null ? t : ""}`;
|
|
785
785
|
return !u || u === `${n}` || u === `${l}`;
|
|
@@ -805,14 +805,14 @@ class na extends Y {
|
|
|
805
805
|
};
|
|
806
806
|
}
|
|
807
807
|
async parseFormula(e, t, r) {
|
|
808
|
-
var
|
|
809
|
-
const { formula1: i = Ve, formula2: o = ye } = e, n = await this._formulaService.getRuleFormulaResult(t, r, e.uid), l = S(i) ? oe((g = (
|
|
808
|
+
var d, g, f, p;
|
|
809
|
+
const { formula1: i = Ve, formula2: o = ye } = e, n = await this._formulaService.getRuleFormulaResult(t, r, e.uid), l = S(i) ? oe((g = (d = n == null ? void 0 : n[0]) == null ? void 0 : d.result) == null ? void 0 : g[0][0]) : i, u = S(o) ? oe((p = (f = n == null ? void 0 : n[1]) == null ? void 0 : f.result) == null ? void 0 : p[0][0]) : o, c = T(String(l)) && T(String(u));
|
|
810
810
|
return {
|
|
811
811
|
formula1: ve(l),
|
|
812
812
|
formula2: ve(u),
|
|
813
813
|
originFormula1: l,
|
|
814
814
|
originFormula2: u,
|
|
815
|
-
isFormulaValid:
|
|
815
|
+
isFormulaValid: c
|
|
816
816
|
};
|
|
817
817
|
}
|
|
818
818
|
getExtraStyle(e, t) {
|
|
@@ -821,19 +821,19 @@ class na extends Y {
|
|
|
821
821
|
};
|
|
822
822
|
}
|
|
823
823
|
parseFormulaSync(e, t, r) {
|
|
824
|
-
var
|
|
825
|
-
const { formula1: i = Ve, formula2: o = ye } = e, n = this._formulaService.getRuleFormulaResultSync(t, r, e.uid), l = S(i) ? oe((g = (
|
|
824
|
+
var d, g, f, p;
|
|
825
|
+
const { formula1: i = Ve, formula2: o = ye } = e, n = this._formulaService.getRuleFormulaResultSync(t, r, e.uid), l = S(i) ? oe((g = (d = n == null ? void 0 : n[0]) == null ? void 0 : d.result) == null ? void 0 : g[0][0]) : i, u = S(o) ? oe((p = (f = n == null ? void 0 : n[1]) == null ? void 0 : f.result) == null ? void 0 : p[0][0]) : o, c = T(String(l)) && T(String(u));
|
|
826
826
|
return {
|
|
827
827
|
formula1: ve(l),
|
|
828
828
|
formula2: ve(u),
|
|
829
829
|
originFormula1: l,
|
|
830
830
|
originFormula2: u,
|
|
831
|
-
isFormulaValid:
|
|
831
|
+
isFormulaValid: c
|
|
832
832
|
};
|
|
833
833
|
}
|
|
834
834
|
async isValidType(e, t, r) {
|
|
835
|
-
const { value: i, unitId: o, subUnitId: n } = e, { formula1: l, formula2: u, originFormula1:
|
|
836
|
-
return !M.isDefine(l) || !M.isDefine(u) ? !0 : M.isDefine(i) && (String(i) === String(l) || String(i) === String(u) || String(i) === String(
|
|
835
|
+
const { value: i, unitId: o, subUnitId: n } = e, { formula1: l, formula2: u, originFormula1: c, originFormula2: d } = await this.parseFormula(r, o, n);
|
|
836
|
+
return !M.isDefine(l) || !M.isDefine(u) ? !0 : M.isDefine(i) && (String(i) === String(l) || String(i) === String(u) || String(i) === String(c != null ? c : "") || String(i) === String(d != null ? d : ""));
|
|
837
837
|
}
|
|
838
838
|
generateRuleErrorMessage(e) {
|
|
839
839
|
return this.localeService.t("dataValidation.checkbox.error");
|
|
@@ -876,7 +876,7 @@ const it = {
|
|
|
876
876
|
}, Be = [
|
|
877
877
|
h.BETWEEN,
|
|
878
878
|
h.NOT_BETWEEN
|
|
879
|
-
], ue = "{FORMULA1}",
|
|
879
|
+
], ue = "{FORMULA1}", ce = "{FORMULA2}", ke = (s) => {
|
|
880
880
|
var e, t;
|
|
881
881
|
if (s == null || typeof s == "boolean")
|
|
882
882
|
return;
|
|
@@ -885,10 +885,10 @@ const it = {
|
|
|
885
885
|
const a = (e = L.parseDate(s)) == null ? void 0 : e.v;
|
|
886
886
|
return M.isDefine(a) ? a : (t = L.parseDate(nt(s).format("YYYY-MM-DD HH:mm:ss"))) == null ? void 0 : t.v;
|
|
887
887
|
};
|
|
888
|
-
class
|
|
888
|
+
class ca extends Y {
|
|
889
889
|
constructor() {
|
|
890
890
|
super(...arguments);
|
|
891
|
-
m(this, "id",
|
|
891
|
+
m(this, "id", C.DATE);
|
|
892
892
|
m(this, "title", "dataValidation.date.title");
|
|
893
893
|
m(this, "order", 40);
|
|
894
894
|
m(this, "operators", [
|
|
@@ -906,11 +906,11 @@ class da extends Y {
|
|
|
906
906
|
m(this, "_lexerTreeBuilder", this.injector.get(X));
|
|
907
907
|
}
|
|
908
908
|
async parseFormula(e, t, r, i, o) {
|
|
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:
|
|
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 = T(String(n == null ? void 0 : n.v)) && T(String(l == null ? void 0 : l.v));
|
|
910
910
|
return {
|
|
911
911
|
formula1: ke(S(u) ? n == null ? void 0 : n.v : u),
|
|
912
|
-
formula2: ke(S(
|
|
913
|
-
isFormulaValid:
|
|
912
|
+
formula2: ke(S(c) ? l == null ? void 0 : l.v : c),
|
|
913
|
+
isFormulaValid: d
|
|
914
914
|
};
|
|
915
915
|
}
|
|
916
916
|
async isValidType(e) {
|
|
@@ -942,19 +942,19 @@ class da extends Y {
|
|
|
942
942
|
}
|
|
943
943
|
normalizeFormula(e, t, r) {
|
|
944
944
|
const { formula1: i, formula2: o, bizInfo: n } = e, l = (u) => {
|
|
945
|
-
var
|
|
945
|
+
var d;
|
|
946
946
|
if (!u)
|
|
947
947
|
return u;
|
|
948
|
-
let
|
|
948
|
+
let c;
|
|
949
949
|
if (!Number.isNaN(+u))
|
|
950
|
-
|
|
950
|
+
c = L.dateFromSerial(+u);
|
|
951
951
|
else {
|
|
952
|
-
const g = (
|
|
952
|
+
const g = (d = L.parseDate(u)) == null ? void 0 : d.v;
|
|
953
953
|
if (g == null)
|
|
954
954
|
return "";
|
|
955
|
-
|
|
955
|
+
c = L.dateFromSerial(g);
|
|
956
956
|
}
|
|
957
|
-
return nt(`${
|
|
957
|
+
return nt(`${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}`),
|
|
@@ -975,19 +975,19 @@ class da extends Y {
|
|
|
975
975
|
var r, i;
|
|
976
976
|
if (!e.operator)
|
|
977
977
|
return this.localeService.t(it.NONE);
|
|
978
|
-
const t = this.localeService.t(it[e.operator]).replace(ue, (r = e.formula1) != null ? r : "").replace(
|
|
978
|
+
const t = this.localeService.t(it[e.operator]).replace(ue, (r = e.formula1) != null ? r : "").replace(ce, (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(ua[e.operator]).replace(ue, r != null ? r : "").replace(
|
|
985
|
+
return `${this.localeService.t(ua[e.operator]).replace(ue, r != null ? r : "").replace(ce, 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,14 +998,14 @@ const Te = {
|
|
|
998
998
|
[h.NOT_EQUAL]: "dataValidation.errorMsg.notEqual",
|
|
999
999
|
NONE: "dataValidation.errorMsg.legal"
|
|
1000
1000
|
};
|
|
1001
|
-
function
|
|
1001
|
+
function Te(s) {
|
|
1002
1002
|
return +s;
|
|
1003
1003
|
}
|
|
1004
|
-
class
|
|
1004
|
+
class da extends Y {
|
|
1005
1005
|
constructor() {
|
|
1006
1006
|
super(...arguments);
|
|
1007
1007
|
m(this, "_customFormulaService", this.injector.get(W));
|
|
1008
|
-
m(this, "id",
|
|
1008
|
+
m(this, "id", C.DECIMAL);
|
|
1009
1009
|
m(this, "_lexerTreeBuilder", this.injector.get(X));
|
|
1010
1010
|
m(this, "title", "dataValidation.decimal.title");
|
|
1011
1011
|
m(this, "order", 20);
|
|
@@ -1026,24 +1026,24 @@ class ca 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(Te(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: Te(i)
|
|
1036
1036
|
};
|
|
1037
1037
|
}
|
|
1038
1038
|
_parseNumber(e) {
|
|
1039
1039
|
return e == null ? Number.NaN : +e;
|
|
1040
1040
|
}
|
|
1041
1041
|
async parseFormula(e, t, r, i, o) {
|
|
1042
|
-
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:
|
|
1042
|
+
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 = T(String(n == null ? void 0 : n.v)) && T(String(l == null ? void 0 : l.v));
|
|
1043
1043
|
return {
|
|
1044
1044
|
formula1: this._parseNumber(S(u) ? n == null ? void 0 : n.v : u),
|
|
1045
|
-
formula2: this._parseNumber(S(
|
|
1046
|
-
isFormulaValid:
|
|
1045
|
+
formula2: this._parseNumber(S(c) ? l == null ? void 0 : l.v : c),
|
|
1046
|
+
isFormulaValid: d
|
|
1047
1047
|
};
|
|
1048
1048
|
}
|
|
1049
1049
|
validatorFormula(e, t, r) {
|
|
@@ -1064,9 +1064,9 @@ class ca 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(ue, r != null ? r : "").replace(ce, i != null ? i : "")}`;
|
|
1070
1070
|
}
|
|
1071
1071
|
}
|
|
1072
1072
|
function ha(s) {
|
|
@@ -1078,14 +1078,14 @@ function ha(s) {
|
|
|
1078
1078
|
const o = s[r];
|
|
1079
1079
|
if (o)
|
|
1080
1080
|
for (let n = 0, l = o.length; n < l; n++) {
|
|
1081
|
-
const u = o[n],
|
|
1082
|
-
if (
|
|
1083
|
-
if (typeof
|
|
1084
|
-
a.add(L.format(u.s.n.pattern,
|
|
1081
|
+
const u = o[n], c = re(u);
|
|
1082
|
+
if (c != null) {
|
|
1083
|
+
if (typeof c != "string" && typeof (u == null ? void 0 : u.s) == "object" && ((t = (e = u.s) == null ? void 0 : e.n) != null && t.pattern)) {
|
|
1084
|
+
a.add(L.format(u.s.n.pattern, c, { throws: !1 }));
|
|
1085
1085
|
continue;
|
|
1086
1086
|
}
|
|
1087
|
-
const
|
|
1088
|
-
|
|
1087
|
+
const d = typeof c == "string" ? c : String(c);
|
|
1088
|
+
T(d) && a.add(d);
|
|
1089
1089
|
}
|
|
1090
1090
|
}
|
|
1091
1091
|
}
|
|
@@ -1107,7 +1107,7 @@ function pa(s, a) {
|
|
|
1107
1107
|
const { formula1: e = "", ranges: t } = s;
|
|
1108
1108
|
if (ut(e.slice(1))) {
|
|
1109
1109
|
const i = Wt(e.slice(1));
|
|
1110
|
-
if ((!i.sheetName || i.sheetName === a) && t.some((o) =>
|
|
1110
|
+
if ((!i.sheetName || i.sheetName === a) && t.some((o) => O.intersects(o, i.range)))
|
|
1111
1111
|
return !0;
|
|
1112
1112
|
}
|
|
1113
1113
|
return !1;
|
|
@@ -1115,21 +1115,21 @@ function pa(s, a) {
|
|
|
1115
1115
|
class _t extends Y {
|
|
1116
1116
|
constructor() {
|
|
1117
1117
|
super(...arguments);
|
|
1118
|
-
m(this, "formulaService", this.injector.get(
|
|
1118
|
+
m(this, "formulaService", this.injector.get(G));
|
|
1119
1119
|
m(this, "_lexer", this.injector.get(X));
|
|
1120
|
-
m(this, "_univerInstanceService", this.injector.get(
|
|
1120
|
+
m(this, "_univerInstanceService", this.injector.get(D));
|
|
1121
1121
|
m(this, "_listCacheService", this.injector.get(le));
|
|
1122
1122
|
m(this, "order", 50);
|
|
1123
1123
|
m(this, "offsetFormulaByRange", !1);
|
|
1124
|
-
m(this, "id",
|
|
1124
|
+
m(this, "id", C.LIST);
|
|
1125
1125
|
m(this, "title", "dataValidation.list.title");
|
|
1126
1126
|
m(this, "operators", []);
|
|
1127
1127
|
m(this, "scopes", ["sheet"]);
|
|
1128
1128
|
m(this, "skipDefaultFontRender", (e) => e.renderMode !== We.TEXT);
|
|
1129
1129
|
}
|
|
1130
1130
|
validatorFormula(e, t, r) {
|
|
1131
|
-
var u,
|
|
1132
|
-
const i = !M.isBlank(e.formula1), o = ga((u = e.formula1) != null ? u : "", this._lexer), n = (
|
|
1131
|
+
var u, c, d;
|
|
1132
|
+
const i = !M.isBlank(e.formula1), o = ga((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 = pa(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")
|
|
@@ -1138,7 +1138,7 @@ class _t extends Y {
|
|
|
1138
1138
|
getExtraStyle(e, t, { style: r }) {
|
|
1139
1139
|
var o;
|
|
1140
1140
|
const i = (o = r.tb !== Se.OVERFLOW ? r.tb : Se.CLIP) != null ? o : Se.WRAP;
|
|
1141
|
-
if (e.type ===
|
|
1141
|
+
if (e.type === C.LIST && (e.renderMode === We.ARROW || e.renderMode === We.TEXT)) {
|
|
1142
1142
|
const n = this.getListWithColorMap(e), l = `${t != null ? t : ""}`, u = n[l];
|
|
1143
1143
|
if (u)
|
|
1144
1144
|
return {
|
|
@@ -1162,7 +1162,7 @@ class _t extends Y {
|
|
|
1162
1162
|
return {
|
|
1163
1163
|
formula1: void 0,
|
|
1164
1164
|
formula2: void 0,
|
|
1165
|
-
isFormulaValid:
|
|
1165
|
+
isFormulaValid: T(String(o))
|
|
1166
1166
|
};
|
|
1167
1167
|
}
|
|
1168
1168
|
async isValidType(e, t, r) {
|
|
@@ -1171,7 +1171,7 @@ class _t extends Y {
|
|
|
1171
1171
|
n,
|
|
1172
1172
|
r
|
|
1173
1173
|
).list : Ee(l);
|
|
1174
|
-
return this.parseCellValue(i).every((
|
|
1174
|
+
return this.parseCellValue(i).every((d) => u.includes(d));
|
|
1175
1175
|
}
|
|
1176
1176
|
generateRuleName() {
|
|
1177
1177
|
return this.localeService.t("dataValidation.list.name");
|
|
@@ -1200,11 +1200,11 @@ class _t extends Y {
|
|
|
1200
1200
|
).list;
|
|
1201
1201
|
}
|
|
1202
1202
|
async getListAsync(e, t, r) {
|
|
1203
|
-
var
|
|
1203
|
+
var c, d;
|
|
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) ? ha((
|
|
1207
|
+
return S(i) ? ha((d = (c = u == null ? void 0 : u[0]) == null ? void 0 : c.result) == null ? void 0 : d[0][0]) : Ee(i);
|
|
1208
1208
|
}
|
|
1209
1209
|
getListWithColor(e, t, r) {
|
|
1210
1210
|
const i = this._getUnitAndSubUnit(t, r);
|
|
@@ -1230,7 +1230,7 @@ class _t extends Y {
|
|
|
1230
1230
|
class fa extends Y {
|
|
1231
1231
|
constructor() {
|
|
1232
1232
|
super(...arguments);
|
|
1233
|
-
m(this, "id",
|
|
1233
|
+
m(this, "id", C.TEXT_LENGTH);
|
|
1234
1234
|
m(this, "title", "dataValidation.textLength.title");
|
|
1235
1235
|
m(this, "_lexerTreeBuilder", this.injector.get(X));
|
|
1236
1236
|
m(this, "order", 30);
|
|
@@ -1270,11 +1270,11 @@ class fa extends Y {
|
|
|
1270
1270
|
return e == null ? Number.NaN : +e;
|
|
1271
1271
|
}
|
|
1272
1272
|
async parseFormula(e, t, r, i, o) {
|
|
1273
|
-
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:
|
|
1273
|
+
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 = T(String(n == null ? void 0 : n.v)) && T(String(l == null ? void 0 : l.v));
|
|
1274
1274
|
return {
|
|
1275
1275
|
formula1: this._parseNumber(S(u) ? n == null ? void 0 : n.v : u),
|
|
1276
|
-
formula2: this._parseNumber(S(
|
|
1277
|
-
isFormulaValid:
|
|
1276
|
+
formula2: this._parseNumber(S(c) ? l == null ? void 0 : l.v : c),
|
|
1277
|
+
isFormulaValid: d
|
|
1278
1278
|
};
|
|
1279
1279
|
}
|
|
1280
1280
|
transform(e, t, r) {
|
|
@@ -1291,7 +1291,7 @@ class fa 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(Lt[e.operator]).replace(ue, r != null ? r : "").replace(
|
|
1294
|
+
return `${this.localeService.t(Lt[e.operator]).replace(ue, r != null ? r : "").replace(ce, i != null ? i : "")}`;
|
|
1295
1295
|
}
|
|
1296
1296
|
}
|
|
1297
1297
|
function vt(s) {
|
|
@@ -1299,62 +1299,62 @@ function vt(s) {
|
|
|
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(
|
|
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:
|
|
1308
|
+
const { worksheet: f } = g, p = new Me();
|
|
1309
1309
|
let R = !1;
|
|
1310
|
-
function E(
|
|
1311
|
-
i &&
|
|
1312
|
-
|
|
1313
|
-
const
|
|
1314
|
-
(vt(
|
|
1315
|
-
v:
|
|
1310
|
+
function E(_, w) {
|
|
1311
|
+
i && _.forEach(($) => {
|
|
1312
|
+
H.foreach($, (x, k) => {
|
|
1313
|
+
const P = f.getCellRaw(x, k), J = ft(P);
|
|
1314
|
+
(vt(P) || J === w) && !(P != null && P.p) && (R = !0, p.setValue(x, k, {
|
|
1315
|
+
v: w,
|
|
1316
1316
|
p: null
|
|
1317
1317
|
}));
|
|
1318
1318
|
});
|
|
1319
1319
|
});
|
|
1320
1320
|
}
|
|
1321
|
-
if (e.forEach((
|
|
1322
|
-
switch (
|
|
1321
|
+
if (e.forEach((_) => {
|
|
1322
|
+
switch (_.type) {
|
|
1323
1323
|
case "delete":
|
|
1324
1324
|
l.push({
|
|
1325
|
-
id:
|
|
1325
|
+
id: I.id,
|
|
1326
1326
|
params: {
|
|
1327
1327
|
unitId: s,
|
|
1328
1328
|
subUnitId: a,
|
|
1329
|
-
ruleId:
|
|
1329
|
+
ruleId: _.rule.uid,
|
|
1330
1330
|
source: r
|
|
1331
1331
|
}
|
|
1332
1332
|
}), u.unshift({
|
|
1333
|
-
id:
|
|
1333
|
+
id: b.id,
|
|
1334
1334
|
params: {
|
|
1335
1335
|
unitId: s,
|
|
1336
1336
|
subUnitId: a,
|
|
1337
|
-
rule:
|
|
1338
|
-
index:
|
|
1337
|
+
rule: _.rule,
|
|
1338
|
+
index: _.index,
|
|
1339
1339
|
source: r
|
|
1340
1340
|
}
|
|
1341
1341
|
});
|
|
1342
1342
|
break;
|
|
1343
1343
|
case "update": {
|
|
1344
|
-
if (he(
|
|
1345
|
-
const $ =
|
|
1346
|
-
ge !==
|
|
1344
|
+
if (he(_.rule.type, n)) {
|
|
1345
|
+
const $ = _.oldRanges[0].startRow, x = _.oldRanges[0].startColumn, k = _.newRanges[0].startRow, P = _.newRanges[0].startColumn, J = k - $, me = P - x, ge = S(_.rule.formula1) ? o.moveFormulaRefOffset(_.rule.formula1, me, J) : _.rule.formula1, pe = S(_.rule.formula2) ? o.moveFormulaRefOffset(_.rule.formula2, me, J) : _.rule.formula2;
|
|
1346
|
+
ge !== _.rule.formula1 || pe !== _.rule.formula2 || !lt(_.newRanges, _.oldRanges) ? (l.push({
|
|
1347
1347
|
id: y.id,
|
|
1348
1348
|
params: {
|
|
1349
1349
|
unitId: s,
|
|
1350
1350
|
subUnitId: a,
|
|
1351
|
-
ruleId:
|
|
1351
|
+
ruleId: _.ruleId,
|
|
1352
1352
|
payload: {
|
|
1353
1353
|
type: V.ALL,
|
|
1354
1354
|
payload: {
|
|
1355
1355
|
formula1: ge,
|
|
1356
1356
|
formula2: pe,
|
|
1357
|
-
ranges:
|
|
1357
|
+
ranges: _.newRanges
|
|
1358
1358
|
}
|
|
1359
1359
|
}
|
|
1360
1360
|
}
|
|
@@ -1363,13 +1363,13 @@ function xe(s, a, e, t, r = "command", i = !0) {
|
|
|
1363
1363
|
params: {
|
|
1364
1364
|
unitId: s,
|
|
1365
1365
|
subUnitId: a,
|
|
1366
|
-
ruleId:
|
|
1366
|
+
ruleId: _.ruleId,
|
|
1367
1367
|
payload: {
|
|
1368
1368
|
type: V.ALL,
|
|
1369
1369
|
payload: {
|
|
1370
|
-
formula1:
|
|
1371
|
-
formula2:
|
|
1372
|
-
ranges:
|
|
1370
|
+
formula1: _.rule.formula1,
|
|
1371
|
+
formula2: _.rule.formula2,
|
|
1372
|
+
ranges: _.oldRanges
|
|
1373
1373
|
}
|
|
1374
1374
|
}
|
|
1375
1375
|
}
|
|
@@ -1378,10 +1378,10 @@ function xe(s, a, e, t, r = "command", i = !0) {
|
|
|
1378
1378
|
params: {
|
|
1379
1379
|
unitId: s,
|
|
1380
1380
|
subUnitId: a,
|
|
1381
|
-
ruleId:
|
|
1381
|
+
ruleId: _.ruleId,
|
|
1382
1382
|
payload: {
|
|
1383
1383
|
type: V.RANGE,
|
|
1384
|
-
payload:
|
|
1384
|
+
payload: _.newRanges
|
|
1385
1385
|
},
|
|
1386
1386
|
source: r
|
|
1387
1387
|
}
|
|
@@ -1390,10 +1390,10 @@ function xe(s, a, e, t, r = "command", i = !0) {
|
|
|
1390
1390
|
params: {
|
|
1391
1391
|
unitId: s,
|
|
1392
1392
|
subUnitId: a,
|
|
1393
|
-
ruleId:
|
|
1393
|
+
ruleId: _.ruleId,
|
|
1394
1394
|
payload: {
|
|
1395
1395
|
type: V.RANGE,
|
|
1396
|
-
payload:
|
|
1396
|
+
payload: _.oldRanges
|
|
1397
1397
|
},
|
|
1398
1398
|
source: r
|
|
1399
1399
|
}
|
|
@@ -1404,10 +1404,10 @@ function xe(s, a, e, t, r = "command", i = !0) {
|
|
|
1404
1404
|
params: {
|
|
1405
1405
|
unitId: s,
|
|
1406
1406
|
subUnitId: a,
|
|
1407
|
-
ruleId:
|
|
1407
|
+
ruleId: _.ruleId,
|
|
1408
1408
|
payload: {
|
|
1409
1409
|
type: V.RANGE,
|
|
1410
|
-
payload:
|
|
1410
|
+
payload: _.newRanges
|
|
1411
1411
|
},
|
|
1412
1412
|
source: r
|
|
1413
1413
|
}
|
|
@@ -1416,58 +1416,58 @@ function xe(s, a, e, t, r = "command", i = !0) {
|
|
|
1416
1416
|
params: {
|
|
1417
1417
|
unitId: s,
|
|
1418
1418
|
subUnitId: a,
|
|
1419
|
-
ruleId:
|
|
1419
|
+
ruleId: _.ruleId,
|
|
1420
1420
|
payload: {
|
|
1421
1421
|
type: V.RANGE,
|
|
1422
|
-
payload:
|
|
1422
|
+
payload: _.oldRanges
|
|
1423
1423
|
},
|
|
1424
1424
|
source: r
|
|
1425
1425
|
}
|
|
1426
1426
|
});
|
|
1427
|
-
const
|
|
1428
|
-
if (
|
|
1429
|
-
const
|
|
1430
|
-
E(
|
|
1427
|
+
const w = c.getRuleById(s, a, _.ruleId);
|
|
1428
|
+
if (w && w.type === C.CHECKBOX) {
|
|
1429
|
+
const x = c.getValidator(C.CHECKBOX).parseFormulaSync(w, s, a);
|
|
1430
|
+
E(_.newRanges, x.formula2);
|
|
1431
1431
|
}
|
|
1432
1432
|
break;
|
|
1433
1433
|
}
|
|
1434
1434
|
case "add": {
|
|
1435
1435
|
if (l.push({
|
|
1436
|
-
id:
|
|
1436
|
+
id: b.id,
|
|
1437
1437
|
params: {
|
|
1438
1438
|
unitId: s,
|
|
1439
1439
|
subUnitId: a,
|
|
1440
|
-
rule:
|
|
1440
|
+
rule: _.rule,
|
|
1441
1441
|
source: r
|
|
1442
1442
|
}
|
|
1443
1443
|
}), u.unshift({
|
|
1444
|
-
id:
|
|
1444
|
+
id: I.id,
|
|
1445
1445
|
params: {
|
|
1446
1446
|
unitId: s,
|
|
1447
1447
|
subUnitId: a,
|
|
1448
|
-
ruleId:
|
|
1448
|
+
ruleId: _.rule.uid,
|
|
1449
1449
|
source: r
|
|
1450
1450
|
}
|
|
1451
|
-
}),
|
|
1452
|
-
const $ =
|
|
1453
|
-
E(
|
|
1451
|
+
}), _.rule.type === C.CHECKBOX) {
|
|
1452
|
+
const $ = c.getValidator(C.CHECKBOX).parseFormulaSync(_.rule, s, a);
|
|
1453
|
+
E(_.rule.ranges, $.originFormula2);
|
|
1454
1454
|
}
|
|
1455
1455
|
break;
|
|
1456
1456
|
}
|
|
1457
1457
|
}
|
|
1458
1458
|
}), R) {
|
|
1459
|
-
const
|
|
1459
|
+
const _ = {
|
|
1460
1460
|
id: ne.id,
|
|
1461
1461
|
params: {
|
|
1462
1462
|
unitId: s,
|
|
1463
1463
|
subUnitId: a,
|
|
1464
|
-
cellValue:
|
|
1464
|
+
cellValue: p.getData()
|
|
1465
1465
|
}
|
|
1466
|
-
},
|
|
1466
|
+
}, w = {
|
|
1467
1467
|
id: ne.id,
|
|
1468
|
-
params:
|
|
1468
|
+
params: dt(t, _.params)
|
|
1469
1469
|
};
|
|
1470
|
-
l.push(
|
|
1470
|
+
l.push(_), u.push(w);
|
|
1471
1471
|
}
|
|
1472
1472
|
return {
|
|
1473
1473
|
redoMutations: l,
|
|
@@ -1480,14 +1480,14 @@ const _a = {
|
|
|
1480
1480
|
handler(s, a) {
|
|
1481
1481
|
if (!a)
|
|
1482
1482
|
return !1;
|
|
1483
|
-
const { unitId: e, subUnitId: t, ranges: r, ruleId: i } = a, o = s.get(
|
|
1483
|
+
const { unitId: e, subUnitId: t, ranges: r, ruleId: i } = a, o = s.get(F), n = s.get(U), l = s.get(Z);
|
|
1484
1484
|
if (!o.getRuleById(e, t, i))
|
|
1485
1485
|
return !1;
|
|
1486
|
-
const
|
|
1487
|
-
|
|
1488
|
-
const
|
|
1486
|
+
const c = o.getRuleObjectMatrix(e, t).clone();
|
|
1487
|
+
c.updateRange(i, r);
|
|
1488
|
+
const d = c.diff(o.getRules(e, t)), { redoMutations: g, undoMutations: f } = xe(e, t, d, s);
|
|
1489
1489
|
return l.pushUndoRedo({
|
|
1490
|
-
undoMutations:
|
|
1490
|
+
undoMutations: f,
|
|
1491
1491
|
redoMutations: g,
|
|
1492
1492
|
unitID: e
|
|
1493
1493
|
}), Le(g, n), !0;
|
|
@@ -1498,21 +1498,21 @@ const _a = {
|
|
|
1498
1498
|
handler(s, a) {
|
|
1499
1499
|
if (!a)
|
|
1500
1500
|
return !1;
|
|
1501
|
-
const { unitId: e, subUnitId: t, rule: r } = a, i = s.get(
|
|
1501
|
+
const { unitId: e, subUnitId: t, rule: r } = a, i = s.get(F), o = s.get(U), n = s.get(Z), l = i.getRuleObjectMatrix(e, t).clone();
|
|
1502
1502
|
l.addRule(r);
|
|
1503
|
-
const u = l.diff(i.getRules(e, t)),
|
|
1503
|
+
const u = l.diff(i.getRules(e, t)), c = i.getValidator(r.type), d = {
|
|
1504
1504
|
unitId: e,
|
|
1505
1505
|
subUnitId: t,
|
|
1506
1506
|
rule: {
|
|
1507
1507
|
...r,
|
|
1508
|
-
...
|
|
1508
|
+
...c == null ? void 0 : c.normalizeFormula(r, e, t)
|
|
1509
1509
|
}
|
|
1510
|
-
}, { redoMutations: g, undoMutations:
|
|
1510
|
+
}, { redoMutations: g, undoMutations: f } = xe(e, t, u, s);
|
|
1511
1511
|
return g.push({
|
|
1512
|
-
id:
|
|
1513
|
-
params:
|
|
1514
|
-
}),
|
|
1515
|
-
id:
|
|
1512
|
+
id: b.id,
|
|
1513
|
+
params: d
|
|
1514
|
+
}), f.unshift({
|
|
1515
|
+
id: I.id,
|
|
1516
1516
|
params: {
|
|
1517
1517
|
unitId: e,
|
|
1518
1518
|
subUnitId: t,
|
|
@@ -1521,7 +1521,7 @@ const _a = {
|
|
|
1521
1521
|
}), n.pushUndoRedo({
|
|
1522
1522
|
unitID: e,
|
|
1523
1523
|
redoMutations: g,
|
|
1524
|
-
undoMutations:
|
|
1524
|
+
undoMutations: f
|
|
1525
1525
|
}), Le(g, o), !0;
|
|
1526
1526
|
}
|
|
1527
1527
|
}, Ra = {
|
|
@@ -1531,16 +1531,16 @@ const _a = {
|
|
|
1531
1531
|
handler(s, a) {
|
|
1532
1532
|
if (!a)
|
|
1533
1533
|
return !1;
|
|
1534
|
-
const e = s.get(
|
|
1535
|
-
if (!d)
|
|
1536
|
-
return !1;
|
|
1537
|
-
const c = r.getRuleById(o, n, l);
|
|
1534
|
+
const e = s.get(U), t = s.get(Z), r = s.get(F), i = s.get(q), { unitId: o, subUnitId: n, ruleId: l, setting: u } = a, c = i.getValidatorItem(u.type);
|
|
1538
1535
|
if (!c)
|
|
1539
1536
|
return !1;
|
|
1540
|
-
const
|
|
1541
|
-
if (!d
|
|
1537
|
+
const d = r.getRuleById(o, n, l);
|
|
1538
|
+
if (!d)
|
|
1542
1539
|
return !1;
|
|
1543
|
-
const
|
|
1540
|
+
const g = { ...d, ...u };
|
|
1541
|
+
if (!c.validatorFormula(g, o, n).success)
|
|
1542
|
+
return !1;
|
|
1543
|
+
const f = {
|
|
1544
1544
|
unitId: o,
|
|
1545
1545
|
subUnitId: n,
|
|
1546
1546
|
ruleId: l,
|
|
@@ -1548,32 +1548,32 @@ const _a = {
|
|
|
1548
1548
|
type: V.SETTING,
|
|
1549
1549
|
payload: {
|
|
1550
1550
|
...u,
|
|
1551
|
-
...
|
|
1551
|
+
...c.normalizeFormula(g, o, n)
|
|
1552
1552
|
}
|
|
1553
1553
|
}
|
|
1554
|
-
},
|
|
1554
|
+
}, p = [{
|
|
1555
1555
|
id: y.id,
|
|
1556
|
-
params:
|
|
1556
|
+
params: f
|
|
1557
1557
|
}], R = {
|
|
1558
1558
|
unitId: o,
|
|
1559
1559
|
subUnitId: n,
|
|
1560
1560
|
ruleId: l,
|
|
1561
1561
|
payload: {
|
|
1562
1562
|
type: V.SETTING,
|
|
1563
|
-
payload: Ut(
|
|
1563
|
+
payload: Ut(d)
|
|
1564
1564
|
}
|
|
1565
1565
|
}, E = [{
|
|
1566
1566
|
id: y.id,
|
|
1567
1567
|
params: R
|
|
1568
1568
|
}];
|
|
1569
|
-
if (u.type ===
|
|
1570
|
-
const
|
|
1571
|
-
if (
|
|
1572
|
-
const k = new Me(), { worksheet:
|
|
1569
|
+
if (u.type === C.CHECKBOX) {
|
|
1570
|
+
const w = d.ranges, $ = s.get(D), x = ze($, { unitId: o, subUnitId: n });
|
|
1571
|
+
if (x) {
|
|
1572
|
+
const k = new Me(), { worksheet: P } = x, { formula2: J = ye, formula1: me = Ve } = d, { formula2: ge = ye, formula1: pe = Ve } = u;
|
|
1573
1573
|
let Pe = !1;
|
|
1574
|
-
if (
|
|
1575
|
-
|
|
1576
|
-
const j =
|
|
1574
|
+
if (w.forEach((fe) => {
|
|
1575
|
+
H.foreach(fe, (ie, He) => {
|
|
1576
|
+
const j = P.getCellRaw(ie, He), Je = ft(j);
|
|
1577
1577
|
(vt(j) || Je === String(J)) && !(j != null && j.p) ? (k.setValue(ie, He, {
|
|
1578
1578
|
v: ge,
|
|
1579
1579
|
p: null
|
|
@@ -1592,15 +1592,15 @@ const _a = {
|
|
|
1592
1592
|
}
|
|
1593
1593
|
}, ie = {
|
|
1594
1594
|
id: ne.id,
|
|
1595
|
-
params:
|
|
1595
|
+
params: dt(s, fe.params)
|
|
1596
1596
|
};
|
|
1597
|
-
|
|
1597
|
+
p.push(fe), E.push(ie);
|
|
1598
1598
|
}
|
|
1599
1599
|
}
|
|
1600
1600
|
}
|
|
1601
|
-
return Le(
|
|
1601
|
+
return Le(p, e).result ? (t.pushUndoRedo({
|
|
1602
1602
|
unitID: o,
|
|
1603
|
-
redoMutations:
|
|
1603
|
+
redoMutations: p,
|
|
1604
1604
|
undoMutations: E
|
|
1605
1605
|
}), !0) : !1;
|
|
1606
1606
|
}
|
|
@@ -1610,10 +1610,10 @@ const _a = {
|
|
|
1610
1610
|
handler(s, a) {
|
|
1611
1611
|
if (!a)
|
|
1612
1612
|
return !1;
|
|
1613
|
-
const e = s.get(
|
|
1613
|
+
const e = s.get(U), t = s.get(Z), r = s.get(F), { unitId: i, subUnitId: o, ruleId: n, options: l } = a, u = r.getRuleById(i, o, n);
|
|
1614
1614
|
if (!u)
|
|
1615
1615
|
return !1;
|
|
1616
|
-
const
|
|
1616
|
+
const c = {
|
|
1617
1617
|
unitId: i,
|
|
1618
1618
|
subUnitId: o,
|
|
1619
1619
|
ruleId: n,
|
|
@@ -1621,9 +1621,9 @@ const _a = {
|
|
|
1621
1621
|
type: V.OPTIONS,
|
|
1622
1622
|
payload: l
|
|
1623
1623
|
}
|
|
1624
|
-
},
|
|
1624
|
+
}, d = [{
|
|
1625
1625
|
id: y.id,
|
|
1626
|
-
params:
|
|
1626
|
+
params: c
|
|
1627
1627
|
}], g = {
|
|
1628
1628
|
unitId: i,
|
|
1629
1629
|
subUnitId: o,
|
|
@@ -1632,15 +1632,15 @@ const _a = {
|
|
|
1632
1632
|
type: V.OPTIONS,
|
|
1633
1633
|
payload: Bt(u)
|
|
1634
1634
|
}
|
|
1635
|
-
},
|
|
1635
|
+
}, f = [{
|
|
1636
1636
|
id: y.id,
|
|
1637
1637
|
params: g
|
|
1638
1638
|
}];
|
|
1639
1639
|
return t.pushUndoRedo({
|
|
1640
1640
|
unitID: i,
|
|
1641
|
-
redoMutations:
|
|
1642
|
-
undoMutations:
|
|
1643
|
-
}), e.executeCommand(y.id,
|
|
1641
|
+
redoMutations: d,
|
|
1642
|
+
undoMutations: f
|
|
1643
|
+
}), e.executeCommand(y.id, c), !0;
|
|
1644
1644
|
}
|
|
1645
1645
|
}, Ea = {
|
|
1646
1646
|
type: z.COMMAND,
|
|
@@ -1648,15 +1648,15 @@ const _a = {
|
|
|
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(
|
|
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
|
-
const u = s.get(Z),
|
|
1654
|
-
|
|
1655
|
-
const
|
|
1653
|
+
const u = s.get(Z), c = l.getRuleObjectMatrix(e, t).clone();
|
|
1654
|
+
c.removeRange(r);
|
|
1655
|
+
const d = c.diff(l.getRules(e, t)), { redoMutations: g, undoMutations: f } = xe(e, t, d, s);
|
|
1656
1656
|
return u.pushUndoRedo({
|
|
1657
1657
|
unitID: e,
|
|
1658
1658
|
redoMutations: g,
|
|
1659
|
-
undoMutations:
|
|
1659
|
+
undoMutations: f
|
|
1660
1660
|
}), Le(g, i).result;
|
|
1661
1661
|
}
|
|
1662
1662
|
}, Ma = {
|
|
@@ -1665,15 +1665,15 @@ const _a = {
|
|
|
1665
1665
|
handler(s, a) {
|
|
1666
1666
|
if (!a)
|
|
1667
1667
|
return !1;
|
|
1668
|
-
const { unitId: e, subUnitId: t } = a, r = s.get(
|
|
1668
|
+
const { unitId: e, subUnitId: t } = a, r = s.get(U), i = s.get(F), o = s.get(Z), n = [...i.getRules(e, t)], l = {
|
|
1669
1669
|
unitId: e,
|
|
1670
1670
|
subUnitId: t,
|
|
1671
|
-
ruleId: n.map((
|
|
1671
|
+
ruleId: n.map((d) => d.uid)
|
|
1672
1672
|
}, u = [{
|
|
1673
|
-
id:
|
|
1673
|
+
id: I.id,
|
|
1674
1674
|
params: l
|
|
1675
|
-
}],
|
|
1676
|
-
id:
|
|
1675
|
+
}], c = [{
|
|
1676
|
+
id: b.id,
|
|
1677
1677
|
params: {
|
|
1678
1678
|
unitId: e,
|
|
1679
1679
|
subUnitId: t,
|
|
@@ -1682,16 +1682,16 @@ const _a = {
|
|
|
1682
1682
|
}];
|
|
1683
1683
|
return o.pushUndoRedo({
|
|
1684
1684
|
redoMutations: u,
|
|
1685
|
-
undoMutations:
|
|
1685
|
+
undoMutations: c,
|
|
1686
1686
|
unitID: e
|
|
1687
|
-
}), r.executeCommand(
|
|
1687
|
+
}), r.executeCommand(I.id, l), !0;
|
|
1688
1688
|
}
|
|
1689
1689
|
}, Va = (s, a) => {
|
|
1690
|
-
const e = s.get(
|
|
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);
|
|
1693
1693
|
return [{
|
|
1694
|
-
id:
|
|
1694
|
+
id: b.id,
|
|
1695
1695
|
params: {
|
|
1696
1696
|
unitId: t,
|
|
1697
1697
|
subUnitId: r,
|
|
@@ -1701,7 +1701,7 @@ const _a = {
|
|
|
1701
1701
|
}];
|
|
1702
1702
|
}
|
|
1703
1703
|
return [{
|
|
1704
|
-
id:
|
|
1704
|
+
id: b.id,
|
|
1705
1705
|
params: {
|
|
1706
1706
|
unitId: t,
|
|
1707
1707
|
subUnitId: r,
|
|
@@ -1717,11 +1717,11 @@ const _a = {
|
|
|
1717
1717
|
handler(s, a) {
|
|
1718
1718
|
if (!a)
|
|
1719
1719
|
return !1;
|
|
1720
|
-
const { unitId: e, subUnitId: t, ruleId: r } = a, i = s.get(
|
|
1721
|
-
id:
|
|
1720
|
+
const { unitId: e, subUnitId: t, ruleId: r } = a, i = s.get(U), o = s.get(Z), n = s.get(F), l = [{
|
|
1721
|
+
id: I.id,
|
|
1722
1722
|
params: a
|
|
1723
1723
|
}], u = [{
|
|
1724
|
-
id:
|
|
1724
|
+
id: b.id,
|
|
1725
1725
|
params: {
|
|
1726
1726
|
unitId: e,
|
|
1727
1727
|
subUnitId: t,
|
|
@@ -1735,15 +1735,15 @@ const _a = {
|
|
|
1735
1735
|
undoMutations: u,
|
|
1736
1736
|
redoMutations: l,
|
|
1737
1737
|
unitID: a.unitId
|
|
1738
|
-
}), i.executeCommand(
|
|
1738
|
+
}), i.executeCommand(I.id, a), !0;
|
|
1739
1739
|
}
|
|
1740
|
-
},
|
|
1741
|
-
var Rt = /* @__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))(Rt || {}),
|
|
1742
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1740
|
+
}, Ca = "SHEET_DATA_VALIDATION_PLUGIN";
|
|
1741
|
+
var Rt = /* @__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))(Rt || {}), Ta = Object.getOwnPropertyDescriptor, Fa = (s, a, e, t) => {
|
|
1742
|
+
for (var r = t > 1 ? void 0 : t ? Ta(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
1745
|
}, je = (s, a) => (e, t) => a(e, t, s);
|
|
1746
|
-
let
|
|
1746
|
+
let Fe = class extends B {
|
|
1747
1747
|
constructor(s, a, e) {
|
|
1748
1748
|
super(), this._univerInstanceService = s, this._permissionService = a, this._lexerTreeBuilder = e;
|
|
1749
1749
|
}
|
|
@@ -1758,38 +1758,38 @@ let Ce = class extends x {
|
|
|
1758
1758
|
continue;
|
|
1759
1759
|
const { token: o } = i, n = $t(o), l = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET);
|
|
1760
1760
|
let u = l.getActiveSheet();
|
|
1761
|
-
const
|
|
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 jt(
|
|
1766
|
+
if (!this._permissionService.getPermissionPoint(new jt(c, R).id)) return !1;
|
|
1767
1767
|
}
|
|
1768
1768
|
if (!u)
|
|
1769
1769
|
return !1;
|
|
1770
|
-
const { startRow:
|
|
1771
|
-
for (let R =
|
|
1772
|
-
for (let E =
|
|
1773
|
-
const
|
|
1774
|
-
if ((
|
|
1770
|
+
const { startRow: d, endRow: g, startColumn: f, endColumn: p } = n.range;
|
|
1771
|
+
for (let R = d; R <= g; R++)
|
|
1772
|
+
for (let E = f; E <= p; E++) {
|
|
1773
|
+
const _ = (t = (e = u.getCell(R, E)) == null ? void 0 : e.selectionProtection) == null ? void 0 : t[0];
|
|
1774
|
+
if ((_ == null ? void 0 : _[Rt.View]) === !1)
|
|
1775
1775
|
return !1;
|
|
1776
1776
|
}
|
|
1777
1777
|
}
|
|
1778
1778
|
return !0;
|
|
1779
1779
|
}
|
|
1780
1780
|
};
|
|
1781
|
-
|
|
1782
|
-
je(0,
|
|
1783
|
-
je(1,
|
|
1781
|
+
Fe = Fa([
|
|
1782
|
+
je(0, D),
|
|
1783
|
+
je(1, Tt),
|
|
1784
1784
|
je(2, v(X))
|
|
1785
|
-
],
|
|
1785
|
+
], Fe);
|
|
1786
1786
|
const Na = "sheets-data-validation.config", st = {};
|
|
1787
|
-
var
|
|
1788
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1787
|
+
var wa = Object.getOwnPropertyDescriptor, Oa = (s, a, e, t) => {
|
|
1788
|
+
for (var r = t > 1 ? void 0 : t ? wa(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
1789
1789
|
(o = s[i]) && (r = o(r) || r);
|
|
1790
1790
|
return r;
|
|
1791
1791
|
}, Qe = (s, a) => (e, t) => a(e, t, s);
|
|
1792
|
-
let Ne = class extends
|
|
1792
|
+
let Ne = class extends B {
|
|
1793
1793
|
constructor(a, e, t) {
|
|
1794
1794
|
super();
|
|
1795
1795
|
m(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
@@ -1807,7 +1807,7 @@ let Ne = class extends x {
|
|
|
1807
1807
|
if (u.length === 0)
|
|
1808
1808
|
return {
|
|
1809
1809
|
undos: [{
|
|
1810
|
-
id:
|
|
1810
|
+
id: b.id,
|
|
1811
1811
|
params: {
|
|
1812
1812
|
unitId: a,
|
|
1813
1813
|
subUnitId: e,
|
|
@@ -1816,7 +1816,7 @@ let Ne = class extends x {
|
|
|
1816
1816
|
}
|
|
1817
1817
|
}],
|
|
1818
1818
|
redos: [{
|
|
1819
|
-
id:
|
|
1819
|
+
id: I.id,
|
|
1820
1820
|
params: {
|
|
1821
1821
|
unitId: a,
|
|
1822
1822
|
subUnitId: e,
|
|
@@ -1825,8 +1825,8 @@ let Ne = class extends x {
|
|
|
1825
1825
|
}
|
|
1826
1826
|
}]
|
|
1827
1827
|
};
|
|
1828
|
-
const
|
|
1829
|
-
|
|
1828
|
+
const c = [], d = [], g = u[0];
|
|
1829
|
+
c.push({
|
|
1830
1830
|
id: y.id,
|
|
1831
1831
|
params: {
|
|
1832
1832
|
unitId: a,
|
|
@@ -1842,7 +1842,7 @@ let Ne = class extends x {
|
|
|
1842
1842
|
},
|
|
1843
1843
|
source: "patched"
|
|
1844
1844
|
}
|
|
1845
|
-
}),
|
|
1845
|
+
}), d.push({
|
|
1846
1846
|
id: y.id,
|
|
1847
1847
|
params: {
|
|
1848
1848
|
unitId: a,
|
|
@@ -1859,24 +1859,24 @@ let Ne = class extends x {
|
|
|
1859
1859
|
source: "patched"
|
|
1860
1860
|
}
|
|
1861
1861
|
});
|
|
1862
|
-
for (let
|
|
1863
|
-
const
|
|
1864
|
-
|
|
1865
|
-
id:
|
|
1862
|
+
for (let f = 1; f < u.length; f++) {
|
|
1863
|
+
const p = u[f], R = Xe();
|
|
1864
|
+
c.push({
|
|
1865
|
+
id: b.id,
|
|
1866
1866
|
params: {
|
|
1867
1867
|
unitId: a,
|
|
1868
1868
|
subUnitId: e,
|
|
1869
1869
|
rule: {
|
|
1870
1870
|
...t,
|
|
1871
1871
|
uid: R,
|
|
1872
|
-
formula1:
|
|
1873
|
-
formula2:
|
|
1874
|
-
ranges:
|
|
1872
|
+
formula1: p.formulas[0],
|
|
1873
|
+
formula2: p.formulas[1],
|
|
1874
|
+
ranges: p.ranges
|
|
1875
1875
|
},
|
|
1876
1876
|
source: "patched"
|
|
1877
1877
|
}
|
|
1878
|
-
}),
|
|
1879
|
-
id:
|
|
1878
|
+
}), d.push({
|
|
1879
|
+
id: I.id,
|
|
1880
1880
|
params: {
|
|
1881
1881
|
unitId: a,
|
|
1882
1882
|
subUnitId: e,
|
|
@@ -1886,8 +1886,8 @@ let Ne = class extends x {
|
|
|
1886
1886
|
});
|
|
1887
1887
|
}
|
|
1888
1888
|
return {
|
|
1889
|
-
undos:
|
|
1890
|
-
redos:
|
|
1889
|
+
undos: d,
|
|
1890
|
+
redos: c
|
|
1891
1891
|
};
|
|
1892
1892
|
}), l = this._getIdWithUnitId(a, e, t.uid);
|
|
1893
1893
|
this._disposableMap.set(l, n);
|
|
@@ -1926,17 +1926,17 @@ let Ne = class extends x {
|
|
|
1926
1926
|
}));
|
|
1927
1927
|
}
|
|
1928
1928
|
};
|
|
1929
|
-
Ne =
|
|
1930
|
-
Qe(0, v(
|
|
1929
|
+
Ne = Oa([
|
|
1930
|
+
Qe(0, v(F)),
|
|
1931
1931
|
Qe(1, v(pt)),
|
|
1932
|
-
Qe(2, v(
|
|
1932
|
+
Qe(2, v(q))
|
|
1933
1933
|
], Ne);
|
|
1934
1934
|
var Aa = Object.getOwnPropertyDescriptor, Ia = (s, a, e, t) => {
|
|
1935
1935
|
for (var r = t > 1 ? void 0 : t ? Aa(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
1936
1936
|
(o = s[i]) && (r = o(r) || r);
|
|
1937
1937
|
return r;
|
|
1938
1938
|
}, te = (s, a) => (e, t) => a(e, t, s);
|
|
1939
|
-
let
|
|
1939
|
+
let we = class extends B {
|
|
1940
1940
|
constructor(a, e, t, r, i, o) {
|
|
1941
1941
|
super();
|
|
1942
1942
|
m(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
@@ -1951,14 +1951,14 @@ let Oe = class extends x {
|
|
|
1951
1951
|
// eslint-disable-next-line max-lines-per-function
|
|
1952
1952
|
registerFormula(a, e, t) {
|
|
1953
1953
|
var u;
|
|
1954
|
-
const r = t.uid, i = this._getIdWithUnitId(a, e, r), o = (u = this._disposableMap.get(i)) != null ? u : /* @__PURE__ */ new Set(), n = (
|
|
1954
|
+
const r = t.uid, i = this._getIdWithUnitId(a, e, r), o = (u = this._disposableMap.get(i)) != null ? u : /* @__PURE__ */ new Set(), n = (c, d) => {
|
|
1955
1955
|
const g = this._dataValidationModel.getRuleById(a, e, r);
|
|
1956
1956
|
if (!g)
|
|
1957
1957
|
return { redos: [], undos: [] };
|
|
1958
|
-
const
|
|
1959
|
-
if (!
|
|
1958
|
+
const f = g[c];
|
|
1959
|
+
if (!f || f === d)
|
|
1960
1960
|
return { redos: [], undos: [] };
|
|
1961
|
-
const
|
|
1961
|
+
const p = {
|
|
1962
1962
|
unitId: a,
|
|
1963
1963
|
subUnitId: e,
|
|
1964
1964
|
ruleId: t.uid,
|
|
@@ -1968,7 +1968,7 @@ let Oe = class extends x {
|
|
|
1968
1968
|
type: g.type,
|
|
1969
1969
|
formula1: g.formula1,
|
|
1970
1970
|
formula2: g.formula2,
|
|
1971
|
-
[
|
|
1971
|
+
[c]: d
|
|
1972
1972
|
}
|
|
1973
1973
|
},
|
|
1974
1974
|
source: "patched"
|
|
@@ -1988,33 +1988,33 @@ let Oe = class extends x {
|
|
|
1988
1988
|
}, E = [
|
|
1989
1989
|
{
|
|
1990
1990
|
id: y.id,
|
|
1991
|
-
params:
|
|
1991
|
+
params: p
|
|
1992
1992
|
}
|
|
1993
|
-
],
|
|
1993
|
+
], _ = [
|
|
1994
1994
|
{
|
|
1995
1995
|
id: y.id,
|
|
1996
1996
|
params: R
|
|
1997
1997
|
}
|
|
1998
1998
|
];
|
|
1999
|
-
return { redos: E, undos:
|
|
1999
|
+
return { redos: E, undos: _ };
|
|
2000
2000
|
}, l = this._dataValidationFormulaService.getRuleFormulaInfo(a, e, r);
|
|
2001
2001
|
if (l) {
|
|
2002
|
-
const [
|
|
2003
|
-
if (
|
|
2002
|
+
const [c, d] = l;
|
|
2003
|
+
if (c) {
|
|
2004
2004
|
const g = this._formulaRefRangeService.registerFormula(
|
|
2005
2005
|
a,
|
|
2006
2006
|
e,
|
|
2007
|
-
|
|
2008
|
-
(
|
|
2007
|
+
c.text,
|
|
2008
|
+
(f) => n("formula1", f)
|
|
2009
2009
|
);
|
|
2010
2010
|
o.add(() => g.dispose());
|
|
2011
2011
|
}
|
|
2012
|
-
if (
|
|
2012
|
+
if (d) {
|
|
2013
2013
|
const g = this._formulaRefRangeService.registerFormula(
|
|
2014
2014
|
a,
|
|
2015
2015
|
e,
|
|
2016
|
-
|
|
2017
|
-
(
|
|
2016
|
+
d.text,
|
|
2017
|
+
(f) => n("formula2", f)
|
|
2018
2018
|
);
|
|
2019
2019
|
o.add(() => g.dispose());
|
|
2020
2020
|
}
|
|
@@ -2023,11 +2023,11 @@ let Oe = class extends x {
|
|
|
2023
2023
|
register(a, e, t) {
|
|
2024
2024
|
var l;
|
|
2025
2025
|
const r = (u) => {
|
|
2026
|
-
const
|
|
2027
|
-
if (lt(g,
|
|
2026
|
+
const c = [...t.ranges], g = c.map((p) => Gt(p, u)).filter((p) => !!p).flat();
|
|
2027
|
+
if (lt(g, c))
|
|
2028
2028
|
return { redos: [], undos: [] };
|
|
2029
2029
|
if (g.length) {
|
|
2030
|
-
const
|
|
2030
|
+
const p = {
|
|
2031
2031
|
unitId: a,
|
|
2032
2032
|
subUnitId: e,
|
|
2033
2033
|
ruleId: t.uid,
|
|
@@ -2036,7 +2036,7 @@ let Oe = class extends x {
|
|
|
2036
2036
|
payload: g
|
|
2037
2037
|
},
|
|
2038
2038
|
source: "patched"
|
|
2039
|
-
}, R = [{ id: y.id, params:
|
|
2039
|
+
}, R = [{ id: y.id, params: p }], E = [{
|
|
2040
2040
|
id: y.id,
|
|
2041
2041
|
params: {
|
|
2042
2042
|
unitId: a,
|
|
@@ -2044,20 +2044,20 @@ let Oe = class extends x {
|
|
|
2044
2044
|
ruleId: t.uid,
|
|
2045
2045
|
payload: {
|
|
2046
2046
|
type: V.RANGE,
|
|
2047
|
-
payload:
|
|
2047
|
+
payload: c
|
|
2048
2048
|
},
|
|
2049
2049
|
source: "patched"
|
|
2050
2050
|
}
|
|
2051
2051
|
}];
|
|
2052
2052
|
return { redos: R, undos: E };
|
|
2053
2053
|
} else {
|
|
2054
|
-
const
|
|
2054
|
+
const p = { unitId: a, subUnitId: e, ruleId: t.uid }, R = [{ id: I.id, params: p }], E = Va(this._injector, p);
|
|
2055
2055
|
return { redos: R, undos: E };
|
|
2056
2056
|
}
|
|
2057
2057
|
}, i = [];
|
|
2058
2058
|
t.ranges.forEach((u) => {
|
|
2059
|
-
const
|
|
2060
|
-
i.push(() =>
|
|
2059
|
+
const c = this._refRangeService.registerRefRange(u, r, a, e);
|
|
2060
|
+
i.push(() => c.dispose());
|
|
2061
2061
|
});
|
|
2062
2062
|
const o = this._getIdWithUnitId(a, e, t.uid), n = (l = this._disposableMap.get(o)) != null ? l : /* @__PURE__ */ new Set();
|
|
2063
2063
|
n.add(() => i.forEach((u) => u())), this._disposableMap.set(o, n);
|
|
@@ -2096,20 +2096,20 @@ let Oe = class extends x {
|
|
|
2096
2096
|
}));
|
|
2097
2097
|
}
|
|
2098
2098
|
};
|
|
2099
|
-
|
|
2100
|
-
te(0, v(
|
|
2099
|
+
we = Ia([
|
|
2100
|
+
te(0, v(F)),
|
|
2101
2101
|
te(1, v(be)),
|
|
2102
2102
|
te(2, v(Qt)),
|
|
2103
|
-
te(3, v(
|
|
2103
|
+
te(3, v(G)),
|
|
2104
2104
|
te(4, v(pt)),
|
|
2105
|
-
te(5, v(
|
|
2106
|
-
],
|
|
2105
|
+
te(5, v(q))
|
|
2106
|
+
], we);
|
|
2107
2107
|
var Da = Object.getOwnPropertyDescriptor, ba = (s, a, e, t) => {
|
|
2108
2108
|
for (var r = t > 1 ? void 0 : t ? Da(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
2109
2109
|
(o = s[i]) && (r = o(r) || r);
|
|
2110
2110
|
return r;
|
|
2111
|
-
},
|
|
2112
|
-
let
|
|
2111
|
+
}, Ge = (s, a) => (e, t) => a(e, t, s);
|
|
2112
|
+
let Oe = class extends B {
|
|
2113
2113
|
constructor(s, a, e) {
|
|
2114
2114
|
super(), this._sheetInterceptorService = s, this._univerInstanceService = a, this._sheetDataValidationModel = e, this._initSheetChange();
|
|
2115
2115
|
}
|
|
@@ -2120,7 +2120,7 @@ let we = class extends x {
|
|
|
2120
2120
|
// eslint-disable-next-line max-lines-per-function
|
|
2121
2121
|
getMutations: (s) => {
|
|
2122
2122
|
var a;
|
|
2123
|
-
if (s.id ===
|
|
2123
|
+
if (s.id === qt.id) {
|
|
2124
2124
|
const e = s.params, t = e.unitId || this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET).getUnitId(), r = this._univerInstanceService.getUniverSheetInstance(t);
|
|
2125
2125
|
if (!r)
|
|
2126
2126
|
return { redos: [], undos: [] };
|
|
@@ -2130,7 +2130,7 @@ let we = class extends x {
|
|
|
2130
2130
|
const o = this._sheetDataValidationModel.getRules(t, i);
|
|
2131
2131
|
if (o.length === 0)
|
|
2132
2132
|
return { redos: [], undos: [] };
|
|
2133
|
-
const n = o.map((
|
|
2133
|
+
const n = o.map((c) => c.uid), l = {
|
|
2134
2134
|
unitId: t,
|
|
2135
2135
|
subUnitId: i,
|
|
2136
2136
|
ruleId: n,
|
|
@@ -2143,11 +2143,11 @@ let we = class extends x {
|
|
|
2143
2143
|
};
|
|
2144
2144
|
return {
|
|
2145
2145
|
redos: [{
|
|
2146
|
-
id:
|
|
2146
|
+
id: I.id,
|
|
2147
2147
|
params: l
|
|
2148
2148
|
}],
|
|
2149
2149
|
undos: [{
|
|
2150
|
-
id:
|
|
2150
|
+
id: b.id,
|
|
2151
2151
|
params: u
|
|
2152
2152
|
}]
|
|
2153
2153
|
};
|
|
@@ -2162,7 +2162,7 @@ let we = class extends x {
|
|
|
2162
2162
|
return {
|
|
2163
2163
|
redos: [
|
|
2164
2164
|
{
|
|
2165
|
-
id:
|
|
2165
|
+
id: b.id,
|
|
2166
2166
|
params: {
|
|
2167
2167
|
unitId: t,
|
|
2168
2168
|
subUnitId: i,
|
|
@@ -2173,7 +2173,7 @@ let we = class extends x {
|
|
|
2173
2173
|
],
|
|
2174
2174
|
undos: [
|
|
2175
2175
|
{
|
|
2176
|
-
id:
|
|
2176
|
+
id: I.id,
|
|
2177
2177
|
params: {
|
|
2178
2178
|
unitId: t,
|
|
2179
2179
|
subUnitId: i,
|
|
@@ -2190,15 +2190,15 @@ let we = class extends x {
|
|
|
2190
2190
|
);
|
|
2191
2191
|
}
|
|
2192
2192
|
};
|
|
2193
|
-
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
],
|
|
2193
|
+
Oe = ba([
|
|
2194
|
+
Ge(0, v(ht)),
|
|
2195
|
+
Ge(1, v(D)),
|
|
2196
|
+
Ge(2, v(F))
|
|
2197
|
+
], Oe);
|
|
2198
2198
|
class La extends Y {
|
|
2199
2199
|
constructor() {
|
|
2200
2200
|
super(...arguments);
|
|
2201
|
-
m(this, "id",
|
|
2201
|
+
m(this, "id", C.ANY);
|
|
2202
2202
|
m(this, "title", "dataValidation.any.title");
|
|
2203
2203
|
m(this, "operators", []);
|
|
2204
2204
|
m(this, "scopes", ["sheet"]);
|
|
@@ -2227,7 +2227,7 @@ class La extends Y {
|
|
|
2227
2227
|
class Ua extends Y {
|
|
2228
2228
|
constructor() {
|
|
2229
2229
|
super(...arguments);
|
|
2230
|
-
m(this, "id",
|
|
2230
|
+
m(this, "id", C.CUSTOM);
|
|
2231
2231
|
m(this, "title", "dataValidation.custom.title");
|
|
2232
2232
|
m(this, "operators", []);
|
|
2233
2233
|
m(this, "scopes", ["sheet"]);
|
|
@@ -2251,8 +2251,8 @@ class Ua extends Y {
|
|
|
2251
2251
|
};
|
|
2252
2252
|
}
|
|
2253
2253
|
async isValidType(e, t, r) {
|
|
2254
|
-
const { column: i, row: o, unitId: n, subUnitId: l } = e, u = await this._customFormulaService.getCellFormulaValue(n, l, r.uid, o, i),
|
|
2255
|
-
return
|
|
2254
|
+
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 T(String(c)) && M.isDefine(c) && c !== "" ? u.t === Ft.BOOLEAN ? !!c : typeof c == "boolean" ? c : typeof c == "number" ? !!c : typeof c == "string" ? T(c) : !!c : !1;
|
|
2256
2256
|
}
|
|
2257
2257
|
generateRuleErrorMessage(e) {
|
|
2258
2258
|
return this.localeService.t("dataValidation.custom.error");
|
|
@@ -2265,7 +2265,7 @@ class Ua extends Y {
|
|
|
2265
2265
|
class Ba extends _t {
|
|
2266
2266
|
constructor() {
|
|
2267
2267
|
super(...arguments);
|
|
2268
|
-
m(this, "id",
|
|
2268
|
+
m(this, "id", C.LIST_MULTIPLE);
|
|
2269
2269
|
m(this, "title", "dataValidation.listMultiple.title");
|
|
2270
2270
|
m(this, "offsetFormulaByRange", !1);
|
|
2271
2271
|
m(this, "skipDefaultFontRender", () => !0);
|
|
@@ -2276,7 +2276,7 @@ class xa extends Y {
|
|
|
2276
2276
|
super(...arguments);
|
|
2277
2277
|
m(this, "_customFormulaService", this.injector.get(W));
|
|
2278
2278
|
m(this, "_lexerTreeBuilder", this.injector.get(X));
|
|
2279
|
-
m(this, "id",
|
|
2279
|
+
m(this, "id", C.WHOLE);
|
|
2280
2280
|
m(this, "title", "dataValidation.whole.title");
|
|
2281
2281
|
m(this, "order", 10);
|
|
2282
2282
|
m(this, "operators", [
|
|
@@ -2295,25 +2295,25 @@ class xa extends Y {
|
|
|
2295
2295
|
return !M.isBlank(e) && (S(e) || !Number.isNaN(+e) && Number.isInteger(+e));
|
|
2296
2296
|
}
|
|
2297
2297
|
async isValidType(e, t, r) {
|
|
2298
|
-
const { value: i } = e, o =
|
|
2298
|
+
const { value: i } = e, o = Te(i);
|
|
2299
2299
|
return !Number.isNaN(o) && Number.isInteger(o);
|
|
2300
2300
|
}
|
|
2301
2301
|
transform(e, t, r) {
|
|
2302
2302
|
const { value: i } = e;
|
|
2303
2303
|
return {
|
|
2304
2304
|
...e,
|
|
2305
|
-
value:
|
|
2305
|
+
value: Te(i)
|
|
2306
2306
|
};
|
|
2307
2307
|
}
|
|
2308
2308
|
_parseNumber(e) {
|
|
2309
2309
|
return e == null ? Number.NaN : +e;
|
|
2310
2310
|
}
|
|
2311
2311
|
async parseFormula(e, t, r, i, o) {
|
|
2312
|
-
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:
|
|
2312
|
+
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 = S(u) ? n == null ? void 0 : n.v : u, g = S(c) ? l == null ? void 0 : l.v : c, f = T(`${d}`) && T(`${g}`);
|
|
2313
2313
|
return {
|
|
2314
|
-
formula1: this._parseNumber(
|
|
2314
|
+
formula1: this._parseNumber(d),
|
|
2315
2315
|
formula2: this._parseNumber(g),
|
|
2316
|
-
isFormulaValid:
|
|
2316
|
+
isFormulaValid: f
|
|
2317
2317
|
};
|
|
2318
2318
|
}
|
|
2319
2319
|
validatorFormula(e, t, r) {
|
|
@@ -2334,9 +2334,9 @@ class xa extends Y {
|
|
|
2334
2334
|
}
|
|
2335
2335
|
generateRuleErrorMessage(e, t) {
|
|
2336
2336
|
if (!e.operator)
|
|
2337
|
-
return this.localeService.t(
|
|
2337
|
+
return this.localeService.t(Ce.NONE).replace("{TYPE}", this.titleStr);
|
|
2338
2338
|
const { transformedFormula1: r, transformedFormula2: i } = Ue(this._lexerTreeBuilder, e, t);
|
|
2339
|
-
return `${this.localeService.t(
|
|
2339
|
+
return `${this.localeService.t(Ce[e.operator]).replace(ue, r != null ? r : "").replace(ce, i != null ? i : "")}`;
|
|
2340
2340
|
}
|
|
2341
2341
|
}
|
|
2342
2342
|
var Pa = Object.getOwnPropertyDescriptor, Ha = (s, a, e, t) => {
|
|
@@ -2354,10 +2354,10 @@ let Ae = class extends Nt {
|
|
|
2354
2354
|
_registerValidators() {
|
|
2355
2355
|
[
|
|
2356
2356
|
La,
|
|
2357
|
-
|
|
2357
|
+
da,
|
|
2358
2358
|
xa,
|
|
2359
2359
|
fa,
|
|
2360
|
-
|
|
2360
|
+
ca,
|
|
2361
2361
|
na,
|
|
2362
2362
|
_t,
|
|
2363
2363
|
Ba,
|
|
@@ -2375,11 +2375,11 @@ let Ae = class extends Nt {
|
|
|
2375
2375
|
const e = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET), t = e.getUnitId(), r = e.getActiveSheet();
|
|
2376
2376
|
if (!r)
|
|
2377
2377
|
throw new Error("No active sheet found");
|
|
2378
|
-
const i = r.getSheetId(), o = (a = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : a.map((
|
|
2378
|
+
const i = r.getSheetId(), o = (a = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : a.map((d) => d.range), n = this._sheetDataValidationModel.getRuleObjectMatrix(t, i).clone();
|
|
2379
2379
|
o && n.removeRange(o);
|
|
2380
|
-
const l = n.diff(this._sheetDataValidationModel.getRules(t, i)), { redoMutations: u, undoMutations:
|
|
2380
|
+
const l = n.diff(this._sheetDataValidationModel.getRules(t, i)), { redoMutations: u, undoMutations: c } = xe(t, i, l, this._injector, "patched");
|
|
2381
2381
|
return {
|
|
2382
|
-
undos:
|
|
2382
|
+
undos: c,
|
|
2383
2383
|
redos: u
|
|
2384
2384
|
};
|
|
2385
2385
|
}
|
|
@@ -2392,19 +2392,19 @@ let Ae = class extends Nt {
|
|
|
2392
2392
|
}
|
|
2393
2393
|
};
|
|
2394
2394
|
Ae = Ha([
|
|
2395
|
-
ae(0,
|
|
2396
|
-
ae(1, v(
|
|
2395
|
+
ae(0, D),
|
|
2396
|
+
ae(1, v(q)),
|
|
2397
2397
|
ae(2, v(be)),
|
|
2398
2398
|
ae(3, v(mt)),
|
|
2399
2399
|
ae(4, v(ht)),
|
|
2400
|
-
ae(5, v(
|
|
2400
|
+
ae(5, v(F))
|
|
2401
2401
|
], Ae);
|
|
2402
2402
|
var Wa = Object.getOwnPropertyDescriptor, $a = (s, a, e, t) => {
|
|
2403
2403
|
for (var r = t > 1 ? void 0 : t ? Wa(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
2404
2404
|
(o = s[i]) && (r = o(r) || r);
|
|
2405
2405
|
return r;
|
|
2406
2406
|
}, Re = (s, a) => (e, t) => a(e, t, s);
|
|
2407
|
-
let Ie = class extends
|
|
2407
|
+
let Ie = class extends B {
|
|
2408
2408
|
constructor(s, a, e, t) {
|
|
2409
2409
|
super(), this._univerInstanceService = s, this._sheetDataValidationModel = a, this._dataValidationCacheService = e, this._lifecycleService = t, this._initRecalculate();
|
|
2410
2410
|
}
|
|
@@ -2416,7 +2416,7 @@ let Ie = class extends x {
|
|
|
2416
2416
|
a.flat().forEach((i) => {
|
|
2417
2417
|
r[i.unitId] || (r[i.unitId] = {}), r[i.unitId][i.subUnitId] || (r[i.unitId][i.subUnitId] = []);
|
|
2418
2418
|
const o = this._univerInstanceService.getUnit(i.unitId, N.UNIVER_SHEET), n = o == null ? void 0 : o.getSheetBySheetId(i.subUnitId);
|
|
2419
|
-
n && r[i.unitId][i.subUnitId].push(...i.ranges.map((l) =>
|
|
2419
|
+
n && r[i.unitId][i.subUnitId].push(...i.ranges.map((l) => H.transformRange(l, n)));
|
|
2420
2420
|
}), Object.entries(r).forEach(([i, o]) => {
|
|
2421
2421
|
Object.entries(o).forEach(([n, l]) => {
|
|
2422
2422
|
(e == null ? void 0 : e.getUnitId()) === i && (t == null ? void 0 : t.getSheetId()) === n ? this.validatorRanges(i, n, l) : requestIdleCallback(() => {
|
|
@@ -2425,18 +2425,21 @@ let Ie = class extends x {
|
|
|
2425
2425
|
});
|
|
2426
2426
|
});
|
|
2427
2427
|
};
|
|
2428
|
-
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(Kt(() => this._lifecycleService.lifecycle$.pipe(tt((a) => a === et.Rendered)))).subscribe(s)), this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(tt(() => this._lifecycleService.stage >= et.Rendered),
|
|
2428
|
+
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(Kt(() => this._lifecycleService.lifecycle$.pipe(tt((a) => a === et.Rendered)))).subscribe(s)), this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(tt(() => this._lifecycleService.stage >= et.Rendered), Ot(20)).subscribe(s));
|
|
2429
2429
|
}
|
|
2430
2430
|
async _validatorByCell(s, a, e, t) {
|
|
2431
2431
|
const r = s.getUnitId(), i = a.getSheetId();
|
|
2432
2432
|
if (!M.isDefine(e) || !M.isDefine(t))
|
|
2433
2433
|
throw new Error(`row or col is not defined, row: ${e}, col: ${t}`);
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
|
|
2434
|
+
let o = e, n = t;
|
|
2435
|
+
const l = a.getMergedCell(e, t);
|
|
2436
|
+
l && (o = l.startRow, n = l.startColumn);
|
|
2437
|
+
const u = this._sheetDataValidationModel.getRuleByLocation(r, i, o, n);
|
|
2438
|
+
return u ? new Promise((c) => {
|
|
2439
|
+
this._sheetDataValidationModel.validator(u, { unitId: r, subUnitId: i, row: o, col: n, worksheet: a, workbook: s }, (d) => {
|
|
2440
|
+
c(d);
|
|
2438
2441
|
});
|
|
2439
|
-
}) :
|
|
2442
|
+
}) : A.VALID;
|
|
2440
2443
|
}
|
|
2441
2444
|
async validatorCell(s, a, e, t) {
|
|
2442
2445
|
const r = this._univerInstanceService.getUnit(s, N.UNIVER_SHEET);
|
|
@@ -2447,7 +2450,7 @@ let Ie = class extends x {
|
|
|
2447
2450
|
throw new Error(`cannot find current worksheet, sheetId: ${a}`);
|
|
2448
2451
|
return this._validatorByCell(r, i, e, t);
|
|
2449
2452
|
}
|
|
2450
|
-
validatorRanges(s, a, e) {
|
|
2453
|
+
async validatorRanges(s, a, e) {
|
|
2451
2454
|
if (!e.length)
|
|
2452
2455
|
return Promise.resolve([]);
|
|
2453
2456
|
const t = this._univerInstanceService.getUnit(s, N.UNIVER_SHEET);
|
|
@@ -2456,13 +2459,27 @@ let Ie = class extends x {
|
|
|
2456
2459
|
const r = t.getSheetBySheetId(a);
|
|
2457
2460
|
if (!r)
|
|
2458
2461
|
throw new Error(`cannot find current worksheet, sheetId: ${a}`);
|
|
2459
|
-
const o = this._sheetDataValidationModel.getRules(s, a).map((
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2462
|
+
const o = this._sheetDataValidationModel.getRules(s, a).map((c) => c.ranges).flat(), n = e.map((c) => o.map((d) => ot(c, d))).flat().filter(Boolean), l = [], u = await Promise.all(
|
|
2463
|
+
n.map((c, d) => {
|
|
2464
|
+
const g = [];
|
|
2465
|
+
for (let f = c.startRow; f <= c.endRow; f++)
|
|
2466
|
+
for (let p = c.startColumn; p <= c.endColumn; p++) {
|
|
2467
|
+
g.push(this._validatorByCell(t, r, f, p));
|
|
2468
|
+
const R = r.getMergedCell(f, p);
|
|
2469
|
+
R && l.push({
|
|
2470
|
+
resultRowIndex: d,
|
|
2471
|
+
resultColIndex: g.length - 1,
|
|
2472
|
+
row: R.startRow,
|
|
2473
|
+
col: R.startColumn
|
|
2474
|
+
});
|
|
2475
|
+
}
|
|
2476
|
+
return Promise.all(g);
|
|
2477
|
+
})
|
|
2478
|
+
);
|
|
2479
|
+
return l.length && l.forEach(({ resultRowIndex: c, resultColIndex: d, row: g, col: f }) => {
|
|
2480
|
+
var p;
|
|
2481
|
+
u[c][d] === A.VALIDATING && (u[c][d] = (p = this._dataValidationCacheService.getValue(s, a, g, f)) != null ? p : A.VALID);
|
|
2482
|
+
}), u;
|
|
2466
2483
|
}
|
|
2467
2484
|
async validatorWorksheet(s, a) {
|
|
2468
2485
|
const e = this._univerInstanceService.getUnit(s, N.UNIVER_SHEET);
|
|
@@ -2476,7 +2493,7 @@ let Ie = class extends x {
|
|
|
2476
2493
|
r.map((i) => Promise.all(
|
|
2477
2494
|
i.ranges.map((o) => {
|
|
2478
2495
|
const n = [];
|
|
2479
|
-
return
|
|
2496
|
+
return H.foreach(o, (l, u) => {
|
|
2480
2497
|
n.push(this._validatorByCell(e, t, l, u));
|
|
2481
2498
|
}), Promise.all(n);
|
|
2482
2499
|
})
|
|
@@ -2492,7 +2509,7 @@ let Ie = class extends x {
|
|
|
2492
2509
|
getDataValidations(s, a, e) {
|
|
2493
2510
|
const t = this._sheetDataValidationModel.getRuleObjectMatrix(s, a), r = /* @__PURE__ */ new Set();
|
|
2494
2511
|
return e.forEach((o) => {
|
|
2495
|
-
|
|
2512
|
+
H.foreach(o, (n, l) => {
|
|
2496
2513
|
const u = t.getValue(n, l);
|
|
2497
2514
|
u && r.add(u);
|
|
2498
2515
|
});
|
|
@@ -2503,16 +2520,16 @@ let Ie = class extends x {
|
|
|
2503
2520
|
}
|
|
2504
2521
|
};
|
|
2505
2522
|
Ie = $a([
|
|
2506
|
-
Re(0,
|
|
2507
|
-
Re(1, v(
|
|
2523
|
+
Re(0, D),
|
|
2524
|
+
Re(1, v(F)),
|
|
2508
2525
|
Re(2, v(Q)),
|
|
2509
|
-
Re(3, v(
|
|
2526
|
+
Re(3, v(wt))
|
|
2510
2527
|
], Ie);
|
|
2511
|
-
var ka = Object.defineProperty, ja = Object.getOwnPropertyDescriptor, Qa = (s, a, e) => a in s ? ka(s, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[a] = e,
|
|
2528
|
+
var ka = Object.defineProperty, ja = Object.getOwnPropertyDescriptor, Qa = (s, a, e) => a in s ? ka(s, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[a] = e, Ga = (s, a, e, t) => {
|
|
2512
2529
|
for (var r = t > 1 ? void 0 : t ? ja(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
2513
2530
|
(o = s[i]) && (r = o(r) || r);
|
|
2514
2531
|
return r;
|
|
2515
|
-
},
|
|
2532
|
+
}, qe = (s, a) => (e, t) => a(e, t, s), St = (s, a, e) => Qa(s, typeof a != "symbol" ? a + "" : a, e);
|
|
2516
2533
|
let De = class extends Dt {
|
|
2517
2534
|
constructor(s = st, a, e, t) {
|
|
2518
2535
|
super(), this._config = s, this._injector = a, this._commandService = e, this._configService = t;
|
|
@@ -2527,14 +2544,14 @@ let De = class extends Dt {
|
|
|
2527
2544
|
[
|
|
2528
2545
|
[Q],
|
|
2529
2546
|
[le],
|
|
2530
|
-
[
|
|
2547
|
+
[G],
|
|
2531
2548
|
[W],
|
|
2532
2549
|
[Ie],
|
|
2533
|
-
[
|
|
2550
|
+
[F],
|
|
2534
2551
|
[Ae],
|
|
2535
|
-
[
|
|
2536
|
-
[we],
|
|
2552
|
+
[Fe],
|
|
2537
2553
|
[Oe],
|
|
2554
|
+
[we],
|
|
2538
2555
|
[Ne]
|
|
2539
2556
|
].forEach((s) => {
|
|
2540
2557
|
this._injector.add(s);
|
|
@@ -2548,28 +2565,28 @@ let De = class extends Dt {
|
|
|
2548
2565
|
Ea
|
|
2549
2566
|
].forEach((s) => {
|
|
2550
2567
|
this._commandService.registerCommand(s);
|
|
2551
|
-
}), this._injector.get(Q), this._injector.get(Ie), this._injector.get(Ae), this._injector.get(Ne), this._injector.get(
|
|
2568
|
+
}), this._injector.get(Q), this._injector.get(Ie), this._injector.get(Ae), this._injector.get(Ne), this._injector.get(we);
|
|
2552
2569
|
}
|
|
2553
2570
|
onReady() {
|
|
2554
|
-
this._injector.get(
|
|
2571
|
+
this._injector.get(Oe);
|
|
2555
2572
|
}
|
|
2556
2573
|
onRendered() {
|
|
2557
|
-
this._injector.get(
|
|
2574
|
+
this._injector.get(Fe);
|
|
2558
2575
|
}
|
|
2559
2576
|
};
|
|
2560
|
-
St(De, "pluginName",
|
|
2577
|
+
St(De, "pluginName", Ca);
|
|
2561
2578
|
St(De, "type", N.UNIVER_SHEET);
|
|
2562
|
-
De =
|
|
2579
|
+
De = Ga([
|
|
2563
2580
|
At(xt),
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
|
|
2581
|
+
qe(1, v(be)),
|
|
2582
|
+
qe(2, U),
|
|
2583
|
+
qe(3, It)
|
|
2567
2584
|
], De);
|
|
2568
2585
|
function ar(s) {
|
|
2569
2586
|
const e = s.get(mt).getCurrentSelections().map((i) => i.range);
|
|
2570
2587
|
return {
|
|
2571
2588
|
uid: Xe(6),
|
|
2572
|
-
type:
|
|
2589
|
+
type: C.DECIMAL,
|
|
2573
2590
|
operator: h.EQUAL,
|
|
2574
2591
|
formula1: "100",
|
|
2575
2592
|
ranges: e != null ? e : [{ startColumn: 0, endColumn: 0, startRow: 0, endRow: 0 }]
|
|
@@ -2585,19 +2602,19 @@ export {
|
|
|
2585
2602
|
rr as CUSTOM_FORMULA_INPUT_NAME,
|
|
2586
2603
|
na as CheckboxValidator,
|
|
2587
2604
|
Ea as ClearRangeDataValidationCommand,
|
|
2588
|
-
|
|
2605
|
+
Ca as DATA_VALIDATION_PLUGIN_NAME,
|
|
2589
2606
|
Q as DataValidationCacheService,
|
|
2590
2607
|
W as DataValidationCustomFormulaService,
|
|
2591
|
-
|
|
2592
|
-
|
|
2608
|
+
Fe as DataValidationFormulaController,
|
|
2609
|
+
G as DataValidationFormulaService,
|
|
2593
2610
|
le as DataValidationListCacheService,
|
|
2594
|
-
|
|
2611
|
+
ca as DateValidator,
|
|
2595
2612
|
sr as LIST_FORMULA_INPUT_NAME,
|
|
2596
2613
|
Ba as ListMultipleValidator,
|
|
2597
2614
|
_t as ListValidator,
|
|
2598
2615
|
Ma as RemoveSheetAllDataValidationCommand,
|
|
2599
2616
|
ya as RemoveSheetDataValidationCommand,
|
|
2600
|
-
|
|
2617
|
+
F as SheetDataValidationModel,
|
|
2601
2618
|
Ie as SheetsDataValidationValidatorService,
|
|
2602
2619
|
De as UniverSheetsDataValidationPlugin,
|
|
2603
2620
|
Sa as UpdateSheetDataValidationOptionsCommand,
|
|
@@ -2605,14 +2622,14 @@ export {
|
|
|
2605
2622
|
Ra as UpdateSheetDataValidationSettingCommand,
|
|
2606
2623
|
ar as createDefaultNewRule,
|
|
2607
2624
|
Ee as deserializeListOptions,
|
|
2608
|
-
|
|
2625
|
+
Te as getCellValueNumber,
|
|
2609
2626
|
re as getCellValueOrigin,
|
|
2610
2627
|
tr as getDataValidationCellValue,
|
|
2611
2628
|
xe as getDataValidationDiffMutations,
|
|
2612
2629
|
_e as getFormulaCellData,
|
|
2613
2630
|
oe as getFormulaResult,
|
|
2614
2631
|
Ue as getTransformedFormula,
|
|
2615
|
-
|
|
2632
|
+
T as isLegalFormulaResult,
|
|
2616
2633
|
er as serializeListOptions,
|
|
2617
2634
|
ve as transformCheckboxValue
|
|
2618
2635
|
};
|