@univerjs/sheets-data-validation 0.6.10-experimental.20250411-055c47d → 0.6.10-experimental.20250418-8830bd4
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 +478 -457
- package/lib/index.js +478 -457
- package/lib/types/common/date-text-map.d.ts +2 -2
- package/lib/types/index.d.ts +6 -0
- package/lib/types/types/const/operator-text-map.d.ts +1 -1
- package/lib/types/validators/any-validator.d.ts +1 -0
- package/lib/types/validators/checkbox-validator.d.ts +2 -0
- package/lib/types/validators/custom-validator.d.ts +1 -0
- package/lib/types/validators/date-validator.d.ts +1 -0
- package/lib/types/validators/decimal-validator.d.ts +1 -0
- package/lib/types/validators/list-validator.d.ts +1 -0
- package/lib/types/validators/text-length-validator.d.ts +1 -0
- package/lib/types/validators/whole-validator.d.ts +1 -0
- package/lib/umd/index.js +1 -1
- package/package.json +12 -7
package/lib/es/index.js
CHANGED
|
@@ -1,24 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
var Rt = (o, a, e) => a in o ?
|
|
3
|
-
var
|
|
4
|
-
import { Inject as
|
|
5
|
-
import { DataValidationModel as
|
|
6
|
-
import { SetRangeValuesMutation as se, RemoveSheetMutation as
|
|
7
|
-
import { Subject as
|
|
8
|
-
import { RegisterOtherFormulaService as
|
|
9
|
-
import { ERROR_TYPE_SET as
|
|
10
|
-
const
|
|
11
|
-
var
|
|
12
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1
|
+
var vt = Object.defineProperty;
|
|
2
|
+
var Rt = (o, a, e) => a in o ? vt(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e;
|
|
3
|
+
var m = (o, a, e) => Rt(o, typeof a != "symbol" ? a + "" : a, e);
|
|
4
|
+
import { Inject as R, ICommandService as U, IUniverInstanceService as O, Disposable as P, ObjectMatrix as Se, UniverInstanceType as N, Range as b, Rectangle as A, isFormulaString as S, DataValidationType as T, getOriginCellValue as St, RBush as Mt, debounce as Vt, Tools as M, DataValidationStatus as D, WrapStrategy as Re, DataValidationOperator as h, numfmt as j, dayjs as it, DataValidationRenderMode as Be, CommandType as z, IUndoRedoService as Z, sequenceExecute as Ie, isRangesEqual as ot, generateRandomId as yt, toDisposable as qe, IPermissionService as Et, Injector as Ge, CellValueType as Tt, RxDisposable as Ft, LifecycleService as Nt, LifecycleStages as Ze, bufferDebounceTime as Ct, DependentOn as Ot, IConfigService as wt, Plugin as At, merge as It } from "@univerjs/core";
|
|
5
|
+
import { DataValidationModel as Ye, DataValidatorRegistryService as q, UpdateRuleType as y, BaseDataValidator as G, TextLengthErrorTitleMap as Dt, AddDataValidationMutation as L, RemoveDataValidationMutation as I, UpdateDataValidationMutation as E, getRuleSetting as bt, getRuleOptions as Lt, UniverDataValidationPlugin as Ut } from "@univerjs/data-validation";
|
|
6
|
+
import { SetRangeValuesMutation as se, RemoveSheetMutation as st, getSheetCommandTarget as Xe, SetRangeValuesUndoMutationFactory as nt, WorksheetViewPermission as xt, RefRangeService as Bt, handleCommonDefaultRangeChangeWithEffectRefCommands as Ht, SheetInterceptorService as lt, RemoveSheetCommand as Pt, SheetsSelectionsService as ut, ClearSelectionAllCommand as Wt } from "@univerjs/sheets";
|
|
7
|
+
import { Subject as Qe, bufferWhen as $t, filter as Je } from "rxjs";
|
|
8
|
+
import { RegisterOtherFormulaService as dt, FormulaRefRangeService as ct } from "@univerjs/sheets-formula";
|
|
9
|
+
import { ERROR_TYPE_SET as kt, LexerTreeBuilder as Y, isReferenceString as ht, sequenceNodeType as jt, deserializeRangeWithSheet as Qt, deserializeRangeWithSheetWithCache as qt, operatorToken as Gt } from "@univerjs/engine-formula";
|
|
10
|
+
const Yt = "SHEET_DATA_VALIDATION_PLUGIN";
|
|
11
|
+
var Xt = Object.getOwnPropertyDescriptor, Kt = (o, a, e, t) => {
|
|
12
|
+
for (var r = t > 1 ? void 0 : t ? Xt(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
13
13
|
(s = o[i]) && (r = s(r) || r);
|
|
14
14
|
return r;
|
|
15
|
-
},
|
|
16
|
-
let Q = class extends
|
|
15
|
+
}, et = (o, a) => (e, t) => a(e, t, o);
|
|
16
|
+
let Q = class extends P {
|
|
17
17
|
constructor(a, e) {
|
|
18
18
|
super();
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
m(this, "_cacheMatrix", /* @__PURE__ */ new Map());
|
|
20
|
+
m(this, "_dirtyRanges$", new Qe());
|
|
21
|
+
m(this, "dirtyRanges$", this._dirtyRanges$.asObservable());
|
|
22
22
|
this._commandService = a, this._univerInstanceService = e, this._initDirtyRanges(), this._initSheetRemove();
|
|
23
23
|
}
|
|
24
24
|
_initDirtyRanges() {
|
|
@@ -36,7 +36,7 @@ let Q = class extends W {
|
|
|
36
36
|
_initSheetRemove() {
|
|
37
37
|
this.disposeWithMe(this._commandService.onCommandExecuted((a) => {
|
|
38
38
|
var e;
|
|
39
|
-
if (a.id ===
|
|
39
|
+
if (a.id === st.id) {
|
|
40
40
|
const { unitId: t, subUnitId: r } = a.params;
|
|
41
41
|
(e = this._cacheMatrix.get(t)) == null || e.delete(r);
|
|
42
42
|
}
|
|
@@ -79,9 +79,9 @@ let Q = class extends W {
|
|
|
79
79
|
return this._ensureCache(a, e).getValue(t, r);
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
-
Q =
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
Q = Kt([
|
|
83
|
+
et(0, R(U)),
|
|
84
|
+
et(1, R(O))
|
|
85
85
|
], Q);
|
|
86
86
|
function oe(o) {
|
|
87
87
|
var a, e;
|
|
@@ -92,26 +92,26 @@ function _e(o) {
|
|
|
92
92
|
return (a = o == null ? void 0 : o[0]) == null ? void 0 : a[0];
|
|
93
93
|
}
|
|
94
94
|
function C(o) {
|
|
95
|
-
return
|
|
95
|
+
return !kt.has(o);
|
|
96
96
|
}
|
|
97
97
|
function de(o, a) {
|
|
98
98
|
var t;
|
|
99
99
|
const e = a.getValidatorItem(o);
|
|
100
100
|
return (t = e == null ? void 0 : e.offsetFormulaByRange) != null ? t : !1;
|
|
101
101
|
}
|
|
102
|
-
var
|
|
103
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
102
|
+
var zt = Object.getOwnPropertyDescriptor, Zt = (o, a, e, t) => {
|
|
103
|
+
for (var r = t > 1 ? void 0 : t ? zt(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
104
104
|
(s = o[i]) && (r = s(r) || r);
|
|
105
105
|
return r;
|
|
106
106
|
}, re = (o, a) => (e, t) => a(e, t, o);
|
|
107
|
-
let H = class extends
|
|
107
|
+
let H = class extends P {
|
|
108
108
|
constructor(a, e, t, r, i) {
|
|
109
109
|
super();
|
|
110
110
|
/**
|
|
111
111
|
* Map of origin formula of rule
|
|
112
112
|
*/
|
|
113
|
-
|
|
114
|
-
|
|
113
|
+
m(this, "_ruleFormulaMap", /* @__PURE__ */ new Map());
|
|
114
|
+
m(this, "_ruleFormulaMap2", /* @__PURE__ */ new Map());
|
|
115
115
|
this._instanceSrv = a, this._registerOtherFormulaService = e, this._dataValidationModel = t, this._dataValidationCacheService = r, this._validatorRegistryService = i, this._initFormulaResultHandler(), this._initDirtyRanges();
|
|
116
116
|
}
|
|
117
117
|
_initFormulaResultHandler() {
|
|
@@ -122,8 +122,8 @@ let H = class extends W {
|
|
|
122
122
|
for (const i in t) {
|
|
123
123
|
const s = t[i], { ruleFormulaMap: n } = this._ensureMaps(e, i);
|
|
124
124
|
s.forEach((l) => {
|
|
125
|
-
var c,
|
|
126
|
-
const u = n.get((c = l.extra) == null ? void 0 : c.ruleId), d = this._dataValidationModel.getRuleById(e, i, (
|
|
125
|
+
var c, g;
|
|
126
|
+
const u = n.get((c = l.extra) == null ? void 0 : c.ruleId), d = this._dataValidationModel.getRuleById(e, i, (g = l.extra) == null ? void 0 : g.ruleId);
|
|
127
127
|
d && u && this._dataValidationCacheService.markRangeDirty(e, i, d.ranges);
|
|
128
128
|
});
|
|
129
129
|
}
|
|
@@ -144,7 +144,7 @@ let H = class extends W {
|
|
|
144
144
|
_handleDirtyRanges(a, e, t) {
|
|
145
145
|
this._dataValidationModel.getRules(a, e).forEach((i) => {
|
|
146
146
|
const s = i.ranges;
|
|
147
|
-
|
|
147
|
+
A.doAnyRangesIntersect(s, t) && this.makeRuleDirty(a, e, i.uid);
|
|
148
148
|
});
|
|
149
149
|
}
|
|
150
150
|
_initDirtyRanges() {
|
|
@@ -193,32 +193,32 @@ let H = class extends W {
|
|
|
193
193
|
const { ruleFormulaMap: s } = this._ensureMaps(a, e), n = s.get(t);
|
|
194
194
|
if (!n)
|
|
195
195
|
return Promise.resolve(void 0);
|
|
196
|
-
const l = await this._registerOtherFormulaService.getFormulaValue(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u,
|
|
197
|
-
return _e((_ = (p = l == null ? void 0 : l.result) == null ? void 0 : p[c]) == null ? void 0 : _[
|
|
196
|
+
const l = await this._registerOtherFormulaService.getFormulaValue(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, g = i - d;
|
|
197
|
+
return _e((_ = (p = l == null ? void 0 : l.result) == null ? void 0 : p[c]) == null ? void 0 : _[g]);
|
|
198
198
|
}
|
|
199
199
|
async getCellFormula2Value(a, e, t, r, i) {
|
|
200
200
|
var p, _;
|
|
201
201
|
const { ruleFormulaMap2: s } = this._ensureMaps(a, e), n = s.get(t);
|
|
202
202
|
if (!n)
|
|
203
203
|
return Promise.resolve(void 0);
|
|
204
|
-
const l = await this._registerOtherFormulaService.getFormulaValue(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u,
|
|
205
|
-
return _e((_ = (p = l == null ? void 0 : l.result) == null ? void 0 : p[c]) == null ? void 0 : _[
|
|
204
|
+
const l = await this._registerOtherFormulaService.getFormulaValue(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, g = i - d;
|
|
205
|
+
return _e((_ = (p = l == null ? void 0 : l.result) == null ? void 0 : p[c]) == null ? void 0 : _[g]);
|
|
206
206
|
}
|
|
207
207
|
getCellFormulaValueSync(a, e, t, r, i) {
|
|
208
208
|
var p, _;
|
|
209
209
|
const { ruleFormulaMap: s } = this._ensureMaps(a, e), n = s.get(t);
|
|
210
210
|
if (!n)
|
|
211
211
|
return;
|
|
212
|
-
const l = this._registerOtherFormulaService.getFormulaValueSync(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u,
|
|
213
|
-
return _e((_ = (p = l == null ? void 0 : l.result) == null ? void 0 : p[c]) == null ? void 0 : _[
|
|
212
|
+
const l = this._registerOtherFormulaService.getFormulaValueSync(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, g = i - d;
|
|
213
|
+
return _e((_ = (p = l == null ? void 0 : l.result) == null ? void 0 : p[c]) == null ? void 0 : _[g]);
|
|
214
214
|
}
|
|
215
215
|
getCellFormula2ValueSync(a, e, t, r, i) {
|
|
216
216
|
var p, _;
|
|
217
217
|
const { ruleFormulaMap2: s } = this._ensureMaps(a, e), n = s.get(t);
|
|
218
218
|
if (!n)
|
|
219
219
|
return;
|
|
220
|
-
const l = this._registerOtherFormulaService.getFormulaValueSync(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u,
|
|
221
|
-
return _e((_ = (p = l == null ? void 0 : l.result) == null ? void 0 : p[c]) == null ? void 0 : _[
|
|
220
|
+
const l = this._registerOtherFormulaService.getFormulaValueSync(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, g = i - d;
|
|
221
|
+
return _e((_ = (p = l == null ? void 0 : l.result) == null ? void 0 : p[c]) == null ? void 0 : _[g]);
|
|
222
222
|
}
|
|
223
223
|
getRuleFormulaInfo(a, e, t) {
|
|
224
224
|
const { ruleFormulaMap: r } = this._ensureMaps(a, e);
|
|
@@ -230,22 +230,22 @@ let H = class extends W {
|
|
|
230
230
|
r && this._registerOtherFormulaService.markFormulaDirty(a, e, r.formulaId), i && this._registerOtherFormulaService.markFormulaDirty(a, e, i.formulaId);
|
|
231
231
|
}
|
|
232
232
|
};
|
|
233
|
-
H =
|
|
234
|
-
re(0,
|
|
235
|
-
re(1,
|
|
236
|
-
re(2,
|
|
237
|
-
re(3,
|
|
238
|
-
re(4,
|
|
233
|
+
H = Zt([
|
|
234
|
+
re(0, O),
|
|
235
|
+
re(1, R(dt)),
|
|
236
|
+
re(2, R(Ye)),
|
|
237
|
+
re(3, R(Q)),
|
|
238
|
+
re(4, R(q))
|
|
239
239
|
], H);
|
|
240
|
-
var
|
|
241
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
240
|
+
var Jt = Object.getOwnPropertyDescriptor, ea = (o, a, e, t) => {
|
|
241
|
+
for (var r = t > 1 ? void 0 : t ? Jt(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
242
242
|
(s = o[i]) && (r = s(r) || r);
|
|
243
243
|
return r;
|
|
244
244
|
}, ie = (o, a) => (e, t) => a(e, t, o);
|
|
245
|
-
let K = class extends
|
|
245
|
+
let K = class extends P {
|
|
246
246
|
constructor(a, e, t, r, i) {
|
|
247
247
|
super();
|
|
248
|
-
|
|
248
|
+
m(this, "_formulaRuleMap", /* @__PURE__ */ new Map());
|
|
249
249
|
this._instanceService = a, this._registerOtherFormulaService = e, this._dataValidationCacheService = t, this._dataValidationModel = r, this._validatorRegistryService = i, this._initFormulaResultHandler();
|
|
250
250
|
}
|
|
251
251
|
_initFormulaResultHandler() {
|
|
@@ -322,26 +322,26 @@ let K = class extends W {
|
|
|
322
322
|
return this._ensureRuleFormulaMap(a, e).get(t);
|
|
323
323
|
}
|
|
324
324
|
};
|
|
325
|
-
K =
|
|
326
|
-
ie(0,
|
|
327
|
-
ie(1,
|
|
328
|
-
ie(2,
|
|
329
|
-
ie(3,
|
|
330
|
-
ie(4,
|
|
325
|
+
K = ea([
|
|
326
|
+
ie(0, O),
|
|
327
|
+
ie(1, R(dt)),
|
|
328
|
+
ie(2, R(Q)),
|
|
329
|
+
ie(3, R(Ye)),
|
|
330
|
+
ie(4, R(q))
|
|
331
331
|
], K);
|
|
332
332
|
function ne(o) {
|
|
333
|
-
return
|
|
333
|
+
return St(o);
|
|
334
334
|
}
|
|
335
|
-
function
|
|
335
|
+
function mt(o) {
|
|
336
336
|
var a;
|
|
337
337
|
return String((a = ne(o)) != null ? a : "");
|
|
338
338
|
}
|
|
339
|
-
class
|
|
339
|
+
class Ke {
|
|
340
340
|
constructor(a, e, t, r, i = !1) {
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
341
|
+
m(this, "_map");
|
|
342
|
+
m(this, "_tree", new Mt());
|
|
343
|
+
m(this, "_dirty", !0);
|
|
344
|
+
m(this, "_buildTree", () => {
|
|
345
345
|
if (!this._dirty || this._disableTree)
|
|
346
346
|
return;
|
|
347
347
|
this._tree.clear();
|
|
@@ -358,7 +358,7 @@ class Xe {
|
|
|
358
358
|
});
|
|
359
359
|
}), this._tree.load(a), this._dirty = !1;
|
|
360
360
|
});
|
|
361
|
-
|
|
361
|
+
m(this, "_debonceBuildTree", Vt(this._buildTree, 0));
|
|
362
362
|
this._unitId = e, this._subUnitId = t, this._univerInstanceService = r, this._disableTree = i, this._map = a, this._buildTree();
|
|
363
363
|
}
|
|
364
364
|
get _worksheet() {
|
|
@@ -368,9 +368,9 @@ class Xe {
|
|
|
368
368
|
_addRule(a, e) {
|
|
369
369
|
if (!this._worksheet)
|
|
370
370
|
return;
|
|
371
|
-
const t =
|
|
371
|
+
const t = A.mergeRanges(e.map((r) => b.transformRange(r, this._worksheet)));
|
|
372
372
|
this._map.forEach((r, i) => {
|
|
373
|
-
const s =
|
|
373
|
+
const s = A.subtractMulti(r, t);
|
|
374
374
|
s.length === 0 ? this._map.delete(i) : this._map.set(i, s);
|
|
375
375
|
}), this._dirty = !0, this._map.set(a, t), this._debonceBuildTree();
|
|
376
376
|
}
|
|
@@ -382,7 +382,7 @@ class Xe {
|
|
|
382
382
|
return;
|
|
383
383
|
const e = a.map((t) => b.transformRange(t, this._worksheet));
|
|
384
384
|
this._map.forEach((t, r) => {
|
|
385
|
-
const i =
|
|
385
|
+
const i = A.subtractMulti(t, e);
|
|
386
386
|
i.length === 0 ? this._map.delete(r) : this._map.set(r, i);
|
|
387
387
|
}), this._dirty = !0, this._debonceBuildTree();
|
|
388
388
|
}
|
|
@@ -400,10 +400,10 @@ class Xe {
|
|
|
400
400
|
if (!t.length)
|
|
401
401
|
return;
|
|
402
402
|
let r = this._map.get(e);
|
|
403
|
-
r ? (this._map.set(e,
|
|
403
|
+
r ? (this._map.set(e, A.mergeRanges([...r, ...t])), r = this._map.get(e)) : (r = t, this._map.set(e, r)), this._map.forEach((i, s) => {
|
|
404
404
|
if (s === e)
|
|
405
405
|
return;
|
|
406
|
-
const n =
|
|
406
|
+
const n = A.subtractMulti(i, t);
|
|
407
407
|
n.length === 0 ? this._map.delete(s) : this._map.set(s, n);
|
|
408
408
|
});
|
|
409
409
|
}), this._dirty = !0, this._debonceBuildTree();
|
|
@@ -414,11 +414,11 @@ class Xe {
|
|
|
414
414
|
return a.forEach((r, i) => {
|
|
415
415
|
var l;
|
|
416
416
|
const s = (l = this._map.get(r.uid)) != null ? l : [], n = r.ranges;
|
|
417
|
-
s.length !== 0 && (s.length !== n.length || s.some((u, d) => !
|
|
417
|
+
s.length !== 0 && (s.length !== n.length || s.some((u, d) => !A.equals(u, n[d]))) && e.push({
|
|
418
418
|
type: "update",
|
|
419
419
|
ruleId: r.uid,
|
|
420
420
|
oldRanges: n,
|
|
421
|
-
newRanges:
|
|
421
|
+
newRanges: A.sort(s),
|
|
422
422
|
rule: r
|
|
423
423
|
}), s.length === 0 && (e.push({
|
|
424
424
|
type: "delete",
|
|
@@ -433,11 +433,11 @@ class Xe {
|
|
|
433
433
|
return a.forEach((i, s) => {
|
|
434
434
|
var u;
|
|
435
435
|
const n = (u = this._map.get(i.uid)) != null ? u : [], l = i.ranges;
|
|
436
|
-
n.length !== 0 && (n.length !== l.length || n.some((d, c) => !
|
|
436
|
+
n.length !== 0 && (n.length !== l.length || n.some((d, c) => !A.equals(d, l[c]))) && t.push({
|
|
437
437
|
type: "update",
|
|
438
438
|
ruleId: i.uid,
|
|
439
439
|
oldRanges: l,
|
|
440
|
-
newRanges:
|
|
440
|
+
newRanges: A.sort(n),
|
|
441
441
|
rule: i
|
|
442
442
|
}), n.length === 0 && (t.push({
|
|
443
443
|
type: "delete",
|
|
@@ -451,14 +451,14 @@ class Xe {
|
|
|
451
451
|
type: "add",
|
|
452
452
|
rule: {
|
|
453
453
|
...i,
|
|
454
|
-
ranges:
|
|
454
|
+
ranges: A.sort(s)
|
|
455
455
|
}
|
|
456
456
|
});
|
|
457
457
|
}), t;
|
|
458
458
|
}
|
|
459
459
|
clone() {
|
|
460
|
-
return new
|
|
461
|
-
new Map(
|
|
460
|
+
return new Ke(
|
|
461
|
+
new Map(M.deepClone(Array.from(this._map.entries()))),
|
|
462
462
|
this._unitId,
|
|
463
463
|
this._subUnitId,
|
|
464
464
|
this._univerInstanceService,
|
|
@@ -477,19 +477,19 @@ class Xe {
|
|
|
477
477
|
return t.length > 0 ? t[0].ruleId : void 0;
|
|
478
478
|
}
|
|
479
479
|
}
|
|
480
|
-
var
|
|
481
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
480
|
+
var ta = Object.getOwnPropertyDescriptor, aa = (o, a, e, t) => {
|
|
481
|
+
for (var r = t > 1 ? void 0 : t ? ta(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
482
482
|
(s = o[i]) && (r = s(r) || r);
|
|
483
483
|
return r;
|
|
484
484
|
}, X = (o, a) => (e, t) => a(e, t, o);
|
|
485
|
-
let F = class extends
|
|
485
|
+
let F = class extends P {
|
|
486
486
|
constructor(a, e, t, r, i, s, n) {
|
|
487
487
|
super();
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
488
|
+
m(this, "_ruleMatrixMap", /* @__PURE__ */ new Map());
|
|
489
|
+
m(this, "_validStatusChange$", new Qe());
|
|
490
|
+
m(this, "_ruleChange$", new Qe());
|
|
491
|
+
m(this, "ruleChange$", this._ruleChange$.asObservable());
|
|
492
|
+
m(this, "validStatusChange$", this._validStatusChange$.asObservable());
|
|
493
493
|
this._dataValidationModel = a, this._univerInstanceService = e, this._dataValidatorRegistryService = t, this._dataValidationCacheService = r, this._dataValidationFormulaService = i, this._dataValidationCustomFormulaService = s, this._commandService = n, this._initRuleUpdateListener(), this.disposeWithMe(() => {
|
|
494
494
|
this._ruleChange$.complete(), this._validStatusChange$.complete();
|
|
495
495
|
}), this._initUniverInstanceListener();
|
|
@@ -501,7 +501,7 @@ let F = class extends W {
|
|
|
501
501
|
})
|
|
502
502
|
), this.disposeWithMe(
|
|
503
503
|
this._commandService.onCommandExecuted((a) => {
|
|
504
|
-
if (a.id ===
|
|
504
|
+
if (a.id === st.id) {
|
|
505
505
|
const { unitId: e, subUnitId: t } = a.params, r = this._ruleMatrixMap.get(e);
|
|
506
506
|
r && r.delete(t);
|
|
507
507
|
}
|
|
@@ -541,7 +541,7 @@ let F = class extends W {
|
|
|
541
541
|
let t = this._ruleMatrixMap.get(a);
|
|
542
542
|
t || (t = /* @__PURE__ */ new Map(), this._ruleMatrixMap.set(a, t));
|
|
543
543
|
let r = t.get(e);
|
|
544
|
-
return r || (r = new
|
|
544
|
+
return r || (r = new Ke(/* @__PURE__ */ new Map(), a, e, this._univerInstanceService), t.set(e, r)), r;
|
|
545
545
|
}
|
|
546
546
|
_addRuleSideEffect(a, e, t) {
|
|
547
547
|
this._ensureRuleMatrix(a, e).addRule(t), this._dataValidationCacheService.addRule(a, e, t), this._dataValidationFormulaService.addRule(a, e, t), this._dataValidationCustomFormulaService.addRule(a, e, t);
|
|
@@ -573,8 +573,8 @@ let F = class extends W {
|
|
|
573
573
|
return this._dataValidationModel.getRuleById(a, e, i);
|
|
574
574
|
}
|
|
575
575
|
validator(a, e, t) {
|
|
576
|
-
const { col: r, row: i, unitId: s, subUnitId: n, worksheet: l } = e, u = (_,
|
|
577
|
-
t && t(_,
|
|
576
|
+
const { col: r, row: i, unitId: s, subUnitId: n, worksheet: l } = e, u = (_, v) => {
|
|
577
|
+
t && t(_, v), v && this._validStatusChange$.next({
|
|
578
578
|
unitId: s,
|
|
579
579
|
subUnitId: n,
|
|
580
580
|
ruleId: a.uid,
|
|
@@ -582,10 +582,10 @@ let F = class extends W {
|
|
|
582
582
|
row: i,
|
|
583
583
|
col: r
|
|
584
584
|
});
|
|
585
|
-
}, d = l.getCellValueOnly(i, r), c = this.getValidator(a.type),
|
|
585
|
+
}, d = l.getCellValueOnly(i, r), c = this.getValidator(a.type), g = l.getCellRaw(i, r), p = ne(g);
|
|
586
586
|
if (c) {
|
|
587
|
-
const _ = this._dataValidationCacheService.ensureCache(s, n),
|
|
588
|
-
return
|
|
587
|
+
const _ = this._dataValidationCacheService.ensureCache(s, n), v = _.getValue(i, r);
|
|
588
|
+
return v == null ? (_.setValue(i, r, D.VALIDATING), c.validator(
|
|
589
589
|
{
|
|
590
590
|
value: p,
|
|
591
591
|
unitId: s,
|
|
@@ -595,13 +595,13 @@ let F = class extends W {
|
|
|
595
595
|
worksheet: e.worksheet,
|
|
596
596
|
workbook: e.workbook,
|
|
597
597
|
interceptValue: ne(d),
|
|
598
|
-
t:
|
|
598
|
+
t: g == null ? void 0 : g.t
|
|
599
599
|
},
|
|
600
600
|
a
|
|
601
|
-
).then((
|
|
602
|
-
const f =
|
|
603
|
-
f === D.VALID ? _.realDeleteValue(i, r) : _.setValue(i, r, f), u(f,
|
|
604
|
-
}), D.VALIDATING) : (u(
|
|
601
|
+
).then((V) => {
|
|
602
|
+
const f = V ? D.VALID : D.INVALID, w = _.getValue(i, r);
|
|
603
|
+
f === D.VALID ? _.realDeleteValue(i, r) : _.setValue(i, r, f), u(f, v !== w);
|
|
604
|
+
}), D.VALIDATING) : (u(v != null ? v : D.VALID, !1), v != null ? v : D.VALID);
|
|
605
605
|
} else
|
|
606
606
|
return u(D.VALID, !1), D.VALID;
|
|
607
607
|
}
|
|
@@ -630,37 +630,38 @@ let F = class extends W {
|
|
|
630
630
|
return this._dataValidationModel.getAll();
|
|
631
631
|
}
|
|
632
632
|
};
|
|
633
|
-
F =
|
|
634
|
-
X(0,
|
|
635
|
-
X(1,
|
|
636
|
-
X(2,
|
|
637
|
-
X(3,
|
|
638
|
-
X(4,
|
|
639
|
-
X(5,
|
|
640
|
-
X(6,
|
|
633
|
+
F = aa([
|
|
634
|
+
X(0, R(Ye)),
|
|
635
|
+
X(1, O),
|
|
636
|
+
X(2, R(q)),
|
|
637
|
+
X(3, R(Q)),
|
|
638
|
+
X(4, R(K)),
|
|
639
|
+
X(5, R(H)),
|
|
640
|
+
X(6, U)
|
|
641
641
|
], F);
|
|
642
|
-
const
|
|
643
|
-
function
|
|
644
|
-
return
|
|
642
|
+
const Me = 1, Ve = 0;
|
|
643
|
+
function tt(o, a) {
|
|
644
|
+
return M.isBlank(o) ? a.t("dataValidation.validFail.value") : S(o) ? a.t("dataValidation.validFail.primitive") : "";
|
|
645
645
|
}
|
|
646
|
-
const pe = (o) =>
|
|
647
|
-
class
|
|
646
|
+
const pe = (o) => M.isDefine(o) && String(o).toLowerCase() === "true" ? "1" : String(o).toLowerCase() === "false" ? "0" : o;
|
|
647
|
+
class ra extends G {
|
|
648
648
|
constructor() {
|
|
649
649
|
super(...arguments);
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
650
|
+
m(this, "id", T.CHECKBOX);
|
|
651
|
+
m(this, "title", "dataValidation.checkbox.title");
|
|
652
|
+
m(this, "operators", []);
|
|
653
|
+
m(this, "scopes", ["sheet"]);
|
|
654
|
+
m(this, "order", 41);
|
|
655
|
+
m(this, "offsetFormulaByRange", !1);
|
|
656
|
+
m(this, "_formulaService", this.injector.get(K));
|
|
657
|
+
m(this, "skipDefaultFontRender", (e, t, r) => {
|
|
657
658
|
const { unitId: i, subUnitId: s } = r, { formula1: n, formula2: l } = this.parseFormulaSync(e, i, s), u = `${t != null ? t : ""}`;
|
|
658
659
|
return !u || u === `${n}` || u === `${l}`;
|
|
659
660
|
});
|
|
660
661
|
}
|
|
661
662
|
validatorFormula(e, t, r) {
|
|
662
663
|
const { formula1: i, formula2: s } = e, n = i === s;
|
|
663
|
-
if (
|
|
664
|
+
if (M.isBlank(i) && M.isBlank(s))
|
|
664
665
|
return {
|
|
665
666
|
success: !0
|
|
666
667
|
};
|
|
@@ -670,7 +671,7 @@ class aa extends G {
|
|
|
670
671
|
formula1: this.localeService.t("dataValidation.validFail.checkboxEqual"),
|
|
671
672
|
formula2: this.localeService.t("dataValidation.validFail.checkboxEqual")
|
|
672
673
|
};
|
|
673
|
-
const l =
|
|
674
|
+
const l = tt(i, this.localeService), u = tt(s, this.localeService);
|
|
674
675
|
return {
|
|
675
676
|
success: !l && !u,
|
|
676
677
|
formula1: l,
|
|
@@ -678,8 +679,8 @@ class aa extends G {
|
|
|
678
679
|
};
|
|
679
680
|
}
|
|
680
681
|
async parseFormula(e, t, r) {
|
|
681
|
-
var c,
|
|
682
|
-
const { formula1: i =
|
|
682
|
+
var c, g, p, _;
|
|
683
|
+
const { formula1: i = Me, formula2: s = Ve } = e, n = await this._formulaService.getRuleFormulaResult(t, r, e.uid), l = S(i) ? oe((g = (c = n == null ? void 0 : n[0]) == null ? void 0 : c.result) == null ? void 0 : g[0][0]) : i, u = S(s) ? oe((_ = (p = n == null ? void 0 : n[1]) == null ? void 0 : p.result) == null ? void 0 : _[0][0]) : s, d = C(String(l)) && C(String(u));
|
|
683
684
|
return {
|
|
684
685
|
formula1: pe(l),
|
|
685
686
|
formula2: pe(u),
|
|
@@ -690,12 +691,12 @@ class aa extends G {
|
|
|
690
691
|
}
|
|
691
692
|
getExtraStyle(e, t) {
|
|
692
693
|
return {
|
|
693
|
-
tb:
|
|
694
|
+
tb: Re.CLIP
|
|
694
695
|
};
|
|
695
696
|
}
|
|
696
697
|
parseFormulaSync(e, t, r) {
|
|
697
|
-
var c,
|
|
698
|
-
const { formula1: i =
|
|
698
|
+
var c, g, p, _;
|
|
699
|
+
const { formula1: i = Me, formula2: s = Ve } = e, n = this._formulaService.getRuleFormulaResultSync(t, r, e.uid), l = S(i) ? oe((g = (c = n == null ? void 0 : n[0]) == null ? void 0 : c.result) == null ? void 0 : g[0][0]) : i, u = S(s) ? oe((_ = (p = n == null ? void 0 : n[1]) == null ? void 0 : p.result) == null ? void 0 : _[0][0]) : s, d = C(String(l)) && C(String(u));
|
|
699
700
|
return {
|
|
700
701
|
formula1: pe(l),
|
|
701
702
|
formula2: pe(u),
|
|
@@ -706,13 +707,16 @@ class aa extends G {
|
|
|
706
707
|
}
|
|
707
708
|
async isValidType(e, t, r) {
|
|
708
709
|
const { value: i, unitId: s, subUnitId: n } = e, { formula1: l, formula2: u, originFormula1: d, originFormula2: c } = await this.parseFormula(r, s, n);
|
|
709
|
-
return !
|
|
710
|
+
return !M.isDefine(l) || !M.isDefine(u) ? !0 : M.isDefine(i) && (String(i) === String(l) || String(i) === String(u) || String(i) === String(d != null ? d : "") || String(i) === String(c != null ? c : ""));
|
|
710
711
|
}
|
|
711
712
|
generateRuleErrorMessage(e) {
|
|
712
713
|
return this.localeService.t("dataValidation.checkbox.error");
|
|
713
714
|
}
|
|
715
|
+
generateRuleName(e) {
|
|
716
|
+
return this.titleStr;
|
|
717
|
+
}
|
|
714
718
|
}
|
|
715
|
-
const
|
|
719
|
+
const ia = {
|
|
716
720
|
[h.BETWEEN]: "dataValidation.date.operators.between",
|
|
717
721
|
[h.EQUAL]: "dataValidation.date.operators.equal",
|
|
718
722
|
[h.GREATER_THAN]: "dataValidation.date.operators.greaterThan",
|
|
@@ -723,7 +727,7 @@ const ra = {
|
|
|
723
727
|
[h.NOT_EQUAL]: "dataValidation.date.operators.notEqual"
|
|
724
728
|
};
|
|
725
729
|
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 + "";
|
|
726
|
-
const
|
|
730
|
+
const at = {
|
|
727
731
|
[h.BETWEEN]: "dataValidation.date.ruleName.between",
|
|
728
732
|
[h.EQUAL]: "dataValidation.date.ruleName.equal",
|
|
729
733
|
[h.GREATER_THAN]: "dataValidation.date.ruleName.greaterThan",
|
|
@@ -731,7 +735,8 @@ const ia = {
|
|
|
731
735
|
[h.LESS_THAN]: "dataValidation.date.ruleName.lessThan",
|
|
732
736
|
[h.LESS_THAN_OR_EQUAL]: "dataValidation.date.ruleName.lessThanOrEqual",
|
|
733
737
|
[h.NOT_BETWEEN]: "dataValidation.date.ruleName.notBetween",
|
|
734
|
-
[h.NOT_EQUAL]: "dataValidation.date.ruleName.notEqual"
|
|
738
|
+
[h.NOT_EQUAL]: "dataValidation.date.ruleName.notEqual",
|
|
739
|
+
NONE: "dataValidation.date.ruleName.legal"
|
|
735
740
|
}, oa = {
|
|
736
741
|
[h.BETWEEN]: "dataValidation.date.errorMsg.between",
|
|
737
742
|
[h.EQUAL]: "dataValidation.date.errorMsg.equal",
|
|
@@ -740,8 +745,9 @@ const ia = {
|
|
|
740
745
|
[h.LESS_THAN]: "dataValidation.date.errorMsg.lessThan",
|
|
741
746
|
[h.LESS_THAN_OR_EQUAL]: "dataValidation.date.errorMsg.lessThanOrEqual",
|
|
742
747
|
[h.NOT_BETWEEN]: "dataValidation.date.errorMsg.notBetween",
|
|
743
|
-
[h.NOT_EQUAL]: "dataValidation.date.errorMsg.notEqual"
|
|
744
|
-
|
|
748
|
+
[h.NOT_EQUAL]: "dataValidation.date.errorMsg.notEqual",
|
|
749
|
+
NONE: "dataValidation.date.errorMsg.legal"
|
|
750
|
+
}, De = [
|
|
745
751
|
h.BETWEEN,
|
|
746
752
|
h.NOT_BETWEEN
|
|
747
753
|
], le = "{FORMULA1}", ue = "{FORMULA2}";
|
|
@@ -755,28 +761,29 @@ function Xa(o) {
|
|
|
755
761
|
const a = ne(o);
|
|
756
762
|
return a == null ? "" : a.toString();
|
|
757
763
|
}
|
|
758
|
-
function
|
|
764
|
+
function be(o, a, e) {
|
|
759
765
|
const { formula1: t, formula2: r } = a, i = a.ranges[0].startRow, s = a.ranges[0].startColumn, n = e.row - i, l = e.col - s, u = S(t) ? o.moveFormulaRefOffset(t, l, n, !0) : t, d = S(r) ? o.moveFormulaRefOffset(r, l, n, !0) : r;
|
|
760
766
|
return {
|
|
761
767
|
transformedFormula1: u,
|
|
762
768
|
transformedFormula2: d
|
|
763
769
|
};
|
|
764
770
|
}
|
|
765
|
-
const
|
|
771
|
+
const He = (o) => {
|
|
766
772
|
var e, t;
|
|
767
773
|
if (o == null || typeof o == "boolean")
|
|
768
774
|
return;
|
|
769
775
|
if (typeof o == "number" || !Number.isNaN(+o))
|
|
770
776
|
return +o;
|
|
771
777
|
const a = (e = j.parseDate(o)) == null ? void 0 : e.v;
|
|
772
|
-
return
|
|
778
|
+
return M.isDefine(a) ? a : (t = j.parseDate(it(o).format("YYYY-MM-DD HH:mm:ss"))) == null ? void 0 : t.v;
|
|
773
779
|
};
|
|
774
780
|
class sa extends G {
|
|
775
781
|
constructor() {
|
|
776
782
|
super(...arguments);
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
783
|
+
m(this, "id", T.DATE);
|
|
784
|
+
m(this, "title", "dataValidation.date.title");
|
|
785
|
+
m(this, "order", 40);
|
|
786
|
+
m(this, "operators", [
|
|
780
787
|
h.BETWEEN,
|
|
781
788
|
h.EQUAL,
|
|
782
789
|
h.GREATER_THAN,
|
|
@@ -786,15 +793,15 @@ class sa extends G {
|
|
|
786
793
|
h.NOT_BETWEEN,
|
|
787
794
|
h.NOT_EQUAL
|
|
788
795
|
]);
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
796
|
+
m(this, "scopes", ["sheet"]);
|
|
797
|
+
m(this, "_customFormulaService", this.injector.get(H));
|
|
798
|
+
m(this, "_lexerTreeBuilder", this.injector.get(Y));
|
|
792
799
|
}
|
|
793
800
|
async parseFormula(e, t, r, i, s) {
|
|
794
801
|
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c = C(String(n == null ? void 0 : n.v)) && C(String(l == null ? void 0 : l.v));
|
|
795
802
|
return {
|
|
796
|
-
formula1:
|
|
797
|
-
formula2:
|
|
803
|
+
formula1: He(S(u) ? n == null ? void 0 : n.v : u),
|
|
804
|
+
formula2: He(S(d) ? l == null ? void 0 : l.v : d),
|
|
798
805
|
isFormulaValid: c
|
|
799
806
|
};
|
|
800
807
|
}
|
|
@@ -803,16 +810,16 @@ class sa extends G {
|
|
|
803
810
|
return typeof r == "number" && typeof t == "string" ? !0 : typeof t == "string" ? !!j.parseDate(t) : !1;
|
|
804
811
|
}
|
|
805
812
|
_validatorSingleFormula(e) {
|
|
806
|
-
return !
|
|
813
|
+
return !M.isBlank(e) && (S(e) || !Number.isNaN(+e) || !!(e && j.parseDate(e)));
|
|
807
814
|
}
|
|
808
815
|
validatorFormula(e, t, r) {
|
|
809
816
|
const i = e.operator;
|
|
810
817
|
if (!i)
|
|
811
818
|
return {
|
|
812
|
-
success: !
|
|
819
|
+
success: !0
|
|
813
820
|
};
|
|
814
821
|
const s = this._validatorSingleFormula(e.formula1), n = this.localeService.t("dataValidation.validFail.date");
|
|
815
|
-
if (
|
|
822
|
+
if (De.includes(i)) {
|
|
816
823
|
const u = this._validatorSingleFormula(e.formula2);
|
|
817
824
|
return {
|
|
818
825
|
success: s && u,
|
|
@@ -834,12 +841,12 @@ class sa extends G {
|
|
|
834
841
|
if (!Number.isNaN(+u))
|
|
835
842
|
d = j.dateFromSerial(+u);
|
|
836
843
|
else {
|
|
837
|
-
const
|
|
838
|
-
if (
|
|
844
|
+
const g = (c = j.parseDate(u)) == null ? void 0 : c.v;
|
|
845
|
+
if (g == null)
|
|
839
846
|
return "";
|
|
840
|
-
d = j.dateFromSerial(
|
|
847
|
+
d = j.dateFromSerial(g);
|
|
841
848
|
}
|
|
842
|
-
return
|
|
849
|
+
return it(`${d[0]}/${d[1]}/${d[2]} ${d[3]}:${d[4]}:${d[5]}`).format(n != null && n.showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD");
|
|
843
850
|
};
|
|
844
851
|
return {
|
|
845
852
|
formula1: S(i) ? i : l(`${i}`),
|
|
@@ -850,29 +857,29 @@ class sa extends G {
|
|
|
850
857
|
const { value: i } = e;
|
|
851
858
|
return {
|
|
852
859
|
...e,
|
|
853
|
-
value:
|
|
860
|
+
value: He(i)
|
|
854
861
|
};
|
|
855
862
|
}
|
|
856
863
|
get operatorNames() {
|
|
857
|
-
return this.operators.map((e) => this.localeService.t(
|
|
864
|
+
return this.operators.map((e) => this.localeService.t(ia[e]));
|
|
858
865
|
}
|
|
859
866
|
generateRuleName(e) {
|
|
860
867
|
var r, i;
|
|
861
868
|
if (!e.operator)
|
|
862
|
-
return this.
|
|
863
|
-
const t = this.localeService.t(
|
|
869
|
+
return this.localeService.t(at.NONE);
|
|
870
|
+
const t = this.localeService.t(at[e.operator]).replace(le, (r = e.formula1) != null ? r : "").replace(ue, (i = e.formula2) != null ? i : "");
|
|
864
871
|
return `${this.titleStr} ${t}`;
|
|
865
872
|
}
|
|
866
873
|
generateRuleErrorMessage(e, t) {
|
|
867
874
|
if (!e.operator)
|
|
868
875
|
return this.titleStr;
|
|
869
|
-
const { transformedFormula1: r, transformedFormula2: i } =
|
|
876
|
+
const { transformedFormula1: r, transformedFormula2: i } = be(this._lexerTreeBuilder, e, t);
|
|
870
877
|
return `${this.localeService.t(oa[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
871
878
|
}
|
|
872
879
|
}
|
|
873
880
|
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 + "";
|
|
874
881
|
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 + "";
|
|
875
|
-
const
|
|
882
|
+
const ye = {
|
|
876
883
|
[h.BETWEEN]: "dataValidation.errorMsg.between",
|
|
877
884
|
[h.EQUAL]: "dataValidation.errorMsg.equal",
|
|
878
885
|
[h.GREATER_THAN]: "dataValidation.errorMsg.greaterThan",
|
|
@@ -880,20 +887,22 @@ const ht = {
|
|
|
880
887
|
[h.LESS_THAN]: "dataValidation.errorMsg.lessThan",
|
|
881
888
|
[h.LESS_THAN_OR_EQUAL]: "dataValidation.errorMsg.lessThanOrEqual",
|
|
882
889
|
[h.NOT_BETWEEN]: "dataValidation.errorMsg.notBetween",
|
|
883
|
-
[h.NOT_EQUAL]: "dataValidation.errorMsg.notEqual"
|
|
890
|
+
[h.NOT_EQUAL]: "dataValidation.errorMsg.notEqual",
|
|
891
|
+
NONE: "dataValidation.errorMsg.legal"
|
|
884
892
|
};
|
|
885
|
-
function
|
|
893
|
+
function Ee(o) {
|
|
886
894
|
let a = o;
|
|
887
895
|
return typeof o == "string" ? ((o.startsWith("¥") || o.startsWith("$")) && (a = o.slice(1)), +a) : +o;
|
|
888
896
|
}
|
|
889
897
|
class na extends G {
|
|
890
898
|
constructor() {
|
|
891
899
|
super(...arguments);
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
900
|
+
m(this, "_customFormulaService", this.injector.get(H));
|
|
901
|
+
m(this, "id", T.DECIMAL);
|
|
902
|
+
m(this, "_lexerTreeBuilder", this.injector.get(Y));
|
|
903
|
+
m(this, "title", "dataValidation.decimal.title");
|
|
904
|
+
m(this, "order", 20);
|
|
905
|
+
m(this, "operators", [
|
|
897
906
|
h.BETWEEN,
|
|
898
907
|
h.EQUAL,
|
|
899
908
|
h.GREATER_THAN,
|
|
@@ -903,20 +912,20 @@ class na extends G {
|
|
|
903
912
|
h.NOT_BETWEEN,
|
|
904
913
|
h.NOT_EQUAL
|
|
905
914
|
]);
|
|
906
|
-
|
|
915
|
+
m(this, "scopes", ["sheet"]);
|
|
907
916
|
}
|
|
908
917
|
_isFormulaOrNumber(e) {
|
|
909
|
-
return !
|
|
918
|
+
return !M.isBlank(e) && (S(e) || !Number.isNaN(+e));
|
|
910
919
|
}
|
|
911
920
|
async isValidType(e, t, r) {
|
|
912
921
|
const { value: i } = e;
|
|
913
|
-
return !Number.isNaN(
|
|
922
|
+
return !Number.isNaN(Ee(i));
|
|
914
923
|
}
|
|
915
924
|
transform(e, t, r) {
|
|
916
925
|
const { value: i } = e;
|
|
917
926
|
return {
|
|
918
927
|
...e,
|
|
919
|
-
value:
|
|
928
|
+
value: Ee(i)
|
|
920
929
|
};
|
|
921
930
|
}
|
|
922
931
|
_parseNumber(e) {
|
|
@@ -934,9 +943,9 @@ class na extends G {
|
|
|
934
943
|
const i = e.operator;
|
|
935
944
|
if (!i)
|
|
936
945
|
return {
|
|
937
|
-
success: !
|
|
946
|
+
success: !0
|
|
938
947
|
};
|
|
939
|
-
const s =
|
|
948
|
+
const s = M.isDefine(e.formula1) && this._isFormulaOrNumber(e.formula1), n = M.isDefine(e.formula2) && this._isFormulaOrNumber(e.formula2), l = De.includes(i), u = this.localeService.t("dataValidation.validFail.number");
|
|
940
949
|
return l ? {
|
|
941
950
|
success: s && n,
|
|
942
951
|
formula1: s ? void 0 : u,
|
|
@@ -948,12 +957,12 @@ class na extends G {
|
|
|
948
957
|
}
|
|
949
958
|
generateRuleErrorMessage(e, t) {
|
|
950
959
|
if (!e.operator)
|
|
951
|
-
return this.titleStr;
|
|
952
|
-
const { transformedFormula1: r, transformedFormula2: i } =
|
|
953
|
-
return `${this.localeService.t(
|
|
960
|
+
return this.localeService.t(ye.NONE).replace("{TYPE}", this.titleStr);
|
|
961
|
+
const { transformedFormula1: r, transformedFormula2: i } = be(this._lexerTreeBuilder, e, t);
|
|
962
|
+
return `${this.localeService.t(ye[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
954
963
|
}
|
|
955
964
|
}
|
|
956
|
-
function
|
|
965
|
+
function Pe(o) {
|
|
957
966
|
if (!o)
|
|
958
967
|
return [];
|
|
959
968
|
const a = /* @__PURE__ */ new Set();
|
|
@@ -980,36 +989,37 @@ const la = [
|
|
|
980
989
|
"offset"
|
|
981
990
|
];
|
|
982
991
|
function ua(o, a) {
|
|
983
|
-
if (!S(o) ||
|
|
992
|
+
if (!S(o) || ht(o.slice(1)))
|
|
984
993
|
return !0;
|
|
985
994
|
const t = a.sequenceNodesBuilder(o);
|
|
986
|
-
return t && t.some((r) => typeof r == "object" && r.nodeType ===
|
|
995
|
+
return t && t.some((r) => typeof r == "object" && r.nodeType === jt.FUNCTION && la.indexOf(r.token.toLowerCase()) > -1);
|
|
987
996
|
}
|
|
988
997
|
function da(o, a) {
|
|
989
998
|
const { formula1: e = "", ranges: t } = o;
|
|
990
|
-
if (
|
|
991
|
-
const i =
|
|
992
|
-
if ((!i.sheetName || i.sheetName === a) && t.some((s) =>
|
|
999
|
+
if (ht(e.slice(1))) {
|
|
1000
|
+
const i = Qt(e.slice(1));
|
|
1001
|
+
if ((!i.sheetName || i.sheetName === a) && t.some((s) => A.intersects(s, i.range)))
|
|
993
1002
|
return !0;
|
|
994
1003
|
}
|
|
995
1004
|
return !1;
|
|
996
1005
|
}
|
|
997
|
-
class
|
|
1006
|
+
class gt extends G {
|
|
998
1007
|
constructor() {
|
|
999
1008
|
super(...arguments);
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
+
m(this, "formulaService", this.injector.get(K));
|
|
1010
|
+
m(this, "_lexer", this.injector.get(Y));
|
|
1011
|
+
m(this, "_univerInstanceService", this.injector.get(O));
|
|
1012
|
+
m(this, "order", 50);
|
|
1013
|
+
m(this, "offsetFormulaByRange", !1);
|
|
1014
|
+
m(this, "id", T.LIST);
|
|
1015
|
+
m(this, "title", "dataValidation.list.title");
|
|
1016
|
+
m(this, "operators", []);
|
|
1017
|
+
m(this, "scopes", ["sheet"]);
|
|
1018
|
+
m(this, "skipDefaultFontRender", (e) => e.renderMode !== Be.TEXT);
|
|
1009
1019
|
}
|
|
1010
1020
|
validatorFormula(e, t, r) {
|
|
1011
1021
|
var u, d, c;
|
|
1012
|
-
const i = !
|
|
1022
|
+
const i = !M.isBlank(e.formula1), s = ua((u = e.formula1) != null ? u : "", this._lexer), n = (c = (d = this._univerInstanceService.getUnit(t, N.UNIVER_SHEET)) == null ? void 0 : d.getSheetBySheetId(r)) == null ? void 0 : c.getName(), l = da(e, n != null ? n : "");
|
|
1013
1023
|
return {
|
|
1014
1024
|
success: !!(i && s && !l),
|
|
1015
1025
|
formula1: i ? s ? l ? this.localeService.t("dataValidation.validFail.listIntersects") : void 0 : this.localeService.t("dataValidation.validFail.listInvalid") : this.localeService.t("dataValidation.validFail.list")
|
|
@@ -1017,7 +1027,7 @@ class mt extends G {
|
|
|
1017
1027
|
}
|
|
1018
1028
|
getExtraStyle(e, t, { style: r }) {
|
|
1019
1029
|
var s;
|
|
1020
|
-
const i = (s = r.tb !==
|
|
1030
|
+
const i = (s = r.tb !== Re.OVERFLOW ? r.tb : Re.CLIP) != null ? s : Re.WRAP;
|
|
1021
1031
|
if (e.type === T.LIST && (e.renderMode === Be.ARROW || e.renderMode === Be.TEXT)) {
|
|
1022
1032
|
const n = this.getListWithColorMap(e), l = `${t != null ? t : ""}`, u = n[l];
|
|
1023
1033
|
if (u)
|
|
@@ -1046,8 +1056,8 @@ class mt extends G {
|
|
|
1046
1056
|
};
|
|
1047
1057
|
}
|
|
1048
1058
|
async isValidType(e, t, r) {
|
|
1049
|
-
var
|
|
1050
|
-
const { value: i, unitId: s, subUnitId: n } = e, { formula1: l = "" } = r, u = await this.formulaService.getRuleFormulaResult(s, n, r.uid), d = S(l) ?
|
|
1059
|
+
var g, p;
|
|
1060
|
+
const { value: i, unitId: s, subUnitId: n } = e, { formula1: l = "" } = r, u = await this.formulaService.getRuleFormulaResult(s, n, r.uid), d = S(l) ? Pe((p = (g = u == null ? void 0 : u[0]) == null ? void 0 : g.result) == null ? void 0 : p[0][0]) : fe(l);
|
|
1051
1061
|
return this.parseCellValue(i).every((_) => d.includes(_));
|
|
1052
1062
|
}
|
|
1053
1063
|
generateRuleName() {
|
|
@@ -1057,22 +1067,22 @@ class mt extends G {
|
|
|
1057
1067
|
return this.localeService.t("dataValidation.list.error");
|
|
1058
1068
|
}
|
|
1059
1069
|
getList(e, t, r) {
|
|
1060
|
-
var
|
|
1061
|
-
const { formula1: i = "" } = e, s = this.injector.get(
|
|
1070
|
+
var g, p, _, v;
|
|
1071
|
+
const { formula1: i = "" } = e, s = this.injector.get(O), n = (g = t ? s.getUniverSheetInstance(t) : void 0) != null ? g : s.getCurrentUnitForType(N.UNIVER_SHEET);
|
|
1062
1072
|
if (!n) return [];
|
|
1063
1073
|
const l = (p = r ? n.getSheetBySheetId(r) : void 0) != null ? p : n.getActiveSheet();
|
|
1064
1074
|
if (!l) return [];
|
|
1065
1075
|
const u = n.getUnitId(), d = l.getSheetId(), c = this.formulaService.getRuleFormulaResultSync(u, d, e.uid);
|
|
1066
|
-
return S(i) ?
|
|
1076
|
+
return S(i) ? Pe((v = (_ = c == null ? void 0 : c[0]) == null ? void 0 : _.result) == null ? void 0 : v[0][0]) : fe(i);
|
|
1067
1077
|
}
|
|
1068
1078
|
async getListAsync(e, t, r) {
|
|
1069
|
-
var
|
|
1070
|
-
const { formula1: i = "" } = e, s = this.injector.get(
|
|
1079
|
+
var g, p, _, v;
|
|
1080
|
+
const { formula1: i = "" } = e, s = this.injector.get(O), n = (g = t ? s.getUniverSheetInstance(t) : void 0) != null ? g : s.getCurrentUnitForType(N.UNIVER_SHEET);
|
|
1071
1081
|
if (!n) return [];
|
|
1072
1082
|
const l = (p = r ? n.getSheetBySheetId(r) : void 0) != null ? p : n.getActiveSheet();
|
|
1073
1083
|
if (!l) return [];
|
|
1074
1084
|
const u = n.getUnitId(), d = l.getSheetId(), c = await this.formulaService.getRuleFormulaResult(u, d, e.uid);
|
|
1075
|
-
return S(i) ?
|
|
1085
|
+
return S(i) ? Pe((v = (_ = c == null ? void 0 : c[0]) == null ? void 0 : _.result) == null ? void 0 : v[0][0]) : fe(i);
|
|
1076
1086
|
}
|
|
1077
1087
|
getListWithColor(e, t, r) {
|
|
1078
1088
|
const i = this.getList(e, t, r), s = (e.formula2 || "").split(",");
|
|
@@ -1088,10 +1098,11 @@ class mt extends G {
|
|
|
1088
1098
|
class ca extends G {
|
|
1089
1099
|
constructor() {
|
|
1090
1100
|
super(...arguments);
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1101
|
+
m(this, "id", T.TEXT_LENGTH);
|
|
1102
|
+
m(this, "title", "dataValidation.textLength.title");
|
|
1103
|
+
m(this, "_lexerTreeBuilder", this.injector.get(Y));
|
|
1104
|
+
m(this, "order", 30);
|
|
1105
|
+
m(this, "operators", [
|
|
1095
1106
|
h.BETWEEN,
|
|
1096
1107
|
h.EQUAL,
|
|
1097
1108
|
h.GREATER_THAN,
|
|
@@ -1101,11 +1112,11 @@ class ca extends G {
|
|
|
1101
1112
|
h.NOT_BETWEEN,
|
|
1102
1113
|
h.NOT_EQUAL
|
|
1103
1114
|
]);
|
|
1104
|
-
|
|
1105
|
-
|
|
1115
|
+
m(this, "scopes", ["sheet"]);
|
|
1116
|
+
m(this, "_customFormulaService", this.injector.get(H));
|
|
1106
1117
|
}
|
|
1107
1118
|
_isFormulaOrInt(e) {
|
|
1108
|
-
return !
|
|
1119
|
+
return !M.isBlank(e) && (S(e) || !Number.isNaN(+e) && Number.isInteger(+e));
|
|
1109
1120
|
}
|
|
1110
1121
|
validatorFormula(e, t, r) {
|
|
1111
1122
|
const i = e.operator;
|
|
@@ -1113,7 +1124,7 @@ class ca extends G {
|
|
|
1113
1124
|
return {
|
|
1114
1125
|
success: !1
|
|
1115
1126
|
};
|
|
1116
|
-
const s =
|
|
1127
|
+
const s = M.isDefine(e.formula1) && this._isFormulaOrInt(e.formula1), n = M.isDefine(e.formula2) && this._isFormulaOrInt(e.formula2), l = De.includes(i), u = this.localeService.t("dataValidation.validFail.number");
|
|
1117
1128
|
return l ? {
|
|
1118
1129
|
success: s && n,
|
|
1119
1130
|
formula1: s ? void 0 : u,
|
|
@@ -1147,29 +1158,29 @@ class ca extends G {
|
|
|
1147
1158
|
generateRuleErrorMessage(e, t) {
|
|
1148
1159
|
if (!e.operator)
|
|
1149
1160
|
return this.titleStr;
|
|
1150
|
-
const { transformedFormula1: r, transformedFormula2: i } =
|
|
1151
|
-
return `${this.localeService.t(
|
|
1161
|
+
const { transformedFormula1: r, transformedFormula2: i } = be(this._lexerTreeBuilder, e, t);
|
|
1162
|
+
return `${this.localeService.t(Dt[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
1152
1163
|
}
|
|
1153
1164
|
}
|
|
1154
|
-
function
|
|
1165
|
+
function _t(o) {
|
|
1155
1166
|
var e, t;
|
|
1156
|
-
return o ? o.p ? !((t = (e = o.p.body) == null ? void 0 : e.dataStream) != null ? t : "").slice(0, -2).trim() :
|
|
1167
|
+
return o ? o.p ? !((t = (e = o.p.body) == null ? void 0 : e.dataStream) != null ? t : "").slice(0, -2).trim() : M.isBlank(o.v) : !0;
|
|
1157
1168
|
}
|
|
1158
|
-
function
|
|
1159
|
-
const s = t.get(Y), n = t.get(q), l = [], u = [], d = t.get(F), c = t.get(
|
|
1160
|
-
if (!
|
|
1169
|
+
function Le(o, a, e, t, r = "command", i = !0) {
|
|
1170
|
+
const s = t.get(Y), n = t.get(q), l = [], u = [], d = t.get(F), c = t.get(O), g = Xe(c, { unitId: o, subUnitId: a });
|
|
1171
|
+
if (!g)
|
|
1161
1172
|
return {
|
|
1162
1173
|
redoMutations: l,
|
|
1163
1174
|
undoMutations: u
|
|
1164
1175
|
};
|
|
1165
|
-
const { worksheet: p } =
|
|
1166
|
-
let
|
|
1167
|
-
function
|
|
1168
|
-
i && f.forEach((
|
|
1169
|
-
b.foreach(
|
|
1170
|
-
const
|
|
1171
|
-
(
|
|
1172
|
-
v:
|
|
1176
|
+
const { worksheet: p } = g, _ = new Se();
|
|
1177
|
+
let v = !1;
|
|
1178
|
+
function V(f, w) {
|
|
1179
|
+
i && f.forEach((W) => {
|
|
1180
|
+
b.foreach(W, (x, $) => {
|
|
1181
|
+
const B = p.getCellRaw(x, $), J = mt(B);
|
|
1182
|
+
(_t(B) || J === w) && !(B != null && B.p) && (v = !0, _.setValue(x, $, {
|
|
1183
|
+
v: w,
|
|
1173
1184
|
p: null
|
|
1174
1185
|
}));
|
|
1175
1186
|
});
|
|
@@ -1179,7 +1190,7 @@ function be(o, a, e, t, r = "command", i = !0) {
|
|
|
1179
1190
|
switch (f.type) {
|
|
1180
1191
|
case "delete":
|
|
1181
1192
|
l.push({
|
|
1182
|
-
id:
|
|
1193
|
+
id: I.id,
|
|
1183
1194
|
params: {
|
|
1184
1195
|
unitId: o,
|
|
1185
1196
|
subUnitId: a,
|
|
@@ -1199,8 +1210,8 @@ function be(o, a, e, t, r = "command", i = !0) {
|
|
|
1199
1210
|
break;
|
|
1200
1211
|
case "update": {
|
|
1201
1212
|
if (de(f.rule.type, n)) {
|
|
1202
|
-
const
|
|
1203
|
-
he !== f.rule.formula1 || me !== f.rule.formula2 || !
|
|
1213
|
+
const W = f.oldRanges[0].startRow, x = f.oldRanges[0].startColumn, $ = f.newRanges[0].startRow, B = f.newRanges[0].startColumn, J = $ - W, ce = B - x, he = S(f.rule.formula1) ? s.moveFormulaRefOffset(f.rule.formula1, ce, J) : f.rule.formula1, me = S(f.rule.formula2) ? s.moveFormulaRefOffset(f.rule.formula2, ce, J) : f.rule.formula2;
|
|
1214
|
+
he !== f.rule.formula1 || me !== f.rule.formula2 || !ot(f.newRanges, f.oldRanges) ? (l.push({
|
|
1204
1215
|
id: E.id,
|
|
1205
1216
|
params: {
|
|
1206
1217
|
unitId: o,
|
|
@@ -1281,10 +1292,10 @@ function be(o, a, e, t, r = "command", i = !0) {
|
|
|
1281
1292
|
source: r
|
|
1282
1293
|
}
|
|
1283
1294
|
});
|
|
1284
|
-
const
|
|
1285
|
-
if (
|
|
1286
|
-
const
|
|
1287
|
-
|
|
1295
|
+
const w = d.getRuleById(o, a, f.ruleId);
|
|
1296
|
+
if (w && w.type === T.CHECKBOX) {
|
|
1297
|
+
const x = d.getValidator(T.CHECKBOX).parseFormulaSync(w, o, a);
|
|
1298
|
+
V(f.newRanges, x.formula2);
|
|
1288
1299
|
}
|
|
1289
1300
|
break;
|
|
1290
1301
|
}
|
|
@@ -1298,7 +1309,7 @@ function be(o, a, e, t, r = "command", i = !0) {
|
|
|
1298
1309
|
source: r
|
|
1299
1310
|
}
|
|
1300
1311
|
}), u.unshift({
|
|
1301
|
-
id:
|
|
1312
|
+
id: I.id,
|
|
1302
1313
|
params: {
|
|
1303
1314
|
unitId: o,
|
|
1304
1315
|
subUnitId: a,
|
|
@@ -1306,13 +1317,13 @@ function be(o, a, e, t, r = "command", i = !0) {
|
|
|
1306
1317
|
source: r
|
|
1307
1318
|
}
|
|
1308
1319
|
}), f.rule.type === T.CHECKBOX) {
|
|
1309
|
-
const
|
|
1310
|
-
|
|
1320
|
+
const W = d.getValidator(T.CHECKBOX).parseFormulaSync(f.rule, o, a);
|
|
1321
|
+
V(f.rule.ranges, W.originFormula2);
|
|
1311
1322
|
}
|
|
1312
1323
|
break;
|
|
1313
1324
|
}
|
|
1314
1325
|
}
|
|
1315
|
-
}),
|
|
1326
|
+
}), v) {
|
|
1316
1327
|
const f = {
|
|
1317
1328
|
id: se.id,
|
|
1318
1329
|
params: {
|
|
@@ -1320,11 +1331,11 @@ function be(o, a, e, t, r = "command", i = !0) {
|
|
|
1320
1331
|
subUnitId: a,
|
|
1321
1332
|
cellValue: _.getData()
|
|
1322
1333
|
}
|
|
1323
|
-
},
|
|
1334
|
+
}, w = {
|
|
1324
1335
|
id: se.id,
|
|
1325
|
-
params:
|
|
1336
|
+
params: nt(t, f.params)
|
|
1326
1337
|
};
|
|
1327
|
-
l.push(f), u.push(
|
|
1338
|
+
l.push(f), u.push(w);
|
|
1328
1339
|
}
|
|
1329
1340
|
return {
|
|
1330
1341
|
redoMutations: l,
|
|
@@ -1337,17 +1348,17 @@ const ha = {
|
|
|
1337
1348
|
handler(o, a) {
|
|
1338
1349
|
if (!a)
|
|
1339
1350
|
return !1;
|
|
1340
|
-
const { unitId: e, subUnitId: t, ranges: r, ruleId: i } = a, s = o.get(F), n = o.get(
|
|
1351
|
+
const { unitId: e, subUnitId: t, ranges: r, ruleId: i } = a, s = o.get(F), n = o.get(U), l = o.get(Z);
|
|
1341
1352
|
if (!s.getRuleById(e, t, i))
|
|
1342
1353
|
return !1;
|
|
1343
1354
|
const d = s.getRuleObjectMatrix(e, t).clone();
|
|
1344
1355
|
d.updateRange(i, r);
|
|
1345
|
-
const c = d.diff(s.getRules(e, t)), { redoMutations:
|
|
1356
|
+
const c = d.diff(s.getRules(e, t)), { redoMutations: g, undoMutations: p } = Le(e, t, c, o);
|
|
1346
1357
|
return l.pushUndoRedo({
|
|
1347
1358
|
undoMutations: p,
|
|
1348
|
-
redoMutations:
|
|
1359
|
+
redoMutations: g,
|
|
1349
1360
|
unitID: e
|
|
1350
|
-
}), Ie(
|
|
1361
|
+
}), Ie(g, n), !0;
|
|
1351
1362
|
}
|
|
1352
1363
|
}, ma = {
|
|
1353
1364
|
type: z.COMMAND,
|
|
@@ -1355,7 +1366,7 @@ const ha = {
|
|
|
1355
1366
|
handler(o, a) {
|
|
1356
1367
|
if (!a)
|
|
1357
1368
|
return !1;
|
|
1358
|
-
const { unitId: e, subUnitId: t, rule: r } = a, i = o.get(F), s = o.get(
|
|
1369
|
+
const { unitId: e, subUnitId: t, rule: r } = a, i = o.get(F), s = o.get(U), n = o.get(Z), l = i.getRuleObjectMatrix(e, t).clone();
|
|
1359
1370
|
l.addRule(r);
|
|
1360
1371
|
const u = l.diff(i.getRules(e, t)), d = i.getValidator(r.type), c = {
|
|
1361
1372
|
unitId: e,
|
|
@@ -1364,12 +1375,12 @@ const ha = {
|
|
|
1364
1375
|
...r,
|
|
1365
1376
|
...d == null ? void 0 : d.normalizeFormula(r, e, t)
|
|
1366
1377
|
}
|
|
1367
|
-
}, { redoMutations:
|
|
1368
|
-
return
|
|
1378
|
+
}, { redoMutations: g, undoMutations: p } = Le(e, t, u, o);
|
|
1379
|
+
return g.push({
|
|
1369
1380
|
id: L.id,
|
|
1370
1381
|
params: c
|
|
1371
1382
|
}), p.unshift({
|
|
1372
|
-
id:
|
|
1383
|
+
id: I.id,
|
|
1373
1384
|
params: {
|
|
1374
1385
|
unitId: e,
|
|
1375
1386
|
subUnitId: t,
|
|
@@ -1377,9 +1388,9 @@ const ha = {
|
|
|
1377
1388
|
}
|
|
1378
1389
|
}), n.pushUndoRedo({
|
|
1379
1390
|
unitID: e,
|
|
1380
|
-
redoMutations:
|
|
1391
|
+
redoMutations: g,
|
|
1381
1392
|
undoMutations: p
|
|
1382
|
-
}), Ie(
|
|
1393
|
+
}), Ie(g, s), !0;
|
|
1383
1394
|
}
|
|
1384
1395
|
}, ga = {
|
|
1385
1396
|
type: z.COMMAND,
|
|
@@ -1388,14 +1399,14 @@ const ha = {
|
|
|
1388
1399
|
handler(o, a) {
|
|
1389
1400
|
if (!a)
|
|
1390
1401
|
return !1;
|
|
1391
|
-
const e = o.get(
|
|
1402
|
+
const e = o.get(U), t = o.get(Z), r = o.get(F), i = o.get(q), { unitId: s, subUnitId: n, ruleId: l, setting: u } = a, d = i.getValidatorItem(u.type);
|
|
1392
1403
|
if (!d)
|
|
1393
1404
|
return !1;
|
|
1394
1405
|
const c = r.getRuleById(s, n, l);
|
|
1395
1406
|
if (!c)
|
|
1396
1407
|
return !1;
|
|
1397
|
-
const
|
|
1398
|
-
if (!d.validatorFormula(
|
|
1408
|
+
const g = { ...c, ...u };
|
|
1409
|
+
if (!d.validatorFormula(g, s, n).success)
|
|
1399
1410
|
return !1;
|
|
1400
1411
|
const p = {
|
|
1401
1412
|
unitId: s,
|
|
@@ -1405,41 +1416,41 @@ const ha = {
|
|
|
1405
1416
|
type: y.SETTING,
|
|
1406
1417
|
payload: {
|
|
1407
1418
|
...u,
|
|
1408
|
-
...d.normalizeFormula(
|
|
1419
|
+
...d.normalizeFormula(g, s, n)
|
|
1409
1420
|
}
|
|
1410
1421
|
}
|
|
1411
1422
|
}, _ = [{
|
|
1412
1423
|
id: E.id,
|
|
1413
1424
|
params: p
|
|
1414
|
-
}],
|
|
1425
|
+
}], v = {
|
|
1415
1426
|
unitId: s,
|
|
1416
1427
|
subUnitId: n,
|
|
1417
1428
|
ruleId: l,
|
|
1418
1429
|
payload: {
|
|
1419
1430
|
type: y.SETTING,
|
|
1420
|
-
payload:
|
|
1431
|
+
payload: bt(c)
|
|
1421
1432
|
}
|
|
1422
|
-
},
|
|
1433
|
+
}, V = [{
|
|
1423
1434
|
id: E.id,
|
|
1424
|
-
params:
|
|
1435
|
+
params: v
|
|
1425
1436
|
}];
|
|
1426
1437
|
if (u.type === T.CHECKBOX) {
|
|
1427
|
-
const
|
|
1428
|
-
if (
|
|
1429
|
-
const $ = new Se(), { worksheet:
|
|
1430
|
-
let
|
|
1431
|
-
if (
|
|
1438
|
+
const w = c.ranges, W = o.get(O), x = Xe(W, { unitId: s, subUnitId: n });
|
|
1439
|
+
if (x) {
|
|
1440
|
+
const $ = new Se(), { worksheet: B } = x, { formula2: J = Ve, formula1: ce = Me } = c, { formula2: he = Ve, formula1: me = Me } = u;
|
|
1441
|
+
let Ue = !1;
|
|
1442
|
+
if (w.forEach((ge) => {
|
|
1432
1443
|
b.foreach(ge, (ae, xe) => {
|
|
1433
|
-
const k =
|
|
1434
|
-
(
|
|
1444
|
+
const k = B.getCellRaw(ae, xe), ze = mt(k);
|
|
1445
|
+
(_t(k) || ze === String(J)) && !(k != null && k.p) ? ($.setValue(ae, xe, {
|
|
1435
1446
|
v: he,
|
|
1436
1447
|
p: null
|
|
1437
|
-
}),
|
|
1448
|
+
}), Ue = !0) : ze === String(ce) && !(k != null && k.p) && ($.setValue(ae, xe, {
|
|
1438
1449
|
v: me,
|
|
1439
1450
|
p: null
|
|
1440
|
-
}),
|
|
1451
|
+
}), Ue = !0);
|
|
1441
1452
|
});
|
|
1442
|
-
}),
|
|
1453
|
+
}), Ue) {
|
|
1443
1454
|
const ge = {
|
|
1444
1455
|
id: se.id,
|
|
1445
1456
|
params: {
|
|
@@ -1449,16 +1460,16 @@ const ha = {
|
|
|
1449
1460
|
}
|
|
1450
1461
|
}, ae = {
|
|
1451
1462
|
id: se.id,
|
|
1452
|
-
params:
|
|
1463
|
+
params: nt(o, ge.params)
|
|
1453
1464
|
};
|
|
1454
|
-
_.push(ge),
|
|
1465
|
+
_.push(ge), V.push(ae);
|
|
1455
1466
|
}
|
|
1456
1467
|
}
|
|
1457
1468
|
}
|
|
1458
1469
|
return Ie(_, e).result ? (t.pushUndoRedo({
|
|
1459
1470
|
unitID: s,
|
|
1460
1471
|
redoMutations: _,
|
|
1461
|
-
undoMutations:
|
|
1472
|
+
undoMutations: V
|
|
1462
1473
|
}), !0) : !1;
|
|
1463
1474
|
}
|
|
1464
1475
|
}, _a = {
|
|
@@ -1467,7 +1478,7 @@ const ha = {
|
|
|
1467
1478
|
handler(o, a) {
|
|
1468
1479
|
if (!a)
|
|
1469
1480
|
return !1;
|
|
1470
|
-
const e = o.get(
|
|
1481
|
+
const e = o.get(U), t = o.get(Z), r = o.get(F), { unitId: i, subUnitId: s, ruleId: n, options: l } = a, u = r.getRuleById(i, s, n);
|
|
1471
1482
|
if (!u)
|
|
1472
1483
|
return !1;
|
|
1473
1484
|
const d = {
|
|
@@ -1481,17 +1492,17 @@ const ha = {
|
|
|
1481
1492
|
}, c = [{
|
|
1482
1493
|
id: E.id,
|
|
1483
1494
|
params: d
|
|
1484
|
-
}],
|
|
1495
|
+
}], g = {
|
|
1485
1496
|
unitId: i,
|
|
1486
1497
|
subUnitId: s,
|
|
1487
1498
|
ruleId: n,
|
|
1488
1499
|
payload: {
|
|
1489
1500
|
type: y.OPTIONS,
|
|
1490
|
-
payload:
|
|
1501
|
+
payload: Lt(u)
|
|
1491
1502
|
}
|
|
1492
1503
|
}, p = [{
|
|
1493
1504
|
id: E.id,
|
|
1494
|
-
params:
|
|
1505
|
+
params: g
|
|
1495
1506
|
}];
|
|
1496
1507
|
return t.pushUndoRedo({
|
|
1497
1508
|
unitID: i,
|
|
@@ -1505,16 +1516,16 @@ const ha = {
|
|
|
1505
1516
|
handler(o, a) {
|
|
1506
1517
|
if (!a)
|
|
1507
1518
|
return !1;
|
|
1508
|
-
const { unitId: e, subUnitId: t, ranges: r } = a, i = o.get(
|
|
1519
|
+
const { unitId: e, subUnitId: t, ranges: r } = a, i = o.get(U), s = o.get(O), n = Xe(s, { unitId: e, subUnitId: t }), l = o.get(F);
|
|
1509
1520
|
if (!n) return !1;
|
|
1510
1521
|
const u = o.get(Z), d = l.getRuleObjectMatrix(e, t).clone();
|
|
1511
1522
|
d.removeRange(r);
|
|
1512
|
-
const c = d.diff(l.getRules(e, t)), { redoMutations:
|
|
1523
|
+
const c = d.diff(l.getRules(e, t)), { redoMutations: g, undoMutations: p } = Le(e, t, c, o);
|
|
1513
1524
|
return u.pushUndoRedo({
|
|
1514
1525
|
unitID: e,
|
|
1515
|
-
redoMutations:
|
|
1526
|
+
redoMutations: g,
|
|
1516
1527
|
undoMutations: p
|
|
1517
|
-
}), Ie(
|
|
1528
|
+
}), Ie(g, i).result;
|
|
1518
1529
|
}
|
|
1519
1530
|
}, fa = {
|
|
1520
1531
|
type: z.COMMAND,
|
|
@@ -1522,12 +1533,12 @@ const ha = {
|
|
|
1522
1533
|
handler(o, a) {
|
|
1523
1534
|
if (!a)
|
|
1524
1535
|
return !1;
|
|
1525
|
-
const { unitId: e, subUnitId: t } = a, r = o.get(
|
|
1536
|
+
const { unitId: e, subUnitId: t } = a, r = o.get(U), i = o.get(F), s = o.get(Z), n = [...i.getRules(e, t)], l = {
|
|
1526
1537
|
unitId: e,
|
|
1527
1538
|
subUnitId: t,
|
|
1528
1539
|
ruleId: n.map((c) => c.uid)
|
|
1529
1540
|
}, u = [{
|
|
1530
|
-
id:
|
|
1541
|
+
id: I.id,
|
|
1531
1542
|
params: l
|
|
1532
1543
|
}], d = [{
|
|
1533
1544
|
id: L.id,
|
|
@@ -1541,9 +1552,9 @@ const ha = {
|
|
|
1541
1552
|
redoMutations: u,
|
|
1542
1553
|
undoMutations: d,
|
|
1543
1554
|
unitID: e
|
|
1544
|
-
}), r.executeCommand(
|
|
1555
|
+
}), r.executeCommand(I.id, l), !0;
|
|
1545
1556
|
}
|
|
1546
|
-
},
|
|
1557
|
+
}, va = (o, a) => {
|
|
1547
1558
|
const e = o.get(F), { unitId: t, subUnitId: r, ruleId: i, source: s } = a;
|
|
1548
1559
|
if (Array.isArray(i)) {
|
|
1549
1560
|
const l = i.map((u) => e.getRuleById(t, r, u)).filter(Boolean);
|
|
@@ -1568,14 +1579,14 @@ const ha = {
|
|
|
1568
1579
|
index: e.getRuleIndex(t, r, i)
|
|
1569
1580
|
}
|
|
1570
1581
|
}];
|
|
1571
|
-
},
|
|
1582
|
+
}, Ra = {
|
|
1572
1583
|
type: z.COMMAND,
|
|
1573
1584
|
id: "sheet.command.remove-data-validation-rule",
|
|
1574
1585
|
handler(o, a) {
|
|
1575
1586
|
if (!a)
|
|
1576
1587
|
return !1;
|
|
1577
|
-
const { unitId: e, subUnitId: t, ruleId: r } = a, i = o.get(
|
|
1578
|
-
id:
|
|
1588
|
+
const { unitId: e, subUnitId: t, ruleId: r } = a, i = o.get(U), s = o.get(Z), n = o.get(F), l = [{
|
|
1589
|
+
id: I.id,
|
|
1579
1590
|
params: a
|
|
1580
1591
|
}], u = [{
|
|
1581
1592
|
id: L.id,
|
|
@@ -1592,19 +1603,19 @@ const ha = {
|
|
|
1592
1603
|
undoMutations: u,
|
|
1593
1604
|
redoMutations: l,
|
|
1594
1605
|
unitID: a.unitId
|
|
1595
|
-
}), i.executeCommand(
|
|
1606
|
+
}), i.executeCommand(I.id, a), !0;
|
|
1596
1607
|
}
|
|
1597
|
-
}, Sa = "sheets-data-validation.config",
|
|
1598
|
-
var
|
|
1599
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1608
|
+
}, Sa = "sheets-data-validation.config", rt = {};
|
|
1609
|
+
var Ma = Object.getOwnPropertyDescriptor, Va = (o, a, e, t) => {
|
|
1610
|
+
for (var r = t > 1 ? void 0 : t ? Ma(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1600
1611
|
(s = o[i]) && (r = s(r) || r);
|
|
1601
1612
|
return r;
|
|
1602
1613
|
}, We = (o, a) => (e, t) => a(e, t, o);
|
|
1603
|
-
let
|
|
1614
|
+
let Te = class extends P {
|
|
1604
1615
|
constructor(a, e, t) {
|
|
1605
1616
|
super();
|
|
1606
|
-
|
|
1607
|
-
|
|
1617
|
+
m(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
1618
|
+
m(this, "registerRule", (a, e, t) => {
|
|
1608
1619
|
de(t.type, this._validatorRegistryService) && this.register(a, e, t);
|
|
1609
1620
|
});
|
|
1610
1621
|
this._dataValidationModel = a, this._formulaRefRangeService = e, this._validatorRegistryService = t, this._initRefRange();
|
|
@@ -1627,7 +1638,7 @@ let Ee = class extends W {
|
|
|
1627
1638
|
}
|
|
1628
1639
|
}],
|
|
1629
1640
|
redos: [{
|
|
1630
|
-
id:
|
|
1641
|
+
id: I.id,
|
|
1631
1642
|
params: {
|
|
1632
1643
|
unitId: a,
|
|
1633
1644
|
subUnitId: e,
|
|
@@ -1636,7 +1647,7 @@ let Ee = class extends W {
|
|
|
1636
1647
|
}
|
|
1637
1648
|
}]
|
|
1638
1649
|
};
|
|
1639
|
-
const d = [], c = [],
|
|
1650
|
+
const d = [], c = [], g = u[0];
|
|
1640
1651
|
d.push({
|
|
1641
1652
|
id: E.id,
|
|
1642
1653
|
params: {
|
|
@@ -1646,9 +1657,9 @@ let Ee = class extends W {
|
|
|
1646
1657
|
payload: {
|
|
1647
1658
|
type: y.ALL,
|
|
1648
1659
|
payload: {
|
|
1649
|
-
ranges:
|
|
1650
|
-
formula1:
|
|
1651
|
-
formula2:
|
|
1660
|
+
ranges: g.ranges,
|
|
1661
|
+
formula1: g.formulas[0],
|
|
1662
|
+
formula2: g.formulas[1]
|
|
1652
1663
|
}
|
|
1653
1664
|
},
|
|
1654
1665
|
source: "patched"
|
|
@@ -1671,7 +1682,7 @@ let Ee = class extends W {
|
|
|
1671
1682
|
}
|
|
1672
1683
|
});
|
|
1673
1684
|
for (let p = 1; p < u.length; p++) {
|
|
1674
|
-
const _ = u[p],
|
|
1685
|
+
const _ = u[p], v = yt();
|
|
1675
1686
|
d.push({
|
|
1676
1687
|
id: L.id,
|
|
1677
1688
|
params: {
|
|
@@ -1679,7 +1690,7 @@ let Ee = class extends W {
|
|
|
1679
1690
|
subUnitId: e,
|
|
1680
1691
|
rule: {
|
|
1681
1692
|
...t,
|
|
1682
|
-
uid:
|
|
1693
|
+
uid: v,
|
|
1683
1694
|
formula1: _.formulas[0],
|
|
1684
1695
|
formula2: _.formulas[1],
|
|
1685
1696
|
ranges: _.ranges
|
|
@@ -1687,11 +1698,11 @@ let Ee = class extends W {
|
|
|
1687
1698
|
source: "patched"
|
|
1688
1699
|
}
|
|
1689
1700
|
}), c.push({
|
|
1690
|
-
id:
|
|
1701
|
+
id: I.id,
|
|
1691
1702
|
params: {
|
|
1692
1703
|
unitId: a,
|
|
1693
1704
|
subUnitId: e,
|
|
1694
|
-
ruleId:
|
|
1705
|
+
ruleId: v,
|
|
1695
1706
|
source: "patched"
|
|
1696
1707
|
}
|
|
1697
1708
|
});
|
|
@@ -1730,24 +1741,24 @@ let Ee = class extends W {
|
|
|
1730
1741
|
}
|
|
1731
1742
|
}
|
|
1732
1743
|
})
|
|
1733
|
-
), this.disposeWithMe(
|
|
1744
|
+
), this.disposeWithMe(qe(() => {
|
|
1734
1745
|
this._disposableMap.forEach((e) => {
|
|
1735
1746
|
e.dispose();
|
|
1736
1747
|
}), this._disposableMap.clear();
|
|
1737
1748
|
}));
|
|
1738
1749
|
}
|
|
1739
1750
|
};
|
|
1740
|
-
|
|
1741
|
-
We(0,
|
|
1742
|
-
We(1,
|
|
1743
|
-
We(2,
|
|
1744
|
-
],
|
|
1745
|
-
var
|
|
1751
|
+
Te = Va([
|
|
1752
|
+
We(0, R(F)),
|
|
1753
|
+
We(1, R(ct)),
|
|
1754
|
+
We(2, R(q))
|
|
1755
|
+
], Te);
|
|
1756
|
+
var pt = /* @__PURE__ */ ((o) => (o[o.View = 0] = "View", o[o.Edit = 1] = "Edit", o[o.ManageCollaborator = 2] = "ManageCollaborator", o[o.Print = 3] = "Print", o[o.Duplicate = 4] = "Duplicate", o[o.Comment = 5] = "Comment", o[o.Copy = 6] = "Copy", o[o.Share = 7] = "Share", o[o.Export = 8] = "Export", o[o.MoveWorksheet = 9] = "MoveWorksheet", o[o.DeleteWorksheet = 10] = "DeleteWorksheet", o[o.HideWorksheet = 11] = "HideWorksheet", o[o.RenameWorksheet = 12] = "RenameWorksheet", o[o.CreateWorksheet = 13] = "CreateWorksheet", o[o.SetWorksheetStyle = 14] = "SetWorksheetStyle", o[o.EditWorksheetCell = 15] = "EditWorksheetCell", o[o.InsertHyperlink = 16] = "InsertHyperlink", o[o.Sort = 17] = "Sort", o[o.Filter = 18] = "Filter", o[o.PivotTable = 19] = "PivotTable", o[o.FloatImg = 20] = "FloatImg", o[o.History = 21] = "History", o[o.RwHgtClWdt = 22] = "RwHgtClWdt", o[o.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", o[o.ViewFilter = 24] = "ViewFilter", o[o.MoveSheet = 25] = "MoveSheet", o[o.DeleteSheet = 26] = "DeleteSheet", o[o.HideSheet = 27] = "HideSheet", o[o.CopySheet = 28] = "CopySheet", o[o.RenameSheet = 29] = "RenameSheet", o[o.CreateSheet = 30] = "CreateSheet", o[o.SelectProtectedCells = 31] = "SelectProtectedCells", o[o.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", o[o.SetCellStyle = 33] = "SetCellStyle", o[o.SetCellValue = 34] = "SetCellValue", o[o.SetRowStyle = 35] = "SetRowStyle", o[o.SetColumnStyle = 36] = "SetColumnStyle", o[o.InsertRow = 37] = "InsertRow", o[o.InsertColumn = 38] = "InsertColumn", o[o.DeleteRow = 39] = "DeleteRow", o[o.DeleteColumn = 40] = "DeleteColumn", o[o.EditExtraObject = 41] = "EditExtraObject", o[o.Delete = 42] = "Delete", o[o.RecoverHistory = 43] = "RecoverHistory", o[o.ViewHistory = 44] = "ViewHistory", o[o.CreatePermissionObject = 45] = "CreatePermissionObject", o[o.UNRECOGNIZED = -1] = "UNRECOGNIZED", o))(pt || {}), ya = Object.getOwnPropertyDescriptor, Ea = (o, a, e, t) => {
|
|
1746
1757
|
for (var r = t > 1 ? void 0 : t ? ya(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1747
1758
|
(s = o[i]) && (r = s(r) || r);
|
|
1748
1759
|
return r;
|
|
1749
|
-
},
|
|
1750
|
-
let
|
|
1760
|
+
}, $e = (o, a) => (e, t) => a(e, t, o);
|
|
1761
|
+
let Fe = class extends P {
|
|
1751
1762
|
constructor(o, a, e) {
|
|
1752
1763
|
super(), this._univerInstanceService = o, this._permissionService = a, this._lexerTreeBuilder = e;
|
|
1753
1764
|
}
|
|
@@ -1760,43 +1771,43 @@ let Te = class extends W {
|
|
|
1760
1771
|
const i = a[r];
|
|
1761
1772
|
if (typeof i == "string")
|
|
1762
1773
|
continue;
|
|
1763
|
-
const { token: s } = i, n =
|
|
1774
|
+
const { token: s } = i, n = qt(s), l = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET);
|
|
1764
1775
|
let u = l.getActiveSheet();
|
|
1765
1776
|
const d = l.getUnitId();
|
|
1766
1777
|
if (n.sheetName) {
|
|
1767
1778
|
if (u = l.getSheetBySheetName(n.sheetName), !u)
|
|
1768
1779
|
return !1;
|
|
1769
|
-
const
|
|
1770
|
-
if (!this._permissionService.getPermissionPoint(new xt(d,
|
|
1780
|
+
const v = u == null ? void 0 : u.getSheetId();
|
|
1781
|
+
if (!this._permissionService.getPermissionPoint(new xt(d, v).id)) return !1;
|
|
1771
1782
|
}
|
|
1772
1783
|
if (!u)
|
|
1773
1784
|
return !1;
|
|
1774
|
-
const { startRow: c, endRow:
|
|
1775
|
-
for (let
|
|
1776
|
-
for (let
|
|
1777
|
-
const f = (t = (e = u.getCell(
|
|
1778
|
-
if ((f == null ? void 0 : f[
|
|
1785
|
+
const { startRow: c, endRow: g, startColumn: p, endColumn: _ } = n.range;
|
|
1786
|
+
for (let v = c; v <= g; v++)
|
|
1787
|
+
for (let V = p; V <= _; V++) {
|
|
1788
|
+
const f = (t = (e = u.getCell(v, V)) == null ? void 0 : e.selectionProtection) == null ? void 0 : t[0];
|
|
1789
|
+
if ((f == null ? void 0 : f[pt.View]) === !1)
|
|
1779
1790
|
return !1;
|
|
1780
1791
|
}
|
|
1781
1792
|
}
|
|
1782
1793
|
return !0;
|
|
1783
1794
|
}
|
|
1784
1795
|
};
|
|
1785
|
-
|
|
1786
|
-
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
],
|
|
1796
|
+
Fe = Ea([
|
|
1797
|
+
$e(0, O),
|
|
1798
|
+
$e(1, Et),
|
|
1799
|
+
$e(2, R(Y))
|
|
1800
|
+
], Fe);
|
|
1790
1801
|
var Ta = Object.getOwnPropertyDescriptor, Fa = (o, a, e, t) => {
|
|
1791
1802
|
for (var r = t > 1 ? void 0 : t ? Ta(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1792
1803
|
(s = o[i]) && (r = s(r) || r);
|
|
1793
1804
|
return r;
|
|
1794
1805
|
}, ee = (o, a) => (e, t) => a(e, t, o);
|
|
1795
|
-
let
|
|
1806
|
+
let Ne = class extends P {
|
|
1796
1807
|
constructor(a, e, t, r, i, s) {
|
|
1797
1808
|
super();
|
|
1798
|
-
|
|
1799
|
-
|
|
1809
|
+
m(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
1810
|
+
m(this, "registerRule", (a, e, t) => {
|
|
1800
1811
|
de(t.type, this._validatorRegistryService) || (this.register(a, e, t), this.registerFormula(a, e, t));
|
|
1801
1812
|
});
|
|
1802
1813
|
this._dataValidationModel = a, this._injector = e, this._refRangeService = t, this._dataValidationFormulaService = r, this._formulaRefRangeService = i, this._validatorRegistryService = s, this._initRefRange();
|
|
@@ -1808,10 +1819,10 @@ let Fe = class extends W {
|
|
|
1808
1819
|
registerFormula(a, e, t) {
|
|
1809
1820
|
var u;
|
|
1810
1821
|
const r = t.uid, i = this._getIdWithUnitId(a, e, r), s = (u = this._disposableMap.get(i)) != null ? u : /* @__PURE__ */ new Set(), n = (d, c) => {
|
|
1811
|
-
const
|
|
1812
|
-
if (!
|
|
1822
|
+
const g = this._dataValidationModel.getRuleById(a, e, r);
|
|
1823
|
+
if (!g)
|
|
1813
1824
|
return { redos: [], undos: [] };
|
|
1814
|
-
const p =
|
|
1825
|
+
const p = g[d];
|
|
1815
1826
|
if (!p || p === c)
|
|
1816
1827
|
return { redos: [], undos: [] };
|
|
1817
1828
|
const _ = {
|
|
@@ -1821,27 +1832,27 @@ let Fe = class extends W {
|
|
|
1821
1832
|
payload: {
|
|
1822
1833
|
type: y.SETTING,
|
|
1823
1834
|
payload: {
|
|
1824
|
-
type:
|
|
1825
|
-
formula1:
|
|
1826
|
-
formula2:
|
|
1835
|
+
type: g.type,
|
|
1836
|
+
formula1: g.formula1,
|
|
1837
|
+
formula2: g.formula2,
|
|
1827
1838
|
[d]: c
|
|
1828
1839
|
}
|
|
1829
1840
|
},
|
|
1830
1841
|
source: "patched"
|
|
1831
|
-
},
|
|
1842
|
+
}, v = {
|
|
1832
1843
|
unitId: a,
|
|
1833
1844
|
subUnitId: e,
|
|
1834
1845
|
ruleId: t.uid,
|
|
1835
1846
|
payload: {
|
|
1836
1847
|
type: y.SETTING,
|
|
1837
1848
|
payload: {
|
|
1838
|
-
type:
|
|
1839
|
-
formula1:
|
|
1840
|
-
formula2:
|
|
1849
|
+
type: g.type,
|
|
1850
|
+
formula1: g.formula1,
|
|
1851
|
+
formula2: g.formula2
|
|
1841
1852
|
}
|
|
1842
1853
|
},
|
|
1843
1854
|
source: "patched"
|
|
1844
|
-
},
|
|
1855
|
+
}, V = [
|
|
1845
1856
|
{
|
|
1846
1857
|
id: E.id,
|
|
1847
1858
|
params: _
|
|
@@ -1849,50 +1860,50 @@ let Fe = class extends W {
|
|
|
1849
1860
|
], f = [
|
|
1850
1861
|
{
|
|
1851
1862
|
id: E.id,
|
|
1852
|
-
params:
|
|
1863
|
+
params: v
|
|
1853
1864
|
}
|
|
1854
1865
|
];
|
|
1855
|
-
return { redos:
|
|
1866
|
+
return { redos: V, undos: f };
|
|
1856
1867
|
}, l = this._dataValidationFormulaService.getRuleFormulaInfo(a, e, r);
|
|
1857
1868
|
if (l) {
|
|
1858
1869
|
const [d, c] = l;
|
|
1859
1870
|
if (d) {
|
|
1860
|
-
const
|
|
1871
|
+
const g = this._formulaRefRangeService.registerFormula(
|
|
1861
1872
|
a,
|
|
1862
1873
|
e,
|
|
1863
1874
|
d.text,
|
|
1864
1875
|
(p) => n("formula1", p)
|
|
1865
1876
|
);
|
|
1866
|
-
s.add(() =>
|
|
1877
|
+
s.add(() => g.dispose());
|
|
1867
1878
|
}
|
|
1868
1879
|
if (c) {
|
|
1869
|
-
const
|
|
1880
|
+
const g = this._formulaRefRangeService.registerFormula(
|
|
1870
1881
|
a,
|
|
1871
1882
|
e,
|
|
1872
1883
|
c.text,
|
|
1873
1884
|
(p) => n("formula2", p)
|
|
1874
1885
|
);
|
|
1875
|
-
s.add(() =>
|
|
1886
|
+
s.add(() => g.dispose());
|
|
1876
1887
|
}
|
|
1877
1888
|
}
|
|
1878
1889
|
}
|
|
1879
1890
|
register(a, e, t) {
|
|
1880
1891
|
var l;
|
|
1881
1892
|
const r = (u) => {
|
|
1882
|
-
const d = [...t.ranges],
|
|
1883
|
-
if (
|
|
1893
|
+
const d = [...t.ranges], g = d.map((_) => Ht(_, u)).filter((_) => !!_).flat();
|
|
1894
|
+
if (ot(g, d))
|
|
1884
1895
|
return { redos: [], undos: [] };
|
|
1885
|
-
if (
|
|
1896
|
+
if (g.length) {
|
|
1886
1897
|
const _ = {
|
|
1887
1898
|
unitId: a,
|
|
1888
1899
|
subUnitId: e,
|
|
1889
1900
|
ruleId: t.uid,
|
|
1890
1901
|
payload: {
|
|
1891
1902
|
type: y.RANGE,
|
|
1892
|
-
payload:
|
|
1903
|
+
payload: g
|
|
1893
1904
|
},
|
|
1894
1905
|
source: "patched"
|
|
1895
|
-
},
|
|
1906
|
+
}, v = [{ id: E.id, params: _ }], V = [{
|
|
1896
1907
|
id: E.id,
|
|
1897
1908
|
params: {
|
|
1898
1909
|
unitId: a,
|
|
@@ -1905,10 +1916,10 @@ let Fe = class extends W {
|
|
|
1905
1916
|
source: "patched"
|
|
1906
1917
|
}
|
|
1907
1918
|
}];
|
|
1908
|
-
return { redos:
|
|
1919
|
+
return { redos: v, undos: V };
|
|
1909
1920
|
} else {
|
|
1910
|
-
const _ = { unitId: a, subUnitId: e, ruleId: t.uid },
|
|
1911
|
-
return { redos:
|
|
1921
|
+
const _ = { unitId: a, subUnitId: e, ruleId: t.uid }, v = [{ id: I.id, params: _ }], V = va(this._injector, _);
|
|
1922
|
+
return { redos: v, undos: V };
|
|
1912
1923
|
}
|
|
1913
1924
|
}, i = [];
|
|
1914
1925
|
t.ranges.forEach((u) => {
|
|
@@ -1945,27 +1956,27 @@ let Fe = class extends W {
|
|
|
1945
1956
|
}
|
|
1946
1957
|
}
|
|
1947
1958
|
})
|
|
1948
|
-
), this.disposeWithMe(
|
|
1959
|
+
), this.disposeWithMe(qe(() => {
|
|
1949
1960
|
this._disposableMap.forEach((e) => {
|
|
1950
1961
|
e.forEach((t) => t());
|
|
1951
1962
|
}), this._disposableMap.clear();
|
|
1952
1963
|
}));
|
|
1953
1964
|
}
|
|
1954
1965
|
};
|
|
1955
|
-
|
|
1956
|
-
ee(0,
|
|
1957
|
-
ee(1,
|
|
1958
|
-
ee(2,
|
|
1959
|
-
ee(3,
|
|
1960
|
-
ee(4,
|
|
1961
|
-
ee(5,
|
|
1962
|
-
],
|
|
1966
|
+
Ne = Fa([
|
|
1967
|
+
ee(0, R(F)),
|
|
1968
|
+
ee(1, R(Ge)),
|
|
1969
|
+
ee(2, R(Bt)),
|
|
1970
|
+
ee(3, R(K)),
|
|
1971
|
+
ee(4, R(ct)),
|
|
1972
|
+
ee(5, R(q))
|
|
1973
|
+
], Ne);
|
|
1963
1974
|
var Na = Object.getOwnPropertyDescriptor, Ca = (o, a, e, t) => {
|
|
1964
1975
|
for (var r = t > 1 ? void 0 : t ? Na(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
1965
1976
|
(s = o[i]) && (r = s(r) || r);
|
|
1966
1977
|
return r;
|
|
1967
|
-
},
|
|
1968
|
-
let
|
|
1978
|
+
}, ke = (o, a) => (e, t) => a(e, t, o);
|
|
1979
|
+
let Ce = class extends P {
|
|
1969
1980
|
constructor(o, a, e) {
|
|
1970
1981
|
super(), this._sheetInterceptorService = o, this._univerInstanceService = a, this._sheetDataValidationModel = e, this._initSheetChange();
|
|
1971
1982
|
}
|
|
@@ -1974,7 +1985,7 @@ let Ne = class extends W {
|
|
|
1974
1985
|
this._sheetInterceptorService.interceptCommand({
|
|
1975
1986
|
getMutations: (o) => {
|
|
1976
1987
|
var a;
|
|
1977
|
-
if (o.id ===
|
|
1988
|
+
if (o.id === Pt.id) {
|
|
1978
1989
|
const e = o.params, t = e.unitId || this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET).getUnitId(), r = this._univerInstanceService.getUniverSheetInstance(t);
|
|
1979
1990
|
if (!r)
|
|
1980
1991
|
return { redos: [], undos: [] };
|
|
@@ -1997,7 +2008,7 @@ let Ne = class extends W {
|
|
|
1997
2008
|
};
|
|
1998
2009
|
return {
|
|
1999
2010
|
redos: [{
|
|
2000
|
-
id:
|
|
2011
|
+
id: I.id,
|
|
2001
2012
|
params: l
|
|
2002
2013
|
}],
|
|
2003
2014
|
undos: [{
|
|
@@ -2012,19 +2023,20 @@ let Ne = class extends W {
|
|
|
2012
2023
|
);
|
|
2013
2024
|
}
|
|
2014
2025
|
};
|
|
2015
|
-
|
|
2016
|
-
|
|
2017
|
-
|
|
2018
|
-
|
|
2019
|
-
],
|
|
2020
|
-
class
|
|
2026
|
+
Ce = Ca([
|
|
2027
|
+
ke(0, R(lt)),
|
|
2028
|
+
ke(1, R(O)),
|
|
2029
|
+
ke(2, R(F))
|
|
2030
|
+
], Ce);
|
|
2031
|
+
class Oa extends G {
|
|
2021
2032
|
constructor() {
|
|
2022
2033
|
super(...arguments);
|
|
2023
|
-
|
|
2024
|
-
|
|
2025
|
-
|
|
2026
|
-
|
|
2027
|
-
|
|
2034
|
+
m(this, "id", T.ANY);
|
|
2035
|
+
m(this, "title", "dataValidation.any.title");
|
|
2036
|
+
m(this, "operators", []);
|
|
2037
|
+
m(this, "scopes", ["sheet"]);
|
|
2038
|
+
m(this, "order", 0);
|
|
2039
|
+
m(this, "offsetFormulaByRange", !1);
|
|
2028
2040
|
}
|
|
2029
2041
|
async parseFormula(e, t, r) {
|
|
2030
2042
|
return {
|
|
@@ -2045,19 +2057,20 @@ class wa extends G {
|
|
|
2045
2057
|
return this.localeService.t("dataValidation.any.error");
|
|
2046
2058
|
}
|
|
2047
2059
|
}
|
|
2048
|
-
class
|
|
2060
|
+
class wa extends G {
|
|
2049
2061
|
constructor() {
|
|
2050
2062
|
super(...arguments);
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
|
|
2063
|
+
m(this, "id", T.CUSTOM);
|
|
2064
|
+
m(this, "title", "dataValidation.custom.title");
|
|
2065
|
+
m(this, "operators", []);
|
|
2066
|
+
m(this, "scopes", ["sheet"]);
|
|
2067
|
+
m(this, "order", 60);
|
|
2068
|
+
m(this, "_customFormulaService", this.injector.get(H));
|
|
2069
|
+
m(this, "_lexerTreeBuilder", this.injector.get(Y));
|
|
2057
2070
|
}
|
|
2058
2071
|
validatorFormula(e, t, r) {
|
|
2059
2072
|
var u;
|
|
2060
|
-
const i = S(e.formula1), s = (u = e.formula1) != null ? u : "", l = this._lexerTreeBuilder.checkIfAddBracket(s) === 0 && s.startsWith(
|
|
2073
|
+
const i = S(e.formula1), s = (u = e.formula1) != null ? u : "", l = this._lexerTreeBuilder.checkIfAddBracket(s) === 0 && s.startsWith(Gt.EQUALS);
|
|
2061
2074
|
return {
|
|
2062
2075
|
success: i && l,
|
|
2063
2076
|
formula1: i && l ? "" : this.localeService.t("dataValidation.validFail.formula")
|
|
@@ -2072,7 +2085,7 @@ class Oa extends G {
|
|
|
2072
2085
|
}
|
|
2073
2086
|
async isValidType(e, t, r) {
|
|
2074
2087
|
const { column: i, row: s, unitId: n, subUnitId: l } = e, u = await this._customFormulaService.getCellFormulaValue(n, l, r.uid, s, i), d = u == null ? void 0 : u.v;
|
|
2075
|
-
return C(String(d)) &&
|
|
2088
|
+
return C(String(d)) && M.isDefine(d) && d !== "" ? u.t === Tt.BOOLEAN ? !!d : typeof d == "boolean" ? d : typeof d == "number" ? !!d : typeof d == "string" ? C(d) : !!d : !1;
|
|
2076
2089
|
}
|
|
2077
2090
|
generateRuleErrorMessage(e) {
|
|
2078
2091
|
return this.localeService.t("dataValidation.custom.error");
|
|
@@ -2082,23 +2095,24 @@ class Oa extends G {
|
|
|
2082
2095
|
return this.localeService.t("dataValidation.custom.ruleName").replace("{FORMULA1}", (t = e.formula1) != null ? t : "");
|
|
2083
2096
|
}
|
|
2084
2097
|
}
|
|
2085
|
-
class
|
|
2098
|
+
class Aa extends gt {
|
|
2086
2099
|
constructor() {
|
|
2087
2100
|
super(...arguments);
|
|
2088
|
-
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
-
|
|
2101
|
+
m(this, "id", T.LIST_MULTIPLE);
|
|
2102
|
+
m(this, "title", "dataValidation.listMultiple.title");
|
|
2103
|
+
m(this, "offsetFormulaByRange", !1);
|
|
2104
|
+
m(this, "skipDefaultFontRender", () => !0);
|
|
2092
2105
|
}
|
|
2093
2106
|
}
|
|
2094
|
-
class
|
|
2107
|
+
class Ia extends G {
|
|
2095
2108
|
constructor() {
|
|
2096
2109
|
super(...arguments);
|
|
2097
|
-
|
|
2098
|
-
|
|
2099
|
-
|
|
2100
|
-
|
|
2101
|
-
|
|
2110
|
+
m(this, "_customFormulaService", this.injector.get(H));
|
|
2111
|
+
m(this, "_lexerTreeBuilder", this.injector.get(Y));
|
|
2112
|
+
m(this, "id", T.WHOLE);
|
|
2113
|
+
m(this, "title", "dataValidation.whole.title");
|
|
2114
|
+
m(this, "order", 10);
|
|
2115
|
+
m(this, "operators", [
|
|
2102
2116
|
h.BETWEEN,
|
|
2103
2117
|
h.EQUAL,
|
|
2104
2118
|
h.GREATER_THAN,
|
|
@@ -2108,30 +2122,30 @@ class Aa extends G {
|
|
|
2108
2122
|
h.NOT_BETWEEN,
|
|
2109
2123
|
h.NOT_EQUAL
|
|
2110
2124
|
]);
|
|
2111
|
-
|
|
2125
|
+
m(this, "scopes", ["sheet"]);
|
|
2112
2126
|
}
|
|
2113
2127
|
_isFormulaOrInt(e) {
|
|
2114
|
-
return !
|
|
2128
|
+
return !M.isBlank(e) && (S(e) || !Number.isNaN(+e) && Number.isInteger(+e));
|
|
2115
2129
|
}
|
|
2116
2130
|
async isValidType(e, t, r) {
|
|
2117
|
-
const { value: i } = e, s =
|
|
2131
|
+
const { value: i } = e, s = Ee(i);
|
|
2118
2132
|
return !Number.isNaN(s) && Number.isInteger(s);
|
|
2119
2133
|
}
|
|
2120
2134
|
transform(e, t, r) {
|
|
2121
2135
|
const { value: i } = e;
|
|
2122
2136
|
return {
|
|
2123
2137
|
...e,
|
|
2124
|
-
value:
|
|
2138
|
+
value: Ee(i)
|
|
2125
2139
|
};
|
|
2126
2140
|
}
|
|
2127
2141
|
_parseNumber(e) {
|
|
2128
2142
|
return e == null ? Number.NaN : +e;
|
|
2129
2143
|
}
|
|
2130
2144
|
async parseFormula(e, t, r, i, s) {
|
|
2131
|
-
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c = S(u) ? n == null ? void 0 : n.v : u,
|
|
2145
|
+
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(t, r, e.uid, i, s), { formula1: u, formula2: d } = e, c = S(u) ? n == null ? void 0 : n.v : u, g = S(d) ? l == null ? void 0 : l.v : d, p = C(`${c}`) && C(`${g}`);
|
|
2132
2146
|
return {
|
|
2133
2147
|
formula1: this._parseNumber(c),
|
|
2134
|
-
formula2: this._parseNumber(
|
|
2148
|
+
formula2: this._parseNumber(g),
|
|
2135
2149
|
isFormulaValid: p
|
|
2136
2150
|
};
|
|
2137
2151
|
}
|
|
@@ -2139,9 +2153,9 @@ class Aa extends G {
|
|
|
2139
2153
|
const i = e.operator;
|
|
2140
2154
|
if (!i)
|
|
2141
2155
|
return {
|
|
2142
|
-
success: !
|
|
2156
|
+
success: !0
|
|
2143
2157
|
};
|
|
2144
|
-
const s =
|
|
2158
|
+
const s = M.isDefine(e.formula1) && this._isFormulaOrInt(e.formula1), n = M.isDefine(e.formula2) && this._isFormulaOrInt(e.formula2), l = De.includes(i), u = this.localeService.t("dataValidation.validFail.number");
|
|
2145
2159
|
return l ? {
|
|
2146
2160
|
success: s && n,
|
|
2147
2161
|
formula1: s ? void 0 : u,
|
|
@@ -2153,9 +2167,9 @@ class Aa extends G {
|
|
|
2153
2167
|
}
|
|
2154
2168
|
generateRuleErrorMessage(e, t) {
|
|
2155
2169
|
if (!e.operator)
|
|
2156
|
-
return this.titleStr;
|
|
2157
|
-
const { transformedFormula1: r, transformedFormula2: i } =
|
|
2158
|
-
return `${this.localeService.t(
|
|
2170
|
+
return this.localeService.t(ye.NONE).replace("{TYPE}", this.titleStr);
|
|
2171
|
+
const { transformedFormula1: r, transformedFormula2: i } = be(this._lexerTreeBuilder, e, t);
|
|
2172
|
+
return `${this.localeService.t(ye[e.operator]).replace(le, r != null ? r : "").replace(ue, i != null ? i : "")}`;
|
|
2159
2173
|
}
|
|
2160
2174
|
}
|
|
2161
2175
|
var Da = Object.getOwnPropertyDescriptor, ba = (o, a, e, t) => {
|
|
@@ -2163,7 +2177,7 @@ var Da = Object.getOwnPropertyDescriptor, ba = (o, a, e, t) => {
|
|
|
2163
2177
|
(s = o[i]) && (r = s(r) || r);
|
|
2164
2178
|
return r;
|
|
2165
2179
|
}, te = (o, a) => (e, t) => a(e, t, o);
|
|
2166
|
-
let
|
|
2180
|
+
let Oe = class extends Ft {
|
|
2167
2181
|
constructor(o, a, e, t, r, i) {
|
|
2168
2182
|
super(), this._univerInstanceService = o, this._dataValidatorRegistryService = a, this._injector = e, this._selectionManagerService = t, this._sheetInterceptorService = r, this._sheetDataValidationModel = i, this._init();
|
|
2169
2183
|
}
|
|
@@ -2172,18 +2186,18 @@ let Ce = class extends Tt {
|
|
|
2172
2186
|
}
|
|
2173
2187
|
_registerValidators() {
|
|
2174
2188
|
[
|
|
2175
|
-
|
|
2189
|
+
Oa,
|
|
2176
2190
|
na,
|
|
2177
|
-
|
|
2191
|
+
Ia,
|
|
2178
2192
|
ca,
|
|
2179
2193
|
sa,
|
|
2180
|
-
|
|
2181
|
-
|
|
2182
|
-
|
|
2183
|
-
|
|
2194
|
+
ra,
|
|
2195
|
+
gt,
|
|
2196
|
+
Aa,
|
|
2197
|
+
wa
|
|
2184
2198
|
].forEach((o) => {
|
|
2185
2199
|
const a = this._injector.createInstance(o);
|
|
2186
|
-
this.disposeWithMe(this._dataValidatorRegistryService.register(a)), this.disposeWithMe(
|
|
2200
|
+
this.disposeWithMe(this._dataValidatorRegistryService.register(a)), this.disposeWithMe(qe(() => this._injector.delete(o)));
|
|
2187
2201
|
});
|
|
2188
2202
|
}
|
|
2189
2203
|
_initCommandInterceptor() {
|
|
@@ -2196,7 +2210,7 @@ let Ce = class extends Tt {
|
|
|
2196
2210
|
throw new Error("No active sheet found");
|
|
2197
2211
|
const i = r.getSheetId(), s = (a = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : a.map((c) => c.range), n = this._sheetDataValidationModel.getRuleObjectMatrix(t, i).clone();
|
|
2198
2212
|
s && n.removeRange(s);
|
|
2199
|
-
const l = n.diff(this._sheetDataValidationModel.getRules(t, i)), { redoMutations: u, undoMutations: d } =
|
|
2213
|
+
const l = n.diff(this._sheetDataValidationModel.getRules(t, i)), { redoMutations: u, undoMutations: d } = Le(t, i, l, this._injector, "patched");
|
|
2200
2214
|
return {
|
|
2201
2215
|
undos: d,
|
|
2202
2216
|
redos: u
|
|
@@ -2210,20 +2224,20 @@ let Ce = class extends Tt {
|
|
|
2210
2224
|
});
|
|
2211
2225
|
}
|
|
2212
2226
|
};
|
|
2213
|
-
|
|
2214
|
-
te(0,
|
|
2215
|
-
te(1,
|
|
2216
|
-
te(2,
|
|
2217
|
-
te(3,
|
|
2218
|
-
te(4,
|
|
2219
|
-
te(5,
|
|
2220
|
-
],
|
|
2221
|
-
var La = Object.getOwnPropertyDescriptor,
|
|
2227
|
+
Oe = ba([
|
|
2228
|
+
te(0, O),
|
|
2229
|
+
te(1, R(q)),
|
|
2230
|
+
te(2, R(Ge)),
|
|
2231
|
+
te(3, R(ut)),
|
|
2232
|
+
te(4, R(lt)),
|
|
2233
|
+
te(5, R(F))
|
|
2234
|
+
], Oe);
|
|
2235
|
+
var La = Object.getOwnPropertyDescriptor, Ua = (o, a, e, t) => {
|
|
2222
2236
|
for (var r = t > 1 ? void 0 : t ? La(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
2223
2237
|
(s = o[i]) && (r = s(r) || r);
|
|
2224
2238
|
return r;
|
|
2225
|
-
},
|
|
2226
|
-
let we = class extends
|
|
2239
|
+
}, ve = (o, a) => (e, t) => a(e, t, o);
|
|
2240
|
+
let we = class extends P {
|
|
2227
2241
|
constructor(o, a, e, t) {
|
|
2228
2242
|
super(), this._univerInstanceService = o, this._sheetDataValidationModel = a, this._dataValidationCacheService = e, this._lifecycleService = t, this._initRecalculate();
|
|
2229
2243
|
}
|
|
@@ -2244,11 +2258,11 @@ let we = class extends W {
|
|
|
2244
2258
|
});
|
|
2245
2259
|
});
|
|
2246
2260
|
};
|
|
2247
|
-
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(
|
|
2261
|
+
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe($t(() => this._lifecycleService.lifecycle$.pipe(Je((a) => a === Ze.Rendered)))).subscribe(o)), this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(Je(() => this._lifecycleService.stage >= Ze.Rendered), Ct(20)).subscribe(o));
|
|
2248
2262
|
}
|
|
2249
2263
|
async _validatorByCell(o, a, e, t) {
|
|
2250
2264
|
const r = o.getUnitId(), i = a.getSheetId();
|
|
2251
|
-
if (!
|
|
2265
|
+
if (!M.isDefine(e) || !M.isDefine(t))
|
|
2252
2266
|
throw new Error(`row or col is not defined, row: ${e}, col: ${t}`);
|
|
2253
2267
|
const s = this._sheetDataValidationModel.getRuleByLocation(r, i, e, t);
|
|
2254
2268
|
return s ? new Promise((n) => {
|
|
@@ -2316,23 +2330,23 @@ let we = class extends W {
|
|
|
2316
2330
|
return this.getDataValidations(o, a, e)[0];
|
|
2317
2331
|
}
|
|
2318
2332
|
};
|
|
2319
|
-
we =
|
|
2320
|
-
|
|
2321
|
-
|
|
2322
|
-
|
|
2323
|
-
|
|
2333
|
+
we = Ua([
|
|
2334
|
+
ve(0, O),
|
|
2335
|
+
ve(1, R(F)),
|
|
2336
|
+
ve(2, R(Q)),
|
|
2337
|
+
ve(3, R(Nt))
|
|
2324
2338
|
], we);
|
|
2325
|
-
var
|
|
2326
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2339
|
+
var xa = Object.defineProperty, Ba = Object.getOwnPropertyDescriptor, Ha = (o, a, e) => a in o ? xa(o, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[a] = e, Pa = (o, a, e, t) => {
|
|
2340
|
+
for (var r = t > 1 ? void 0 : t ? Ba(a, e) : a, i = o.length - 1, s; i >= 0; i--)
|
|
2327
2341
|
(s = o[i]) && (r = s(r) || r);
|
|
2328
2342
|
return r;
|
|
2329
|
-
},
|
|
2330
|
-
let
|
|
2331
|
-
constructor(o =
|
|
2343
|
+
}, je = (o, a) => (e, t) => a(e, t, o), ft = (o, a, e) => Ha(o, typeof a != "symbol" ? a + "" : a, e);
|
|
2344
|
+
let Ae = class extends At {
|
|
2345
|
+
constructor(o = rt, a, e, t) {
|
|
2332
2346
|
super(), this._config = o, this._injector = a, this._commandService = e, this._configService = t;
|
|
2333
2347
|
const { ...r } = It(
|
|
2334
2348
|
{},
|
|
2335
|
-
|
|
2349
|
+
rt,
|
|
2336
2350
|
this._config
|
|
2337
2351
|
);
|
|
2338
2352
|
this._configService.setConfig(Sa, r);
|
|
@@ -2344,11 +2358,11 @@ let Oe = class extends Ot {
|
|
|
2344
2358
|
[H],
|
|
2345
2359
|
[we],
|
|
2346
2360
|
[F],
|
|
2361
|
+
[Oe],
|
|
2362
|
+
[Fe],
|
|
2347
2363
|
[Ce],
|
|
2348
|
-
[Te],
|
|
2349
2364
|
[Ne],
|
|
2350
|
-
[
|
|
2351
|
-
[Ee]
|
|
2365
|
+
[Te]
|
|
2352
2366
|
].forEach((o) => {
|
|
2353
2367
|
this._injector.add(o);
|
|
2354
2368
|
}), [
|
|
@@ -2356,67 +2370,74 @@ let Oe = class extends Ot {
|
|
|
2356
2370
|
ha,
|
|
2357
2371
|
ga,
|
|
2358
2372
|
_a,
|
|
2359
|
-
|
|
2373
|
+
Ra,
|
|
2360
2374
|
fa,
|
|
2361
2375
|
pa
|
|
2362
2376
|
].forEach((o) => {
|
|
2363
2377
|
this._commandService.registerCommand(o);
|
|
2364
|
-
}), this._injector.get(Q), this._injector.get(we), this._injector.get(
|
|
2378
|
+
}), this._injector.get(Q), this._injector.get(we), this._injector.get(Oe), this._injector.get(Te), this._injector.get(Ne);
|
|
2365
2379
|
}
|
|
2366
2380
|
onReady() {
|
|
2367
|
-
this._injector.get(
|
|
2381
|
+
this._injector.get(Ce);
|
|
2368
2382
|
}
|
|
2369
2383
|
onRendered() {
|
|
2370
|
-
this._injector.get(
|
|
2384
|
+
this._injector.get(Fe);
|
|
2371
2385
|
}
|
|
2372
2386
|
};
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
],
|
|
2387
|
+
ft(Ae, "pluginName", Yt);
|
|
2388
|
+
ft(Ae, "type", N.UNIVER_SHEET);
|
|
2389
|
+
Ae = Pa([
|
|
2390
|
+
Ot(Ut),
|
|
2391
|
+
je(1, R(Ge)),
|
|
2392
|
+
je(2, U),
|
|
2393
|
+
je(3, wt)
|
|
2394
|
+
], Ae);
|
|
2381
2395
|
function Ka(o) {
|
|
2382
|
-
const e = o.get(
|
|
2396
|
+
const e = o.get(ut).getCurrentSelections().map((i) => i.range);
|
|
2383
2397
|
return {
|
|
2384
|
-
uid:
|
|
2398
|
+
uid: M.generateRandomId(6),
|
|
2385
2399
|
type: T.DECIMAL,
|
|
2386
2400
|
operator: h.EQUAL,
|
|
2387
2401
|
formula1: "100",
|
|
2388
2402
|
ranges: e != null ? e : [{ startColumn: 0, endColumn: 0, startRow: 0, endRow: 0 }]
|
|
2389
2403
|
};
|
|
2390
2404
|
}
|
|
2405
|
+
const za = "data-validation.custom-formula-input", Za = "data-validation.formula-input", Ja = "data-validation.list-formula-input", er = "data-validation.checkbox-formula-input";
|
|
2391
2406
|
export {
|
|
2392
2407
|
ma as AddSheetDataValidationCommand,
|
|
2393
|
-
|
|
2394
|
-
Me as
|
|
2395
|
-
|
|
2408
|
+
Za as BASE_FORMULA_INPUT_NAME,
|
|
2409
|
+
Me as CHECKBOX_FORMULA_1,
|
|
2410
|
+
Ve as CHECKBOX_FORMULA_2,
|
|
2411
|
+
er as CHECKBOX_FORMULA_INPUT_NAME,
|
|
2412
|
+
za as CUSTOM_FORMULA_INPUT_NAME,
|
|
2413
|
+
ra as CheckboxValidator,
|
|
2396
2414
|
pa as ClearRangeDataValidationCommand,
|
|
2397
|
-
|
|
2415
|
+
Yt as DATA_VALIDATION_PLUGIN_NAME,
|
|
2398
2416
|
Q as DataValidationCacheService,
|
|
2399
2417
|
H as DataValidationCustomFormulaService,
|
|
2400
|
-
|
|
2418
|
+
Fe as DataValidationFormulaController,
|
|
2401
2419
|
K as DataValidationFormulaService,
|
|
2402
2420
|
sa as DateValidator,
|
|
2403
|
-
|
|
2404
|
-
|
|
2421
|
+
Ja as LIST_FORMULA_INPUT_NAME,
|
|
2422
|
+
Aa as ListMultipleValidator,
|
|
2423
|
+
gt as ListValidator,
|
|
2405
2424
|
fa as RemoveSheetAllDataValidationCommand,
|
|
2406
|
-
|
|
2425
|
+
Ra as RemoveSheetDataValidationCommand,
|
|
2407
2426
|
F as SheetDataValidationModel,
|
|
2408
2427
|
we as SheetsDataValidationValidatorService,
|
|
2409
|
-
|
|
2428
|
+
Ae as UniverSheetsDataValidationPlugin,
|
|
2410
2429
|
_a as UpdateSheetDataValidationOptionsCommand,
|
|
2411
2430
|
ha as UpdateSheetDataValidationRangeCommand,
|
|
2412
2431
|
ga as UpdateSheetDataValidationSettingCommand,
|
|
2413
2432
|
Ka as createDefaultNewRule,
|
|
2414
2433
|
fe as deserializeListOptions,
|
|
2434
|
+
Ee as getCellValueNumber,
|
|
2415
2435
|
ne as getCellValueOrigin,
|
|
2416
2436
|
Xa as getDataValidationCellValue,
|
|
2417
|
-
|
|
2437
|
+
Le as getDataValidationDiffMutations,
|
|
2418
2438
|
_e as getFormulaCellData,
|
|
2419
2439
|
oe as getFormulaResult,
|
|
2440
|
+
be as getTransformedFormula,
|
|
2420
2441
|
C as isLegalFormulaResult,
|
|
2421
2442
|
Ya as serializeListOptions,
|
|
2422
2443
|
pe as transformCheckboxValue
|