@univerjs/sheets-data-validation 0.12.3 → 0.12.4-experimental.20251208-c4b8a44
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 +932 -801
- package/lib/index.js +932 -801
- package/lib/types/index.d.ts +1 -0
- package/lib/types/services/dv-formula.service.d.ts +3 -1
- package/lib/types/services/dv-list-cache.service.d.ts +53 -0
- package/lib/types/validators/list-validator.d.ts +4 -2
- package/lib/umd/index.js +1 -1
- package/package.json +9 -9
- package/LICENSE +0 -176
package/lib/es/index.js
CHANGED
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var m = (
|
|
4
|
-
import { Inject as v, ICommandService as
|
|
5
|
-
import { DataValidationModel as
|
|
6
|
-
import { ERROR_TYPE_SET as
|
|
7
|
-
import { SetRangeValuesMutation as
|
|
8
|
-
import { Subject as
|
|
9
|
-
import { RegisterOtherFormulaService as
|
|
10
|
-
var
|
|
11
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
12
|
-
(
|
|
1
|
+
var Et = Object.defineProperty;
|
|
2
|
+
var Mt = (s, a, e) => a in s ? Et(s, a, { enumerable: !0, configurable: !0, writable: !0, value: e }) : s[a] = e;
|
|
3
|
+
var m = (s, a, e) => Mt(s, typeof a != "symbol" ? a + "" : a, e);
|
|
4
|
+
import { Inject as v, ICommandService as B, IUniverInstanceService as I, Disposable as x, ObjectMatrix as Me, getIntersectRange as ot, UniverInstanceType as N, Range as U, Rectangle as w, isFormulaString as S, getOriginCellValue as Vt, Injector as be, numfmt as L, DataValidationType as T, RBush as yt, debounce as Tt, Tools as M, DataValidationStatus as b, 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 Ft, generateRandomId as Xe, toDisposable as Ke, CellValueType as Ct, RxDisposable as Nt, LifecycleService as Ot, LifecycleStages as et, bufferDebounceTime as wt, DependentOn as At, IConfigService as It, Plugin as Dt, merge as bt } from "@univerjs/core";
|
|
5
|
+
import { DataValidationModel as ce, DataValidatorRegistryService as G, UpdateRuleType as V, BaseDataValidator as Y, TextLengthErrorTitleMap as Lt, AddDataValidationMutation as D, RemoveDataValidationMutation as A, UpdateDataValidationMutation as y, getRuleSetting as Ut, getRuleOptions as Bt, UniverDataValidationPlugin as xt } from "@univerjs/data-validation";
|
|
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 dt, getSheetCommandTarget as ze, SetRangeValuesUndoMutationFactory as ct, WorksheetViewPermission as jt, RefRangeService as Qt, handleCommonDefaultRangeChangeWithEffectRefCommands as qt, SheetInterceptorService as ht, RemoveSheetCommand as Gt, CopySheetCommand as Yt, SheetsSelectionsService as mt, ClearSelectionAllCommand as Xt } from "@univerjs/sheets";
|
|
8
|
+
import { Subject as Ye, bufferWhen as Kt, filter as tt } from "rxjs";
|
|
9
|
+
import { RegisterOtherFormulaService as gt, FormulaRefRangeService as pt } from "@univerjs/sheets-formula";
|
|
10
|
+
var zt = Object.getOwnPropertyDescriptor, Zt = (s, a, e, t) => {
|
|
11
|
+
for (var r = t > 1 ? void 0 : t ? zt(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
12
|
+
(o = s[i]) && (r = o(r) || r);
|
|
13
13
|
return r;
|
|
14
|
-
},
|
|
15
|
-
let Q = class extends
|
|
14
|
+
}, $e = (s, a) => (e, t) => a(e, t, s);
|
|
15
|
+
let Q = class extends x {
|
|
16
16
|
constructor(a, e, t) {
|
|
17
17
|
super();
|
|
18
18
|
m(this, "_cacheMatrix", /* @__PURE__ */ new Map());
|
|
19
|
-
m(this, "_dirtyRanges$", new
|
|
19
|
+
m(this, "_dirtyRanges$", new Ye());
|
|
20
20
|
m(this, "dirtyRanges$", this._dirtyRanges$.asObservable());
|
|
21
21
|
this._commandService = a, this._univerInstanceService = e, this._sheetDataValidationModel = t, this._initDirtyRanges(), this._initSheetRemove();
|
|
22
22
|
}
|
|
23
23
|
_initDirtyRanges() {
|
|
24
24
|
this.disposeWithMe(this._commandService.onCommandExecuted((a, e) => {
|
|
25
|
-
if (a.id ===
|
|
25
|
+
if (a.id === ne.id && !(e != null && e.onlyLocal)) {
|
|
26
26
|
const { cellValue: t, unitId: r, subUnitId: i } = a.params;
|
|
27
27
|
if (t) {
|
|
28
|
-
const
|
|
29
|
-
if (
|
|
30
|
-
const u = this._sheetDataValidationModel.getRules(r, i).map((d) => d.ranges).flat().map((d) => ot(d,
|
|
28
|
+
const o = new Me(t).getDataRange();
|
|
29
|
+
if (o.endRow === -1) return;
|
|
30
|
+
const u = this._sheetDataValidationModel.getRules(r, i).map((d) => d.ranges).flat().map((d) => ot(d, 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 W {
|
|
|
36
36
|
_initSheetRemove() {
|
|
37
37
|
this.disposeWithMe(this._commandService.onCommandExecuted((a) => {
|
|
38
38
|
var e;
|
|
39
|
-
if (a.id ===
|
|
39
|
+
if (a.id === dt.id) {
|
|
40
40
|
const { unitId: t, subUnitId: r } = a.params;
|
|
41
41
|
(e = this._cacheMatrix.get(t)) == null || e.delete(r);
|
|
42
42
|
}
|
|
@@ -48,7 +48,7 @@ let Q = class extends W {
|
|
|
48
48
|
let t = this._cacheMatrix.get(a);
|
|
49
49
|
t || (t = /* @__PURE__ */ new Map(), this._cacheMatrix.set(a, t));
|
|
50
50
|
let r = t.get(e);
|
|
51
|
-
return r || (r = new
|
|
51
|
+
return r || (r = new Me(), t.set(e, r)), r;
|
|
52
52
|
}
|
|
53
53
|
ensureCache(a, e) {
|
|
54
54
|
return this._ensureCache(a, e);
|
|
@@ -61,8 +61,8 @@ let Q = class extends W {
|
|
|
61
61
|
}
|
|
62
62
|
markRangeDirty(a, e, t, r) {
|
|
63
63
|
const i = this._ensureCache(a, e);
|
|
64
|
-
t.forEach((
|
|
65
|
-
|
|
64
|
+
t.forEach((o) => {
|
|
65
|
+
U.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,8 +70,8 @@ let Q = class extends W {
|
|
|
70
70
|
_deleteRange(a, e, t) {
|
|
71
71
|
const r = this._ensureCache(a, e);
|
|
72
72
|
t.forEach((i) => {
|
|
73
|
-
|
|
74
|
-
r.realDeleteValue(
|
|
73
|
+
U.foreach(i, (o, n) => {
|
|
74
|
+
r.realDeleteValue(o, n);
|
|
75
75
|
});
|
|
76
76
|
}), this._dirtyRanges$.next({ unitId: a, subUnitId: e, ranges: t });
|
|
77
77
|
}
|
|
@@ -79,33 +79,33 @@ let Q = class extends W {
|
|
|
79
79
|
return this._ensureCache(a, e).getValue(t, r);
|
|
80
80
|
}
|
|
81
81
|
};
|
|
82
|
-
Q =
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
Q = Zt([
|
|
83
|
+
$e(0, v(B)),
|
|
84
|
+
$e(1, v(I)),
|
|
85
|
+
$e(2, v(ce))
|
|
86
86
|
], Q);
|
|
87
|
-
function oe(
|
|
87
|
+
function oe(s) {
|
|
88
88
|
var a, e;
|
|
89
|
-
return (e = (a =
|
|
89
|
+
return (e = (a = s == null ? void 0 : s[0]) == null ? void 0 : a[0]) == null ? void 0 : e.v;
|
|
90
90
|
}
|
|
91
|
-
function
|
|
91
|
+
function _e(s) {
|
|
92
92
|
var a;
|
|
93
|
-
return (a =
|
|
93
|
+
return (a = s == null ? void 0 : s[0]) == null ? void 0 : a[0];
|
|
94
94
|
}
|
|
95
|
-
function
|
|
96
|
-
return !
|
|
95
|
+
function F(s) {
|
|
96
|
+
return !Pt.has(s);
|
|
97
97
|
}
|
|
98
|
-
function
|
|
98
|
+
function he(s, a) {
|
|
99
99
|
var t;
|
|
100
|
-
const e = a.getValidatorItem(
|
|
100
|
+
const e = a.getValidatorItem(s);
|
|
101
101
|
return (t = e == null ? void 0 : e.offsetFormulaByRange) != null ? t : !1;
|
|
102
102
|
}
|
|
103
|
-
var
|
|
104
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
105
|
-
(
|
|
103
|
+
var Jt = Object.getOwnPropertyDescriptor, ea = (s, a, e, t) => {
|
|
104
|
+
for (var r = t > 1 ? void 0 : t ? Jt(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
105
|
+
(o = s[i]) && (r = o(r) || r);
|
|
106
106
|
return r;
|
|
107
|
-
},
|
|
108
|
-
let
|
|
107
|
+
}, se = (s, a) => (e, t) => a(e, t, s);
|
|
108
|
+
let W = class extends x {
|
|
109
109
|
constructor(a, e, t, r, i) {
|
|
110
110
|
super();
|
|
111
111
|
/**
|
|
@@ -124,8 +124,8 @@ let H = class extends W {
|
|
|
124
124
|
const t = a[e];
|
|
125
125
|
if (this._instanceSrv.getUnitType(e) === N.UNIVER_SHEET)
|
|
126
126
|
for (const i in t) {
|
|
127
|
-
const
|
|
128
|
-
|
|
127
|
+
const o = t[i], { ruleFormulaMap: n } = this._ensureMaps(e, i);
|
|
128
|
+
o.forEach((l) => {
|
|
129
129
|
var c, g;
|
|
130
130
|
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);
|
|
131
131
|
d && u && this._dataValidationCacheService.markRangeDirty(e, i, d.ranges);
|
|
@@ -139,16 +139,16 @@ let H = class extends W {
|
|
|
139
139
|
t || (t = /* @__PURE__ */ new Map(), this._ruleFormulaMap.set(a, t)), r || (r = /* @__PURE__ */ new Map(), this._ruleFormulaMap2.set(a, r));
|
|
140
140
|
let i = t.get(e);
|
|
141
141
|
i || (i = /* @__PURE__ */ new Map(), t.set(e, i));
|
|
142
|
-
let
|
|
143
|
-
return
|
|
142
|
+
let o = r.get(e);
|
|
143
|
+
return o || (o = /* @__PURE__ */ new Map(), r.set(e, o)), { ruleFormulaMap: i, ruleFormulaMap2: o };
|
|
144
144
|
}
|
|
145
145
|
_registerFormula(a, e, t, r, i) {
|
|
146
146
|
return this._registerOtherFormulaService.registerFormulaWithRange(a, e, r, i, { ruleId: t });
|
|
147
147
|
}
|
|
148
148
|
_handleDirtyRanges(a, e, t) {
|
|
149
149
|
this._dataValidationModel.getRules(a, e).forEach((i) => {
|
|
150
|
-
const
|
|
151
|
-
|
|
150
|
+
const o = i.ranges;
|
|
151
|
+
w.doAnyRangesIntersect(o, t) && this.makeRuleDirty(a, e, i.uid);
|
|
152
152
|
});
|
|
153
153
|
}
|
|
154
154
|
_initDirtyRanges() {
|
|
@@ -157,18 +157,18 @@ let H = class extends W {
|
|
|
157
157
|
}));
|
|
158
158
|
}
|
|
159
159
|
deleteByRuleId(a, e, t) {
|
|
160
|
-
const { ruleFormulaMap: r, ruleFormulaMap2: i } = this._ensureMaps(a, e),
|
|
161
|
-
if (!
|
|
160
|
+
const { ruleFormulaMap: r, ruleFormulaMap2: i } = this._ensureMaps(a, e), o = this._dataValidationModel.getRuleById(a, e, t), n = r.get(t);
|
|
161
|
+
if (!o || !n)
|
|
162
162
|
return;
|
|
163
163
|
const l = r.get(t);
|
|
164
164
|
l && (r.delete(t), this._registerOtherFormulaService.deleteFormula(a, e, [l.formulaId]));
|
|
165
165
|
const u = i.get(t);
|
|
166
166
|
u && (i.delete(t), this._registerOtherFormulaService.deleteFormula(a, e, [u.formulaId]));
|
|
167
167
|
}
|
|
168
|
-
_addFormulaByRange(a, e, t, r, i,
|
|
169
|
-
const { ruleFormulaMap: n, ruleFormulaMap2: l } = this._ensureMaps(a, e), u =
|
|
168
|
+
_addFormulaByRange(a, e, t, r, i, o) {
|
|
169
|
+
const { ruleFormulaMap: n, ruleFormulaMap2: l } = this._ensureMaps(a, e), u = o[0].startRow, d = o[0].startColumn;
|
|
170
170
|
if (r && S(r)) {
|
|
171
|
-
const c = this._registerFormula(a, e, t, r,
|
|
171
|
+
const c = this._registerFormula(a, e, t, r, o);
|
|
172
172
|
n.set(t, {
|
|
173
173
|
formula: r,
|
|
174
174
|
originCol: d,
|
|
@@ -177,7 +177,7 @@ let H = class extends W {
|
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
179
|
if (i && S(i)) {
|
|
180
|
-
const c = this._registerFormula(a, e, t, i,
|
|
180
|
+
const c = this._registerFormula(a, e, t, i, o);
|
|
181
181
|
l.set(t, {
|
|
182
182
|
formula: i,
|
|
183
183
|
originCol: d,
|
|
@@ -187,70 +187,197 @@ let H = class extends W {
|
|
|
187
187
|
}
|
|
188
188
|
}
|
|
189
189
|
addRule(a, e, t) {
|
|
190
|
-
if (
|
|
191
|
-
const { ranges: r, formula1: i, formula2:
|
|
192
|
-
this._addFormulaByRange(a, e, n, i,
|
|
190
|
+
if (he(t.type, this._validatorRegistryService)) {
|
|
191
|
+
const { ranges: r, formula1: i, formula2: o, uid: n } = t;
|
|
192
|
+
this._addFormulaByRange(a, e, n, i, o, r);
|
|
193
193
|
}
|
|
194
194
|
}
|
|
195
195
|
async getCellFormulaValue(a, e, t, r, i) {
|
|
196
|
-
var
|
|
197
|
-
const { ruleFormulaMap:
|
|
196
|
+
var _, f;
|
|
197
|
+
const { ruleFormulaMap: o } = this._ensureMaps(a, e), n = o.get(t);
|
|
198
198
|
if (!n)
|
|
199
199
|
return Promise.resolve(void 0);
|
|
200
200
|
const l = await this._registerOtherFormulaService.getFormulaValue(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, g = i - d;
|
|
201
|
-
return
|
|
201
|
+
return _e((f = (_ = l == null ? void 0 : l.result) == null ? void 0 : _[c]) == null ? void 0 : f[g]);
|
|
202
202
|
}
|
|
203
203
|
async getCellFormula2Value(a, e, t, r, i) {
|
|
204
|
-
var
|
|
205
|
-
const { ruleFormulaMap2:
|
|
204
|
+
var _, f;
|
|
205
|
+
const { ruleFormulaMap2: o } = this._ensureMaps(a, e), n = o.get(t);
|
|
206
206
|
if (!n)
|
|
207
207
|
return Promise.resolve(void 0);
|
|
208
208
|
const l = await this._registerOtherFormulaService.getFormulaValue(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, g = i - d;
|
|
209
|
-
return
|
|
209
|
+
return _e((f = (_ = l == null ? void 0 : l.result) == null ? void 0 : _[c]) == null ? void 0 : f[g]);
|
|
210
210
|
}
|
|
211
211
|
getCellFormulaValueSync(a, e, t, r, i) {
|
|
212
|
-
var
|
|
213
|
-
const { ruleFormulaMap:
|
|
212
|
+
var _, f;
|
|
213
|
+
const { ruleFormulaMap: o } = this._ensureMaps(a, e), n = o.get(t);
|
|
214
214
|
if (!n)
|
|
215
215
|
return;
|
|
216
216
|
const l = this._registerOtherFormulaService.getFormulaValueSync(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, g = i - d;
|
|
217
|
-
return
|
|
217
|
+
return _e((f = (_ = l == null ? void 0 : l.result) == null ? void 0 : _[c]) == null ? void 0 : f[g]);
|
|
218
218
|
}
|
|
219
219
|
getCellFormula2ValueSync(a, e, t, r, i) {
|
|
220
|
-
var
|
|
221
|
-
const { ruleFormulaMap2:
|
|
220
|
+
var _, f;
|
|
221
|
+
const { ruleFormulaMap2: o } = this._ensureMaps(a, e), n = o.get(t);
|
|
222
222
|
if (!n)
|
|
223
223
|
return;
|
|
224
224
|
const l = this._registerOtherFormulaService.getFormulaValueSync(a, e, n.formulaId), { originRow: u, originCol: d } = n, c = r - u, g = i - d;
|
|
225
|
-
return
|
|
225
|
+
return _e((f = (_ = l == null ? void 0 : l.result) == null ? void 0 : _[c]) == null ? void 0 : f[g]);
|
|
226
226
|
}
|
|
227
227
|
getRuleFormulaInfo(a, e, t) {
|
|
228
228
|
const { ruleFormulaMap: r } = this._ensureMaps(a, e);
|
|
229
229
|
return r.get(t);
|
|
230
230
|
}
|
|
231
231
|
makeRuleDirty(a, e, t) {
|
|
232
|
-
var
|
|
233
|
-
const r = (n = (
|
|
232
|
+
var o, n, l, u;
|
|
233
|
+
const r = (n = (o = this._ruleFormulaMap.get(a)) == null ? void 0 : o.get(e)) == null ? void 0 : n.get(t), i = (u = (l = this._ruleFormulaMap2.get(a)) == null ? void 0 : l.get(e)) == null ? void 0 : u.get(t);
|
|
234
234
|
r && this._registerOtherFormulaService.markFormulaDirty(a, e, r.formulaId), i && this._registerOtherFormulaService.markFormulaDirty(a, e, i.formulaId);
|
|
235
235
|
}
|
|
236
236
|
};
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
],
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
237
|
+
W = ea([
|
|
238
|
+
se(0, I),
|
|
239
|
+
se(1, v(gt)),
|
|
240
|
+
se(2, v(ce)),
|
|
241
|
+
se(3, v(Q)),
|
|
242
|
+
se(4, v(G))
|
|
243
|
+
], W);
|
|
244
|
+
function re(s) {
|
|
245
|
+
return Vt(s);
|
|
246
|
+
}
|
|
247
|
+
function ft(s) {
|
|
248
|
+
var a;
|
|
249
|
+
return String((a = re(s)) != null ? a : "");
|
|
250
|
+
}
|
|
251
|
+
function er(s) {
|
|
252
|
+
return s.filter(Boolean).join(",");
|
|
253
|
+
}
|
|
254
|
+
function Ee(s) {
|
|
255
|
+
return s.split(",").filter(Boolean);
|
|
256
|
+
}
|
|
257
|
+
function tr(s) {
|
|
258
|
+
const a = re(s);
|
|
259
|
+
return a == null ? "" : a.toString();
|
|
260
|
+
}
|
|
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, d = S(r) ? s.moveFormulaRefOffset(r, l, n, !0) : r;
|
|
263
|
+
return {
|
|
264
|
+
transformedFormula1: u,
|
|
265
|
+
transformedFormula2: d
|
|
266
|
+
};
|
|
267
|
+
}
|
|
268
|
+
var ta = Object.getOwnPropertyDescriptor, aa = (s, a, e, t) => {
|
|
269
|
+
for (var r = t > 1 ? void 0 : t ? ta(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
270
|
+
(o = s[i]) && (r = o(r) || r);
|
|
247
271
|
return r;
|
|
248
|
-
},
|
|
249
|
-
let
|
|
250
|
-
constructor(a, e
|
|
272
|
+
}, at = (s, a) => (e, t) => a(e, t, s);
|
|
273
|
+
let le = class extends x {
|
|
274
|
+
constructor(a, e) {
|
|
275
|
+
super();
|
|
276
|
+
// Cache structure: unitId -> subUnitId -> ruleId -> cache item
|
|
277
|
+
m(this, "_cache", /* @__PURE__ */ new Map());
|
|
278
|
+
this._injector = a, this._dataValidationModel = e, this._initRuleChangeListener();
|
|
279
|
+
}
|
|
280
|
+
_initRuleChangeListener() {
|
|
281
|
+
this.disposeWithMe(
|
|
282
|
+
this._dataValidationModel.ruleChange$.subscribe((a) => {
|
|
283
|
+
(a.type === "remove" || a.type === "update") && this.markRuleDirty(a.unitId, a.subUnitId, a.rule.uid);
|
|
284
|
+
})
|
|
285
|
+
);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Get cached list data or compute and cache it if not exists.
|
|
289
|
+
*/
|
|
290
|
+
getOrCompute(a, e, t) {
|
|
291
|
+
const r = this.getCache(a, e, t.uid);
|
|
292
|
+
if (r)
|
|
293
|
+
return r;
|
|
294
|
+
const o = this._injector.get(q).getRuleFormulaResultSync(a, e, t.uid);
|
|
295
|
+
return this.computeAndCache(a, e, t, o);
|
|
296
|
+
}
|
|
297
|
+
_ensureCache(a, e) {
|
|
298
|
+
let t = this._cache.get(a);
|
|
299
|
+
t || (t = /* @__PURE__ */ new Map(), this._cache.set(a, t));
|
|
300
|
+
let r = t.get(e);
|
|
301
|
+
return r || (r = /* @__PURE__ */ new Map(), t.set(e, r)), r;
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Get cached list data for a rule. Returns undefined if not cached.
|
|
305
|
+
*/
|
|
306
|
+
getCache(a, e, t) {
|
|
307
|
+
var r, i;
|
|
308
|
+
return (i = (r = this._cache.get(a)) == null ? void 0 : r.get(e)) == null ? void 0 : i.get(t);
|
|
309
|
+
}
|
|
310
|
+
/**
|
|
311
|
+
* Set cache for a rule.
|
|
312
|
+
*/
|
|
313
|
+
setCache(a, e, t, r) {
|
|
314
|
+
this._ensureCache(a, e).set(t, r);
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Mark a rule's cache as dirty (invalidate it).
|
|
318
|
+
* Called when formula results change.
|
|
319
|
+
*/
|
|
320
|
+
markRuleDirty(a, e, t) {
|
|
321
|
+
var r, i;
|
|
322
|
+
(i = (r = this._cache.get(a)) == null ? void 0 : r.get(e)) == null || i.delete(t);
|
|
323
|
+
}
|
|
324
|
+
/**
|
|
325
|
+
* Clear all caches.
|
|
326
|
+
*/
|
|
327
|
+
clear() {
|
|
328
|
+
this._cache.clear();
|
|
329
|
+
}
|
|
330
|
+
/**
|
|
331
|
+
* Compute list data from formula result and cache it.
|
|
332
|
+
*/
|
|
333
|
+
computeAndCache(a, e, t, r) {
|
|
334
|
+
var _, f, R;
|
|
335
|
+
const { formula1: i = "", formula2: o = "" } = t, n = S(i) ? this._getRuleFormulaResultSet((R = (f = (_ = r == null ? void 0 : r[0]) == null ? void 0 : _.result) == null ? void 0 : f[0]) == null ? void 0 : R[0]) : Ee(i), l = o.split(","), u = n.map((E, p) => ({ label: E, color: l[p] || "" })), d = {};
|
|
336
|
+
for (const E of u)
|
|
337
|
+
E.color && (d[E.label] = E.color);
|
|
338
|
+
const c = new Set(n), g = { list: n, listWithColor: u, colorMap: d, set: c };
|
|
339
|
+
return this.setCache(a, e, t.uid, g), g;
|
|
340
|
+
}
|
|
341
|
+
/**
|
|
342
|
+
* Extract string list from formula result cells.
|
|
343
|
+
*/
|
|
344
|
+
_getRuleFormulaResultSet(a) {
|
|
345
|
+
var t, r;
|
|
346
|
+
if (!a)
|
|
347
|
+
return [];
|
|
348
|
+
const e = /* @__PURE__ */ new Set();
|
|
349
|
+
for (let i = 0, o = a.length; i < o; i++) {
|
|
350
|
+
const n = a[i];
|
|
351
|
+
if (n)
|
|
352
|
+
for (let l = 0, u = n.length; l < u; l++) {
|
|
353
|
+
const d = n[l], c = re(d);
|
|
354
|
+
if (c != null) {
|
|
355
|
+
if (typeof c != "string" && typeof (d == null ? void 0 : d.s) == "object" && ((r = (t = d.s) == null ? void 0 : t.n) != null && r.pattern)) {
|
|
356
|
+
e.add(L.format(d.s.n.pattern, c, { throws: !1 }));
|
|
357
|
+
continue;
|
|
358
|
+
}
|
|
359
|
+
const g = typeof c == "string" ? c : String(c);
|
|
360
|
+
F(g) && e.add(g);
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return [...e];
|
|
365
|
+
}
|
|
366
|
+
};
|
|
367
|
+
le = aa([
|
|
368
|
+
at(0, v(be)),
|
|
369
|
+
at(1, v(ce))
|
|
370
|
+
], le);
|
|
371
|
+
var ra = Object.getOwnPropertyDescriptor, ia = (s, a, e, t) => {
|
|
372
|
+
for (var r = t > 1 ? void 0 : t ? ra(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
373
|
+
(o = s[i]) && (r = o(r) || r);
|
|
374
|
+
return r;
|
|
375
|
+
}, ee = (s, a) => (e, t) => a(e, t, s);
|
|
376
|
+
let q = class extends x {
|
|
377
|
+
constructor(a, e, t, r, i, o) {
|
|
251
378
|
super();
|
|
252
379
|
m(this, "_formulaRuleMap", /* @__PURE__ */ new Map());
|
|
253
|
-
this._instanceService = a, this._registerOtherFormulaService = e, this._dataValidationCacheService = t, this._dataValidationModel = r, this._validatorRegistryService = i, this._initFormulaResultHandler();
|
|
380
|
+
this._instanceService = a, this._registerOtherFormulaService = e, this._dataValidationCacheService = t, this._dataValidationModel = r, this._validatorRegistryService = i, this._listCacheService = o, this._initFormulaResultHandler();
|
|
254
381
|
}
|
|
255
382
|
_initFormulaResultHandler() {
|
|
256
383
|
this.disposeWithMe(this._registerOtherFormulaService.formulaResult$.subscribe((a) => {
|
|
@@ -258,12 +385,13 @@ let K = class extends W {
|
|
|
258
385
|
const t = a[e];
|
|
259
386
|
if (this._instanceService.getUnitType(e) === N.UNIVER_SHEET)
|
|
260
387
|
for (const i in t) {
|
|
261
|
-
const
|
|
262
|
-
|
|
263
|
-
var
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
c
|
|
388
|
+
const o = t[i], n = this._ensureRuleFormulaMap(e, i);
|
|
389
|
+
o.forEach((l) => {
|
|
390
|
+
var d;
|
|
391
|
+
const u = (d = l.extra) == null ? void 0 : d.ruleId;
|
|
392
|
+
if (u && n.get(u)) {
|
|
393
|
+
const c = this._dataValidationModel.getRuleById(e, i, u);
|
|
394
|
+
c && (this._listCacheService.markRuleDirty(e, i, u), this._dataValidationCacheService.markRangeDirty(e, i, c.ranges));
|
|
267
395
|
}
|
|
268
396
|
});
|
|
269
397
|
}
|
|
@@ -281,69 +409,63 @@ let K = class extends W {
|
|
|
281
409
|
return this._registerOtherFormulaService.registerFormulaWithRange(a, e, t, i, { ruleId: r });
|
|
282
410
|
}
|
|
283
411
|
addRule(a, e, t) {
|
|
284
|
-
if (!
|
|
285
|
-
const { formula1: r, formula2: i, uid:
|
|
412
|
+
if (!he(t.type, this._validatorRegistryService) && t.type !== T.CHECKBOX) {
|
|
413
|
+
const { formula1: r, formula2: i, uid: o } = t, n = S(r), l = S(i);
|
|
286
414
|
if (!n && !l)
|
|
287
415
|
return;
|
|
288
416
|
const u = this._ensureRuleFormulaMap(a, e), d = [void 0, void 0];
|
|
289
417
|
if (n) {
|
|
290
|
-
const c = this._registerSingleFormula(a, e, r,
|
|
418
|
+
const c = this._registerSingleFormula(a, e, r, o);
|
|
291
419
|
d[0] = { id: c, text: r };
|
|
292
420
|
}
|
|
293
421
|
if (l) {
|
|
294
|
-
const c = this._registerSingleFormula(a, e, i,
|
|
422
|
+
const c = this._registerSingleFormula(a, e, i, o);
|
|
295
423
|
d[1] = { id: c, text: i };
|
|
296
424
|
}
|
|
297
|
-
u.set(
|
|
425
|
+
u.set(o, d);
|
|
298
426
|
}
|
|
299
427
|
}
|
|
300
428
|
removeRule(a, e, t) {
|
|
301
429
|
const i = this._ensureRuleFormulaMap(a, e).get(t);
|
|
302
430
|
if (!i)
|
|
303
431
|
return;
|
|
304
|
-
const [
|
|
432
|
+
const [o, n] = i, l = [o == null ? void 0 : o.id, n == null ? void 0 : n.id].filter(Boolean);
|
|
305
433
|
l.length && this._registerOtherFormulaService.deleteFormula(a, e, l);
|
|
306
434
|
}
|
|
307
435
|
getRuleFormulaResult(a, e, t) {
|
|
308
436
|
const i = this._ensureRuleFormulaMap(a, e).get(t);
|
|
309
437
|
if (!i)
|
|
310
438
|
return Promise.resolve(null);
|
|
311
|
-
const
|
|
439
|
+
const o = async (n) => n && this._registerOtherFormulaService.getFormulaValue(a, e, n.id);
|
|
312
440
|
return Promise.all([
|
|
313
|
-
|
|
314
|
-
|
|
441
|
+
o(i[0]),
|
|
442
|
+
o(i[1])
|
|
315
443
|
]);
|
|
316
444
|
}
|
|
317
445
|
getRuleFormulaResultSync(a, e, t) {
|
|
318
446
|
const i = this._ensureRuleFormulaMap(a, e).get(t);
|
|
319
447
|
if (i)
|
|
320
|
-
return i.map((
|
|
321
|
-
if (
|
|
322
|
-
return this._registerOtherFormulaService.getFormulaValueSync(a, e,
|
|
448
|
+
return i.map((o) => {
|
|
449
|
+
if (o)
|
|
450
|
+
return this._registerOtherFormulaService.getFormulaValueSync(a, e, o.id);
|
|
323
451
|
});
|
|
324
452
|
}
|
|
325
453
|
getRuleFormulaInfo(a, e, t) {
|
|
326
454
|
return this._ensureRuleFormulaMap(a, e).get(t);
|
|
327
455
|
}
|
|
328
456
|
};
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
return Vt(o);
|
|
338
|
-
}
|
|
339
|
-
function pt(o) {
|
|
340
|
-
var a;
|
|
341
|
-
return String((a = ne(o)) != null ? a : "");
|
|
342
|
-
}
|
|
457
|
+
q = ia([
|
|
458
|
+
ee(0, I),
|
|
459
|
+
ee(1, v(gt)),
|
|
460
|
+
ee(2, v(Q)),
|
|
461
|
+
ee(3, v(ce)),
|
|
462
|
+
ee(4, v(G)),
|
|
463
|
+
ee(5, v(le))
|
|
464
|
+
], q);
|
|
343
465
|
class Ze {
|
|
344
466
|
constructor(a, e, t, r, i = !1) {
|
|
345
467
|
m(this, "_map");
|
|
346
|
-
m(this, "_tree", new
|
|
468
|
+
m(this, "_tree", new yt());
|
|
347
469
|
m(this, "_dirty", !0);
|
|
348
470
|
m(this, "_buildTree", () => {
|
|
349
471
|
if (!this._dirty || this._disableTree)
|
|
@@ -362,7 +484,7 @@ class Ze {
|
|
|
362
484
|
});
|
|
363
485
|
}), this._tree.load(a), this._dirty = !1;
|
|
364
486
|
});
|
|
365
|
-
m(this, "_debonceBuildTree",
|
|
487
|
+
m(this, "_debonceBuildTree", Tt(this._buildTree, 0));
|
|
366
488
|
this._unitId = e, this._subUnitId = t, this._univerInstanceService = r, this._disableTree = i, this._map = a, this._buildTree();
|
|
367
489
|
}
|
|
368
490
|
get _worksheet() {
|
|
@@ -372,10 +494,10 @@ class Ze {
|
|
|
372
494
|
_addRule(a, e) {
|
|
373
495
|
if (!this._worksheet)
|
|
374
496
|
return;
|
|
375
|
-
const t =
|
|
497
|
+
const t = w.mergeRanges(e.map((r) => U.transformRange(r, this._worksheet)));
|
|
376
498
|
this._map.forEach((r, i) => {
|
|
377
|
-
const
|
|
378
|
-
|
|
499
|
+
const o = w.subtractMulti(r, t);
|
|
500
|
+
o.length === 0 ? this._map.delete(i) : this._map.set(i, o);
|
|
379
501
|
}), this._dirty = !0, this._map.set(a, t), this._debonceBuildTree();
|
|
380
502
|
}
|
|
381
503
|
addRule(a) {
|
|
@@ -384,9 +506,9 @@ class Ze {
|
|
|
384
506
|
removeRange(a) {
|
|
385
507
|
if (!this._worksheet)
|
|
386
508
|
return;
|
|
387
|
-
const e = a.map((t) =>
|
|
509
|
+
const e = a.map((t) => U.transformRange(t, this._worksheet));
|
|
388
510
|
this._map.forEach((t, r) => {
|
|
389
|
-
const i =
|
|
511
|
+
const i = w.subtractMulti(t, e);
|
|
390
512
|
i.length === 0 ? this._map.delete(r) : this._map.set(r, i);
|
|
391
513
|
}), this._dirty = !0, this._debonceBuildTree();
|
|
392
514
|
}
|
|
@@ -404,11 +526,11 @@ class Ze {
|
|
|
404
526
|
if (!t.length)
|
|
405
527
|
return;
|
|
406
528
|
let r = this._map.get(e);
|
|
407
|
-
r ? (this._map.set(e,
|
|
408
|
-
if (
|
|
529
|
+
r ? (this._map.set(e, w.mergeRanges([...r, ...t])), r = this._map.get(e)) : (r = t, this._map.set(e, r)), this._map.forEach((i, o) => {
|
|
530
|
+
if (o === e)
|
|
409
531
|
return;
|
|
410
|
-
const n =
|
|
411
|
-
n.length === 0 ? this._map.delete(
|
|
532
|
+
const n = w.subtractMulti(i, t);
|
|
533
|
+
n.length === 0 ? this._map.delete(o) : this._map.set(o, n);
|
|
412
534
|
});
|
|
413
535
|
}), this._dirty = !0, this._debonceBuildTree();
|
|
414
536
|
}
|
|
@@ -417,14 +539,14 @@ class Ze {
|
|
|
417
539
|
let t = 0;
|
|
418
540
|
return a.forEach((r, i) => {
|
|
419
541
|
var l;
|
|
420
|
-
const
|
|
421
|
-
|
|
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, d) => !w.equals(u, n[d]))) && e.push({
|
|
422
544
|
type: "update",
|
|
423
545
|
ruleId: r.uid,
|
|
424
546
|
oldRanges: n,
|
|
425
|
-
newRanges:
|
|
547
|
+
newRanges: w.sort(o),
|
|
426
548
|
rule: r
|
|
427
|
-
}),
|
|
549
|
+
}), o.length === 0 && (e.push({
|
|
428
550
|
type: "delete",
|
|
429
551
|
rule: r,
|
|
430
552
|
index: i - t
|
|
@@ -434,35 +556,35 @@ class Ze {
|
|
|
434
556
|
diffWithAddition(a, e) {
|
|
435
557
|
const t = [];
|
|
436
558
|
let r = 0;
|
|
437
|
-
return a.forEach((i,
|
|
559
|
+
return a.forEach((i, o) => {
|
|
438
560
|
var u;
|
|
439
561
|
const n = (u = this._map.get(i.uid)) != null ? u : [], l = i.ranges;
|
|
440
|
-
n.length !== 0 && (n.length !== l.length || n.some((d, c) => !
|
|
562
|
+
n.length !== 0 && (n.length !== l.length || n.some((d, c) => !w.equals(d, l[c]))) && t.push({
|
|
441
563
|
type: "update",
|
|
442
564
|
ruleId: i.uid,
|
|
443
565
|
oldRanges: l,
|
|
444
|
-
newRanges:
|
|
566
|
+
newRanges: w.sort(n),
|
|
445
567
|
rule: i
|
|
446
568
|
}), n.length === 0 && (t.push({
|
|
447
569
|
type: "delete",
|
|
448
570
|
rule: i,
|
|
449
|
-
index:
|
|
571
|
+
index: o - r
|
|
450
572
|
}), r++);
|
|
451
573
|
}), Array.from(e).forEach((i) => {
|
|
452
574
|
var n;
|
|
453
|
-
const
|
|
575
|
+
const o = (n = this._map.get(i.uid)) != null ? n : [];
|
|
454
576
|
t.push({
|
|
455
577
|
type: "add",
|
|
456
578
|
rule: {
|
|
457
579
|
...i,
|
|
458
|
-
ranges:
|
|
580
|
+
ranges: w.sort(o)
|
|
459
581
|
}
|
|
460
582
|
});
|
|
461
583
|
}), t;
|
|
462
584
|
}
|
|
463
585
|
clone() {
|
|
464
586
|
return new Ze(
|
|
465
|
-
new Map(
|
|
587
|
+
new Map(M.deepClone(Array.from(this._map.entries()))),
|
|
466
588
|
this._unitId,
|
|
467
589
|
this._subUnitId,
|
|
468
590
|
this._univerInstanceService,
|
|
@@ -481,20 +603,20 @@ class Ze {
|
|
|
481
603
|
return t.length > 0 ? t[0].ruleId : void 0;
|
|
482
604
|
}
|
|
483
605
|
}
|
|
484
|
-
var
|
|
485
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
486
|
-
(
|
|
606
|
+
var sa = Object.getOwnPropertyDescriptor, oa = (s, a, e, t) => {
|
|
607
|
+
for (var r = t > 1 ? void 0 : t ? sa(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
608
|
+
(o = s[i]) && (r = o(r) || r);
|
|
487
609
|
return r;
|
|
488
|
-
},
|
|
489
|
-
let
|
|
490
|
-
constructor(a, e, t, r, i,
|
|
610
|
+
}, K = (s, a) => (e, t) => a(e, t, s);
|
|
611
|
+
let C = class extends x {
|
|
612
|
+
constructor(a, e, t, r, i, o, n) {
|
|
491
613
|
super();
|
|
492
614
|
m(this, "_ruleMatrixMap", /* @__PURE__ */ new Map());
|
|
493
|
-
m(this, "_validStatusChange$", new
|
|
494
|
-
m(this, "_ruleChange$", new
|
|
615
|
+
m(this, "_validStatusChange$", new Ye());
|
|
616
|
+
m(this, "_ruleChange$", new Ye());
|
|
495
617
|
m(this, "ruleChange$", this._ruleChange$.asObservable());
|
|
496
618
|
m(this, "validStatusChange$", this._validStatusChange$.asObservable());
|
|
497
|
-
this._dataValidationModel = a, this._univerInstanceService = e, this._dataValidatorRegistryService = t, this._dataValidationCacheService = r, this._dataValidationFormulaService = i, this._dataValidationCustomFormulaService =
|
|
619
|
+
this._dataValidationModel = a, this._univerInstanceService = e, this._dataValidatorRegistryService = t, this._dataValidationCacheService = r, this._dataValidationFormulaService = i, this._dataValidationCustomFormulaService = o, this._commandService = n, this._initRuleUpdateListener(), this.disposeWithMe(() => {
|
|
498
620
|
this._ruleChange$.complete(), this._validStatusChange$.complete();
|
|
499
621
|
}), this._initUniverInstanceListener();
|
|
500
622
|
}
|
|
@@ -505,7 +627,7 @@ let F = class extends W {
|
|
|
505
627
|
})
|
|
506
628
|
), this.disposeWithMe(
|
|
507
629
|
this._commandService.onCommandExecuted((a) => {
|
|
508
|
-
if (a.id ===
|
|
630
|
+
if (a.id === dt.id) {
|
|
509
631
|
const { unitId: e, subUnitId: t } = a.params, r = this._ruleMatrixMap.get(e);
|
|
510
632
|
r && r.delete(t);
|
|
511
633
|
}
|
|
@@ -516,12 +638,12 @@ let F = class extends W {
|
|
|
516
638
|
const a = this._dataValidationModel.getAll();
|
|
517
639
|
for (const [e, t] of a)
|
|
518
640
|
for (const [r, i] of t)
|
|
519
|
-
for (const
|
|
520
|
-
this._addRule(e, r,
|
|
641
|
+
for (const o of i)
|
|
642
|
+
this._addRule(e, r, o), this._ruleChange$.next({
|
|
521
643
|
type: "add",
|
|
522
644
|
unitId: e,
|
|
523
645
|
subUnitId: r,
|
|
524
|
-
rule:
|
|
646
|
+
rule: o,
|
|
525
647
|
source: "patched"
|
|
526
648
|
});
|
|
527
649
|
this.disposeWithMe(
|
|
@@ -556,11 +678,11 @@ let F = class extends W {
|
|
|
556
678
|
});
|
|
557
679
|
}
|
|
558
680
|
_updateRule(a, e, t, r, i) {
|
|
559
|
-
const
|
|
681
|
+
const o = this._ensureRuleMatrix(a, e), n = {
|
|
560
682
|
...r,
|
|
561
683
|
...i.payload
|
|
562
684
|
};
|
|
563
|
-
i.type ===
|
|
685
|
+
i.type === V.RANGE ? o.updateRange(t, i.payload) : i.type === V.ALL && o.updateRange(t, i.payload.ranges), this._dataValidationCacheService.removeRule(a, e, r), this._dataValidationCacheService.addRule(a, e, n), this._dataValidationFormulaService.removeRule(a, e, r.uid), this._dataValidationFormulaService.addRule(a, e, n), this._dataValidationCustomFormulaService.deleteByRuleId(a, e, t), this._dataValidationCustomFormulaService.addRule(a, e, n);
|
|
564
686
|
}
|
|
565
687
|
_removeRule(a, e, t) {
|
|
566
688
|
this._ensureRuleMatrix(a, e).removeRule(t), this._dataValidationCacheService.removeRule(a, e, t), this._dataValidationCustomFormulaService.deleteByRuleId(a, e, t.uid);
|
|
@@ -577,34 +699,34 @@ let F = class extends W {
|
|
|
577
699
|
return this._dataValidationModel.getRuleById(a, e, i);
|
|
578
700
|
}
|
|
579
701
|
validator(a, e, t) {
|
|
580
|
-
const { col: r, row: i, unitId:
|
|
581
|
-
t && t(
|
|
582
|
-
unitId:
|
|
702
|
+
const { col: r, row: i, unitId: o, subUnitId: n, worksheet: l } = e, u = (f, R) => {
|
|
703
|
+
t && t(f, R), R && this._validStatusChange$.next({
|
|
704
|
+
unitId: o,
|
|
583
705
|
subUnitId: n,
|
|
584
706
|
ruleId: a.uid,
|
|
585
|
-
status:
|
|
707
|
+
status: f,
|
|
586
708
|
row: i,
|
|
587
709
|
col: r
|
|
588
710
|
});
|
|
589
|
-
}, d = l.getCellValueOnly(i, r), c = this.getValidator(a.type), g = l.getCellRaw(i, r),
|
|
711
|
+
}, d = l.getCellValueOnly(i, r), c = this.getValidator(a.type), g = l.getCellRaw(i, r), _ = re(g);
|
|
590
712
|
if (c) {
|
|
591
|
-
const
|
|
592
|
-
return R == null ? (
|
|
713
|
+
const f = this._dataValidationCacheService.ensureCache(o, n), R = f.getValue(i, r);
|
|
714
|
+
return R == null ? (f.setValue(i, r, b.VALIDATING), c.validator(
|
|
593
715
|
{
|
|
594
|
-
value:
|
|
595
|
-
unitId:
|
|
716
|
+
value: _,
|
|
717
|
+
unitId: o,
|
|
596
718
|
subUnitId: n,
|
|
597
719
|
row: i,
|
|
598
720
|
column: r,
|
|
599
721
|
worksheet: e.worksheet,
|
|
600
722
|
workbook: e.workbook,
|
|
601
|
-
interceptValue:
|
|
723
|
+
interceptValue: re(d),
|
|
602
724
|
t: g == null ? void 0 : g.t
|
|
603
725
|
},
|
|
604
726
|
a
|
|
605
|
-
).then((
|
|
606
|
-
const
|
|
607
|
-
|
|
727
|
+
).then((E) => {
|
|
728
|
+
const p = E ? b.VALID : b.INVALID, O = f.getValue(i, r);
|
|
729
|
+
p === b.VALID ? f.realDeleteValue(i, r) : f.setValue(i, r, p), u(p, R !== O);
|
|
608
730
|
}), b.VALIDATING) : (u(R != null ? R : b.VALID, !1), R != null ? R : b.VALID);
|
|
609
731
|
} else
|
|
610
732
|
return u(b.VALID, !1), b.VALID;
|
|
@@ -634,21 +756,21 @@ let F = class extends W {
|
|
|
634
756
|
return this._dataValidationModel.getAll();
|
|
635
757
|
}
|
|
636
758
|
};
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
],
|
|
646
|
-
const
|
|
647
|
-
function
|
|
648
|
-
return
|
|
759
|
+
C = oa([
|
|
760
|
+
K(0, v(ce)),
|
|
761
|
+
K(1, I),
|
|
762
|
+
K(2, v(G)),
|
|
763
|
+
K(3, v(Q)),
|
|
764
|
+
K(4, v(q)),
|
|
765
|
+
K(5, v(W)),
|
|
766
|
+
K(6, B)
|
|
767
|
+
], C);
|
|
768
|
+
const Ve = 1, ye = 0;
|
|
769
|
+
function rt(s, a) {
|
|
770
|
+
return M.isBlank(s) ? a.t("dataValidation.validFail.value") : S(s) ? a.t("dataValidation.validFail.primitive") : "";
|
|
649
771
|
}
|
|
650
|
-
const
|
|
651
|
-
class
|
|
772
|
+
const ve = (s) => M.isDefine(s) && String(s).toLowerCase() === "true" ? "1" : String(s).toLowerCase() === "false" ? "0" : s;
|
|
773
|
+
class na extends Y {
|
|
652
774
|
constructor() {
|
|
653
775
|
super(...arguments);
|
|
654
776
|
m(this, "id", T.CHECKBOX);
|
|
@@ -657,15 +779,15 @@ class ia extends G {
|
|
|
657
779
|
m(this, "scopes", ["sheet"]);
|
|
658
780
|
m(this, "order", 41);
|
|
659
781
|
m(this, "offsetFormulaByRange", !1);
|
|
660
|
-
m(this, "_formulaService", this.injector.get(
|
|
782
|
+
m(this, "_formulaService", this.injector.get(q));
|
|
661
783
|
m(this, "skipDefaultFontRender", (e, t, r) => {
|
|
662
|
-
const { unitId: i, subUnitId:
|
|
784
|
+
const { unitId: i, subUnitId: o } = r, { formula1: n, formula2: l } = this.parseFormulaSync(e, i, o), u = `${t != null ? t : ""}`;
|
|
663
785
|
return !u || u === `${n}` || u === `${l}`;
|
|
664
786
|
});
|
|
665
787
|
}
|
|
666
788
|
validatorFormula(e, t, r) {
|
|
667
|
-
const { formula1: i, formula2:
|
|
668
|
-
if (
|
|
789
|
+
const { formula1: i, formula2: o } = e, n = i === o;
|
|
790
|
+
if (M.isBlank(i) && M.isBlank(o))
|
|
669
791
|
return {
|
|
670
792
|
success: !0
|
|
671
793
|
};
|
|
@@ -675,7 +797,7 @@ class ia extends G {
|
|
|
675
797
|
formula1: this.localeService.t("dataValidation.validFail.checkboxEqual"),
|
|
676
798
|
formula2: this.localeService.t("dataValidation.validFail.checkboxEqual")
|
|
677
799
|
};
|
|
678
|
-
const l =
|
|
800
|
+
const l = rt(i, this.localeService), u = rt(o, this.localeService);
|
|
679
801
|
return {
|
|
680
802
|
success: !l && !u,
|
|
681
803
|
formula1: l,
|
|
@@ -683,11 +805,11 @@ class ia extends G {
|
|
|
683
805
|
};
|
|
684
806
|
}
|
|
685
807
|
async parseFormula(e, t, r) {
|
|
686
|
-
var c, g,
|
|
687
|
-
const { formula1: i =
|
|
808
|
+
var c, g, _, f;
|
|
809
|
+
const { formula1: i = Ve, formula2: o = ye } = 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(o) ? oe((f = (_ = n == null ? void 0 : n[1]) == null ? void 0 : _.result) == null ? void 0 : f[0][0]) : o, d = F(String(l)) && F(String(u));
|
|
688
810
|
return {
|
|
689
|
-
formula1:
|
|
690
|
-
formula2:
|
|
811
|
+
formula1: ve(l),
|
|
812
|
+
formula2: ve(u),
|
|
691
813
|
originFormula1: l,
|
|
692
814
|
originFormula2: u,
|
|
693
815
|
isFormulaValid: d
|
|
@@ -695,23 +817,23 @@ class ia extends G {
|
|
|
695
817
|
}
|
|
696
818
|
getExtraStyle(e, t) {
|
|
697
819
|
return {
|
|
698
|
-
tb:
|
|
820
|
+
tb: Se.CLIP
|
|
699
821
|
};
|
|
700
822
|
}
|
|
701
823
|
parseFormulaSync(e, t, r) {
|
|
702
|
-
var c, g,
|
|
703
|
-
const { formula1: i =
|
|
824
|
+
var c, g, _, f;
|
|
825
|
+
const { formula1: i = Ve, formula2: o = ye } = 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(o) ? oe((f = (_ = n == null ? void 0 : n[1]) == null ? void 0 : _.result) == null ? void 0 : f[0][0]) : o, d = F(String(l)) && F(String(u));
|
|
704
826
|
return {
|
|
705
|
-
formula1:
|
|
706
|
-
formula2:
|
|
827
|
+
formula1: ve(l),
|
|
828
|
+
formula2: ve(u),
|
|
707
829
|
originFormula1: l,
|
|
708
830
|
originFormula2: u,
|
|
709
831
|
isFormulaValid: d
|
|
710
832
|
};
|
|
711
833
|
}
|
|
712
834
|
async isValidType(e, t, r) {
|
|
713
|
-
const { value: i, unitId:
|
|
714
|
-
return !
|
|
835
|
+
const { value: i, unitId: o, subUnitId: n } = e, { formula1: l, formula2: u, originFormula1: d, originFormula2: c } = 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(d != null ? d : "") || String(i) === String(c != null ? c : ""));
|
|
715
837
|
}
|
|
716
838
|
generateRuleErrorMessage(e) {
|
|
717
839
|
return this.localeService.t("dataValidation.checkbox.error");
|
|
@@ -720,7 +842,7 @@ class ia extends G {
|
|
|
720
842
|
return this.titleStr;
|
|
721
843
|
}
|
|
722
844
|
}
|
|
723
|
-
const
|
|
845
|
+
const la = {
|
|
724
846
|
[h.BETWEEN]: "dataValidation.date.operators.between",
|
|
725
847
|
[h.EQUAL]: "dataValidation.date.operators.equal",
|
|
726
848
|
[h.GREATER_THAN]: "dataValidation.date.operators.greaterThan",
|
|
@@ -731,7 +853,7 @@ const oa = {
|
|
|
731
853
|
[h.NOT_EQUAL]: "dataValidation.date.operators.notEqual"
|
|
732
854
|
};
|
|
733
855
|
h.BETWEEN + "", h.EQUAL + "", h.GREATER_THAN + "", h.GREATER_THAN_OR_EQUAL + "", h.LESS_THAN + "", h.LESS_THAN_OR_EQUAL + "", h.NOT_BETWEEN + "", h.NOT_EQUAL + "";
|
|
734
|
-
const
|
|
856
|
+
const it = {
|
|
735
857
|
[h.BETWEEN]: "dataValidation.date.ruleName.between",
|
|
736
858
|
[h.EQUAL]: "dataValidation.date.ruleName.equal",
|
|
737
859
|
[h.GREATER_THAN]: "dataValidation.date.ruleName.greaterThan",
|
|
@@ -741,7 +863,7 @@ const rt = {
|
|
|
741
863
|
[h.NOT_BETWEEN]: "dataValidation.date.ruleName.notBetween",
|
|
742
864
|
[h.NOT_EQUAL]: "dataValidation.date.ruleName.notEqual",
|
|
743
865
|
NONE: "dataValidation.date.ruleName.legal"
|
|
744
|
-
},
|
|
866
|
+
}, ua = {
|
|
745
867
|
[h.BETWEEN]: "dataValidation.date.errorMsg.between",
|
|
746
868
|
[h.EQUAL]: "dataValidation.date.errorMsg.equal",
|
|
747
869
|
[h.GREATER_THAN]: "dataValidation.date.errorMsg.greaterThan",
|
|
@@ -751,37 +873,19 @@ const rt = {
|
|
|
751
873
|
[h.NOT_BETWEEN]: "dataValidation.date.errorMsg.notBetween",
|
|
752
874
|
[h.NOT_EQUAL]: "dataValidation.date.errorMsg.notEqual",
|
|
753
875
|
NONE: "dataValidation.date.errorMsg.legal"
|
|
754
|
-
},
|
|
876
|
+
}, Be = [
|
|
755
877
|
h.BETWEEN,
|
|
756
878
|
h.NOT_BETWEEN
|
|
757
|
-
],
|
|
758
|
-
function Ka(o) {
|
|
759
|
-
return o.filter(Boolean).join(",");
|
|
760
|
-
}
|
|
761
|
-
function _e(o) {
|
|
762
|
-
return o.split(",").filter(Boolean);
|
|
763
|
-
}
|
|
764
|
-
function za(o) {
|
|
765
|
-
const a = ne(o);
|
|
766
|
-
return a == null ? "" : a.toString();
|
|
767
|
-
}
|
|
768
|
-
function Le(o, a, e) {
|
|
769
|
-
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;
|
|
770
|
-
return {
|
|
771
|
-
transformedFormula1: u,
|
|
772
|
-
transformedFormula2: d
|
|
773
|
-
};
|
|
774
|
-
}
|
|
775
|
-
const We = (o) => {
|
|
879
|
+
], ue = "{FORMULA1}", de = "{FORMULA2}", ke = (s) => {
|
|
776
880
|
var e, t;
|
|
777
|
-
if (
|
|
881
|
+
if (s == null || typeof s == "boolean")
|
|
778
882
|
return;
|
|
779
|
-
if (typeof
|
|
780
|
-
return +
|
|
781
|
-
const a = (e =
|
|
782
|
-
return
|
|
883
|
+
if (typeof s == "number" || !Number.isNaN(+s))
|
|
884
|
+
return +s;
|
|
885
|
+
const a = (e = L.parseDate(s)) == null ? void 0 : e.v;
|
|
886
|
+
return M.isDefine(a) ? a : (t = L.parseDate(nt(s).format("YYYY-MM-DD HH:mm:ss"))) == null ? void 0 : t.v;
|
|
783
887
|
};
|
|
784
|
-
class
|
|
888
|
+
class da extends Y {
|
|
785
889
|
constructor() {
|
|
786
890
|
super(...arguments);
|
|
787
891
|
m(this, "id", T.DATE);
|
|
@@ -798,23 +902,23 @@ class na extends G {
|
|
|
798
902
|
h.NOT_EQUAL
|
|
799
903
|
]);
|
|
800
904
|
m(this, "scopes", ["sheet"]);
|
|
801
|
-
m(this, "_customFormulaService", this.injector.get(
|
|
802
|
-
m(this, "_lexerTreeBuilder", this.injector.get(
|
|
905
|
+
m(this, "_customFormulaService", this.injector.get(W));
|
|
906
|
+
m(this, "_lexerTreeBuilder", this.injector.get(X));
|
|
803
907
|
}
|
|
804
|
-
async parseFormula(e, t, r, i,
|
|
805
|
-
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i,
|
|
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: d } = e, c = F(String(n == null ? void 0 : n.v)) && F(String(l == null ? void 0 : l.v));
|
|
806
910
|
return {
|
|
807
|
-
formula1:
|
|
808
|
-
formula2:
|
|
911
|
+
formula1: ke(S(u) ? n == null ? void 0 : n.v : u),
|
|
912
|
+
formula2: ke(S(d) ? l == null ? void 0 : l.v : d),
|
|
809
913
|
isFormulaValid: c
|
|
810
914
|
};
|
|
811
915
|
}
|
|
812
916
|
async isValidType(e) {
|
|
813
917
|
const { interceptValue: t, value: r } = e;
|
|
814
|
-
return typeof r == "number" && typeof t == "string" ? !!
|
|
918
|
+
return typeof r == "number" && typeof t == "string" ? !!L.parseDate(t) : typeof t == "string" ? !!L.parseDate(t) : !1;
|
|
815
919
|
}
|
|
816
920
|
_validatorSingleFormula(e) {
|
|
817
|
-
return !
|
|
921
|
+
return !M.isBlank(e) && (S(e) || !Number.isNaN(+e) || !!(e && L.parseDate(e)));
|
|
818
922
|
}
|
|
819
923
|
validatorFormula(e, t, r) {
|
|
820
924
|
const i = e.operator;
|
|
@@ -822,68 +926,68 @@ class na extends G {
|
|
|
822
926
|
return {
|
|
823
927
|
success: !0
|
|
824
928
|
};
|
|
825
|
-
const
|
|
826
|
-
if (
|
|
929
|
+
const o = this._validatorSingleFormula(e.formula1), n = this.localeService.t("dataValidation.validFail.date");
|
|
930
|
+
if (Be.includes(i)) {
|
|
827
931
|
const u = this._validatorSingleFormula(e.formula2);
|
|
828
932
|
return {
|
|
829
|
-
success:
|
|
830
|
-
formula1:
|
|
933
|
+
success: o && u,
|
|
934
|
+
formula1: o ? void 0 : n,
|
|
831
935
|
formula2: u ? void 0 : n
|
|
832
936
|
};
|
|
833
937
|
}
|
|
834
938
|
return {
|
|
835
|
-
success:
|
|
836
|
-
formula1:
|
|
939
|
+
success: o,
|
|
940
|
+
formula1: o ? void 0 : n
|
|
837
941
|
};
|
|
838
942
|
}
|
|
839
943
|
normalizeFormula(e, t, r) {
|
|
840
|
-
const { formula1: i, formula2:
|
|
944
|
+
const { formula1: i, formula2: o, bizInfo: n } = e, l = (u) => {
|
|
841
945
|
var c;
|
|
842
946
|
if (!u)
|
|
843
947
|
return u;
|
|
844
948
|
let d;
|
|
845
949
|
if (!Number.isNaN(+u))
|
|
846
|
-
d =
|
|
950
|
+
d = L.dateFromSerial(+u);
|
|
847
951
|
else {
|
|
848
|
-
const g = (c =
|
|
952
|
+
const g = (c = L.parseDate(u)) == null ? void 0 : c.v;
|
|
849
953
|
if (g == null)
|
|
850
954
|
return "";
|
|
851
|
-
d =
|
|
955
|
+
d = L.dateFromSerial(g);
|
|
852
956
|
}
|
|
853
|
-
return
|
|
957
|
+
return nt(`${d[0]}/${d[1]}/${d[2]} ${d[3]}:${d[4]}:${d[5]}`).format(n != null && n.showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD");
|
|
854
958
|
};
|
|
855
959
|
return {
|
|
856
960
|
formula1: S(i) ? i : l(`${i}`),
|
|
857
|
-
formula2: S(
|
|
961
|
+
formula2: S(o) ? o : l(`${o}`)
|
|
858
962
|
};
|
|
859
963
|
}
|
|
860
964
|
transform(e, t, r) {
|
|
861
965
|
const { value: i } = e;
|
|
862
966
|
return {
|
|
863
967
|
...e,
|
|
864
|
-
value:
|
|
968
|
+
value: ke(i)
|
|
865
969
|
};
|
|
866
970
|
}
|
|
867
971
|
get operatorNames() {
|
|
868
|
-
return this.operators.map((e) => this.localeService.t(
|
|
972
|
+
return this.operators.map((e) => this.localeService.t(la[e]));
|
|
869
973
|
}
|
|
870
974
|
generateRuleName(e) {
|
|
871
975
|
var r, i;
|
|
872
976
|
if (!e.operator)
|
|
873
|
-
return this.localeService.t(
|
|
874
|
-
const t = this.localeService.t(
|
|
977
|
+
return this.localeService.t(it.NONE);
|
|
978
|
+
const t = this.localeService.t(it[e.operator]).replace(ue, (r = e.formula1) != null ? r : "").replace(de, (i = e.formula2) != null ? i : "");
|
|
875
979
|
return `${this.titleStr} ${t}`;
|
|
876
980
|
}
|
|
877
981
|
generateRuleErrorMessage(e, t) {
|
|
878
982
|
if (!e.operator)
|
|
879
983
|
return this.titleStr;
|
|
880
|
-
const { transformedFormula1: r, transformedFormula2: i } =
|
|
881
|
-
return `${this.localeService.t(
|
|
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(de, i != null ? i : "")}`;
|
|
882
986
|
}
|
|
883
987
|
}
|
|
884
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 + "";
|
|
885
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 + "";
|
|
886
|
-
const
|
|
990
|
+
const Te = {
|
|
887
991
|
[h.BETWEEN]: "dataValidation.errorMsg.between",
|
|
888
992
|
[h.EQUAL]: "dataValidation.errorMsg.equal",
|
|
889
993
|
[h.GREATER_THAN]: "dataValidation.errorMsg.greaterThan",
|
|
@@ -894,15 +998,15 @@ const Me = {
|
|
|
894
998
|
[h.NOT_EQUAL]: "dataValidation.errorMsg.notEqual",
|
|
895
999
|
NONE: "dataValidation.errorMsg.legal"
|
|
896
1000
|
};
|
|
897
|
-
function
|
|
898
|
-
return +
|
|
1001
|
+
function Fe(s) {
|
|
1002
|
+
return +s;
|
|
899
1003
|
}
|
|
900
|
-
class
|
|
1004
|
+
class ca extends Y {
|
|
901
1005
|
constructor() {
|
|
902
1006
|
super(...arguments);
|
|
903
|
-
m(this, "_customFormulaService", this.injector.get(
|
|
1007
|
+
m(this, "_customFormulaService", this.injector.get(W));
|
|
904
1008
|
m(this, "id", T.DECIMAL);
|
|
905
|
-
m(this, "_lexerTreeBuilder", this.injector.get(
|
|
1009
|
+
m(this, "_lexerTreeBuilder", this.injector.get(X));
|
|
906
1010
|
m(this, "title", "dataValidation.decimal.title");
|
|
907
1011
|
m(this, "order", 20);
|
|
908
1012
|
m(this, "operators", [
|
|
@@ -918,24 +1022,24 @@ class la extends G {
|
|
|
918
1022
|
m(this, "scopes", ["sheet"]);
|
|
919
1023
|
}
|
|
920
1024
|
_isFormulaOrNumber(e) {
|
|
921
|
-
return !
|
|
1025
|
+
return !M.isBlank(e) && (S(e) || !Number.isNaN(+e));
|
|
922
1026
|
}
|
|
923
1027
|
async isValidType(e, t, r) {
|
|
924
1028
|
const { value: i } = e;
|
|
925
|
-
return !Number.isNaN(
|
|
1029
|
+
return !Number.isNaN(Fe(i));
|
|
926
1030
|
}
|
|
927
1031
|
transform(e, t, r) {
|
|
928
1032
|
const { value: i } = e;
|
|
929
1033
|
return {
|
|
930
1034
|
...e,
|
|
931
|
-
value:
|
|
1035
|
+
value: Fe(i)
|
|
932
1036
|
};
|
|
933
1037
|
}
|
|
934
1038
|
_parseNumber(e) {
|
|
935
1039
|
return e == null ? Number.NaN : +e;
|
|
936
1040
|
}
|
|
937
|
-
async parseFormula(e, t, r, i,
|
|
938
|
-
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i,
|
|
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: d } = e, c = F(String(n == null ? void 0 : n.v)) && F(String(l == null ? void 0 : l.v));
|
|
939
1043
|
return {
|
|
940
1044
|
formula1: this._parseNumber(S(u) ? n == null ? void 0 : n.v : u),
|
|
941
1045
|
formula2: this._parseNumber(S(d) ? l == null ? void 0 : l.v : d),
|
|
@@ -948,90 +1052,93 @@ class la extends G {
|
|
|
948
1052
|
return {
|
|
949
1053
|
success: !0
|
|
950
1054
|
};
|
|
951
|
-
const
|
|
1055
|
+
const o = M.isDefine(e.formula1) && this._isFormulaOrNumber(e.formula1), n = M.isDefine(e.formula2) && this._isFormulaOrNumber(e.formula2), l = Be.includes(i), u = this.localeService.t("dataValidation.validFail.number");
|
|
952
1056
|
return l ? {
|
|
953
|
-
success:
|
|
954
|
-
formula1:
|
|
1057
|
+
success: o && n,
|
|
1058
|
+
formula1: o ? void 0 : u,
|
|
955
1059
|
formula2: n ? void 0 : u
|
|
956
1060
|
} : {
|
|
957
|
-
success:
|
|
958
|
-
formula1:
|
|
1061
|
+
success: o,
|
|
1062
|
+
formula1: o ? "" : u
|
|
959
1063
|
};
|
|
960
1064
|
}
|
|
961
1065
|
generateRuleErrorMessage(e, t) {
|
|
962
1066
|
if (!e.operator)
|
|
963
|
-
return this.localeService.t(
|
|
964
|
-
const { transformedFormula1: r, transformedFormula2: i } =
|
|
965
|
-
return `${this.localeService.t(
|
|
1067
|
+
return this.localeService.t(Te.NONE).replace("{TYPE}", this.titleStr);
|
|
1068
|
+
const { transformedFormula1: r, transformedFormula2: i } = Ue(this._lexerTreeBuilder, e, t);
|
|
1069
|
+
return `${this.localeService.t(Te[e.operator]).replace(ue, r != null ? r : "").replace(de, i != null ? i : "")}`;
|
|
966
1070
|
}
|
|
967
1071
|
}
|
|
968
|
-
function
|
|
969
|
-
|
|
1072
|
+
function ha(s) {
|
|
1073
|
+
var e, t;
|
|
1074
|
+
if (!s)
|
|
970
1075
|
return [];
|
|
971
1076
|
const a = /* @__PURE__ */ new Set();
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
const
|
|
977
|
-
if (
|
|
978
|
-
if (typeof
|
|
979
|
-
a.add(
|
|
980
|
-
|
|
1077
|
+
for (let r = 0, i = s.length; r < i; r++) {
|
|
1078
|
+
const o = s[r];
|
|
1079
|
+
if (o)
|
|
1080
|
+
for (let n = 0, l = o.length; n < l; n++) {
|
|
1081
|
+
const u = o[n], d = re(u);
|
|
1082
|
+
if (d != null) {
|
|
1083
|
+
if (typeof d != "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, d, { throws: !1 }));
|
|
1085
|
+
continue;
|
|
981
1086
|
}
|
|
982
|
-
|
|
1087
|
+
const c = typeof d == "string" ? d : String(d);
|
|
1088
|
+
F(c) && a.add(c);
|
|
983
1089
|
}
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
return [...a];
|
|
987
1093
|
}
|
|
988
|
-
const
|
|
1094
|
+
const ma = [
|
|
989
1095
|
"if",
|
|
990
1096
|
"indirect",
|
|
991
1097
|
"choose",
|
|
992
1098
|
"offset"
|
|
993
1099
|
];
|
|
994
|
-
function
|
|
995
|
-
if (!S(
|
|
1100
|
+
function ga(s, a) {
|
|
1101
|
+
if (!S(s) || ut(s.slice(1)))
|
|
996
1102
|
return !0;
|
|
997
|
-
const t = a.sequenceNodesBuilder(
|
|
998
|
-
return t && t.some((r) => typeof r == "object" && r.nodeType ===
|
|
1103
|
+
const t = a.sequenceNodesBuilder(s);
|
|
1104
|
+
return t && t.some((r) => typeof r == "object" && r.nodeType === Ht.FUNCTION && ma.indexOf(r.token.toLowerCase()) > -1);
|
|
999
1105
|
}
|
|
1000
|
-
function
|
|
1001
|
-
const { formula1: e = "", ranges: t } =
|
|
1002
|
-
if (
|
|
1003
|
-
const i =
|
|
1004
|
-
if ((!i.sheetName || i.sheetName === a) && t.some((
|
|
1106
|
+
function pa(s, a) {
|
|
1107
|
+
const { formula1: e = "", ranges: t } = s;
|
|
1108
|
+
if (ut(e.slice(1))) {
|
|
1109
|
+
const i = Wt(e.slice(1));
|
|
1110
|
+
if ((!i.sheetName || i.sheetName === a) && t.some((o) => w.intersects(o, i.range)))
|
|
1005
1111
|
return !0;
|
|
1006
1112
|
}
|
|
1007
1113
|
return !1;
|
|
1008
1114
|
}
|
|
1009
|
-
class
|
|
1115
|
+
class _t extends Y {
|
|
1010
1116
|
constructor() {
|
|
1011
1117
|
super(...arguments);
|
|
1012
|
-
m(this, "formulaService", this.injector.get(
|
|
1013
|
-
m(this, "_lexer", this.injector.get(
|
|
1014
|
-
m(this, "_univerInstanceService", this.injector.get(
|
|
1118
|
+
m(this, "formulaService", this.injector.get(q));
|
|
1119
|
+
m(this, "_lexer", this.injector.get(X));
|
|
1120
|
+
m(this, "_univerInstanceService", this.injector.get(I));
|
|
1121
|
+
m(this, "_listCacheService", this.injector.get(le));
|
|
1015
1122
|
m(this, "order", 50);
|
|
1016
1123
|
m(this, "offsetFormulaByRange", !1);
|
|
1017
1124
|
m(this, "id", T.LIST);
|
|
1018
1125
|
m(this, "title", "dataValidation.list.title");
|
|
1019
1126
|
m(this, "operators", []);
|
|
1020
1127
|
m(this, "scopes", ["sheet"]);
|
|
1021
|
-
m(this, "skipDefaultFontRender", (e) => e.renderMode !==
|
|
1128
|
+
m(this, "skipDefaultFontRender", (e) => e.renderMode !== We.TEXT);
|
|
1022
1129
|
}
|
|
1023
1130
|
validatorFormula(e, t, r) {
|
|
1024
1131
|
var u, d, c;
|
|
1025
|
-
const i = !
|
|
1132
|
+
const i = !M.isBlank(e.formula1), o = ga((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 = pa(e, n != null ? n : "");
|
|
1026
1133
|
return {
|
|
1027
|
-
success: !!(i &&
|
|
1028
|
-
formula1: i ?
|
|
1134
|
+
success: !!(i && o && !l),
|
|
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")
|
|
1029
1136
|
};
|
|
1030
1137
|
}
|
|
1031
1138
|
getExtraStyle(e, t, { style: r }) {
|
|
1032
|
-
var
|
|
1033
|
-
const i = (
|
|
1034
|
-
if (e.type === T.LIST && (e.renderMode ===
|
|
1139
|
+
var o;
|
|
1140
|
+
const i = (o = r.tb !== Se.OVERFLOW ? r.tb : Se.CLIP) != null ? o : Se.WRAP;
|
|
1141
|
+
if (e.type === T.LIST && (e.renderMode === We.ARROW || e.renderMode === We.TEXT)) {
|
|
1035
1142
|
const n = this.getListWithColorMap(e), l = `${t != null ? t : ""}`, u = n[l];
|
|
1036
1143
|
if (u)
|
|
1037
1144
|
return {
|
|
@@ -1047,21 +1154,24 @@ class ft extends G {
|
|
|
1047
1154
|
}
|
|
1048
1155
|
parseCellValue(e) {
|
|
1049
1156
|
const t = e.toString();
|
|
1050
|
-
return
|
|
1157
|
+
return Ee(t);
|
|
1051
1158
|
}
|
|
1052
1159
|
async parseFormula(e, t, r) {
|
|
1053
1160
|
var l, u;
|
|
1054
|
-
const i = await this.formulaService.getRuleFormulaResult(t, r, e.uid),
|
|
1161
|
+
const i = await this.formulaService.getRuleFormulaResult(t, r, e.uid), o = oe((u = (l = i == null ? void 0 : i[0]) == null ? void 0 : l.result) == null ? void 0 : u[0][0]);
|
|
1055
1162
|
return {
|
|
1056
1163
|
formula1: void 0,
|
|
1057
1164
|
formula2: void 0,
|
|
1058
|
-
isFormulaValid:
|
|
1165
|
+
isFormulaValid: F(String(o))
|
|
1059
1166
|
};
|
|
1060
1167
|
}
|
|
1061
1168
|
async isValidType(e, t, r) {
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1169
|
+
const { value: i, unitId: o, subUnitId: n } = e, { formula1: l = "" } = r, u = S(l) ? this._listCacheService.getOrCompute(
|
|
1170
|
+
o,
|
|
1171
|
+
n,
|
|
1172
|
+
r
|
|
1173
|
+
).list : Ee(l);
|
|
1174
|
+
return this.parseCellValue(i).every((c) => u.includes(c));
|
|
1065
1175
|
}
|
|
1066
1176
|
generateRuleName() {
|
|
1067
1177
|
return this.localeService.t("dataValidation.list.name");
|
|
@@ -1069,41 +1179,60 @@ class ft extends G {
|
|
|
1069
1179
|
generateRuleErrorMessage() {
|
|
1070
1180
|
return this.localeService.t("dataValidation.list.error");
|
|
1071
1181
|
}
|
|
1182
|
+
_getUnitAndSubUnit(e, t) {
|
|
1183
|
+
var o, n;
|
|
1184
|
+
const r = (o = e ? this._univerInstanceService.getUniverSheetInstance(e) : void 0) != null ? o : this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET);
|
|
1185
|
+
if (!r) return null;
|
|
1186
|
+
const i = (n = t ? r.getSheetBySheetId(t) : void 0) != null ? n : r.getActiveSheet();
|
|
1187
|
+
return i ? {
|
|
1188
|
+
unitId: r.getUnitId(),
|
|
1189
|
+
subUnitId: i.getSheetId()
|
|
1190
|
+
} : null;
|
|
1191
|
+
}
|
|
1072
1192
|
getList(e, t, r) {
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1193
|
+
const i = this._getUnitAndSubUnit(t, r);
|
|
1194
|
+
if (!i) return [];
|
|
1195
|
+
const { unitId: o, subUnitId: n } = i;
|
|
1196
|
+
return this._listCacheService.getOrCompute(
|
|
1197
|
+
o,
|
|
1198
|
+
n,
|
|
1199
|
+
e
|
|
1200
|
+
).list;
|
|
1080
1201
|
}
|
|
1081
1202
|
async getListAsync(e, t, r) {
|
|
1082
|
-
var
|
|
1083
|
-
const { formula1: i = "" } = e,
|
|
1084
|
-
if (!
|
|
1085
|
-
const
|
|
1086
|
-
|
|
1087
|
-
const u = n.getUnitId(), d = l.getSheetId(), c = await this.formulaService.getRuleFormulaResult(u, d, e.uid);
|
|
1088
|
-
return S(i) ? $e((R = (p = c == null ? void 0 : c[0]) == null ? void 0 : p.result) == null ? void 0 : R[0][0]) : _e(i);
|
|
1203
|
+
var d, c;
|
|
1204
|
+
const { formula1: i = "" } = e, o = this._getUnitAndSubUnit(t, r);
|
|
1205
|
+
if (!o) return [];
|
|
1206
|
+
const { unitId: n, subUnitId: l } = o, u = await this.formulaService.getRuleFormulaResult(n, l, e.uid);
|
|
1207
|
+
return S(i) ? ha((c = (d = u == null ? void 0 : u[0]) == null ? void 0 : d.result) == null ? void 0 : c[0][0]) : Ee(i);
|
|
1089
1208
|
}
|
|
1090
1209
|
getListWithColor(e, t, r) {
|
|
1091
|
-
const i = this.
|
|
1092
|
-
|
|
1210
|
+
const i = this._getUnitAndSubUnit(t, r);
|
|
1211
|
+
if (!i) return [];
|
|
1212
|
+
const { unitId: o, subUnitId: n } = i;
|
|
1213
|
+
return this._listCacheService.getOrCompute(
|
|
1214
|
+
o,
|
|
1215
|
+
n,
|
|
1216
|
+
e
|
|
1217
|
+
).listWithColor;
|
|
1093
1218
|
}
|
|
1094
1219
|
getListWithColorMap(e, t, r) {
|
|
1095
|
-
const i = this.
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1220
|
+
const i = this._getUnitAndSubUnit(t, r);
|
|
1221
|
+
if (!i) return {};
|
|
1222
|
+
const { unitId: o, subUnitId: n } = i;
|
|
1223
|
+
return this._listCacheService.getOrCompute(
|
|
1224
|
+
o,
|
|
1225
|
+
n,
|
|
1226
|
+
e
|
|
1227
|
+
).colorMap;
|
|
1099
1228
|
}
|
|
1100
1229
|
}
|
|
1101
|
-
class
|
|
1230
|
+
class fa extends Y {
|
|
1102
1231
|
constructor() {
|
|
1103
1232
|
super(...arguments);
|
|
1104
1233
|
m(this, "id", T.TEXT_LENGTH);
|
|
1105
1234
|
m(this, "title", "dataValidation.textLength.title");
|
|
1106
|
-
m(this, "_lexerTreeBuilder", this.injector.get(
|
|
1235
|
+
m(this, "_lexerTreeBuilder", this.injector.get(X));
|
|
1107
1236
|
m(this, "order", 30);
|
|
1108
1237
|
m(this, "operators", [
|
|
1109
1238
|
h.BETWEEN,
|
|
@@ -1116,10 +1245,10 @@ class ha extends G {
|
|
|
1116
1245
|
h.NOT_EQUAL
|
|
1117
1246
|
]);
|
|
1118
1247
|
m(this, "scopes", ["sheet"]);
|
|
1119
|
-
m(this, "_customFormulaService", this.injector.get(
|
|
1248
|
+
m(this, "_customFormulaService", this.injector.get(W));
|
|
1120
1249
|
}
|
|
1121
1250
|
_isFormulaOrInt(e) {
|
|
1122
|
-
return !
|
|
1251
|
+
return !M.isBlank(e) && (S(e) || !Number.isNaN(+e) && Number.isInteger(+e));
|
|
1123
1252
|
}
|
|
1124
1253
|
validatorFormula(e, t, r) {
|
|
1125
1254
|
const i = e.operator;
|
|
@@ -1127,21 +1256,21 @@ class ha extends G {
|
|
|
1127
1256
|
return {
|
|
1128
1257
|
success: !1
|
|
1129
1258
|
};
|
|
1130
|
-
const
|
|
1259
|
+
const o = M.isDefine(e.formula1) && this._isFormulaOrInt(e.formula1), n = M.isDefine(e.formula2) && this._isFormulaOrInt(e.formula2), l = Be.includes(i), u = this.localeService.t("dataValidation.validFail.number");
|
|
1131
1260
|
return l ? {
|
|
1132
|
-
success:
|
|
1133
|
-
formula1:
|
|
1261
|
+
success: o && n,
|
|
1262
|
+
formula1: o ? void 0 : u,
|
|
1134
1263
|
formula2: n ? void 0 : u
|
|
1135
1264
|
} : {
|
|
1136
|
-
success:
|
|
1265
|
+
success: o,
|
|
1137
1266
|
formula1: u
|
|
1138
1267
|
};
|
|
1139
1268
|
}
|
|
1140
1269
|
_parseNumber(e) {
|
|
1141
1270
|
return e == null ? Number.NaN : +e;
|
|
1142
1271
|
}
|
|
1143
|
-
async parseFormula(e, t, r, i,
|
|
1144
|
-
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i,
|
|
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: d } = e, c = F(String(n == null ? void 0 : n.v)) && F(String(l == null ? void 0 : l.v));
|
|
1145
1274
|
return {
|
|
1146
1275
|
formula1: this._parseNumber(S(u) ? n == null ? void 0 : n.v : u),
|
|
1147
1276
|
formula2: this._parseNumber(S(d) ? l == null ? void 0 : l.v : d),
|
|
@@ -1161,110 +1290,110 @@ class ha extends G {
|
|
|
1161
1290
|
generateRuleErrorMessage(e, t) {
|
|
1162
1291
|
if (!e.operator)
|
|
1163
1292
|
return this.titleStr;
|
|
1164
|
-
const { transformedFormula1: r, transformedFormula2: i } =
|
|
1165
|
-
return `${this.localeService.t(
|
|
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(de, i != null ? i : "")}`;
|
|
1166
1295
|
}
|
|
1167
1296
|
}
|
|
1168
|
-
function
|
|
1297
|
+
function vt(s) {
|
|
1169
1298
|
var e, t;
|
|
1170
|
-
return
|
|
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;
|
|
1171
1300
|
}
|
|
1172
|
-
function
|
|
1173
|
-
const
|
|
1301
|
+
function xe(s, a, e, t, r = "command", i = !0) {
|
|
1302
|
+
const o = t.get(X), n = t.get(G), l = [], u = [], d = t.get(C), c = t.get(I), g = ze(c, { unitId: s, subUnitId: a });
|
|
1174
1303
|
if (!g)
|
|
1175
1304
|
return {
|
|
1176
1305
|
redoMutations: l,
|
|
1177
1306
|
undoMutations: u
|
|
1178
1307
|
};
|
|
1179
|
-
const { worksheet:
|
|
1308
|
+
const { worksheet: _ } = g, f = new Me();
|
|
1180
1309
|
let R = !1;
|
|
1181
|
-
function
|
|
1182
|
-
i &&
|
|
1183
|
-
|
|
1184
|
-
const
|
|
1185
|
-
(
|
|
1186
|
-
v:
|
|
1310
|
+
function E(p, O) {
|
|
1311
|
+
i && p.forEach(($) => {
|
|
1312
|
+
U.foreach($, (P, k) => {
|
|
1313
|
+
const H = _.getCellRaw(P, k), J = ft(H);
|
|
1314
|
+
(vt(H) || J === O) && !(H != null && H.p) && (R = !0, f.setValue(P, k, {
|
|
1315
|
+
v: O,
|
|
1187
1316
|
p: null
|
|
1188
1317
|
}));
|
|
1189
1318
|
});
|
|
1190
1319
|
});
|
|
1191
1320
|
}
|
|
1192
|
-
if (e.forEach((
|
|
1193
|
-
switch (
|
|
1321
|
+
if (e.forEach((p) => {
|
|
1322
|
+
switch (p.type) {
|
|
1194
1323
|
case "delete":
|
|
1195
1324
|
l.push({
|
|
1196
1325
|
id: A.id,
|
|
1197
1326
|
params: {
|
|
1198
|
-
unitId:
|
|
1327
|
+
unitId: s,
|
|
1199
1328
|
subUnitId: a,
|
|
1200
|
-
ruleId:
|
|
1329
|
+
ruleId: p.rule.uid,
|
|
1201
1330
|
source: r
|
|
1202
1331
|
}
|
|
1203
1332
|
}), u.unshift({
|
|
1204
1333
|
id: D.id,
|
|
1205
1334
|
params: {
|
|
1206
|
-
unitId:
|
|
1335
|
+
unitId: s,
|
|
1207
1336
|
subUnitId: a,
|
|
1208
|
-
rule:
|
|
1209
|
-
index:
|
|
1337
|
+
rule: p.rule,
|
|
1338
|
+
index: p.index,
|
|
1210
1339
|
source: r
|
|
1211
1340
|
}
|
|
1212
1341
|
});
|
|
1213
1342
|
break;
|
|
1214
1343
|
case "update": {
|
|
1215
|
-
if (
|
|
1216
|
-
const $ =
|
|
1217
|
-
|
|
1344
|
+
if (he(p.rule.type, n)) {
|
|
1345
|
+
const $ = p.oldRanges[0].startRow, P = p.oldRanges[0].startColumn, k = p.newRanges[0].startRow, H = p.newRanges[0].startColumn, J = k - $, me = H - P, ge = S(p.rule.formula1) ? o.moveFormulaRefOffset(p.rule.formula1, me, J) : p.rule.formula1, pe = S(p.rule.formula2) ? o.moveFormulaRefOffset(p.rule.formula2, me, J) : p.rule.formula2;
|
|
1346
|
+
ge !== p.rule.formula1 || pe !== p.rule.formula2 || !lt(p.newRanges, p.oldRanges) ? (l.push({
|
|
1218
1347
|
id: y.id,
|
|
1219
1348
|
params: {
|
|
1220
|
-
unitId:
|
|
1349
|
+
unitId: s,
|
|
1221
1350
|
subUnitId: a,
|
|
1222
|
-
ruleId:
|
|
1351
|
+
ruleId: p.ruleId,
|
|
1223
1352
|
payload: {
|
|
1224
|
-
type:
|
|
1353
|
+
type: V.ALL,
|
|
1225
1354
|
payload: {
|
|
1226
|
-
formula1:
|
|
1227
|
-
formula2:
|
|
1228
|
-
ranges:
|
|
1355
|
+
formula1: ge,
|
|
1356
|
+
formula2: pe,
|
|
1357
|
+
ranges: p.newRanges
|
|
1229
1358
|
}
|
|
1230
1359
|
}
|
|
1231
1360
|
}
|
|
1232
1361
|
}), u.unshift({
|
|
1233
1362
|
id: y.id,
|
|
1234
1363
|
params: {
|
|
1235
|
-
unitId:
|
|
1364
|
+
unitId: s,
|
|
1236
1365
|
subUnitId: a,
|
|
1237
|
-
ruleId:
|
|
1366
|
+
ruleId: p.ruleId,
|
|
1238
1367
|
payload: {
|
|
1239
|
-
type:
|
|
1368
|
+
type: V.ALL,
|
|
1240
1369
|
payload: {
|
|
1241
|
-
formula1:
|
|
1242
|
-
formula2:
|
|
1243
|
-
ranges:
|
|
1370
|
+
formula1: p.rule.formula1,
|
|
1371
|
+
formula2: p.rule.formula2,
|
|
1372
|
+
ranges: p.oldRanges
|
|
1244
1373
|
}
|
|
1245
1374
|
}
|
|
1246
1375
|
}
|
|
1247
1376
|
})) : (l.push({
|
|
1248
1377
|
id: y.id,
|
|
1249
1378
|
params: {
|
|
1250
|
-
unitId:
|
|
1379
|
+
unitId: s,
|
|
1251
1380
|
subUnitId: a,
|
|
1252
|
-
ruleId:
|
|
1381
|
+
ruleId: p.ruleId,
|
|
1253
1382
|
payload: {
|
|
1254
|
-
type:
|
|
1255
|
-
payload:
|
|
1383
|
+
type: V.RANGE,
|
|
1384
|
+
payload: p.newRanges
|
|
1256
1385
|
},
|
|
1257
1386
|
source: r
|
|
1258
1387
|
}
|
|
1259
1388
|
}), u.unshift({
|
|
1260
1389
|
id: y.id,
|
|
1261
1390
|
params: {
|
|
1262
|
-
unitId:
|
|
1391
|
+
unitId: s,
|
|
1263
1392
|
subUnitId: a,
|
|
1264
|
-
ruleId:
|
|
1393
|
+
ruleId: p.ruleId,
|
|
1265
1394
|
payload: {
|
|
1266
|
-
type:
|
|
1267
|
-
payload:
|
|
1395
|
+
type: V.RANGE,
|
|
1396
|
+
payload: p.oldRanges
|
|
1268
1397
|
},
|
|
1269
1398
|
source: r
|
|
1270
1399
|
}
|
|
@@ -1273,32 +1402,32 @@ function Ue(o, a, e, t, r = "command", i = !0) {
|
|
|
1273
1402
|
l.push({
|
|
1274
1403
|
id: y.id,
|
|
1275
1404
|
params: {
|
|
1276
|
-
unitId:
|
|
1405
|
+
unitId: s,
|
|
1277
1406
|
subUnitId: a,
|
|
1278
|
-
ruleId:
|
|
1407
|
+
ruleId: p.ruleId,
|
|
1279
1408
|
payload: {
|
|
1280
|
-
type:
|
|
1281
|
-
payload:
|
|
1409
|
+
type: V.RANGE,
|
|
1410
|
+
payload: p.newRanges
|
|
1282
1411
|
},
|
|
1283
1412
|
source: r
|
|
1284
1413
|
}
|
|
1285
1414
|
}), u.unshift({
|
|
1286
1415
|
id: y.id,
|
|
1287
1416
|
params: {
|
|
1288
|
-
unitId:
|
|
1417
|
+
unitId: s,
|
|
1289
1418
|
subUnitId: a,
|
|
1290
|
-
ruleId:
|
|
1419
|
+
ruleId: p.ruleId,
|
|
1291
1420
|
payload: {
|
|
1292
|
-
type:
|
|
1293
|
-
payload:
|
|
1421
|
+
type: V.RANGE,
|
|
1422
|
+
payload: p.oldRanges
|
|
1294
1423
|
},
|
|
1295
1424
|
source: r
|
|
1296
1425
|
}
|
|
1297
1426
|
});
|
|
1298
|
-
const
|
|
1299
|
-
if (
|
|
1300
|
-
const
|
|
1301
|
-
|
|
1427
|
+
const O = d.getRuleById(s, a, p.ruleId);
|
|
1428
|
+
if (O && O.type === T.CHECKBOX) {
|
|
1429
|
+
const P = d.getValidator(T.CHECKBOX).parseFormulaSync(O, s, a);
|
|
1430
|
+
E(p.newRanges, P.formula2);
|
|
1302
1431
|
}
|
|
1303
1432
|
break;
|
|
1304
1433
|
}
|
|
@@ -1306,70 +1435,70 @@ function Ue(o, a, e, t, r = "command", i = !0) {
|
|
|
1306
1435
|
if (l.push({
|
|
1307
1436
|
id: D.id,
|
|
1308
1437
|
params: {
|
|
1309
|
-
unitId:
|
|
1438
|
+
unitId: s,
|
|
1310
1439
|
subUnitId: a,
|
|
1311
|
-
rule:
|
|
1440
|
+
rule: p.rule,
|
|
1312
1441
|
source: r
|
|
1313
1442
|
}
|
|
1314
1443
|
}), u.unshift({
|
|
1315
1444
|
id: A.id,
|
|
1316
1445
|
params: {
|
|
1317
|
-
unitId:
|
|
1446
|
+
unitId: s,
|
|
1318
1447
|
subUnitId: a,
|
|
1319
|
-
ruleId:
|
|
1448
|
+
ruleId: p.rule.uid,
|
|
1320
1449
|
source: r
|
|
1321
1450
|
}
|
|
1322
|
-
}),
|
|
1323
|
-
const $ = d.getValidator(T.CHECKBOX).parseFormulaSync(
|
|
1324
|
-
|
|
1451
|
+
}), p.rule.type === T.CHECKBOX) {
|
|
1452
|
+
const $ = d.getValidator(T.CHECKBOX).parseFormulaSync(p.rule, s, a);
|
|
1453
|
+
E(p.rule.ranges, $.originFormula2);
|
|
1325
1454
|
}
|
|
1326
1455
|
break;
|
|
1327
1456
|
}
|
|
1328
1457
|
}
|
|
1329
1458
|
}), R) {
|
|
1330
|
-
const
|
|
1331
|
-
id:
|
|
1459
|
+
const p = {
|
|
1460
|
+
id: ne.id,
|
|
1332
1461
|
params: {
|
|
1333
|
-
unitId:
|
|
1462
|
+
unitId: s,
|
|
1334
1463
|
subUnitId: a,
|
|
1335
|
-
cellValue:
|
|
1464
|
+
cellValue: f.getData()
|
|
1336
1465
|
}
|
|
1337
|
-
},
|
|
1338
|
-
id:
|
|
1339
|
-
params:
|
|
1466
|
+
}, O = {
|
|
1467
|
+
id: ne.id,
|
|
1468
|
+
params: ct(t, p.params)
|
|
1340
1469
|
};
|
|
1341
|
-
l.push(
|
|
1470
|
+
l.push(p), u.push(O);
|
|
1342
1471
|
}
|
|
1343
1472
|
return {
|
|
1344
1473
|
redoMutations: l,
|
|
1345
1474
|
undoMutations: u
|
|
1346
1475
|
};
|
|
1347
1476
|
}
|
|
1348
|
-
const
|
|
1477
|
+
const _a = {
|
|
1349
1478
|
type: z.COMMAND,
|
|
1350
1479
|
id: "sheet.command.updateDataValidationRuleRange",
|
|
1351
|
-
handler(
|
|
1480
|
+
handler(s, a) {
|
|
1352
1481
|
if (!a)
|
|
1353
1482
|
return !1;
|
|
1354
|
-
const { unitId: e, subUnitId: t, ranges: r, ruleId: i } = a,
|
|
1355
|
-
if (!
|
|
1483
|
+
const { unitId: e, subUnitId: t, ranges: r, ruleId: i } = a, o = s.get(C), n = s.get(B), l = s.get(Z);
|
|
1484
|
+
if (!o.getRuleById(e, t, i))
|
|
1356
1485
|
return !1;
|
|
1357
|
-
const d =
|
|
1486
|
+
const d = o.getRuleObjectMatrix(e, t).clone();
|
|
1358
1487
|
d.updateRange(i, r);
|
|
1359
|
-
const c = d.diff(
|
|
1488
|
+
const c = d.diff(o.getRules(e, t)), { redoMutations: g, undoMutations: _ } = xe(e, t, c, s);
|
|
1360
1489
|
return l.pushUndoRedo({
|
|
1361
|
-
undoMutations:
|
|
1490
|
+
undoMutations: _,
|
|
1362
1491
|
redoMutations: g,
|
|
1363
1492
|
unitID: e
|
|
1364
|
-
}),
|
|
1493
|
+
}), Le(g, n), !0;
|
|
1365
1494
|
}
|
|
1366
|
-
},
|
|
1495
|
+
}, va = {
|
|
1367
1496
|
type: z.COMMAND,
|
|
1368
1497
|
id: "sheet.command.addDataValidation",
|
|
1369
|
-
handler(
|
|
1498
|
+
handler(s, a) {
|
|
1370
1499
|
if (!a)
|
|
1371
1500
|
return !1;
|
|
1372
|
-
const { unitId: e, subUnitId: t, rule: r } = a, i =
|
|
1501
|
+
const { unitId: e, subUnitId: t, rule: r } = a, i = s.get(C), o = s.get(B), n = s.get(Z), l = i.getRuleObjectMatrix(e, t).clone();
|
|
1373
1502
|
l.addRule(r);
|
|
1374
1503
|
const u = l.diff(i.getRules(e, t)), d = i.getValidator(r.type), c = {
|
|
1375
1504
|
unitId: e,
|
|
@@ -1378,11 +1507,11 @@ const ma = {
|
|
|
1378
1507
|
...r,
|
|
1379
1508
|
...d == null ? void 0 : d.normalizeFormula(r, e, t)
|
|
1380
1509
|
}
|
|
1381
|
-
}, { redoMutations: g, undoMutations:
|
|
1510
|
+
}, { redoMutations: g, undoMutations: _ } = xe(e, t, u, s);
|
|
1382
1511
|
return g.push({
|
|
1383
1512
|
id: D.id,
|
|
1384
1513
|
params: c
|
|
1385
|
-
}),
|
|
1514
|
+
}), _.unshift({
|
|
1386
1515
|
id: A.id,
|
|
1387
1516
|
params: {
|
|
1388
1517
|
unitId: e,
|
|
@@ -1392,104 +1521,104 @@ const ma = {
|
|
|
1392
1521
|
}), n.pushUndoRedo({
|
|
1393
1522
|
unitID: e,
|
|
1394
1523
|
redoMutations: g,
|
|
1395
|
-
undoMutations:
|
|
1396
|
-
}),
|
|
1524
|
+
undoMutations: _
|
|
1525
|
+
}), Le(g, o), !0;
|
|
1397
1526
|
}
|
|
1398
|
-
},
|
|
1527
|
+
}, Ra = {
|
|
1399
1528
|
type: z.COMMAND,
|
|
1400
1529
|
id: "sheets.command.update-data-validation-setting",
|
|
1401
1530
|
// eslint-disable-next-line max-lines-per-function
|
|
1402
|
-
handler(
|
|
1531
|
+
handler(s, a) {
|
|
1403
1532
|
if (!a)
|
|
1404
1533
|
return !1;
|
|
1405
|
-
const e =
|
|
1534
|
+
const e = s.get(B), t = s.get(Z), r = s.get(C), i = s.get(G), { unitId: o, subUnitId: n, ruleId: l, setting: u } = a, d = i.getValidatorItem(u.type);
|
|
1406
1535
|
if (!d)
|
|
1407
1536
|
return !1;
|
|
1408
|
-
const c = r.getRuleById(
|
|
1537
|
+
const c = r.getRuleById(o, n, l);
|
|
1409
1538
|
if (!c)
|
|
1410
1539
|
return !1;
|
|
1411
1540
|
const g = { ...c, ...u };
|
|
1412
|
-
if (!d.validatorFormula(g,
|
|
1541
|
+
if (!d.validatorFormula(g, o, n).success)
|
|
1413
1542
|
return !1;
|
|
1414
|
-
const
|
|
1415
|
-
unitId:
|
|
1543
|
+
const _ = {
|
|
1544
|
+
unitId: o,
|
|
1416
1545
|
subUnitId: n,
|
|
1417
1546
|
ruleId: l,
|
|
1418
1547
|
payload: {
|
|
1419
|
-
type:
|
|
1548
|
+
type: V.SETTING,
|
|
1420
1549
|
payload: {
|
|
1421
1550
|
...u,
|
|
1422
|
-
...d.normalizeFormula(g,
|
|
1551
|
+
...d.normalizeFormula(g, o, n)
|
|
1423
1552
|
}
|
|
1424
1553
|
}
|
|
1425
|
-
},
|
|
1554
|
+
}, f = [{
|
|
1426
1555
|
id: y.id,
|
|
1427
|
-
params:
|
|
1556
|
+
params: _
|
|
1428
1557
|
}], R = {
|
|
1429
|
-
unitId:
|
|
1558
|
+
unitId: o,
|
|
1430
1559
|
subUnitId: n,
|
|
1431
1560
|
ruleId: l,
|
|
1432
1561
|
payload: {
|
|
1433
|
-
type:
|
|
1434
|
-
payload:
|
|
1562
|
+
type: V.SETTING,
|
|
1563
|
+
payload: Ut(c)
|
|
1435
1564
|
}
|
|
1436
|
-
},
|
|
1565
|
+
}, E = [{
|
|
1437
1566
|
id: y.id,
|
|
1438
1567
|
params: R
|
|
1439
1568
|
}];
|
|
1440
1569
|
if (u.type === T.CHECKBOX) {
|
|
1441
|
-
const
|
|
1442
|
-
if (
|
|
1443
|
-
const k = new
|
|
1444
|
-
let
|
|
1445
|
-
if (
|
|
1446
|
-
|
|
1447
|
-
const j =
|
|
1448
|
-
(
|
|
1449
|
-
v:
|
|
1570
|
+
const O = c.ranges, $ = s.get(I), P = ze($, { unitId: o, subUnitId: n });
|
|
1571
|
+
if (P) {
|
|
1572
|
+
const k = new Me(), { worksheet: H } = P, { formula2: J = ye, formula1: me = Ve } = c, { formula2: ge = ye, formula1: pe = Ve } = u;
|
|
1573
|
+
let Pe = !1;
|
|
1574
|
+
if (O.forEach((fe) => {
|
|
1575
|
+
U.foreach(fe, (ie, He) => {
|
|
1576
|
+
const j = H.getCellRaw(ie, He), Je = ft(j);
|
|
1577
|
+
(vt(j) || Je === String(J)) && !(j != null && j.p) ? (k.setValue(ie, He, {
|
|
1578
|
+
v: ge,
|
|
1450
1579
|
p: null
|
|
1451
|
-
}),
|
|
1452
|
-
v:
|
|
1580
|
+
}), Pe = !0) : Je === String(me) && !(j != null && j.p) && (k.setValue(ie, He, {
|
|
1581
|
+
v: pe,
|
|
1453
1582
|
p: null
|
|
1454
|
-
}),
|
|
1583
|
+
}), Pe = !0);
|
|
1455
1584
|
});
|
|
1456
|
-
}),
|
|
1457
|
-
const
|
|
1458
|
-
id:
|
|
1585
|
+
}), Pe) {
|
|
1586
|
+
const fe = {
|
|
1587
|
+
id: ne.id,
|
|
1459
1588
|
params: {
|
|
1460
|
-
unitId:
|
|
1589
|
+
unitId: o,
|
|
1461
1590
|
subUnitId: n,
|
|
1462
1591
|
cellValue: k.getData()
|
|
1463
1592
|
}
|
|
1464
|
-
},
|
|
1465
|
-
id:
|
|
1466
|
-
params:
|
|
1593
|
+
}, ie = {
|
|
1594
|
+
id: ne.id,
|
|
1595
|
+
params: ct(s, fe.params)
|
|
1467
1596
|
};
|
|
1468
|
-
|
|
1597
|
+
f.push(fe), E.push(ie);
|
|
1469
1598
|
}
|
|
1470
1599
|
}
|
|
1471
1600
|
}
|
|
1472
|
-
return
|
|
1473
|
-
unitID:
|
|
1474
|
-
redoMutations:
|
|
1475
|
-
undoMutations:
|
|
1601
|
+
return Le(f, e).result ? (t.pushUndoRedo({
|
|
1602
|
+
unitID: o,
|
|
1603
|
+
redoMutations: f,
|
|
1604
|
+
undoMutations: E
|
|
1476
1605
|
}), !0) : !1;
|
|
1477
1606
|
}
|
|
1478
|
-
},
|
|
1607
|
+
}, Sa = {
|
|
1479
1608
|
type: z.COMMAND,
|
|
1480
1609
|
id: "sheets.command.update-data-validation-options",
|
|
1481
|
-
handler(
|
|
1610
|
+
handler(s, a) {
|
|
1482
1611
|
if (!a)
|
|
1483
1612
|
return !1;
|
|
1484
|
-
const e =
|
|
1613
|
+
const e = s.get(B), t = s.get(Z), r = s.get(C), { unitId: i, subUnitId: o, ruleId: n, options: l } = a, u = r.getRuleById(i, o, n);
|
|
1485
1614
|
if (!u)
|
|
1486
1615
|
return !1;
|
|
1487
1616
|
const d = {
|
|
1488
1617
|
unitId: i,
|
|
1489
|
-
subUnitId:
|
|
1618
|
+
subUnitId: o,
|
|
1490
1619
|
ruleId: n,
|
|
1491
1620
|
payload: {
|
|
1492
|
-
type:
|
|
1621
|
+
type: V.OPTIONS,
|
|
1493
1622
|
payload: l
|
|
1494
1623
|
}
|
|
1495
1624
|
}, c = [{
|
|
@@ -1497,46 +1626,46 @@ const ma = {
|
|
|
1497
1626
|
params: d
|
|
1498
1627
|
}], g = {
|
|
1499
1628
|
unitId: i,
|
|
1500
|
-
subUnitId:
|
|
1629
|
+
subUnitId: o,
|
|
1501
1630
|
ruleId: n,
|
|
1502
1631
|
payload: {
|
|
1503
|
-
type:
|
|
1504
|
-
payload:
|
|
1632
|
+
type: V.OPTIONS,
|
|
1633
|
+
payload: Bt(u)
|
|
1505
1634
|
}
|
|
1506
|
-
},
|
|
1635
|
+
}, _ = [{
|
|
1507
1636
|
id: y.id,
|
|
1508
1637
|
params: g
|
|
1509
1638
|
}];
|
|
1510
1639
|
return t.pushUndoRedo({
|
|
1511
1640
|
unitID: i,
|
|
1512
1641
|
redoMutations: c,
|
|
1513
|
-
undoMutations:
|
|
1642
|
+
undoMutations: _
|
|
1514
1643
|
}), e.executeCommand(y.id, d), !0;
|
|
1515
1644
|
}
|
|
1516
|
-
},
|
|
1645
|
+
}, Ea = {
|
|
1517
1646
|
type: z.COMMAND,
|
|
1518
1647
|
id: "sheets.command.clear-range-data-validation",
|
|
1519
|
-
handler(
|
|
1648
|
+
handler(s, a) {
|
|
1520
1649
|
if (!a)
|
|
1521
1650
|
return !1;
|
|
1522
|
-
const { unitId: e, subUnitId: t, ranges: r } = a, i =
|
|
1651
|
+
const { unitId: e, subUnitId: t, ranges: r } = a, i = s.get(B), o = s.get(I), n = ze(o, { unitId: e, subUnitId: t }), l = s.get(C);
|
|
1523
1652
|
if (!n) return !1;
|
|
1524
|
-
const u =
|
|
1653
|
+
const u = s.get(Z), d = l.getRuleObjectMatrix(e, t).clone();
|
|
1525
1654
|
d.removeRange(r);
|
|
1526
|
-
const c = d.diff(l.getRules(e, t)), { redoMutations: g, undoMutations:
|
|
1655
|
+
const c = d.diff(l.getRules(e, t)), { redoMutations: g, undoMutations: _ } = xe(e, t, c, s);
|
|
1527
1656
|
return u.pushUndoRedo({
|
|
1528
1657
|
unitID: e,
|
|
1529
1658
|
redoMutations: g,
|
|
1530
|
-
undoMutations:
|
|
1531
|
-
}),
|
|
1659
|
+
undoMutations: _
|
|
1660
|
+
}), Le(g, i).result;
|
|
1532
1661
|
}
|
|
1533
|
-
},
|
|
1662
|
+
}, Ma = {
|
|
1534
1663
|
type: z.COMMAND,
|
|
1535
1664
|
id: "sheet.command.remove-all-data-validation",
|
|
1536
|
-
handler(
|
|
1665
|
+
handler(s, a) {
|
|
1537
1666
|
if (!a)
|
|
1538
1667
|
return !1;
|
|
1539
|
-
const { unitId: e, subUnitId: t } = a, r =
|
|
1668
|
+
const { unitId: e, subUnitId: t } = a, r = s.get(B), i = s.get(C), o = s.get(Z), n = [...i.getRules(e, t)], l = {
|
|
1540
1669
|
unitId: e,
|
|
1541
1670
|
subUnitId: t,
|
|
1542
1671
|
ruleId: n.map((c) => c.uid)
|
|
@@ -1551,14 +1680,14 @@ const ma = {
|
|
|
1551
1680
|
rule: n
|
|
1552
1681
|
}
|
|
1553
1682
|
}];
|
|
1554
|
-
return
|
|
1683
|
+
return o.pushUndoRedo({
|
|
1555
1684
|
redoMutations: u,
|
|
1556
1685
|
undoMutations: d,
|
|
1557
1686
|
unitID: e
|
|
1558
1687
|
}), r.executeCommand(A.id, l), !0;
|
|
1559
1688
|
}
|
|
1560
|
-
},
|
|
1561
|
-
const e =
|
|
1689
|
+
}, Va = (s, a) => {
|
|
1690
|
+
const e = s.get(C), { unitId: t, subUnitId: r, ruleId: i, source: o } = a;
|
|
1562
1691
|
if (Array.isArray(i)) {
|
|
1563
1692
|
const l = i.map((u) => e.getRuleById(t, r, u)).filter(Boolean);
|
|
1564
1693
|
return [{
|
|
@@ -1567,7 +1696,7 @@ const ma = {
|
|
|
1567
1696
|
unitId: t,
|
|
1568
1697
|
subUnitId: r,
|
|
1569
1698
|
rule: l,
|
|
1570
|
-
source:
|
|
1699
|
+
source: o
|
|
1571
1700
|
}
|
|
1572
1701
|
}];
|
|
1573
1702
|
}
|
|
@@ -1582,13 +1711,13 @@ const ma = {
|
|
|
1582
1711
|
index: e.getRuleIndex(t, r, i)
|
|
1583
1712
|
}
|
|
1584
1713
|
}];
|
|
1585
|
-
},
|
|
1714
|
+
}, ya = {
|
|
1586
1715
|
type: z.COMMAND,
|
|
1587
1716
|
id: "sheet.command.remove-data-validation-rule",
|
|
1588
|
-
handler(
|
|
1717
|
+
handler(s, a) {
|
|
1589
1718
|
if (!a)
|
|
1590
1719
|
return !1;
|
|
1591
|
-
const { unitId: e, subUnitId: t, ruleId: r } = a, i =
|
|
1720
|
+
const { unitId: e, subUnitId: t, ruleId: r } = a, i = s.get(B), o = s.get(Z), n = s.get(C), l = [{
|
|
1592
1721
|
id: A.id,
|
|
1593
1722
|
params: a
|
|
1594
1723
|
}], u = [{
|
|
@@ -1602,70 +1731,70 @@ const ma = {
|
|
|
1602
1731
|
index: n.getRuleIndex(e, t, r)
|
|
1603
1732
|
}
|
|
1604
1733
|
}];
|
|
1605
|
-
return
|
|
1734
|
+
return o.pushUndoRedo({
|
|
1606
1735
|
undoMutations: u,
|
|
1607
1736
|
redoMutations: l,
|
|
1608
1737
|
unitID: a.unitId
|
|
1609
1738
|
}), i.executeCommand(A.id, a), !0;
|
|
1610
1739
|
}
|
|
1611
|
-
},
|
|
1612
|
-
var Rt = /* @__PURE__ */ ((
|
|
1613
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1614
|
-
(
|
|
1740
|
+
}, Ta = "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 || {}), Fa = Object.getOwnPropertyDescriptor, Ca = (s, a, e, t) => {
|
|
1742
|
+
for (var r = t > 1 ? void 0 : t ? Fa(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
1743
|
+
(o = s[i]) && (r = o(r) || r);
|
|
1615
1744
|
return r;
|
|
1616
|
-
},
|
|
1617
|
-
let
|
|
1618
|
-
constructor(
|
|
1619
|
-
super(), this._univerInstanceService =
|
|
1745
|
+
}, je = (s, a) => (e, t) => a(e, t, s);
|
|
1746
|
+
let Ce = class extends x {
|
|
1747
|
+
constructor(s, a, e) {
|
|
1748
|
+
super(), this._univerInstanceService = s, this._permissionService = a, this._lexerTreeBuilder = e;
|
|
1620
1749
|
}
|
|
1621
|
-
getFormulaRefCheck(
|
|
1750
|
+
getFormulaRefCheck(s) {
|
|
1622
1751
|
var e, t;
|
|
1623
|
-
const a = this._lexerTreeBuilder.sequenceNodesBuilder(
|
|
1752
|
+
const a = this._lexerTreeBuilder.sequenceNodesBuilder(s);
|
|
1624
1753
|
if (!a)
|
|
1625
1754
|
return !0;
|
|
1626
1755
|
for (let r = 0; r < a.length; r++) {
|
|
1627
1756
|
const i = a[r];
|
|
1628
1757
|
if (typeof i == "string")
|
|
1629
1758
|
continue;
|
|
1630
|
-
const { token:
|
|
1759
|
+
const { token: o } = i, n = $t(o), l = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET);
|
|
1631
1760
|
let u = l.getActiveSheet();
|
|
1632
1761
|
const d = l.getUnitId();
|
|
1633
1762
|
if (n.sheetName) {
|
|
1634
1763
|
if (u = l.getSheetBySheetName(n.sheetName), !u)
|
|
1635
1764
|
return !1;
|
|
1636
1765
|
const R = u == null ? void 0 : u.getSheetId();
|
|
1637
|
-
if (!this._permissionService.getPermissionPoint(new
|
|
1766
|
+
if (!this._permissionService.getPermissionPoint(new jt(d, R).id)) return !1;
|
|
1638
1767
|
}
|
|
1639
1768
|
if (!u)
|
|
1640
1769
|
return !1;
|
|
1641
|
-
const { startRow: c, endRow: g, startColumn:
|
|
1770
|
+
const { startRow: c, endRow: g, startColumn: _, endColumn: f } = n.range;
|
|
1642
1771
|
for (let R = c; R <= g; R++)
|
|
1643
|
-
for (let
|
|
1644
|
-
const
|
|
1645
|
-
if ((
|
|
1772
|
+
for (let E = _; E <= f; E++) {
|
|
1773
|
+
const p = (t = (e = u.getCell(R, E)) == null ? void 0 : e.selectionProtection) == null ? void 0 : t[0];
|
|
1774
|
+
if ((p == null ? void 0 : p[Rt.View]) === !1)
|
|
1646
1775
|
return !1;
|
|
1647
1776
|
}
|
|
1648
1777
|
}
|
|
1649
1778
|
return !0;
|
|
1650
1779
|
}
|
|
1651
1780
|
};
|
|
1652
|
-
|
|
1653
|
-
|
|
1654
|
-
|
|
1655
|
-
|
|
1656
|
-
],
|
|
1657
|
-
const
|
|
1658
|
-
var
|
|
1659
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1660
|
-
(
|
|
1781
|
+
Ce = Ca([
|
|
1782
|
+
je(0, I),
|
|
1783
|
+
je(1, Ft),
|
|
1784
|
+
je(2, v(X))
|
|
1785
|
+
], Ce);
|
|
1786
|
+
const Na = "sheets-data-validation.config", st = {};
|
|
1787
|
+
var Oa = Object.getOwnPropertyDescriptor, wa = (s, a, e, t) => {
|
|
1788
|
+
for (var r = t > 1 ? void 0 : t ? Oa(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
1789
|
+
(o = s[i]) && (r = o(r) || r);
|
|
1661
1790
|
return r;
|
|
1662
|
-
},
|
|
1663
|
-
let
|
|
1791
|
+
}, Qe = (s, a) => (e, t) => a(e, t, s);
|
|
1792
|
+
let Ne = class extends x {
|
|
1664
1793
|
constructor(a, e, t) {
|
|
1665
1794
|
super();
|
|
1666
1795
|
m(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
1667
1796
|
m(this, "registerRule", (a, e, t) => {
|
|
1668
|
-
|
|
1797
|
+
he(t.type, this._validatorRegistryService) && this.register(a, e, t);
|
|
1669
1798
|
});
|
|
1670
1799
|
this._dataValidationModel = a, this._formulaRefRangeService = e, this._validatorRegistryService = t, this._initRefRange();
|
|
1671
1800
|
}
|
|
@@ -1674,7 +1803,7 @@ let Fe = class extends W {
|
|
|
1674
1803
|
}
|
|
1675
1804
|
// eslint-disable-next-line max-lines-per-function
|
|
1676
1805
|
register(a, e, t) {
|
|
1677
|
-
const r = t.ranges, i = t.formula1,
|
|
1806
|
+
const r = t.ranges, i = t.formula1, o = t.formula2, n = this._formulaRefRangeService.registerRangeFormula(a, e, r, [i != null ? i : "", o != null ? o : ""], (u) => {
|
|
1678
1807
|
if (u.length === 0)
|
|
1679
1808
|
return {
|
|
1680
1809
|
undos: [{
|
|
@@ -1704,7 +1833,7 @@ let Fe = class extends W {
|
|
|
1704
1833
|
subUnitId: e,
|
|
1705
1834
|
ruleId: t.uid,
|
|
1706
1835
|
payload: {
|
|
1707
|
-
type:
|
|
1836
|
+
type: V.ALL,
|
|
1708
1837
|
payload: {
|
|
1709
1838
|
ranges: g.ranges,
|
|
1710
1839
|
formula1: g.formulas[0],
|
|
@@ -1720,18 +1849,18 @@ let Fe = class extends W {
|
|
|
1720
1849
|
subUnitId: e,
|
|
1721
1850
|
ruleId: t.uid,
|
|
1722
1851
|
payload: {
|
|
1723
|
-
type:
|
|
1852
|
+
type: V.ALL,
|
|
1724
1853
|
payload: {
|
|
1725
1854
|
ranges: r,
|
|
1726
1855
|
formula1: i,
|
|
1727
|
-
formula2:
|
|
1856
|
+
formula2: o
|
|
1728
1857
|
}
|
|
1729
1858
|
},
|
|
1730
1859
|
source: "patched"
|
|
1731
1860
|
}
|
|
1732
1861
|
});
|
|
1733
|
-
for (let
|
|
1734
|
-
const
|
|
1862
|
+
for (let _ = 1; _ < u.length; _++) {
|
|
1863
|
+
const f = u[_], R = Xe();
|
|
1735
1864
|
d.push({
|
|
1736
1865
|
id: D.id,
|
|
1737
1866
|
params: {
|
|
@@ -1740,9 +1869,9 @@ let Fe = class extends W {
|
|
|
1740
1869
|
rule: {
|
|
1741
1870
|
...t,
|
|
1742
1871
|
uid: R,
|
|
1743
|
-
formula1:
|
|
1744
|
-
formula2:
|
|
1745
|
-
ranges:
|
|
1872
|
+
formula1: f.formulas[0],
|
|
1873
|
+
formula2: f.formulas[1],
|
|
1874
|
+
ranges: f.ranges
|
|
1746
1875
|
},
|
|
1747
1876
|
source: "patched"
|
|
1748
1877
|
}
|
|
@@ -1767,54 +1896,54 @@ let Fe = class extends W {
|
|
|
1767
1896
|
const a = this._dataValidationModel.getAll();
|
|
1768
1897
|
for (const [e, t] of a)
|
|
1769
1898
|
for (const [r, i] of t)
|
|
1770
|
-
for (const
|
|
1771
|
-
this.registerRule(e, r,
|
|
1899
|
+
for (const o of i)
|
|
1900
|
+
this.registerRule(e, r, o);
|
|
1772
1901
|
this.disposeWithMe(
|
|
1773
1902
|
this._dataValidationModel.ruleChange$.subscribe((e) => {
|
|
1774
1903
|
const { unitId: t, subUnitId: r, rule: i } = e;
|
|
1775
1904
|
switch (e.type) {
|
|
1776
1905
|
case "add": {
|
|
1777
|
-
const
|
|
1778
|
-
this.registerRule(e.unitId, e.subUnitId,
|
|
1906
|
+
const o = e.rule;
|
|
1907
|
+
this.registerRule(e.unitId, e.subUnitId, o);
|
|
1779
1908
|
break;
|
|
1780
1909
|
}
|
|
1781
1910
|
case "remove": {
|
|
1782
|
-
const
|
|
1783
|
-
|
|
1911
|
+
const o = this._disposableMap.get(this._getIdWithUnitId(t, r, i.uid));
|
|
1912
|
+
o && o.dispose();
|
|
1784
1913
|
break;
|
|
1785
1914
|
}
|
|
1786
1915
|
case "update": {
|
|
1787
|
-
const
|
|
1788
|
-
n && n.dispose(), this.registerRule(e.unitId, e.subUnitId,
|
|
1916
|
+
const o = e.rule, n = this._disposableMap.get(this._getIdWithUnitId(t, r, o.uid));
|
|
1917
|
+
n && n.dispose(), this.registerRule(e.unitId, e.subUnitId, o);
|
|
1789
1918
|
break;
|
|
1790
1919
|
}
|
|
1791
1920
|
}
|
|
1792
1921
|
})
|
|
1793
|
-
), this.disposeWithMe(
|
|
1922
|
+
), this.disposeWithMe(Ke(() => {
|
|
1794
1923
|
this._disposableMap.forEach((e) => {
|
|
1795
1924
|
e.dispose();
|
|
1796
1925
|
}), this._disposableMap.clear();
|
|
1797
1926
|
}));
|
|
1798
1927
|
}
|
|
1799
1928
|
};
|
|
1800
|
-
|
|
1801
|
-
|
|
1802
|
-
|
|
1803
|
-
|
|
1804
|
-
],
|
|
1805
|
-
var
|
|
1806
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1807
|
-
(
|
|
1929
|
+
Ne = wa([
|
|
1930
|
+
Qe(0, v(C)),
|
|
1931
|
+
Qe(1, v(pt)),
|
|
1932
|
+
Qe(2, v(G))
|
|
1933
|
+
], Ne);
|
|
1934
|
+
var Aa = Object.getOwnPropertyDescriptor, Ia = (s, a, e, t) => {
|
|
1935
|
+
for (var r = t > 1 ? void 0 : t ? Aa(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
1936
|
+
(o = s[i]) && (r = o(r) || r);
|
|
1808
1937
|
return r;
|
|
1809
|
-
},
|
|
1810
|
-
let
|
|
1811
|
-
constructor(a, e, t, r, i,
|
|
1938
|
+
}, te = (s, a) => (e, t) => a(e, t, s);
|
|
1939
|
+
let Oe = class extends x {
|
|
1940
|
+
constructor(a, e, t, r, i, o) {
|
|
1812
1941
|
super();
|
|
1813
1942
|
m(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
1814
1943
|
m(this, "registerRule", (a, e, t) => {
|
|
1815
|
-
|
|
1944
|
+
he(t.type, this._validatorRegistryService) || (this.register(a, e, t), this.registerFormula(a, e, t));
|
|
1816
1945
|
});
|
|
1817
|
-
this._dataValidationModel = a, this._injector = e, this._refRangeService = t, this._dataValidationFormulaService = r, this._formulaRefRangeService = i, this._validatorRegistryService =
|
|
1946
|
+
this._dataValidationModel = a, this._injector = e, this._refRangeService = t, this._dataValidationFormulaService = r, this._formulaRefRangeService = i, this._validatorRegistryService = o, this._initRefRange();
|
|
1818
1947
|
}
|
|
1819
1948
|
_getIdWithUnitId(a, e, t) {
|
|
1820
1949
|
return `${a}_${e}_${t}`;
|
|
@@ -1822,19 +1951,19 @@ let Ne = class extends W {
|
|
|
1822
1951
|
// eslint-disable-next-line max-lines-per-function
|
|
1823
1952
|
registerFormula(a, e, t) {
|
|
1824
1953
|
var u;
|
|
1825
|
-
const r = t.uid, i = this._getIdWithUnitId(a, e, r),
|
|
1954
|
+
const r = t.uid, i = this._getIdWithUnitId(a, e, r), o = (u = this._disposableMap.get(i)) != null ? u : /* @__PURE__ */ new Set(), n = (d, c) => {
|
|
1826
1955
|
const g = this._dataValidationModel.getRuleById(a, e, r);
|
|
1827
1956
|
if (!g)
|
|
1828
1957
|
return { redos: [], undos: [] };
|
|
1829
|
-
const
|
|
1830
|
-
if (!
|
|
1958
|
+
const _ = g[d];
|
|
1959
|
+
if (!_ || _ === c)
|
|
1831
1960
|
return { redos: [], undos: [] };
|
|
1832
|
-
const
|
|
1961
|
+
const f = {
|
|
1833
1962
|
unitId: a,
|
|
1834
1963
|
subUnitId: e,
|
|
1835
1964
|
ruleId: t.uid,
|
|
1836
1965
|
payload: {
|
|
1837
|
-
type:
|
|
1966
|
+
type: V.SETTING,
|
|
1838
1967
|
payload: {
|
|
1839
1968
|
type: g.type,
|
|
1840
1969
|
formula1: g.formula1,
|
|
@@ -1848,7 +1977,7 @@ let Ne = class extends W {
|
|
|
1848
1977
|
subUnitId: e,
|
|
1849
1978
|
ruleId: t.uid,
|
|
1850
1979
|
payload: {
|
|
1851
|
-
type:
|
|
1980
|
+
type: V.SETTING,
|
|
1852
1981
|
payload: {
|
|
1853
1982
|
type: g.type,
|
|
1854
1983
|
formula1: g.formula1,
|
|
@@ -1856,18 +1985,18 @@ let Ne = class extends W {
|
|
|
1856
1985
|
}
|
|
1857
1986
|
},
|
|
1858
1987
|
source: "patched"
|
|
1859
|
-
},
|
|
1988
|
+
}, E = [
|
|
1860
1989
|
{
|
|
1861
1990
|
id: y.id,
|
|
1862
|
-
params:
|
|
1991
|
+
params: f
|
|
1863
1992
|
}
|
|
1864
|
-
],
|
|
1993
|
+
], p = [
|
|
1865
1994
|
{
|
|
1866
1995
|
id: y.id,
|
|
1867
1996
|
params: R
|
|
1868
1997
|
}
|
|
1869
1998
|
];
|
|
1870
|
-
return { redos:
|
|
1999
|
+
return { redos: E, undos: p };
|
|
1871
2000
|
}, l = this._dataValidationFormulaService.getRuleFormulaInfo(a, e, r);
|
|
1872
2001
|
if (l) {
|
|
1873
2002
|
const [d, c] = l;
|
|
@@ -1876,132 +2005,132 @@ let Ne = class extends W {
|
|
|
1876
2005
|
a,
|
|
1877
2006
|
e,
|
|
1878
2007
|
d.text,
|
|
1879
|
-
(
|
|
2008
|
+
(_) => n("formula1", _)
|
|
1880
2009
|
);
|
|
1881
|
-
|
|
2010
|
+
o.add(() => g.dispose());
|
|
1882
2011
|
}
|
|
1883
2012
|
if (c) {
|
|
1884
2013
|
const g = this._formulaRefRangeService.registerFormula(
|
|
1885
2014
|
a,
|
|
1886
2015
|
e,
|
|
1887
2016
|
c.text,
|
|
1888
|
-
(
|
|
2017
|
+
(_) => n("formula2", _)
|
|
1889
2018
|
);
|
|
1890
|
-
|
|
2019
|
+
o.add(() => g.dispose());
|
|
1891
2020
|
}
|
|
1892
2021
|
}
|
|
1893
2022
|
}
|
|
1894
2023
|
register(a, e, t) {
|
|
1895
2024
|
var l;
|
|
1896
2025
|
const r = (u) => {
|
|
1897
|
-
const d = [...t.ranges], g = d.map((
|
|
1898
|
-
if (
|
|
2026
|
+
const d = [...t.ranges], g = d.map((f) => qt(f, u)).filter((f) => !!f).flat();
|
|
2027
|
+
if (lt(g, d))
|
|
1899
2028
|
return { redos: [], undos: [] };
|
|
1900
2029
|
if (g.length) {
|
|
1901
|
-
const
|
|
2030
|
+
const f = {
|
|
1902
2031
|
unitId: a,
|
|
1903
2032
|
subUnitId: e,
|
|
1904
2033
|
ruleId: t.uid,
|
|
1905
2034
|
payload: {
|
|
1906
|
-
type:
|
|
2035
|
+
type: V.RANGE,
|
|
1907
2036
|
payload: g
|
|
1908
2037
|
},
|
|
1909
2038
|
source: "patched"
|
|
1910
|
-
}, R = [{ id: y.id, params:
|
|
2039
|
+
}, R = [{ id: y.id, params: f }], E = [{
|
|
1911
2040
|
id: y.id,
|
|
1912
2041
|
params: {
|
|
1913
2042
|
unitId: a,
|
|
1914
2043
|
subUnitId: e,
|
|
1915
2044
|
ruleId: t.uid,
|
|
1916
2045
|
payload: {
|
|
1917
|
-
type:
|
|
2046
|
+
type: V.RANGE,
|
|
1918
2047
|
payload: d
|
|
1919
2048
|
},
|
|
1920
2049
|
source: "patched"
|
|
1921
2050
|
}
|
|
1922
2051
|
}];
|
|
1923
|
-
return { redos: R, undos:
|
|
2052
|
+
return { redos: R, undos: E };
|
|
1924
2053
|
} else {
|
|
1925
|
-
const
|
|
1926
|
-
return { redos: R, undos:
|
|
2054
|
+
const f = { unitId: a, subUnitId: e, ruleId: t.uid }, R = [{ id: A.id, params: f }], E = Va(this._injector, f);
|
|
2055
|
+
return { redos: R, undos: E };
|
|
1927
2056
|
}
|
|
1928
2057
|
}, i = [];
|
|
1929
2058
|
t.ranges.forEach((u) => {
|
|
1930
2059
|
const d = this._refRangeService.registerRefRange(u, r, a, e);
|
|
1931
2060
|
i.push(() => d.dispose());
|
|
1932
2061
|
});
|
|
1933
|
-
const
|
|
1934
|
-
n.add(() => i.forEach((u) => u())), this._disposableMap.set(
|
|
2062
|
+
const o = this._getIdWithUnitId(a, e, t.uid), n = (l = this._disposableMap.get(o)) != null ? l : /* @__PURE__ */ new Set();
|
|
2063
|
+
n.add(() => i.forEach((u) => u())), this._disposableMap.set(o, n);
|
|
1935
2064
|
}
|
|
1936
2065
|
_initRefRange() {
|
|
1937
2066
|
const a = this._dataValidationModel.getAll();
|
|
1938
2067
|
for (const [e, t] of a)
|
|
1939
2068
|
for (const [r, i] of t)
|
|
1940
|
-
for (const
|
|
1941
|
-
this.registerRule(e, r,
|
|
2069
|
+
for (const o of i)
|
|
2070
|
+
this.registerRule(e, r, o);
|
|
1942
2071
|
this.disposeWithMe(
|
|
1943
2072
|
this._dataValidationModel.ruleChange$.subscribe((e) => {
|
|
1944
2073
|
const { unitId: t, subUnitId: r, rule: i } = e;
|
|
1945
2074
|
switch (e.type) {
|
|
1946
2075
|
case "add": {
|
|
1947
|
-
const
|
|
1948
|
-
this.registerRule(e.unitId, e.subUnitId,
|
|
2076
|
+
const o = e.rule;
|
|
2077
|
+
this.registerRule(e.unitId, e.subUnitId, o);
|
|
1949
2078
|
break;
|
|
1950
2079
|
}
|
|
1951
2080
|
case "remove": {
|
|
1952
|
-
const
|
|
1953
|
-
|
|
2081
|
+
const o = this._disposableMap.get(this._getIdWithUnitId(t, r, i.uid));
|
|
2082
|
+
o && o.forEach((n) => n());
|
|
1954
2083
|
break;
|
|
1955
2084
|
}
|
|
1956
2085
|
case "update": {
|
|
1957
|
-
const
|
|
1958
|
-
n && n.forEach((l) => l()), this.registerRule(e.unitId, e.subUnitId,
|
|
2086
|
+
const o = e.rule, n = this._disposableMap.get(this._getIdWithUnitId(t, r, o.uid));
|
|
2087
|
+
n && n.forEach((l) => l()), this.registerRule(e.unitId, e.subUnitId, o);
|
|
1959
2088
|
break;
|
|
1960
2089
|
}
|
|
1961
2090
|
}
|
|
1962
2091
|
})
|
|
1963
|
-
), this.disposeWithMe(
|
|
2092
|
+
), this.disposeWithMe(Ke(() => {
|
|
1964
2093
|
this._disposableMap.forEach((e) => {
|
|
1965
2094
|
e.forEach((t) => t());
|
|
1966
2095
|
}), this._disposableMap.clear();
|
|
1967
2096
|
}));
|
|
1968
2097
|
}
|
|
1969
2098
|
};
|
|
1970
|
-
|
|
1971
|
-
|
|
1972
|
-
|
|
1973
|
-
|
|
1974
|
-
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
],
|
|
1978
|
-
var
|
|
1979
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
1980
|
-
(
|
|
2099
|
+
Oe = Ia([
|
|
2100
|
+
te(0, v(C)),
|
|
2101
|
+
te(1, v(be)),
|
|
2102
|
+
te(2, v(Qt)),
|
|
2103
|
+
te(3, v(q)),
|
|
2104
|
+
te(4, v(pt)),
|
|
2105
|
+
te(5, v(G))
|
|
2106
|
+
], Oe);
|
|
2107
|
+
var Da = Object.getOwnPropertyDescriptor, ba = (s, a, e, t) => {
|
|
2108
|
+
for (var r = t > 1 ? void 0 : t ? Da(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
2109
|
+
(o = s[i]) && (r = o(r) || r);
|
|
1981
2110
|
return r;
|
|
1982
|
-
},
|
|
1983
|
-
let
|
|
1984
|
-
constructor(
|
|
1985
|
-
super(), this._sheetInterceptorService =
|
|
2111
|
+
}, qe = (s, a) => (e, t) => a(e, t, s);
|
|
2112
|
+
let we = class extends x {
|
|
2113
|
+
constructor(s, a, e) {
|
|
2114
|
+
super(), this._sheetInterceptorService = s, this._univerInstanceService = a, this._sheetDataValidationModel = e, this._initSheetChange();
|
|
1986
2115
|
}
|
|
1987
2116
|
// eslint-disable-next-line max-lines-per-function
|
|
1988
2117
|
_initSheetChange() {
|
|
1989
2118
|
this.disposeWithMe(
|
|
1990
2119
|
this._sheetInterceptorService.interceptCommand({
|
|
1991
2120
|
// eslint-disable-next-line max-lines-per-function
|
|
1992
|
-
getMutations: (
|
|
2121
|
+
getMutations: (s) => {
|
|
1993
2122
|
var a;
|
|
1994
|
-
if (
|
|
1995
|
-
const e =
|
|
2123
|
+
if (s.id === Gt.id) {
|
|
2124
|
+
const e = s.params, t = e.unitId || this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET).getUnitId(), r = this._univerInstanceService.getUniverSheetInstance(t);
|
|
1996
2125
|
if (!r)
|
|
1997
2126
|
return { redos: [], undos: [] };
|
|
1998
2127
|
const i = e.subUnitId || ((a = r.getActiveSheet()) == null ? void 0 : a.getSheetId());
|
|
1999
2128
|
if (!i)
|
|
2000
2129
|
return { redos: [], undos: [] };
|
|
2001
|
-
const
|
|
2002
|
-
if (
|
|
2130
|
+
const o = this._sheetDataValidationModel.getRules(t, i);
|
|
2131
|
+
if (o.length === 0)
|
|
2003
2132
|
return { redos: [], undos: [] };
|
|
2004
|
-
const n =
|
|
2133
|
+
const n = o.map((d) => d.uid), l = {
|
|
2005
2134
|
unitId: t,
|
|
2006
2135
|
subUnitId: i,
|
|
2007
2136
|
ruleId: n,
|
|
@@ -2009,7 +2138,7 @@ let Ce = class extends W {
|
|
|
2009
2138
|
}, u = {
|
|
2010
2139
|
unitId: t,
|
|
2011
2140
|
subUnitId: i,
|
|
2012
|
-
rule: [...
|
|
2141
|
+
rule: [...o],
|
|
2013
2142
|
source: "patched"
|
|
2014
2143
|
};
|
|
2015
2144
|
return {
|
|
@@ -2022,14 +2151,14 @@ let Ce = class extends W {
|
|
|
2022
2151
|
params: u
|
|
2023
2152
|
}]
|
|
2024
2153
|
};
|
|
2025
|
-
} else if (
|
|
2026
|
-
const e =
|
|
2154
|
+
} else if (s.id === Yt.id) {
|
|
2155
|
+
const e = s.params, { unitId: t, subUnitId: r, targetSubUnitId: i } = e;
|
|
2027
2156
|
if (!t || !r || !i)
|
|
2028
2157
|
return { redos: [], undos: [] };
|
|
2029
|
-
const
|
|
2030
|
-
if (
|
|
2158
|
+
const o = this._sheetDataValidationModel.getRules(t, r);
|
|
2159
|
+
if (o.length === 0)
|
|
2031
2160
|
return { redos: [], undos: [] };
|
|
2032
|
-
const n =
|
|
2161
|
+
const n = o.map((l) => ({ ...l, uid: Xe(6) }));
|
|
2033
2162
|
return {
|
|
2034
2163
|
redos: [
|
|
2035
2164
|
{
|
|
@@ -2061,12 +2190,12 @@ let Ce = class extends W {
|
|
|
2061
2190
|
);
|
|
2062
2191
|
}
|
|
2063
2192
|
};
|
|
2064
|
-
|
|
2065
|
-
|
|
2066
|
-
|
|
2067
|
-
|
|
2068
|
-
],
|
|
2069
|
-
class
|
|
2193
|
+
we = ba([
|
|
2194
|
+
qe(0, v(ht)),
|
|
2195
|
+
qe(1, v(I)),
|
|
2196
|
+
qe(2, v(C))
|
|
2197
|
+
], we);
|
|
2198
|
+
class La extends Y {
|
|
2070
2199
|
constructor() {
|
|
2071
2200
|
super(...arguments);
|
|
2072
2201
|
m(this, "id", T.ANY);
|
|
@@ -2095,7 +2224,7 @@ class Ia extends G {
|
|
|
2095
2224
|
return this.localeService.t("dataValidation.any.error");
|
|
2096
2225
|
}
|
|
2097
2226
|
}
|
|
2098
|
-
class
|
|
2227
|
+
class Ua extends Y {
|
|
2099
2228
|
constructor() {
|
|
2100
2229
|
super(...arguments);
|
|
2101
2230
|
m(this, "id", T.CUSTOM);
|
|
@@ -2103,12 +2232,12 @@ class Aa extends G {
|
|
|
2103
2232
|
m(this, "operators", []);
|
|
2104
2233
|
m(this, "scopes", ["sheet"]);
|
|
2105
2234
|
m(this, "order", 60);
|
|
2106
|
-
m(this, "_customFormulaService", this.injector.get(
|
|
2107
|
-
m(this, "_lexerTreeBuilder", this.injector.get(
|
|
2235
|
+
m(this, "_customFormulaService", this.injector.get(W));
|
|
2236
|
+
m(this, "_lexerTreeBuilder", this.injector.get(X));
|
|
2108
2237
|
}
|
|
2109
2238
|
validatorFormula(e, t, r) {
|
|
2110
2239
|
var u;
|
|
2111
|
-
const i = S(e.formula1),
|
|
2240
|
+
const i = S(e.formula1), o = (u = e.formula1) != null ? u : "", l = this._lexerTreeBuilder.checkIfAddBracket(o) === 0 && o.startsWith(kt.EQUALS);
|
|
2112
2241
|
return {
|
|
2113
2242
|
success: i && l,
|
|
2114
2243
|
formula1: i && l ? "" : this.localeService.t("dataValidation.validFail.formula")
|
|
@@ -2122,8 +2251,8 @@ class Aa extends G {
|
|
|
2122
2251
|
};
|
|
2123
2252
|
}
|
|
2124
2253
|
async isValidType(e, t, r) {
|
|
2125
|
-
const { column: i, row:
|
|
2126
|
-
return
|
|
2254
|
+
const { column: i, row: o, unitId: n, subUnitId: l } = e, u = await this._customFormulaService.getCellFormulaValue(n, l, r.uid, o, i), d = u == null ? void 0 : u.v;
|
|
2255
|
+
return F(String(d)) && M.isDefine(d) && d !== "" ? u.t === Ct.BOOLEAN ? !!d : typeof d == "boolean" ? d : typeof d == "number" ? !!d : typeof d == "string" ? F(d) : !!d : !1;
|
|
2127
2256
|
}
|
|
2128
2257
|
generateRuleErrorMessage(e) {
|
|
2129
2258
|
return this.localeService.t("dataValidation.custom.error");
|
|
@@ -2133,7 +2262,7 @@ class Aa extends G {
|
|
|
2133
2262
|
return this.localeService.t("dataValidation.custom.ruleName").replace("{FORMULA1}", (t = e.formula1) != null ? t : "");
|
|
2134
2263
|
}
|
|
2135
2264
|
}
|
|
2136
|
-
class
|
|
2265
|
+
class Ba extends _t {
|
|
2137
2266
|
constructor() {
|
|
2138
2267
|
super(...arguments);
|
|
2139
2268
|
m(this, "id", T.LIST_MULTIPLE);
|
|
@@ -2142,11 +2271,11 @@ class Da extends ft {
|
|
|
2142
2271
|
m(this, "skipDefaultFontRender", () => !0);
|
|
2143
2272
|
}
|
|
2144
2273
|
}
|
|
2145
|
-
class
|
|
2274
|
+
class xa extends Y {
|
|
2146
2275
|
constructor() {
|
|
2147
2276
|
super(...arguments);
|
|
2148
|
-
m(this, "_customFormulaService", this.injector.get(
|
|
2149
|
-
m(this, "_lexerTreeBuilder", this.injector.get(
|
|
2277
|
+
m(this, "_customFormulaService", this.injector.get(W));
|
|
2278
|
+
m(this, "_lexerTreeBuilder", this.injector.get(X));
|
|
2150
2279
|
m(this, "id", T.WHOLE);
|
|
2151
2280
|
m(this, "title", "dataValidation.whole.title");
|
|
2152
2281
|
m(this, "order", 10);
|
|
@@ -2163,28 +2292,28 @@ class ba extends G {
|
|
|
2163
2292
|
m(this, "scopes", ["sheet"]);
|
|
2164
2293
|
}
|
|
2165
2294
|
_isFormulaOrInt(e) {
|
|
2166
|
-
return !
|
|
2295
|
+
return !M.isBlank(e) && (S(e) || !Number.isNaN(+e) && Number.isInteger(+e));
|
|
2167
2296
|
}
|
|
2168
2297
|
async isValidType(e, t, r) {
|
|
2169
|
-
const { value: i } = e,
|
|
2170
|
-
return !Number.isNaN(
|
|
2298
|
+
const { value: i } = e, o = Fe(i);
|
|
2299
|
+
return !Number.isNaN(o) && Number.isInteger(o);
|
|
2171
2300
|
}
|
|
2172
2301
|
transform(e, t, r) {
|
|
2173
2302
|
const { value: i } = e;
|
|
2174
2303
|
return {
|
|
2175
2304
|
...e,
|
|
2176
|
-
value:
|
|
2305
|
+
value: Fe(i)
|
|
2177
2306
|
};
|
|
2178
2307
|
}
|
|
2179
2308
|
_parseNumber(e) {
|
|
2180
2309
|
return e == null ? Number.NaN : +e;
|
|
2181
2310
|
}
|
|
2182
|
-
async parseFormula(e, t, r, i,
|
|
2183
|
-
const n = await this._customFormulaService.getCellFormulaValue(t, r, e.uid, i,
|
|
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: d } = e, c = S(u) ? n == null ? void 0 : n.v : u, g = S(d) ? l == null ? void 0 : l.v : d, _ = F(`${c}`) && F(`${g}`);
|
|
2184
2313
|
return {
|
|
2185
2314
|
formula1: this._parseNumber(c),
|
|
2186
2315
|
formula2: this._parseNumber(g),
|
|
2187
|
-
isFormulaValid:
|
|
2316
|
+
isFormulaValid: _
|
|
2188
2317
|
};
|
|
2189
2318
|
}
|
|
2190
2319
|
validatorFormula(e, t, r) {
|
|
@@ -2193,62 +2322,62 @@ class ba extends G {
|
|
|
2193
2322
|
return {
|
|
2194
2323
|
success: !0
|
|
2195
2324
|
};
|
|
2196
|
-
const
|
|
2325
|
+
const o = M.isDefine(e.formula1) && this._isFormulaOrInt(e.formula1), n = M.isDefine(e.formula2) && this._isFormulaOrInt(e.formula2), l = Be.includes(i), u = this.localeService.t("dataValidation.validFail.number");
|
|
2197
2326
|
return l ? {
|
|
2198
|
-
success:
|
|
2199
|
-
formula1:
|
|
2327
|
+
success: o && n,
|
|
2328
|
+
formula1: o ? void 0 : u,
|
|
2200
2329
|
formula2: n ? void 0 : u
|
|
2201
2330
|
} : {
|
|
2202
|
-
success:
|
|
2331
|
+
success: o,
|
|
2203
2332
|
formula1: u
|
|
2204
2333
|
};
|
|
2205
2334
|
}
|
|
2206
2335
|
generateRuleErrorMessage(e, t) {
|
|
2207
2336
|
if (!e.operator)
|
|
2208
|
-
return this.localeService.t(
|
|
2209
|
-
const { transformedFormula1: r, transformedFormula2: i } =
|
|
2210
|
-
return `${this.localeService.t(
|
|
2337
|
+
return this.localeService.t(Te.NONE).replace("{TYPE}", this.titleStr);
|
|
2338
|
+
const { transformedFormula1: r, transformedFormula2: i } = Ue(this._lexerTreeBuilder, e, t);
|
|
2339
|
+
return `${this.localeService.t(Te[e.operator]).replace(ue, r != null ? r : "").replace(de, i != null ? i : "")}`;
|
|
2211
2340
|
}
|
|
2212
2341
|
}
|
|
2213
|
-
var
|
|
2214
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2215
|
-
(
|
|
2342
|
+
var Pa = Object.getOwnPropertyDescriptor, Ha = (s, a, e, t) => {
|
|
2343
|
+
for (var r = t > 1 ? void 0 : t ? Pa(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
2344
|
+
(o = s[i]) && (r = o(r) || r);
|
|
2216
2345
|
return r;
|
|
2217
|
-
},
|
|
2218
|
-
let
|
|
2219
|
-
constructor(
|
|
2220
|
-
super(), this._univerInstanceService =
|
|
2346
|
+
}, ae = (s, a) => (e, t) => a(e, t, s);
|
|
2347
|
+
let Ae = class extends Nt {
|
|
2348
|
+
constructor(s, a, e, t, r, i) {
|
|
2349
|
+
super(), this._univerInstanceService = s, this._dataValidatorRegistryService = a, this._injector = e, this._selectionManagerService = t, this._sheetInterceptorService = r, this._sheetDataValidationModel = i, this._init();
|
|
2221
2350
|
}
|
|
2222
2351
|
_init() {
|
|
2223
2352
|
this._registerValidators(), this._initCommandInterceptor();
|
|
2224
2353
|
}
|
|
2225
2354
|
_registerValidators() {
|
|
2226
2355
|
[
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2356
|
+
La,
|
|
2357
|
+
ca,
|
|
2358
|
+
xa,
|
|
2359
|
+
fa,
|
|
2360
|
+
da,
|
|
2231
2361
|
na,
|
|
2232
|
-
|
|
2233
|
-
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
this.disposeWithMe(this._dataValidatorRegistryService.register(a)), this.disposeWithMe(Xe(() => this._injector.delete(o)));
|
|
2362
|
+
_t,
|
|
2363
|
+
Ba,
|
|
2364
|
+
Ua
|
|
2365
|
+
].forEach((s) => {
|
|
2366
|
+
const a = this._injector.createInstance(s);
|
|
2367
|
+
this.disposeWithMe(this._dataValidatorRegistryService.register(a)), this.disposeWithMe(Ke(() => this._injector.delete(s)));
|
|
2239
2368
|
});
|
|
2240
2369
|
}
|
|
2241
2370
|
_initCommandInterceptor() {
|
|
2242
2371
|
this._sheetInterceptorService.interceptCommand({
|
|
2243
|
-
getMutations: (
|
|
2372
|
+
getMutations: (s) => {
|
|
2244
2373
|
var a;
|
|
2245
|
-
if (
|
|
2374
|
+
if (s.id === Xt.id) {
|
|
2246
2375
|
const e = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET), t = e.getUnitId(), r = e.getActiveSheet();
|
|
2247
2376
|
if (!r)
|
|
2248
2377
|
throw new Error("No active sheet found");
|
|
2249
|
-
const i = r.getSheetId(),
|
|
2250
|
-
|
|
2251
|
-
const l = n.diff(this._sheetDataValidationModel.getRules(t, i)), { redoMutations: u, undoMutations: d } =
|
|
2378
|
+
const i = r.getSheetId(), o = (a = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : a.map((c) => c.range), n = this._sheetDataValidationModel.getRuleObjectMatrix(t, i).clone();
|
|
2379
|
+
o && n.removeRange(o);
|
|
2380
|
+
const l = n.diff(this._sheetDataValidationModel.getRules(t, i)), { redoMutations: u, undoMutations: d } = xe(t, i, l, this._injector, "patched");
|
|
2252
2381
|
return {
|
|
2253
2382
|
undos: d,
|
|
2254
2383
|
redos: u
|
|
@@ -2262,226 +2391,228 @@ let Oe = class extends Nt {
|
|
|
2262
2391
|
});
|
|
2263
2392
|
}
|
|
2264
2393
|
};
|
|
2265
|
-
|
|
2266
|
-
|
|
2267
|
-
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2272
|
-
],
|
|
2273
|
-
var
|
|
2274
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2275
|
-
(
|
|
2394
|
+
Ae = Ha([
|
|
2395
|
+
ae(0, I),
|
|
2396
|
+
ae(1, v(G)),
|
|
2397
|
+
ae(2, v(be)),
|
|
2398
|
+
ae(3, v(mt)),
|
|
2399
|
+
ae(4, v(ht)),
|
|
2400
|
+
ae(5, v(C))
|
|
2401
|
+
], Ae);
|
|
2402
|
+
var Wa = Object.getOwnPropertyDescriptor, $a = (s, a, e, t) => {
|
|
2403
|
+
for (var r = t > 1 ? void 0 : t ? Wa(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
2404
|
+
(o = s[i]) && (r = o(r) || r);
|
|
2276
2405
|
return r;
|
|
2277
|
-
}, Re = (
|
|
2278
|
-
let
|
|
2279
|
-
constructor(
|
|
2280
|
-
super(), this._univerInstanceService =
|
|
2406
|
+
}, Re = (s, a) => (e, t) => a(e, t, s);
|
|
2407
|
+
let Ie = class extends x {
|
|
2408
|
+
constructor(s, a, e, t) {
|
|
2409
|
+
super(), this._univerInstanceService = s, this._sheetDataValidationModel = a, this._dataValidationCacheService = e, this._lifecycleService = t, this._initRecalculate();
|
|
2281
2410
|
}
|
|
2282
2411
|
_initRecalculate() {
|
|
2283
|
-
const
|
|
2412
|
+
const s = (a) => {
|
|
2284
2413
|
if (a.length === 0)
|
|
2285
2414
|
return;
|
|
2286
2415
|
const e = this._univerInstanceService.getCurrentUnitForType(N.UNIVER_SHEET), t = e == null ? void 0 : e.getActiveSheet(), r = {};
|
|
2287
2416
|
a.flat().forEach((i) => {
|
|
2288
2417
|
r[i.unitId] || (r[i.unitId] = {}), r[i.unitId][i.subUnitId] || (r[i.unitId][i.subUnitId] = []);
|
|
2289
|
-
const
|
|
2290
|
-
n && r[i.unitId][i.subUnitId].push(...i.ranges.map((l) =>
|
|
2291
|
-
}), Object.entries(r).forEach(([i,
|
|
2292
|
-
Object.entries(
|
|
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) => U.transformRange(l, n)));
|
|
2420
|
+
}), Object.entries(r).forEach(([i, o]) => {
|
|
2421
|
+
Object.entries(o).forEach(([n, l]) => {
|
|
2293
2422
|
(e == null ? void 0 : e.getUnitId()) === i && (t == null ? void 0 : t.getSheetId()) === n ? this.validatorRanges(i, n, l) : requestIdleCallback(() => {
|
|
2294
2423
|
this.validatorRanges(i, n, l);
|
|
2295
2424
|
});
|
|
2296
2425
|
});
|
|
2297
2426
|
});
|
|
2298
2427
|
};
|
|
2299
|
-
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(
|
|
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), wt(20)).subscribe(s));
|
|
2300
2429
|
}
|
|
2301
|
-
async _validatorByCell(
|
|
2302
|
-
const r =
|
|
2303
|
-
if (!
|
|
2430
|
+
async _validatorByCell(s, a, e, t) {
|
|
2431
|
+
const r = s.getUnitId(), i = a.getSheetId();
|
|
2432
|
+
if (!M.isDefine(e) || !M.isDefine(t))
|
|
2304
2433
|
throw new Error(`row or col is not defined, row: ${e}, col: ${t}`);
|
|
2305
|
-
const
|
|
2306
|
-
return
|
|
2307
|
-
this._sheetDataValidationModel.validator(
|
|
2434
|
+
const o = this._sheetDataValidationModel.getRuleByLocation(r, i, e, t);
|
|
2435
|
+
return o ? new Promise((n) => {
|
|
2436
|
+
this._sheetDataValidationModel.validator(o, { unitId: r, subUnitId: i, row: e, col: t, worksheet: a, workbook: s }, (l) => {
|
|
2308
2437
|
n(l);
|
|
2309
2438
|
});
|
|
2310
2439
|
}) : b.VALID;
|
|
2311
2440
|
}
|
|
2312
|
-
async validatorCell(
|
|
2313
|
-
const r = this._univerInstanceService.getUnit(
|
|
2441
|
+
async validatorCell(s, a, e, t) {
|
|
2442
|
+
const r = this._univerInstanceService.getUnit(s, N.UNIVER_SHEET);
|
|
2314
2443
|
if (!r)
|
|
2315
|
-
throw new Error(`cannot find current workbook, unitId: ${
|
|
2444
|
+
throw new Error(`cannot find current workbook, unitId: ${s}`);
|
|
2316
2445
|
const i = r.getSheetBySheetId(a);
|
|
2317
2446
|
if (!i)
|
|
2318
2447
|
throw new Error(`cannot find current worksheet, sheetId: ${a}`);
|
|
2319
2448
|
return this._validatorByCell(r, i, e, t);
|
|
2320
2449
|
}
|
|
2321
|
-
validatorRanges(
|
|
2450
|
+
validatorRanges(s, a, e) {
|
|
2322
2451
|
if (!e.length)
|
|
2323
2452
|
return Promise.resolve([]);
|
|
2324
|
-
const t = this._univerInstanceService.getUnit(
|
|
2453
|
+
const t = this._univerInstanceService.getUnit(s, N.UNIVER_SHEET);
|
|
2325
2454
|
if (!t)
|
|
2326
|
-
throw new Error(`cannot find current workbook, unitId: ${
|
|
2455
|
+
throw new Error(`cannot find current workbook, unitId: ${s}`);
|
|
2327
2456
|
const r = t.getSheetBySheetId(a);
|
|
2328
2457
|
if (!r)
|
|
2329
2458
|
throw new Error(`cannot find current worksheet, sheetId: ${a}`);
|
|
2330
|
-
const
|
|
2459
|
+
const o = this._sheetDataValidationModel.getRules(s, a).map((l) => l.ranges).flat(), n = e.map((l) => o.map((u) => ot(l, u))).flat().filter(Boolean);
|
|
2331
2460
|
return Promise.all(n.map((l) => {
|
|
2332
2461
|
const u = [];
|
|
2333
|
-
return
|
|
2462
|
+
return U.foreach(l, (d, c) => {
|
|
2334
2463
|
u.push(this._validatorByCell(t, r, d, c));
|
|
2335
2464
|
}), Promise.all(u);
|
|
2336
2465
|
}));
|
|
2337
2466
|
}
|
|
2338
|
-
async validatorWorksheet(
|
|
2339
|
-
const e = this._univerInstanceService.getUnit(
|
|
2467
|
+
async validatorWorksheet(s, a) {
|
|
2468
|
+
const e = this._univerInstanceService.getUnit(s, N.UNIVER_SHEET);
|
|
2340
2469
|
if (!e)
|
|
2341
|
-
throw new Error(`cannot find current workbook, unitId: ${
|
|
2470
|
+
throw new Error(`cannot find current workbook, unitId: ${s}`);
|
|
2342
2471
|
const t = e.getSheetBySheetId(a);
|
|
2343
2472
|
if (!t)
|
|
2344
2473
|
throw new Error(`cannot find current worksheet, sheetId: ${a}`);
|
|
2345
|
-
const r = this._sheetDataValidationModel.getRules(
|
|
2474
|
+
const r = this._sheetDataValidationModel.getRules(s, a);
|
|
2346
2475
|
return await Promise.all(
|
|
2347
2476
|
r.map((i) => Promise.all(
|
|
2348
|
-
i.ranges.map((
|
|
2477
|
+
i.ranges.map((o) => {
|
|
2349
2478
|
const n = [];
|
|
2350
|
-
return
|
|
2479
|
+
return U.foreach(o, (l, u) => {
|
|
2351
2480
|
n.push(this._validatorByCell(e, t, l, u));
|
|
2352
2481
|
}), Promise.all(n);
|
|
2353
2482
|
})
|
|
2354
2483
|
))
|
|
2355
|
-
), this._dataValidationCacheService.ensureCache(
|
|
2484
|
+
), this._dataValidationCacheService.ensureCache(s, a);
|
|
2356
2485
|
}
|
|
2357
|
-
async validatorWorkbook(
|
|
2358
|
-
const a = this._sheetDataValidationModel.getSubUnitIds(
|
|
2486
|
+
async validatorWorkbook(s) {
|
|
2487
|
+
const a = this._sheetDataValidationModel.getSubUnitIds(s), e = await Promise.all(a.map((r) => this.validatorWorksheet(s, r))), t = {};
|
|
2359
2488
|
return e.forEach((r, i) => {
|
|
2360
2489
|
t[a[i]] = r;
|
|
2361
2490
|
}), t;
|
|
2362
2491
|
}
|
|
2363
|
-
getDataValidations(
|
|
2364
|
-
const t = this._sheetDataValidationModel.getRuleObjectMatrix(
|
|
2365
|
-
return e.forEach((
|
|
2366
|
-
|
|
2492
|
+
getDataValidations(s, a, e) {
|
|
2493
|
+
const t = this._sheetDataValidationModel.getRuleObjectMatrix(s, a), r = /* @__PURE__ */ new Set();
|
|
2494
|
+
return e.forEach((o) => {
|
|
2495
|
+
U.foreach(o, (n, l) => {
|
|
2367
2496
|
const u = t.getValue(n, l);
|
|
2368
2497
|
u && r.add(u);
|
|
2369
2498
|
});
|
|
2370
|
-
}), Array.from(r).map((
|
|
2499
|
+
}), Array.from(r).map((o) => this._sheetDataValidationModel.getRuleById(s, a, o)).filter(Boolean);
|
|
2371
2500
|
}
|
|
2372
|
-
getDataValidation(
|
|
2373
|
-
return this.getDataValidations(
|
|
2501
|
+
getDataValidation(s, a, e) {
|
|
2502
|
+
return this.getDataValidations(s, a, e)[0];
|
|
2374
2503
|
}
|
|
2375
2504
|
};
|
|
2376
|
-
|
|
2377
|
-
Re(0,
|
|
2378
|
-
Re(1, v(
|
|
2505
|
+
Ie = $a([
|
|
2506
|
+
Re(0, I),
|
|
2507
|
+
Re(1, v(C)),
|
|
2379
2508
|
Re(2, v(Q)),
|
|
2380
|
-
Re(3, v(
|
|
2381
|
-
],
|
|
2382
|
-
var
|
|
2383
|
-
for (var r = t > 1 ? void 0 : t ?
|
|
2384
|
-
(
|
|
2509
|
+
Re(3, v(Ot))
|
|
2510
|
+
], 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, qa = (s, a, e, t) => {
|
|
2512
|
+
for (var r = t > 1 ? void 0 : t ? ja(a, e) : a, i = s.length - 1, o; i >= 0; i--)
|
|
2513
|
+
(o = s[i]) && (r = o(r) || r);
|
|
2385
2514
|
return r;
|
|
2386
|
-
},
|
|
2387
|
-
let
|
|
2388
|
-
constructor(
|
|
2389
|
-
super(), this._config =
|
|
2390
|
-
const { ...r } =
|
|
2515
|
+
}, Ge = (s, a) => (e, t) => a(e, t, s), St = (s, a, e) => Qa(s, typeof a != "symbol" ? a + "" : a, e);
|
|
2516
|
+
let De = class extends Dt {
|
|
2517
|
+
constructor(s = st, a, e, t) {
|
|
2518
|
+
super(), this._config = s, this._injector = a, this._commandService = e, this._configService = t;
|
|
2519
|
+
const { ...r } = bt(
|
|
2391
2520
|
{},
|
|
2392
|
-
|
|
2521
|
+
st,
|
|
2393
2522
|
this._config
|
|
2394
2523
|
);
|
|
2395
|
-
this._configService.setConfig(
|
|
2524
|
+
this._configService.setConfig(Na, r);
|
|
2396
2525
|
}
|
|
2397
2526
|
onStarting() {
|
|
2398
2527
|
[
|
|
2399
2528
|
[Q],
|
|
2400
|
-
[
|
|
2401
|
-
[
|
|
2529
|
+
[le],
|
|
2530
|
+
[q],
|
|
2531
|
+
[W],
|
|
2532
|
+
[Ie],
|
|
2533
|
+
[C],
|
|
2534
|
+
[Ae],
|
|
2535
|
+
[Ce],
|
|
2402
2536
|
[we],
|
|
2403
|
-
[F],
|
|
2404
2537
|
[Oe],
|
|
2405
|
-
[
|
|
2406
|
-
|
|
2407
|
-
|
|
2408
|
-
[Fe]
|
|
2409
|
-
].forEach((o) => {
|
|
2410
|
-
this._injector.add(o);
|
|
2538
|
+
[Ne]
|
|
2539
|
+
].forEach((s) => {
|
|
2540
|
+
this._injector.add(s);
|
|
2411
2541
|
}), [
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
pa,
|
|
2415
|
-
fa,
|
|
2416
|
-
Sa,
|
|
2542
|
+
va,
|
|
2543
|
+
_a,
|
|
2417
2544
|
Ra,
|
|
2418
|
-
|
|
2419
|
-
|
|
2420
|
-
|
|
2421
|
-
|
|
2545
|
+
Sa,
|
|
2546
|
+
ya,
|
|
2547
|
+
Ma,
|
|
2548
|
+
Ea
|
|
2549
|
+
].forEach((s) => {
|
|
2550
|
+
this._commandService.registerCommand(s);
|
|
2551
|
+
}), this._injector.get(Q), this._injector.get(Ie), this._injector.get(Ae), this._injector.get(Ne), this._injector.get(Oe);
|
|
2422
2552
|
}
|
|
2423
2553
|
onReady() {
|
|
2424
|
-
this._injector.get(
|
|
2554
|
+
this._injector.get(we);
|
|
2425
2555
|
}
|
|
2426
2556
|
onRendered() {
|
|
2427
|
-
this._injector.get(
|
|
2557
|
+
this._injector.get(Ce);
|
|
2428
2558
|
}
|
|
2429
2559
|
};
|
|
2430
|
-
|
|
2431
|
-
|
|
2432
|
-
|
|
2433
|
-
|
|
2434
|
-
|
|
2435
|
-
|
|
2436
|
-
|
|
2437
|
-
],
|
|
2438
|
-
function
|
|
2439
|
-
const e =
|
|
2560
|
+
St(De, "pluginName", Ta);
|
|
2561
|
+
St(De, "type", N.UNIVER_SHEET);
|
|
2562
|
+
De = qa([
|
|
2563
|
+
At(xt),
|
|
2564
|
+
Ge(1, v(be)),
|
|
2565
|
+
Ge(2, B),
|
|
2566
|
+
Ge(3, It)
|
|
2567
|
+
], De);
|
|
2568
|
+
function ar(s) {
|
|
2569
|
+
const e = s.get(mt).getCurrentSelections().map((i) => i.range);
|
|
2440
2570
|
return {
|
|
2441
|
-
uid:
|
|
2571
|
+
uid: Xe(6),
|
|
2442
2572
|
type: T.DECIMAL,
|
|
2443
2573
|
operator: h.EQUAL,
|
|
2444
2574
|
formula1: "100",
|
|
2445
2575
|
ranges: e != null ? e : [{ startColumn: 0, endColumn: 0, startRow: 0, endRow: 0 }]
|
|
2446
2576
|
};
|
|
2447
2577
|
}
|
|
2448
|
-
const
|
|
2578
|
+
const rr = "data-validation.custom-formula-input", ir = "data-validation.formula-input", sr = "data-validation.list-formula-input", or = "data-validation.checkbox-formula-input";
|
|
2449
2579
|
export {
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2580
|
+
va as AddSheetDataValidationCommand,
|
|
2581
|
+
ir as BASE_FORMULA_INPUT_NAME,
|
|
2582
|
+
Ve as CHECKBOX_FORMULA_1,
|
|
2583
|
+
ye as CHECKBOX_FORMULA_2,
|
|
2584
|
+
or as CHECKBOX_FORMULA_INPUT_NAME,
|
|
2585
|
+
rr as CUSTOM_FORMULA_INPUT_NAME,
|
|
2586
|
+
na as CheckboxValidator,
|
|
2587
|
+
Ea as ClearRangeDataValidationCommand,
|
|
2588
|
+
Ta as DATA_VALIDATION_PLUGIN_NAME,
|
|
2459
2589
|
Q as DataValidationCacheService,
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
|
|
2470
|
-
|
|
2471
|
-
Ie as
|
|
2472
|
-
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2476
|
-
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
|
|
2590
|
+
W as DataValidationCustomFormulaService,
|
|
2591
|
+
Ce as DataValidationFormulaController,
|
|
2592
|
+
q as DataValidationFormulaService,
|
|
2593
|
+
le as DataValidationListCacheService,
|
|
2594
|
+
da as DateValidator,
|
|
2595
|
+
sr as LIST_FORMULA_INPUT_NAME,
|
|
2596
|
+
Ba as ListMultipleValidator,
|
|
2597
|
+
_t as ListValidator,
|
|
2598
|
+
Ma as RemoveSheetAllDataValidationCommand,
|
|
2599
|
+
ya as RemoveSheetDataValidationCommand,
|
|
2600
|
+
C as SheetDataValidationModel,
|
|
2601
|
+
Ie as SheetsDataValidationValidatorService,
|
|
2602
|
+
De as UniverSheetsDataValidationPlugin,
|
|
2603
|
+
Sa as UpdateSheetDataValidationOptionsCommand,
|
|
2604
|
+
_a as UpdateSheetDataValidationRangeCommand,
|
|
2605
|
+
Ra as UpdateSheetDataValidationSettingCommand,
|
|
2606
|
+
ar as createDefaultNewRule,
|
|
2607
|
+
Ee as deserializeListOptions,
|
|
2608
|
+
Fe as getCellValueNumber,
|
|
2609
|
+
re as getCellValueOrigin,
|
|
2610
|
+
tr as getDataValidationCellValue,
|
|
2611
|
+
xe as getDataValidationDiffMutations,
|
|
2612
|
+
_e as getFormulaCellData,
|
|
2482
2613
|
oe as getFormulaResult,
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
|
|
2486
|
-
|
|
2614
|
+
Ue as getTransformedFormula,
|
|
2615
|
+
F as isLegalFormulaResult,
|
|
2616
|
+
er as serializeListOptions,
|
|
2617
|
+
ve as transformCheckboxValue
|
|
2487
2618
|
};
|