@univerjs/sheets-data-validation 0.5.0-alpha.0 → 0.5.0-beta.1
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 +1573 -1687
- package/lib/types/controllers/dv-formula-ref-range.controller.d.ts +13 -0
- package/lib/types/models/sheet-data-validation-model.d.ts +1 -2
- package/lib/types/services/dv-custom-formula.service.d.ts +4 -1
- package/lib/types/services/dv-formula.service.d.ts +2 -3
- package/lib/types/utils/formula.d.ts +5 -1
- package/lib/types/validators/const.d.ts +17 -0
- package/lib/types/validators/custom-validator.d.ts +1 -1
- package/lib/types/validators/date-validator.d.ts +5 -7
- package/lib/types/validators/decimal-validator.d.ts +6 -3
- package/lib/types/validators/text-length-validator.d.ts +5 -3
- package/lib/types/validators/util.d.ts +7 -1
- package/lib/types/validators/whole-validator.d.ts +5 -2
- package/lib/umd/index.js +1 -1
- package/package.json +11 -12
package/lib/es/index.js
CHANGED
|
@@ -1,37 +1,37 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { Inject as
|
|
5
|
-
import { DataValidationModel as
|
|
6
|
-
import { SetRangeValuesMutation as
|
|
7
|
-
import { Subject as
|
|
8
|
-
import { RegisterOtherFormulaService as
|
|
9
|
-
import { ERROR_TYPE_SET as
|
|
10
|
-
const
|
|
11
|
-
var
|
|
12
|
-
for (var
|
|
13
|
-
(
|
|
14
|
-
return r &&
|
|
15
|
-
},
|
|
16
|
-
let
|
|
1
|
+
var St = Object.defineProperty;
|
|
2
|
+
var Vt = (o, t, e) => t in o ? St(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e;
|
|
3
|
+
var f = (o, t, e) => Vt(o, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { Inject as v, ICommandService as H, Disposable as W, ObjectMatrix as Re, Range as I, DataValidationType as M, UniverInstanceType as A, isFormulaString as R, IUniverInstanceService as D, getOriginCellValue as Nt, debounce as Mt, Rectangle as B, Tools as N, DataValidationStatus as Y, WrapStrategy as ve, DataValidationOperator as h, numfmt as k, dayjs as it, DataValidationRenderMode as Le, CommandType as K, IUndoRedoService as z, sequenceExecute as Oe, CellValueType as yt, Injector as je, RxDisposable as Et, toDisposable as qe, IPermissionService as Tt, generateRandomId as wt, isRangesEqual as Ft, LifecycleService as Ct, LifecycleStages as et, bufferDebounceTime as Ot, DependentOn as bt, Plugin as It, IConfigService as At } from "@univerjs/core";
|
|
5
|
+
import { DataValidationModel as Ge, DataValidatorRegistryService as Qe, UpdateRuleType as w, BaseDataValidator as q, TextLengthErrorTitleMap as Dt, AddDataValidationMutation as U, RemoveDataValidationMutation as P, UpdateDataValidationMutation as b, getRuleSetting as xt, getRuleOptions as Lt, UniverDataValidationPlugin as Bt } from "@univerjs/data-validation";
|
|
6
|
+
import { SetRangeValuesMutation as se, RemoveSheetMutation as Pt, getSheetCommandTarget as Ye, SetRangeValuesUndoMutationFactory as st, SheetsSelectionsService as ot, SheetInterceptorService as nt, ClearSelectionAllCommand as Ut, WorksheetViewPermission as $t, RefRangeService as Ht, handleCommonDefaultRangeChangeWithEffectRefCommands as Wt, RemoveSheetCommand as kt } from "@univerjs/sheets";
|
|
7
|
+
import { Subject as We, bufferWhen as jt, filter as tt } from "rxjs";
|
|
8
|
+
import { RegisterOtherFormulaService as lt, FormulaRefRangeService as ut } from "@univerjs/sheets-formula";
|
|
9
|
+
import { ERROR_TYPE_SET as qt, LexerTreeBuilder as Z, isReferenceString as ct, sequenceNodeType as Gt, deserializeRangeWithSheet as Qt, deserializeRangeWithSheetWithCache as Yt } from "@univerjs/engine-formula";
|
|
10
|
+
const Xt = "SHEET_DATA_VALIDATION_PLUGIN";
|
|
11
|
+
var Kt = Object.defineProperty, zt = Object.getOwnPropertyDescriptor, Zt = (o, t, e, r) => {
|
|
12
|
+
for (var a = r > 1 ? void 0 : r ? zt(t, e) : t, i = o.length - 1, s; i >= 0; i--)
|
|
13
|
+
(s = o[i]) && (a = (r ? s(t, e, a) : s(a)) || a);
|
|
14
|
+
return r && a && Kt(t, e, a), a;
|
|
15
|
+
}, Jt = (o, t) => (e, r) => t(e, r, o);
|
|
16
|
+
let j = class extends W {
|
|
17
17
|
constructor(t) {
|
|
18
18
|
super();
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
19
|
+
f(this, "_cacheMatrix", /* @__PURE__ */ new Map());
|
|
20
|
+
f(this, "_dirtyRanges$", new We());
|
|
21
|
+
f(this, "dirtyRanges$", this._dirtyRanges$.asObservable());
|
|
22
22
|
this._commandService = t, this._initDirtyRanges();
|
|
23
23
|
}
|
|
24
24
|
_initDirtyRanges() {
|
|
25
25
|
this.disposeWithMe(this._commandService.onCommandExecuted((t) => {
|
|
26
|
-
if (t.id ===
|
|
27
|
-
const { cellValue: e, unitId: r, subUnitId:
|
|
26
|
+
if (t.id === se.id) {
|
|
27
|
+
const { cellValue: e, unitId: r, subUnitId: a } = t.params;
|
|
28
28
|
if (e) {
|
|
29
|
-
const
|
|
30
|
-
if (
|
|
29
|
+
const i = new Re(e).getDataRange();
|
|
30
|
+
if (i.endRow === -1) return;
|
|
31
31
|
this._dirtyRanges$.next({
|
|
32
32
|
unitId: r,
|
|
33
|
-
subUnitId:
|
|
34
|
-
ranges: [
|
|
33
|
+
subUnitId: a,
|
|
34
|
+
ranges: [i]
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
37
|
}
|
|
@@ -40,8 +40,8 @@ let ue = class extends ce {
|
|
|
40
40
|
_ensureCache(t, e) {
|
|
41
41
|
let r = this._cacheMatrix.get(t);
|
|
42
42
|
r || (r = /* @__PURE__ */ new Map(), this._cacheMatrix.set(t, r));
|
|
43
|
-
let
|
|
44
|
-
return
|
|
43
|
+
let a = r.get(e);
|
|
44
|
+
return a || (a = new Re(), r.set(e, a)), a;
|
|
45
45
|
}
|
|
46
46
|
ensureCache(t, e) {
|
|
47
47
|
return this._ensureCache(t, e);
|
|
@@ -52,170 +52,212 @@ let ue = class extends ce {
|
|
|
52
52
|
removeRule(t, e, r) {
|
|
53
53
|
this._deleteRange(t, e, r.ranges);
|
|
54
54
|
}
|
|
55
|
-
updateRuleRanges(t, e, r,
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
const c =
|
|
55
|
+
updateRuleRanges(t, e, r, a, i) {
|
|
56
|
+
const s = this._ensureCache(t, e);
|
|
57
|
+
i.forEach((n) => {
|
|
58
|
+
I.foreach(n, (l, u) => {
|
|
59
|
+
const c = s.getValue(l, u);
|
|
60
60
|
c && (c.temp = !0);
|
|
61
61
|
});
|
|
62
|
-
}),
|
|
63
|
-
|
|
64
|
-
const c =
|
|
65
|
-
c && c.ruleId === r ? c.temp = !1 :
|
|
62
|
+
}), a.forEach((n) => {
|
|
63
|
+
I.foreach(n, (l, u) => {
|
|
64
|
+
const c = s.getValue(l, u);
|
|
65
|
+
c && c.ruleId === r ? c.temp = !1 : s.setValue(l, u, void 0);
|
|
66
66
|
});
|
|
67
|
-
}),
|
|
68
|
-
|
|
69
|
-
const c =
|
|
70
|
-
c && c.temp === !0 &&
|
|
67
|
+
}), i.forEach((n) => {
|
|
68
|
+
I.foreach(n, (l, u) => {
|
|
69
|
+
const c = s.getValue(l, u);
|
|
70
|
+
c && c.temp === !0 && s.realDeleteValue(l, u);
|
|
71
71
|
});
|
|
72
|
-
}), this._dirtyRanges$.next({ unitId: t, subUnitId: e, ranges: [...
|
|
72
|
+
}), this._dirtyRanges$.next({ unitId: t, subUnitId: e, ranges: [...i, ...a] });
|
|
73
73
|
}
|
|
74
74
|
markRangeDirty(t, e, r) {
|
|
75
|
-
const
|
|
76
|
-
r.forEach((
|
|
77
|
-
|
|
78
|
-
|
|
75
|
+
const a = this._ensureCache(t, e);
|
|
76
|
+
r.forEach((i) => {
|
|
77
|
+
I.foreach(i, (s, n) => {
|
|
78
|
+
a.setValue(s, n, void 0);
|
|
79
79
|
});
|
|
80
80
|
}), this._dirtyRanges$.next({ unitId: t, subUnitId: e, ranges: r });
|
|
81
81
|
}
|
|
82
|
-
markCellDirty(t, e, r,
|
|
83
|
-
this._ensureCache(t, e).setValue(r,
|
|
82
|
+
markCellDirty(t, e, r, a) {
|
|
83
|
+
this._ensureCache(t, e).setValue(r, a, void 0), this._dirtyRanges$.next({ unitId: t, subUnitId: e, ranges: [{ startRow: r, startColumn: a, endRow: r, endColumn: a }] });
|
|
84
84
|
}
|
|
85
85
|
_deleteRange(t, e, r) {
|
|
86
|
-
const
|
|
87
|
-
r.forEach((
|
|
88
|
-
|
|
89
|
-
|
|
86
|
+
const a = this._ensureCache(t, e);
|
|
87
|
+
r.forEach((i) => {
|
|
88
|
+
I.foreach(i, (s, n) => {
|
|
89
|
+
a.realDeleteValue(s, n);
|
|
90
90
|
});
|
|
91
91
|
}), this._dirtyRanges$.next({ unitId: t, subUnitId: e, ranges: r });
|
|
92
92
|
}
|
|
93
|
-
getValue(t, e, r,
|
|
94
|
-
return this._ensureCache(t, e).getValue(r,
|
|
93
|
+
getValue(t, e, r, a) {
|
|
94
|
+
return this._ensureCache(t, e).getValue(r, a);
|
|
95
95
|
}
|
|
96
|
-
setValue(t, e, r,
|
|
97
|
-
return this._ensureCache(t, e).setValue(r,
|
|
96
|
+
setValue(t, e, r, a, i) {
|
|
97
|
+
return this._ensureCache(t, e).setValue(r, a, i);
|
|
98
98
|
}
|
|
99
99
|
};
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
],
|
|
103
|
-
function
|
|
100
|
+
j = Zt([
|
|
101
|
+
Jt(0, v(H))
|
|
102
|
+
], j);
|
|
103
|
+
function ie(o) {
|
|
104
104
|
var t, e;
|
|
105
|
-
return (e = (t =
|
|
105
|
+
return (e = (t = o == null ? void 0 : o[0]) == null ? void 0 : t[0]) == null ? void 0 : e.v;
|
|
106
106
|
}
|
|
107
|
-
function
|
|
107
|
+
function he(o) {
|
|
108
108
|
var t;
|
|
109
|
-
return (t =
|
|
109
|
+
return (t = o == null ? void 0 : o[0]) == null ? void 0 : t[0];
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
return !
|
|
111
|
+
function O(o) {
|
|
112
|
+
return !qt.has(o);
|
|
113
113
|
}
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
114
|
+
function le(o) {
|
|
115
|
+
return o !== M.LIST && o !== M.LIST_MULTIPLE && o !== M.CHECKBOX && o !== M.ANY;
|
|
116
|
+
}
|
|
117
|
+
var er = Object.defineProperty, tr = Object.getOwnPropertyDescriptor, rr = (o, t, e, r) => {
|
|
118
|
+
for (var a = r > 1 ? void 0 : r ? tr(t, e) : t, i = o.length - 1, s; i >= 0; i--)
|
|
119
|
+
(s = o[i]) && (a = (r ? s(t, e, a) : s(a)) || a);
|
|
120
|
+
return r && a && er(t, e, a), a;
|
|
121
|
+
}, me = (o, t) => (e, r) => t(e, r, o);
|
|
122
|
+
let $ = class extends W {
|
|
123
|
+
constructor(t, e, r, a) {
|
|
121
124
|
super();
|
|
122
125
|
/**
|
|
123
126
|
* Map of origin formula of rule
|
|
124
127
|
*/
|
|
125
|
-
|
|
126
|
-
this
|
|
128
|
+
f(this, "_ruleFormulaMap", /* @__PURE__ */ new Map());
|
|
129
|
+
f(this, "_ruleFormulaMap2", /* @__PURE__ */ new Map());
|
|
130
|
+
this._instanceSrv = t, this._registerOtherFormulaService = e, this._dataValidationModel = r, this._dataValidationCacheService = a, this._initFormulaResultHandler();
|
|
127
131
|
}
|
|
128
132
|
_initFormulaResultHandler() {
|
|
129
133
|
this.disposeWithMe(this._registerOtherFormulaService.formulaResult$.subscribe((t) => {
|
|
130
134
|
for (const e in t) {
|
|
131
135
|
const r = t[e];
|
|
132
|
-
if (this._instanceSrv.getUnitType(e) ===
|
|
133
|
-
for (const
|
|
134
|
-
const
|
|
135
|
-
|
|
136
|
+
if (this._instanceSrv.getUnitType(e) === A.UNIVER_SHEET)
|
|
137
|
+
for (const i in r) {
|
|
138
|
+
const s = r[i], { ruleFormulaMap: n } = this._ensureMaps(e, i);
|
|
139
|
+
s.forEach((l) => {
|
|
136
140
|
var d, m;
|
|
137
|
-
const u =
|
|
138
|
-
c && u &&
|
|
141
|
+
const u = n.get((d = l.extra) == null ? void 0 : d.ruleId), c = this._dataValidationModel.getRuleById(e, i, (m = l.extra) == null ? void 0 : m.ruleId);
|
|
142
|
+
c && u && this._dataValidationCacheService.markRangeDirty(e, i, c.ranges);
|
|
139
143
|
});
|
|
140
144
|
}
|
|
141
145
|
}
|
|
142
146
|
}));
|
|
143
147
|
}
|
|
144
148
|
_ensureMaps(t, e) {
|
|
145
|
-
let r = this._ruleFormulaMap.get(t);
|
|
146
|
-
r || (r = /* @__PURE__ */ new Map(), this._ruleFormulaMap.set(t, r));
|
|
149
|
+
let r = this._ruleFormulaMap.get(t), a = this._ruleFormulaMap2.get(t);
|
|
150
|
+
r || (r = /* @__PURE__ */ new Map(), this._ruleFormulaMap.set(t, r)), a || (a = /* @__PURE__ */ new Map(), this._ruleFormulaMap2.set(t, a));
|
|
147
151
|
let i = r.get(e);
|
|
148
|
-
|
|
152
|
+
i || (i = /* @__PURE__ */ new Map(), r.set(e, i));
|
|
153
|
+
let s = a.get(e);
|
|
154
|
+
return s || (s = /* @__PURE__ */ new Map(), a.set(e, s)), { ruleFormulaMap: i, ruleFormulaMap2: s };
|
|
149
155
|
}
|
|
150
|
-
_registerFormula(t, e, r,
|
|
151
|
-
return this._registerOtherFormulaService.registerFormulaWithRange(t, e,
|
|
156
|
+
_registerFormula(t, e, r, a, i) {
|
|
157
|
+
return this._registerOtherFormulaService.registerFormulaWithRange(t, e, a, i, { ruleId: r });
|
|
152
158
|
}
|
|
153
159
|
deleteByRuleId(t, e, r) {
|
|
154
|
-
const { ruleFormulaMap: i } = this._ensureMaps(t, e),
|
|
155
|
-
if (!
|
|
156
|
-
return;
|
|
157
|
-
const o = i.get(r);
|
|
158
|
-
o && (i.delete(r), this._registerOtherFormulaService.deleteFormula(t, e, [o.formulaId]));
|
|
159
|
-
}
|
|
160
|
-
_addFormulaByRange(t, e, r, i, a) {
|
|
161
|
-
const { ruleFormulaMap: n } = this._ensureMaps(t, e);
|
|
162
|
-
if (!i)
|
|
160
|
+
const { ruleFormulaMap: a, ruleFormulaMap2: i } = this._ensureMaps(t, e), s = this._dataValidationModel.getRuleById(t, e, r), n = a.get(r);
|
|
161
|
+
if (!s || !n)
|
|
163
162
|
return;
|
|
164
|
-
const
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
163
|
+
const l = a.get(r);
|
|
164
|
+
l && (a.delete(r), this._registerOtherFormulaService.deleteFormula(t, e, [l.formulaId]));
|
|
165
|
+
const u = i.get(r);
|
|
166
|
+
u && (i.delete(r), this._registerOtherFormulaService.deleteFormula(t, e, [u.formulaId]));
|
|
167
|
+
}
|
|
168
|
+
_addFormulaByRange(t, e, r, a, i, s) {
|
|
169
|
+
const { ruleFormulaMap: n, ruleFormulaMap2: l } = this._ensureMaps(t, e), u = s[0].startRow, c = s[0].startColumn;
|
|
170
|
+
if (a && R(a)) {
|
|
171
|
+
const d = this._registerFormula(t, e, r, a, s);
|
|
172
|
+
n.set(r, {
|
|
173
|
+
formula: a,
|
|
174
|
+
originCol: c,
|
|
175
|
+
originRow: u,
|
|
176
|
+
formulaId: d
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
if (i && R(i)) {
|
|
180
|
+
const d = this._registerFormula(t, e, r, i, s);
|
|
181
|
+
l.set(r, {
|
|
182
|
+
formula: i,
|
|
183
|
+
originCol: c,
|
|
184
|
+
originRow: u,
|
|
185
|
+
formulaId: d
|
|
186
|
+
});
|
|
187
|
+
}
|
|
172
188
|
}
|
|
173
189
|
addRule(t, e, r) {
|
|
174
|
-
|
|
175
|
-
|
|
190
|
+
if (le(r.type)) {
|
|
191
|
+
const { ranges: a, formula1: i, formula2: s, uid: n } = r;
|
|
192
|
+
this._addFormulaByRange(t, e, n, i, s, a);
|
|
193
|
+
}
|
|
176
194
|
}
|
|
177
|
-
async getCellFormulaValue(t, e, r,
|
|
178
|
-
var
|
|
179
|
-
const { ruleFormulaMap:
|
|
180
|
-
if (!
|
|
195
|
+
async getCellFormulaValue(t, e, r, a, i) {
|
|
196
|
+
var _, p;
|
|
197
|
+
const { ruleFormulaMap: s } = this._ensureMaps(t, e), n = s.get(r);
|
|
198
|
+
if (!n)
|
|
181
199
|
return Promise.resolve(void 0);
|
|
182
|
-
const l = await this._registerOtherFormulaService.getFormulaValue(t, e,
|
|
183
|
-
return
|
|
200
|
+
const l = await this._registerOtherFormulaService.getFormulaValue(t, e, n.formulaId), { originRow: u, originCol: c } = n, d = a - u, m = i - c;
|
|
201
|
+
return he((p = (_ = l == null ? void 0 : l.result) == null ? void 0 : _[d]) == null ? void 0 : p[m]);
|
|
202
|
+
}
|
|
203
|
+
async getCellFormula2Value(t, e, r, a, i) {
|
|
204
|
+
var _, p;
|
|
205
|
+
const { ruleFormulaMap2: s } = this._ensureMaps(t, e), n = s.get(r);
|
|
206
|
+
if (!n)
|
|
207
|
+
return Promise.resolve(void 0);
|
|
208
|
+
const l = await this._registerOtherFormulaService.getFormulaValue(t, e, n.formulaId), { originRow: u, originCol: c } = n, d = a - u, m = i - c;
|
|
209
|
+
return he((p = (_ = l == null ? void 0 : l.result) == null ? void 0 : _[d]) == null ? void 0 : p[m]);
|
|
210
|
+
}
|
|
211
|
+
getCellFormulaValueSync(t, e, r, a, i) {
|
|
212
|
+
var _, p;
|
|
213
|
+
const { ruleFormulaMap: s } = this._ensureMaps(t, e), n = s.get(r);
|
|
214
|
+
if (!n)
|
|
215
|
+
return;
|
|
216
|
+
const l = this._registerOtherFormulaService.getFormulaValueSync(t, e, n.formulaId), { originRow: u, originCol: c } = n, d = a - u, m = i - c;
|
|
217
|
+
return he((p = (_ = l == null ? void 0 : l.result) == null ? void 0 : _[d]) == null ? void 0 : p[m]);
|
|
218
|
+
}
|
|
219
|
+
getCellFormula2ValueSync(t, e, r, a, i) {
|
|
220
|
+
var _, p;
|
|
221
|
+
const { ruleFormulaMap2: s } = this._ensureMaps(t, e), n = s.get(r);
|
|
222
|
+
if (!n)
|
|
223
|
+
return;
|
|
224
|
+
const l = this._registerOtherFormulaService.getFormulaValueSync(t, e, n.formulaId), { originRow: u, originCol: c } = n, d = a - u, m = i - c;
|
|
225
|
+
return he((p = (_ = l == null ? void 0 : l.result) == null ? void 0 : _[d]) == null ? void 0 : p[m]);
|
|
184
226
|
}
|
|
185
227
|
getRuleFormulaInfo(t, e, r) {
|
|
186
|
-
const { ruleFormulaMap:
|
|
187
|
-
return
|
|
228
|
+
const { ruleFormulaMap: a } = this._ensureMaps(t, e);
|
|
229
|
+
return a.get(r);
|
|
188
230
|
}
|
|
189
231
|
};
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
],
|
|
196
|
-
var
|
|
197
|
-
for (var
|
|
198
|
-
(
|
|
199
|
-
return r &&
|
|
200
|
-
},
|
|
201
|
-
let
|
|
202
|
-
constructor(t, e, r,
|
|
232
|
+
$ = rr([
|
|
233
|
+
me(0, D),
|
|
234
|
+
me(1, v(lt)),
|
|
235
|
+
me(2, v(Ge)),
|
|
236
|
+
me(3, v(j))
|
|
237
|
+
], $);
|
|
238
|
+
var ar = Object.defineProperty, ir = Object.getOwnPropertyDescriptor, sr = (o, t, e, r) => {
|
|
239
|
+
for (var a = r > 1 ? void 0 : r ? ir(t, e) : t, i = o.length - 1, s; i >= 0; i--)
|
|
240
|
+
(s = o[i]) && (a = (r ? s(t, e, a) : s(a)) || a);
|
|
241
|
+
return r && a && ar(t, e, a), a;
|
|
242
|
+
}, fe = (o, t) => (e, r) => t(e, r, o);
|
|
243
|
+
let X = class extends W {
|
|
244
|
+
constructor(t, e, r, a) {
|
|
203
245
|
super();
|
|
204
|
-
|
|
205
|
-
this._instanceService = t, this._registerOtherFormulaService = e, this._dataValidationCacheService = r, this._dataValidationModel =
|
|
246
|
+
f(this, "_formulaRuleMap", /* @__PURE__ */ new Map());
|
|
247
|
+
this._instanceService = t, this._registerOtherFormulaService = e, this._dataValidationCacheService = r, this._dataValidationModel = a, this._initFormulaResultHandler();
|
|
206
248
|
}
|
|
207
249
|
_initFormulaResultHandler() {
|
|
208
250
|
this.disposeWithMe(this._registerOtherFormulaService.formulaResult$.subscribe((t) => {
|
|
209
251
|
for (const e in t) {
|
|
210
252
|
const r = t[e];
|
|
211
|
-
if (this._instanceService.getUnitType(e) ===
|
|
212
|
-
for (const
|
|
213
|
-
const
|
|
214
|
-
|
|
253
|
+
if (this._instanceService.getUnitType(e) === A.UNIVER_SHEET)
|
|
254
|
+
for (const i in r) {
|
|
255
|
+
const s = r[i], n = this._ensureRuleFormulaMap(e, i);
|
|
256
|
+
s.forEach((l) => {
|
|
215
257
|
var u, c;
|
|
216
|
-
if (
|
|
217
|
-
const d = this._dataValidationModel.getRuleById(e,
|
|
218
|
-
d && this._dataValidationCacheService.markRangeDirty(e,
|
|
258
|
+
if (n.get((u = l.extra) == null ? void 0 : u.ruleId)) {
|
|
259
|
+
const d = this._dataValidationModel.getRuleById(e, i, (c = l.extra) == null ? void 0 : c.ruleId);
|
|
260
|
+
d && this._dataValidationCacheService.markRangeDirty(e, i, d.ranges);
|
|
219
261
|
}
|
|
220
262
|
});
|
|
221
263
|
}
|
|
@@ -225,97 +267,73 @@ let te = class extends ce {
|
|
|
225
267
|
_ensureRuleFormulaMap(t, e) {
|
|
226
268
|
let r = this._formulaRuleMap.get(t);
|
|
227
269
|
r || (r = /* @__PURE__ */ new Map(), this._formulaRuleMap.set(t, r));
|
|
228
|
-
let
|
|
229
|
-
return
|
|
270
|
+
let a = r.get(e);
|
|
271
|
+
return a || (a = /* @__PURE__ */ new Map(), r.set(e, a)), a;
|
|
230
272
|
}
|
|
231
|
-
_registerSingleFormula(t, e, r,
|
|
232
|
-
const
|
|
233
|
-
return this._registerOtherFormulaService.registerFormulaWithRange(t, e, r,
|
|
273
|
+
_registerSingleFormula(t, e, r, a) {
|
|
274
|
+
const i = [{ startColumn: 0, endColumn: 0, startRow: 0, endRow: 0 }];
|
|
275
|
+
return this._registerOtherFormulaService.registerFormulaWithRange(t, e, r, i, { ruleId: a });
|
|
234
276
|
}
|
|
235
|
-
addRule(t, e, r
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
277
|
+
addRule(t, e, r) {
|
|
278
|
+
if (!le(r.type) && r.type !== M.CHECKBOX) {
|
|
279
|
+
const { formula1: a, formula2: i, uid: s } = r, n = R(a), l = R(i);
|
|
280
|
+
if (!n && !l)
|
|
281
|
+
return;
|
|
282
|
+
const u = this._ensureRuleFormulaMap(t, e), c = [void 0, void 0];
|
|
283
|
+
if (n) {
|
|
284
|
+
const d = this._registerSingleFormula(t, e, a, s);
|
|
285
|
+
c[0] = { id: d, text: a };
|
|
286
|
+
}
|
|
287
|
+
if (l) {
|
|
288
|
+
const d = this._registerSingleFormula(t, e, i, s);
|
|
289
|
+
c[1] = { id: d, text: i };
|
|
290
|
+
}
|
|
291
|
+
u.set(s, c);
|
|
247
292
|
}
|
|
248
|
-
u.set(r, c);
|
|
249
293
|
}
|
|
250
294
|
removeRule(t, e, r) {
|
|
251
|
-
const
|
|
252
|
-
if (!
|
|
295
|
+
const i = this._ensureRuleFormulaMap(t, e).get(r);
|
|
296
|
+
if (!i)
|
|
253
297
|
return;
|
|
254
|
-
const [
|
|
298
|
+
const [s, n] = i, l = [s == null ? void 0 : s.id, n == null ? void 0 : n.id].filter(Boolean);
|
|
255
299
|
l.length && this._registerOtherFormulaService.deleteFormula(t, e, l);
|
|
256
300
|
}
|
|
257
|
-
updateRuleFormulaText(t, e, r, i, a, n) {
|
|
258
|
-
const l = this._ensureRuleFormulaMap(t, e).get(r);
|
|
259
|
-
if (!l) {
|
|
260
|
-
this.addRule(t, e, r, i, a, n);
|
|
261
|
-
return;
|
|
262
|
-
}
|
|
263
|
-
const [u, c] = l;
|
|
264
|
-
if ((u == null ? void 0 : u.text) !== i)
|
|
265
|
-
if (u && this._registerOtherFormulaService.deleteFormula(t, e, [u.id]), F(i)) {
|
|
266
|
-
const d = this._registerSingleFormula(t, e, i, r);
|
|
267
|
-
l[0] = {
|
|
268
|
-
text: i,
|
|
269
|
-
id: d
|
|
270
|
-
};
|
|
271
|
-
} else
|
|
272
|
-
l[0] = void 0;
|
|
273
|
-
if ((c == null ? void 0 : c.text) !== a)
|
|
274
|
-
if (c && this._registerOtherFormulaService.deleteFormula(t, e, [c.id]), F(a)) {
|
|
275
|
-
const d = this._registerSingleFormula(t, e, a, r);
|
|
276
|
-
l[1] = {
|
|
277
|
-
text: a,
|
|
278
|
-
id: d
|
|
279
|
-
};
|
|
280
|
-
} else
|
|
281
|
-
l[1] = void 0;
|
|
282
|
-
}
|
|
283
301
|
getRuleFormulaResult(t, e, r) {
|
|
284
|
-
const
|
|
285
|
-
if (!
|
|
302
|
+
const i = this._ensureRuleFormulaMap(t, e).get(r);
|
|
303
|
+
if (!i)
|
|
286
304
|
return Promise.resolve(null);
|
|
287
|
-
const
|
|
305
|
+
const s = async (n) => n && this._registerOtherFormulaService.getFormulaValue(t, e, n.id);
|
|
288
306
|
return Promise.all([
|
|
289
|
-
|
|
290
|
-
|
|
307
|
+
s(i[0]),
|
|
308
|
+
s(i[1])
|
|
291
309
|
]);
|
|
292
310
|
}
|
|
293
311
|
getRuleFormulaResultSync(t, e, r) {
|
|
294
|
-
const
|
|
295
|
-
if (
|
|
296
|
-
return
|
|
297
|
-
if (
|
|
298
|
-
return this._registerOtherFormulaService.getFormulaValueSync(t, e,
|
|
312
|
+
const i = this._ensureRuleFormulaMap(t, e).get(r);
|
|
313
|
+
if (i)
|
|
314
|
+
return i.map((s) => {
|
|
315
|
+
if (s)
|
|
316
|
+
return this._registerOtherFormulaService.getFormulaValueSync(t, e, s.id);
|
|
299
317
|
});
|
|
300
318
|
}
|
|
301
319
|
getRuleFormulaInfo(t, e, r) {
|
|
302
320
|
return this._ensureRuleFormulaMap(t, e).get(r);
|
|
303
321
|
}
|
|
304
322
|
};
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
],
|
|
311
|
-
function
|
|
312
|
-
return
|
|
323
|
+
X = sr([
|
|
324
|
+
fe(0, D),
|
|
325
|
+
fe(1, v(lt)),
|
|
326
|
+
fe(2, v(j)),
|
|
327
|
+
fe(3, v(Ge))
|
|
328
|
+
], X);
|
|
329
|
+
function ae(o) {
|
|
330
|
+
return Nt(o);
|
|
313
331
|
}
|
|
314
|
-
function
|
|
332
|
+
function dt(o) {
|
|
315
333
|
var t;
|
|
316
|
-
return String((t =
|
|
334
|
+
return String((t = ae(o)) != null ? t : "");
|
|
317
335
|
}
|
|
318
|
-
const
|
|
336
|
+
const or = class ke {
|
|
319
337
|
/**
|
|
320
338
|
* Accept two comparable values and creates new instance of interval
|
|
321
339
|
* Predicate Interval.comparable_less(low, high) supposed to return true on these values
|
|
@@ -330,7 +348,7 @@ const gr = class it {
|
|
|
330
348
|
* @returns {Interval}
|
|
331
349
|
*/
|
|
332
350
|
clone() {
|
|
333
|
-
return new
|
|
351
|
+
return new ke(this.low, this.high);
|
|
334
352
|
}
|
|
335
353
|
/**
|
|
336
354
|
* Propery max returns clone of this interval
|
|
@@ -377,7 +395,7 @@ const gr = class it {
|
|
|
377
395
|
* @returns {Interval}
|
|
378
396
|
*/
|
|
379
397
|
merge(t) {
|
|
380
|
-
return new
|
|
398
|
+
return new ke(
|
|
381
399
|
this.low === void 0 ? t.low : this.low < t.low ? this.low : t.low,
|
|
382
400
|
this.high === void 0 ? t.high : this.high > t.high ? this.high : t.high
|
|
383
401
|
);
|
|
@@ -406,17 +424,17 @@ const gr = class it {
|
|
|
406
424
|
static comparable_less_than(t, e) {
|
|
407
425
|
return t < e;
|
|
408
426
|
}
|
|
409
|
-
},
|
|
410
|
-
class
|
|
411
|
-
constructor(t = void 0, e = void 0, r = null,
|
|
412
|
-
if (this.left = r, this.right =
|
|
413
|
-
let [
|
|
414
|
-
|
|
427
|
+
}, T = 0, V = 1;
|
|
428
|
+
class G {
|
|
429
|
+
constructor(t = void 0, e = void 0, r = null, a = null, i = null, s = V) {
|
|
430
|
+
if (this.left = r, this.right = a, this.parent = i, this.color = s, this.item = { key: t, value: e }, t && t instanceof Array && t.length === 2 && !Number.isNaN(t[0]) && !Number.isNaN(t[1])) {
|
|
431
|
+
let [n, l] = t;
|
|
432
|
+
n > l && ([n, l] = [l, n]), this.item.key = new or(n, l);
|
|
415
433
|
}
|
|
416
434
|
this.max = this.item.key ? this.item.key.max : void 0;
|
|
417
435
|
}
|
|
418
436
|
isNil() {
|
|
419
|
-
return this.item.key === void 0 && this.item.value === void 0 && this.left === null && this.right === null && this.color ===
|
|
437
|
+
return this.item.key === void 0 && this.item.value === void 0 && this.left === null && this.right === null && this.color === V;
|
|
420
438
|
}
|
|
421
439
|
_value_less_than(t) {
|
|
422
440
|
return this.item.value && t.item.value && this.item.value.less_than ? this.item.value.less_than(t.item.value) : this.item.value < t.item.value;
|
|
@@ -459,12 +477,12 @@ class _e {
|
|
|
459
477
|
return e(t.item.key.high, r);
|
|
460
478
|
}
|
|
461
479
|
}
|
|
462
|
-
class
|
|
480
|
+
class Xe {
|
|
463
481
|
/**
|
|
464
482
|
* Construct new empty instance of IntervalTree
|
|
465
483
|
*/
|
|
466
484
|
constructor() {
|
|
467
|
-
this.root = null, this.nil_node = new
|
|
485
|
+
this.root = null, this.nil_node = new G();
|
|
468
486
|
}
|
|
469
487
|
/**
|
|
470
488
|
* Returns number of items stored in the interval tree
|
|
@@ -524,7 +542,7 @@ class ct {
|
|
|
524
542
|
*/
|
|
525
543
|
insert(t, e = t) {
|
|
526
544
|
if (t === void 0) return;
|
|
527
|
-
let r = new
|
|
545
|
+
let r = new G(t, e, this.nil_node, this.nil_node, null, T);
|
|
528
546
|
return this.tree_insert(r), this.recalc_max(r), r;
|
|
529
547
|
}
|
|
530
548
|
/**
|
|
@@ -534,7 +552,7 @@ class ct {
|
|
|
534
552
|
* @returns {boolean} true if item {key, value} exist in the tree, false otherwise
|
|
535
553
|
*/
|
|
536
554
|
exist(t, e = t) {
|
|
537
|
-
let r = new
|
|
555
|
+
let r = new G(t, e);
|
|
538
556
|
return !!this.tree_search(this.root, r);
|
|
539
557
|
}
|
|
540
558
|
/**
|
|
@@ -544,8 +562,8 @@ class ct {
|
|
|
544
562
|
* @returns {boolean} true if item {key, value} deleted, false if not found
|
|
545
563
|
*/
|
|
546
564
|
remove(t, e = t) {
|
|
547
|
-
let r = new
|
|
548
|
-
return
|
|
565
|
+
let r = new G(t, e), a = this.tree_search(this.root, r);
|
|
566
|
+
return a && this.tree_delete(a), a;
|
|
549
567
|
}
|
|
550
568
|
/**
|
|
551
569
|
* Returns array of entry values which keys intersect with given interval <br/>
|
|
@@ -554,9 +572,9 @@ class ct {
|
|
|
554
572
|
* @param outputMapperFn(value,key) - optional function that maps (value, key) to custom output
|
|
555
573
|
* @returns {Array}
|
|
556
574
|
*/
|
|
557
|
-
search(t, e = (r,
|
|
558
|
-
let r = new
|
|
559
|
-
return this.tree_search_interval(this.root, r,
|
|
575
|
+
search(t, e = (r, a) => r === a ? a.output() : r) {
|
|
576
|
+
let r = new G(t), a = [];
|
|
577
|
+
return this.tree_search_interval(this.root, r, a), a.map((i) => e(i.item.value, i.item.key));
|
|
560
578
|
}
|
|
561
579
|
/**
|
|
562
580
|
* Returns true if intersection between given and any interval stored in the tree found
|
|
@@ -564,7 +582,7 @@ class ct {
|
|
|
564
582
|
* @returns {boolean}
|
|
565
583
|
*/
|
|
566
584
|
intersect_any(t) {
|
|
567
|
-
let e = new
|
|
585
|
+
let e = new G(t);
|
|
568
586
|
return this.tree_find_any_interval(this.root, e);
|
|
569
587
|
}
|
|
570
588
|
/**
|
|
@@ -580,7 +598,7 @@ class ct {
|
|
|
580
598
|
* @param callback(value,key) - function to be called for each tree item
|
|
581
599
|
*/
|
|
582
600
|
map(t) {
|
|
583
|
-
const e = new
|
|
601
|
+
const e = new Xe();
|
|
584
602
|
return this.tree_walk(this.root, (r) => e.insert(r.item.key, t(r.item.value, r.item.key))), e;
|
|
585
603
|
}
|
|
586
604
|
/**
|
|
@@ -588,9 +606,9 @@ class ct {
|
|
|
588
606
|
* @param outputMapperFn(value,key) - optional function that maps (value, key) to custom output
|
|
589
607
|
* @returns {Iterator}
|
|
590
608
|
*/
|
|
591
|
-
*iterate(t, e = (r,
|
|
609
|
+
*iterate(t, e = (r, a) => r === a ? a.output() : r) {
|
|
592
610
|
let r;
|
|
593
|
-
for (t ? r = this.tree_search_nearest_forward(this.root, new
|
|
611
|
+
for (t ? r = this.tree_search_nearest_forward(this.root, new G(t)) : this.root && (r = this.local_minimum(this.root)); r; )
|
|
594
612
|
yield e(r.item.value, r.item.key), r = this.tree_successor(r);
|
|
595
613
|
}
|
|
596
614
|
recalc_max(t) {
|
|
@@ -613,29 +631,29 @@ class ct {
|
|
|
613
631
|
// Go upwords to the root and re-color until violation will be resolved
|
|
614
632
|
insert_fixup(t) {
|
|
615
633
|
let e, r;
|
|
616
|
-
for (e = t; e !== this.root && e.parent.color ===
|
|
617
|
-
e.parent === e.parent.parent.left ? (r = e.parent.parent.right, r.color ===
|
|
618
|
-
this.root.color =
|
|
634
|
+
for (e = t; e !== this.root && e.parent.color === T; )
|
|
635
|
+
e.parent === e.parent.parent.left ? (r = e.parent.parent.right, r.color === T ? (e.parent.color = V, r.color = V, e.parent.parent.color = T, e = e.parent.parent) : (e === e.parent.right && (e = e.parent, this.rotate_left(e)), e.parent.color = V, e.parent.parent.color = T, this.rotate_right(e.parent.parent))) : (r = e.parent.parent.left, r.color === T ? (e.parent.color = V, r.color = V, e.parent.parent.color = T, e = e.parent.parent) : (e === e.parent.left && (e = e.parent, this.rotate_right(e)), e.parent.color = V, e.parent.parent.color = T, this.rotate_left(e.parent.parent)));
|
|
636
|
+
this.root.color = V;
|
|
619
637
|
}
|
|
620
638
|
tree_delete(t) {
|
|
621
639
|
let e, r;
|
|
622
640
|
t.left === this.nil_node || t.right === this.nil_node ? e = t : e = this.tree_successor(t), e.left !== this.nil_node ? r = e.left : r = e.right, r.parent = e.parent, e === this.root ? this.root = r : (e === e.parent.left ? e.parent.left = r : e.parent.right = r, e.parent.update_max()), this.recalc_max(r), e !== t && (t.copy_data(e), t.update_max(), this.recalc_max(t)), /*fix_node != this.nil_node && */
|
|
623
|
-
e.color ===
|
|
641
|
+
e.color === V && this.delete_fixup(r);
|
|
624
642
|
}
|
|
625
643
|
delete_fixup(t) {
|
|
626
644
|
let e = t, r;
|
|
627
|
-
for (; e !== this.root && e.parent != null && e.color ===
|
|
628
|
-
e === e.parent.left ? (r = e.parent.right, r.color ===
|
|
629
|
-
e.color =
|
|
645
|
+
for (; e !== this.root && e.parent != null && e.color === V; )
|
|
646
|
+
e === e.parent.left ? (r = e.parent.right, r.color === T && (r.color = V, e.parent.color = T, this.rotate_left(e.parent), r = e.parent.right), r.left.color === V && r.right.color === V ? (r.color = T, e = e.parent) : (r.right.color === V && (r.color = T, r.left.color = V, this.rotate_right(r), r = e.parent.right), r.color = e.parent.color, e.parent.color = V, r.right.color = V, this.rotate_left(e.parent), e = this.root)) : (r = e.parent.left, r.color === T && (r.color = V, e.parent.color = T, this.rotate_right(e.parent), r = e.parent.left), r.left.color === V && r.right.color === V ? (r.color = T, e = e.parent) : (r.left.color === V && (r.color = T, r.right.color = V, this.rotate_left(r), r = e.parent.left), r.color = e.parent.color, e.parent.color = V, r.left.color = V, this.rotate_right(e.parent), e = this.root));
|
|
647
|
+
e.color = V;
|
|
630
648
|
}
|
|
631
649
|
tree_search(t, e) {
|
|
632
650
|
if (!(t == null || t === this.nil_node))
|
|
633
651
|
return e.equal_to(t) ? t : e.less_than(t) ? this.tree_search(t.left, e) : this.tree_search(t.right, e);
|
|
634
652
|
}
|
|
635
653
|
tree_search_nearest_forward(t, e) {
|
|
636
|
-
let r,
|
|
637
|
-
for (;
|
|
638
|
-
|
|
654
|
+
let r, a = t;
|
|
655
|
+
for (; a && a !== this.nil_node; )
|
|
656
|
+
a.less_than(e) ? a.intersect(e) ? (r = a, a = a.left) : a = a.right : ((!r || a.less_than(r)) && (r = a), a = a.left);
|
|
639
657
|
return r || null;
|
|
640
658
|
}
|
|
641
659
|
// Original search_interval method; container res support push() insertion
|
|
@@ -661,13 +679,13 @@ class ct {
|
|
|
661
679
|
return e;
|
|
662
680
|
}
|
|
663
681
|
tree_successor(t) {
|
|
664
|
-
let e, r,
|
|
682
|
+
let e, r, a;
|
|
665
683
|
if (t.right !== this.nil_node)
|
|
666
684
|
e = this.local_minimum(t.right);
|
|
667
685
|
else {
|
|
668
|
-
for (r = t,
|
|
669
|
-
r =
|
|
670
|
-
e =
|
|
686
|
+
for (r = t, a = t.parent; a != null && a.right === r; )
|
|
687
|
+
r = a, a = a.parent;
|
|
688
|
+
e = a;
|
|
671
689
|
}
|
|
672
690
|
return e;
|
|
673
691
|
}
|
|
@@ -692,69 +710,69 @@ class ct {
|
|
|
692
710
|
testRedBlackProperty() {
|
|
693
711
|
let t = !0;
|
|
694
712
|
return this.tree_walk(this.root, function(e) {
|
|
695
|
-
e.color ===
|
|
713
|
+
e.color === T && (e.left.color === V && e.right.color === V || (t = !1));
|
|
696
714
|
}), t;
|
|
697
715
|
}
|
|
698
716
|
/* Throw error if not every path from root to bottom has same black height */
|
|
699
717
|
testBlackHeightProperty(t) {
|
|
700
|
-
let e = 0, r = 0,
|
|
701
|
-
if (t.color ===
|
|
718
|
+
let e = 0, r = 0, a = 0;
|
|
719
|
+
if (t.color === V && e++, t.left !== this.nil_node ? r = this.testBlackHeightProperty(t.left) : r = 1, t.right !== this.nil_node ? a = this.testBlackHeightProperty(t.right) : a = 1, r !== a)
|
|
702
720
|
throw new Error("Red-black height property violated");
|
|
703
721
|
return e += r, e;
|
|
704
722
|
}
|
|
705
723
|
}
|
|
706
|
-
class
|
|
707
|
-
constructor(t, e, r,
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
724
|
+
class Ke {
|
|
725
|
+
constructor(t, e, r, a, i = !1) {
|
|
726
|
+
f(this, "_map");
|
|
727
|
+
f(this, "_tree", /* @__PURE__ */ new Map());
|
|
728
|
+
f(this, "_dirty", !0);
|
|
729
|
+
f(this, "_buildTree", () => {
|
|
712
730
|
if (!this._dirty || this._disableTree)
|
|
713
731
|
return;
|
|
714
732
|
const t = /* @__PURE__ */ new Map();
|
|
715
|
-
this._map.forEach((r,
|
|
716
|
-
r.forEach((
|
|
717
|
-
for (let
|
|
718
|
-
let
|
|
719
|
-
|
|
720
|
-
startRow:
|
|
721
|
-
endRow:
|
|
722
|
-
ruleId:
|
|
733
|
+
this._map.forEach((r, a) => {
|
|
734
|
+
r.forEach((i) => {
|
|
735
|
+
for (let s = i.startColumn; s <= i.endColumn; s++) {
|
|
736
|
+
let n = t.get(s);
|
|
737
|
+
n || (n = [], t.set(s, n)), n.push({
|
|
738
|
+
startRow: i.startRow,
|
|
739
|
+
endRow: i.endRow,
|
|
740
|
+
ruleId: a
|
|
723
741
|
});
|
|
724
742
|
}
|
|
725
743
|
});
|
|
726
744
|
});
|
|
727
745
|
const e = /* @__PURE__ */ new Map();
|
|
728
|
-
t.forEach((r,
|
|
729
|
-
const
|
|
730
|
-
r.forEach((
|
|
731
|
-
|
|
732
|
-
}), e.set(
|
|
746
|
+
t.forEach((r, a) => {
|
|
747
|
+
const i = new Xe();
|
|
748
|
+
r.forEach((s) => {
|
|
749
|
+
i.insert([s.startRow, s.endRow], s.ruleId);
|
|
750
|
+
}), e.set(a, i);
|
|
733
751
|
}), this._tree = e, this._dirty = !1;
|
|
734
752
|
});
|
|
735
|
-
|
|
736
|
-
this._unitId = e, this._subUnitId = r, this._univerInstanceService =
|
|
753
|
+
f(this, "_debonceBuildTree", Mt(this._buildTree, 0));
|
|
754
|
+
this._unitId = e, this._subUnitId = r, this._univerInstanceService = a, this._disableTree = i, this._map = t, this._buildTree();
|
|
737
755
|
}
|
|
738
756
|
get _worksheet() {
|
|
739
757
|
var t;
|
|
740
|
-
return (t = this._univerInstanceService.getUnit(this._unitId,
|
|
758
|
+
return (t = this._univerInstanceService.getUnit(this._unitId, A.UNIVER_SHEET)) == null ? void 0 : t.getSheetBySheetId(this._subUnitId);
|
|
741
759
|
}
|
|
742
760
|
addRule(t) {
|
|
743
761
|
if (!this._worksheet)
|
|
744
762
|
return;
|
|
745
|
-
const e = t.uid, r = t.ranges.map((
|
|
746
|
-
this._map.forEach((
|
|
747
|
-
const
|
|
748
|
-
|
|
763
|
+
const e = t.uid, r = t.ranges.map((a) => I.transformRange(a, this._worksheet));
|
|
764
|
+
this._map.forEach((a, i) => {
|
|
765
|
+
const s = B.subtractMulti(a, r);
|
|
766
|
+
s.length === 0 ? this._map.delete(i) : this._map.set(i, s);
|
|
749
767
|
}), this._dirty = !0, this._map.set(e, r), this._debonceBuildTree();
|
|
750
768
|
}
|
|
751
769
|
removeRange(t) {
|
|
752
770
|
if (!this._worksheet)
|
|
753
771
|
return;
|
|
754
|
-
const e = t.map((r) =>
|
|
755
|
-
this._map.forEach((r,
|
|
756
|
-
const
|
|
757
|
-
|
|
772
|
+
const e = t.map((r) => I.transformRange(r, this._worksheet));
|
|
773
|
+
this._map.forEach((r, a) => {
|
|
774
|
+
const i = B.subtractMulti(r, e);
|
|
775
|
+
i.length === 0 ? this._map.delete(a) : this._map.set(a, i);
|
|
758
776
|
}), this._dirty = !0, this._debonceBuildTree();
|
|
759
777
|
}
|
|
760
778
|
removeRule(t) {
|
|
@@ -764,76 +782,76 @@ class dt {
|
|
|
764
782
|
if (!this._worksheet)
|
|
765
783
|
return;
|
|
766
784
|
this._map.delete(t);
|
|
767
|
-
const r = e.map((
|
|
768
|
-
this._map.forEach((
|
|
769
|
-
const
|
|
770
|
-
|
|
785
|
+
const r = e.map((a) => I.transformRange(a, this._worksheet));
|
|
786
|
+
this._map.forEach((a, i) => {
|
|
787
|
+
const s = B.subtractMulti(a, r);
|
|
788
|
+
s.length === 0 ? this._map.delete(i) : this._map.set(i, s);
|
|
771
789
|
}), this._map.set(t, r), this._dirty = !0, this._debonceBuildTree();
|
|
772
790
|
}
|
|
773
791
|
addRangeRules(t) {
|
|
774
792
|
t.forEach(({ id: e, ranges: r }) => {
|
|
775
793
|
if (!r.length)
|
|
776
794
|
return;
|
|
777
|
-
let
|
|
778
|
-
|
|
779
|
-
if (
|
|
795
|
+
let a = this._map.get(e);
|
|
796
|
+
a ? (this._map.set(e, B.mergeRanges([...a, ...r])), a = this._map.get(e)) : (a = r, this._map.set(e, a)), this._map.forEach((i, s) => {
|
|
797
|
+
if (s === e)
|
|
780
798
|
return;
|
|
781
|
-
const
|
|
782
|
-
|
|
799
|
+
const n = B.subtractMulti(i, r);
|
|
800
|
+
n.length === 0 ? this._map.delete(s) : this._map.set(s, n);
|
|
783
801
|
});
|
|
784
802
|
}), this._dirty = !0, this._debonceBuildTree();
|
|
785
803
|
}
|
|
786
804
|
diff(t) {
|
|
787
805
|
const e = [];
|
|
788
806
|
let r = 0;
|
|
789
|
-
return t.forEach((
|
|
807
|
+
return t.forEach((a, i) => {
|
|
790
808
|
var l;
|
|
791
|
-
const
|
|
792
|
-
|
|
809
|
+
const s = (l = this._map.get(a.uid)) != null ? l : [], n = a.ranges;
|
|
810
|
+
s.length !== 0 && (s.length !== n.length || s.some((u, c) => !B.equals(u, n[c]))) && e.push({
|
|
793
811
|
type: "update",
|
|
794
|
-
ruleId:
|
|
795
|
-
oldRanges:
|
|
796
|
-
newRanges:
|
|
797
|
-
rule:
|
|
798
|
-
}),
|
|
812
|
+
ruleId: a.uid,
|
|
813
|
+
oldRanges: n,
|
|
814
|
+
newRanges: B.sort(s),
|
|
815
|
+
rule: a
|
|
816
|
+
}), s.length === 0 && (e.push({
|
|
799
817
|
type: "delete",
|
|
800
|
-
rule:
|
|
801
|
-
index:
|
|
818
|
+
rule: a,
|
|
819
|
+
index: i - r
|
|
802
820
|
}), r++);
|
|
803
821
|
}), e;
|
|
804
822
|
}
|
|
805
823
|
diffWithAddition(t, e) {
|
|
806
824
|
const r = [];
|
|
807
|
-
let
|
|
808
|
-
return t.forEach((
|
|
825
|
+
let a = 0;
|
|
826
|
+
return t.forEach((i, s) => {
|
|
809
827
|
var u;
|
|
810
|
-
const
|
|
811
|
-
|
|
828
|
+
const n = (u = this._map.get(i.uid)) != null ? u : [], l = i.ranges;
|
|
829
|
+
n.length !== 0 && (n.length !== l.length || n.some((c, d) => !B.equals(c, l[d]))) && r.push({
|
|
812
830
|
type: "update",
|
|
813
|
-
ruleId:
|
|
831
|
+
ruleId: i.uid,
|
|
814
832
|
oldRanges: l,
|
|
815
|
-
newRanges:
|
|
816
|
-
rule:
|
|
817
|
-
}),
|
|
833
|
+
newRanges: B.sort(n),
|
|
834
|
+
rule: i
|
|
835
|
+
}), n.length === 0 && (r.push({
|
|
818
836
|
type: "delete",
|
|
819
|
-
rule:
|
|
820
|
-
index:
|
|
821
|
-
}),
|
|
822
|
-
}), Array.from(e).forEach((
|
|
823
|
-
var
|
|
824
|
-
const
|
|
837
|
+
rule: i,
|
|
838
|
+
index: s - a
|
|
839
|
+
}), a++);
|
|
840
|
+
}), Array.from(e).forEach((i) => {
|
|
841
|
+
var n;
|
|
842
|
+
const s = (n = this._map.get(i.uid)) != null ? n : [];
|
|
825
843
|
r.push({
|
|
826
844
|
type: "add",
|
|
827
845
|
rule: {
|
|
828
|
-
...
|
|
829
|
-
ranges:
|
|
846
|
+
...i,
|
|
847
|
+
ranges: B.sort(s)
|
|
830
848
|
}
|
|
831
849
|
});
|
|
832
850
|
}), r;
|
|
833
851
|
}
|
|
834
852
|
clone() {
|
|
835
|
-
return new
|
|
836
|
-
new Map(
|
|
853
|
+
return new Ke(
|
|
854
|
+
new Map(N.deepClone(Array.from(this._map.entries()))),
|
|
837
855
|
this._unitId,
|
|
838
856
|
this._subUnitId,
|
|
839
857
|
this._univerInstanceService,
|
|
@@ -846,24 +864,24 @@ class dt {
|
|
|
846
864
|
const r = this._tree.get(e);
|
|
847
865
|
if (!r)
|
|
848
866
|
return;
|
|
849
|
-
const
|
|
850
|
-
return
|
|
867
|
+
const a = r.search([t, t]);
|
|
868
|
+
return a.length > 0 ? a[0] : void 0;
|
|
851
869
|
}
|
|
852
870
|
}
|
|
853
|
-
var
|
|
854
|
-
for (var
|
|
855
|
-
(
|
|
856
|
-
return r &&
|
|
857
|
-
},
|
|
858
|
-
let
|
|
859
|
-
constructor(t, e, r, i,
|
|
871
|
+
var nr = Object.defineProperty, lr = Object.getOwnPropertyDescriptor, ur = (o, t, e, r) => {
|
|
872
|
+
for (var a = r > 1 ? void 0 : r ? lr(t, e) : t, i = o.length - 1, s; i >= 0; i--)
|
|
873
|
+
(s = o[i]) && (a = (r ? s(t, e, a) : s(a)) || a);
|
|
874
|
+
return r && a && nr(t, e, a), a;
|
|
875
|
+
}, Q = (o, t) => (e, r) => t(e, r, o);
|
|
876
|
+
let F = class extends W {
|
|
877
|
+
constructor(t, e, r, a, i, s, n) {
|
|
860
878
|
super();
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
this._dataValidationModel = t, this._univerInstanceService = e, this._dataValidatorRegistryService = r, this._dataValidationCacheService =
|
|
879
|
+
f(this, "_ruleMatrixMap", /* @__PURE__ */ new Map());
|
|
880
|
+
f(this, "_validStatusChange$", new We());
|
|
881
|
+
f(this, "_ruleChange$", new We());
|
|
882
|
+
f(this, "ruleChange$", this._ruleChange$.asObservable());
|
|
883
|
+
f(this, "validStatusChange$", this._validStatusChange$.asObservable());
|
|
884
|
+
this._dataValidationModel = t, this._univerInstanceService = e, this._dataValidatorRegistryService = r, this._dataValidationCacheService = a, this._dataValidationFormulaService = i, this._dataValidationCustomFormulaService = s, this._commandService = n, this._initRuleUpdateListener(), this.disposeWithMe(() => {
|
|
867
885
|
this._ruleChange$.complete(), this._validStatusChange$.complete();
|
|
868
886
|
}), this._initUniverInstanceListener();
|
|
869
887
|
}
|
|
@@ -874,9 +892,9 @@ let j = class extends ce {
|
|
|
874
892
|
})
|
|
875
893
|
), this.disposeWithMe(
|
|
876
894
|
this._commandService.onCommandExecuted((t) => {
|
|
877
|
-
if (t.id ===
|
|
878
|
-
const { unitId: e, subUnitId: r } = t.params,
|
|
879
|
-
|
|
895
|
+
if (t.id === Pt.id) {
|
|
896
|
+
const { unitId: e, subUnitId: r } = t.params, a = this._ruleMatrixMap.get(e);
|
|
897
|
+
a && a.delete(r);
|
|
880
898
|
}
|
|
881
899
|
})
|
|
882
900
|
);
|
|
@@ -884,13 +902,13 @@ let j = class extends ce {
|
|
|
884
902
|
_initRuleUpdateListener() {
|
|
885
903
|
const t = this._dataValidationModel.getAll();
|
|
886
904
|
for (const [e, r] of t)
|
|
887
|
-
for (const [
|
|
888
|
-
for (const
|
|
889
|
-
this._addRule(e,
|
|
905
|
+
for (const [a, i] of r)
|
|
906
|
+
for (const s of i)
|
|
907
|
+
this._addRule(e, a, s), this._ruleChange$.next({
|
|
890
908
|
type: "add",
|
|
891
909
|
unitId: e,
|
|
892
|
-
subUnitId:
|
|
893
|
-
rule:
|
|
910
|
+
subUnitId: a,
|
|
911
|
+
rule: s,
|
|
894
912
|
source: "patched"
|
|
895
913
|
});
|
|
896
914
|
this.disposeWithMe(
|
|
@@ -913,97 +931,84 @@ let j = class extends ce {
|
|
|
913
931
|
_ensureRuleMatrix(t, e) {
|
|
914
932
|
let r = this._ruleMatrixMap.get(t);
|
|
915
933
|
r || (r = /* @__PURE__ */ new Map(), this._ruleMatrixMap.set(t, r));
|
|
916
|
-
let
|
|
917
|
-
return
|
|
934
|
+
let a = r.get(e);
|
|
935
|
+
return a || (a = new Ke(/* @__PURE__ */ new Map(), t, e, this._univerInstanceService), r.set(e, a)), a;
|
|
918
936
|
}
|
|
919
937
|
_addRuleSideEffect(t, e, r) {
|
|
920
|
-
this._ensureRuleMatrix(t, e).addRule(r), this._dataValidationCacheService.addRule(t, e, r), this._dataValidationFormulaService.addRule(t, e, r
|
|
938
|
+
this._ensureRuleMatrix(t, e).addRule(r), this._dataValidationCacheService.addRule(t, e, r), this._dataValidationFormulaService.addRule(t, e, r), this._dataValidationCustomFormulaService.addRule(t, e, r);
|
|
921
939
|
}
|
|
922
940
|
_addRule(t, e, r) {
|
|
923
|
-
(Array.isArray(r) ? r : [r]).forEach((
|
|
924
|
-
this._addRuleSideEffect(t, e,
|
|
941
|
+
(Array.isArray(r) ? r : [r]).forEach((i) => {
|
|
942
|
+
this._addRuleSideEffect(t, e, i);
|
|
925
943
|
});
|
|
926
944
|
}
|
|
927
|
-
_updateRule(t, e, r,
|
|
928
|
-
const
|
|
929
|
-
|
|
930
|
-
...i
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
...i,
|
|
934
|
-
...a.payload
|
|
935
|
-
})) : a.payload.type === $.CUSTOM && this._dataValidationCustomFormulaService.addRule(t, e, {
|
|
936
|
-
...i,
|
|
937
|
-
...a.payload
|
|
938
|
-
}));
|
|
945
|
+
_updateRule(t, e, r, a, i) {
|
|
946
|
+
const s = this._ensureRuleMatrix(t, e), n = {
|
|
947
|
+
...a,
|
|
948
|
+
...i.payload
|
|
949
|
+
};
|
|
950
|
+
i.type === w.RANGE ? (s.updateRange(r, i.payload), this._dataValidationCacheService.updateRuleRanges(t, e, r, i.payload, a.ranges)) : i.type === w.SETTING ? this._dataValidationCacheService.markRangeDirty(t, e, a.ranges) : i.type === w.ALL && (s.updateRange(r, i.payload.ranges), this._dataValidationCacheService.updateRuleRanges(t, e, r, i.payload.ranges, a.ranges), this._dataValidationCacheService.markRangeDirty(t, e, a.ranges)), this._dataValidationFormulaService.removeRule(t, e, a.uid), this._dataValidationFormulaService.addRule(t, e, n), this._dataValidationCustomFormulaService.deleteByRuleId(t, e, r), this._dataValidationCustomFormulaService.addRule(t, e, n);
|
|
939
951
|
}
|
|
940
952
|
_removeRule(t, e, r) {
|
|
941
|
-
this._ensureRuleMatrix(t, e).removeRule(r), this._dataValidationCacheService.removeRule(t, e, r),
|
|
953
|
+
this._ensureRuleMatrix(t, e).removeRule(r), this._dataValidationCacheService.removeRule(t, e, r), this._dataValidationCustomFormulaService.deleteByRuleId(t, e, r.uid);
|
|
942
954
|
}
|
|
943
955
|
getValidator(t) {
|
|
944
956
|
return this._dataValidatorRegistryService.getValidatorItem(t);
|
|
945
957
|
}
|
|
946
|
-
getRuleIdByLocation(t, e, r,
|
|
947
|
-
return this._ensureRuleMatrix(t, e).getValue(r,
|
|
958
|
+
getRuleIdByLocation(t, e, r, a) {
|
|
959
|
+
return this._ensureRuleMatrix(t, e).getValue(r, a);
|
|
948
960
|
}
|
|
949
|
-
getRuleByLocation(t, e, r,
|
|
950
|
-
const
|
|
951
|
-
if (
|
|
952
|
-
return this._dataValidationModel.getRuleById(t, e,
|
|
961
|
+
getRuleByLocation(t, e, r, a) {
|
|
962
|
+
const i = this.getRuleIdByLocation(t, e, r, a);
|
|
963
|
+
if (i)
|
|
964
|
+
return this._dataValidationModel.getRuleById(t, e, i);
|
|
953
965
|
}
|
|
954
966
|
validator(t, e, r) {
|
|
955
|
-
const { col:
|
|
956
|
-
r && r(
|
|
957
|
-
unitId:
|
|
958
|
-
subUnitId:
|
|
967
|
+
const { col: a, row: i, unitId: s, subUnitId: n, worksheet: l } = e, u = t.uid, c = t.formula1, d = t.formula2, m = (C, E) => {
|
|
968
|
+
r && r(C, E), E && this._validStatusChange$.next({
|
|
969
|
+
unitId: s,
|
|
970
|
+
subUnitId: n,
|
|
959
971
|
ruleId: t.uid,
|
|
960
|
-
status:
|
|
961
|
-
row:
|
|
962
|
-
col:
|
|
972
|
+
status: C,
|
|
973
|
+
row: i,
|
|
974
|
+
col: a
|
|
963
975
|
});
|
|
964
|
-
},
|
|
965
|
-
if (
|
|
966
|
-
const
|
|
967
|
-
return !
|
|
968
|
-
value:
|
|
969
|
-
interceptValue:
|
|
970
|
-
status:
|
|
976
|
+
}, _ = l.getCellValueOnly(i, a), p = this.getValidator(t.type), S = l.getCellRaw(i, a), y = ae(S), g = ae(_);
|
|
977
|
+
if (p) {
|
|
978
|
+
const C = this._dataValidationCacheService.ensureCache(s, n), E = C.getValue(i, a);
|
|
979
|
+
return !E || E.value !== y || E.interceptValue !== g || E.ruleId !== u || E.formula1 !== c || E.formula2 !== d ? (C.setValue(i, a, {
|
|
980
|
+
value: y,
|
|
981
|
+
interceptValue: g,
|
|
982
|
+
status: Y.VALIDATING,
|
|
971
983
|
ruleId: u,
|
|
972
984
|
formula1: c || "",
|
|
973
985
|
formula2: d || ""
|
|
974
|
-
}),
|
|
986
|
+
}), p.validator(
|
|
975
987
|
{
|
|
976
|
-
value:
|
|
977
|
-
unitId:
|
|
978
|
-
subUnitId:
|
|
979
|
-
row:
|
|
980
|
-
column:
|
|
988
|
+
value: y,
|
|
989
|
+
unitId: s,
|
|
990
|
+
subUnitId: n,
|
|
991
|
+
row: i,
|
|
992
|
+
column: a,
|
|
981
993
|
worksheet: e.worksheet,
|
|
982
994
|
workbook: e.workbook,
|
|
983
|
-
interceptValue:
|
|
984
|
-
t:
|
|
995
|
+
interceptValue: ae(_),
|
|
996
|
+
t: S == null ? void 0 : S.t
|
|
985
997
|
},
|
|
986
998
|
t
|
|
987
|
-
).then((
|
|
988
|
-
const L =
|
|
989
|
-
|
|
990
|
-
value:
|
|
999
|
+
).then((x) => {
|
|
1000
|
+
const L = x ? Y.VALID : Y.INVALID;
|
|
1001
|
+
C.setValue(i, a, {
|
|
1002
|
+
value: y,
|
|
991
1003
|
status: L,
|
|
992
1004
|
ruleId: u,
|
|
993
|
-
interceptValue:
|
|
1005
|
+
interceptValue: g,
|
|
994
1006
|
formula1: c || "",
|
|
995
1007
|
formula2: d || ""
|
|
996
1008
|
}), m(L, !0);
|
|
997
|
-
}),
|
|
1009
|
+
}), Y.VALIDATING) : (m(E.status, !1), E.status);
|
|
998
1010
|
} else
|
|
999
|
-
return m(
|
|
1000
|
-
}
|
|
1001
|
-
getRuleErrorMsg(t, e, r) {
|
|
1002
|
-
const i = this._dataValidationModel.getRuleById(t, e, r);
|
|
1003
|
-
if (!i)
|
|
1004
|
-
return "";
|
|
1005
|
-
const a = this._dataValidatorRegistryService.getValidatorItem(i.type);
|
|
1006
|
-
return i.error ? i.error : a ? a.getRuleFinalError(i) : "";
|
|
1011
|
+
return m(Y.VALID, !1), Y.VALID;
|
|
1007
1012
|
}
|
|
1008
1013
|
getRuleObjectMatrix(t, e) {
|
|
1009
1014
|
return this._ensureRuleMatrix(t, e);
|
|
@@ -1030,58 +1035,58 @@ let j = class extends ce {
|
|
|
1030
1035
|
return this._dataValidationModel.getAll();
|
|
1031
1036
|
}
|
|
1032
1037
|
};
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
],
|
|
1042
|
-
const
|
|
1043
|
-
function
|
|
1044
|
-
return
|
|
1038
|
+
F = ur([
|
|
1039
|
+
Q(0, v(Ge)),
|
|
1040
|
+
Q(1, D),
|
|
1041
|
+
Q(2, v(Qe)),
|
|
1042
|
+
Q(3, v(j)),
|
|
1043
|
+
Q(4, v(X)),
|
|
1044
|
+
Q(5, v($)),
|
|
1045
|
+
Q(6, H)
|
|
1046
|
+
], F);
|
|
1047
|
+
const Se = 1, Ve = 0;
|
|
1048
|
+
function rt(o, t) {
|
|
1049
|
+
return N.isBlank(o) ? t.t("dataValidation.validFail.value") : R(o) ? t.t("dataValidation.validFail.primitive") : "";
|
|
1045
1050
|
}
|
|
1046
|
-
const
|
|
1047
|
-
class
|
|
1051
|
+
const _e = (o) => N.isDefine(o) && String(o).toLowerCase() === "true" ? "1" : String(o).toLowerCase() === "false" ? "0" : o;
|
|
1052
|
+
class cr extends q {
|
|
1048
1053
|
constructor() {
|
|
1049
1054
|
super(...arguments);
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
const { unitId:
|
|
1057
|
-
return !u || u === `${
|
|
1055
|
+
f(this, "id", M.CHECKBOX);
|
|
1056
|
+
f(this, "title", "dataValidation.checkbox.title");
|
|
1057
|
+
f(this, "operators", []);
|
|
1058
|
+
f(this, "scopes", ["sheet"]);
|
|
1059
|
+
f(this, "_formulaService", this.injector.get(X));
|
|
1060
|
+
f(this, "skipDefaultFontRender", (e, r, a) => {
|
|
1061
|
+
const { unitId: i, subUnitId: s } = a, { formula1: n, formula2: l } = this.parseFormulaSync(e, i, s), u = `${r != null ? r : ""}`;
|
|
1062
|
+
return !u || u === `${n}` || u === `${l}`;
|
|
1058
1063
|
});
|
|
1059
1064
|
}
|
|
1060
|
-
validatorFormula(e, r,
|
|
1061
|
-
const { formula1:
|
|
1062
|
-
if (
|
|
1065
|
+
validatorFormula(e, r, a) {
|
|
1066
|
+
const { formula1: i, formula2: s } = e, n = i === s;
|
|
1067
|
+
if (N.isBlank(i) && N.isBlank(s))
|
|
1063
1068
|
return {
|
|
1064
1069
|
success: !0
|
|
1065
1070
|
};
|
|
1066
|
-
if (
|
|
1071
|
+
if (n)
|
|
1067
1072
|
return {
|
|
1068
1073
|
success: !1,
|
|
1069
1074
|
formula1: this.localeService.t("dataValidation.validFail.checkboxEqual"),
|
|
1070
1075
|
formula2: this.localeService.t("dataValidation.validFail.checkboxEqual")
|
|
1071
1076
|
};
|
|
1072
|
-
const l =
|
|
1077
|
+
const l = rt(i, this.localeService), u = rt(s, this.localeService);
|
|
1073
1078
|
return {
|
|
1074
1079
|
success: !l && !u,
|
|
1075
1080
|
formula1: l,
|
|
1076
1081
|
formula2: u
|
|
1077
1082
|
};
|
|
1078
1083
|
}
|
|
1079
|
-
async parseFormula(e, r,
|
|
1080
|
-
var d, m,
|
|
1081
|
-
const { formula1:
|
|
1084
|
+
async parseFormula(e, r, a) {
|
|
1085
|
+
var d, m, _, p;
|
|
1086
|
+
const { formula1: i = Se, formula2: s = Ve } = e, n = await this._formulaService.getRuleFormulaResult(r, a, e.uid), l = R(i) ? ie((m = (d = n == null ? void 0 : n[0]) == null ? void 0 : d.result) == null ? void 0 : m[0][0]) : i, u = R(s) ? ie((p = (_ = n == null ? void 0 : n[1]) == null ? void 0 : _.result) == null ? void 0 : p[0][0]) : s, c = O(String(l)) && O(String(u));
|
|
1082
1087
|
return {
|
|
1083
|
-
formula1:
|
|
1084
|
-
formula2:
|
|
1088
|
+
formula1: _e(l),
|
|
1089
|
+
formula2: _e(u),
|
|
1085
1090
|
originFormula1: l,
|
|
1086
1091
|
originFormula2: u,
|
|
1087
1092
|
isFormulaValid: c
|
|
@@ -1089,700 +1094,439 @@ class yr extends de {
|
|
|
1089
1094
|
}
|
|
1090
1095
|
getExtraStyle(e, r) {
|
|
1091
1096
|
return {
|
|
1092
|
-
tb:
|
|
1097
|
+
tb: ve.CLIP
|
|
1093
1098
|
};
|
|
1094
1099
|
}
|
|
1095
|
-
parseFormulaSync(e, r,
|
|
1096
|
-
var d, m,
|
|
1097
|
-
const { formula1:
|
|
1100
|
+
parseFormulaSync(e, r, a) {
|
|
1101
|
+
var d, m, _, p;
|
|
1102
|
+
const { formula1: i = Se, formula2: s = Ve } = e, n = this._formulaService.getRuleFormulaResultSync(r, a, e.uid), l = R(i) ? ie((m = (d = n == null ? void 0 : n[0]) == null ? void 0 : d.result) == null ? void 0 : m[0][0]) : i, u = R(s) ? ie((p = (_ = n == null ? void 0 : n[1]) == null ? void 0 : _.result) == null ? void 0 : p[0][0]) : s, c = O(String(l)) && O(String(u));
|
|
1098
1103
|
return {
|
|
1099
|
-
formula1:
|
|
1100
|
-
formula2:
|
|
1104
|
+
formula1: _e(l),
|
|
1105
|
+
formula2: _e(u),
|
|
1101
1106
|
originFormula1: l,
|
|
1102
1107
|
originFormula2: u,
|
|
1103
1108
|
isFormulaValid: c
|
|
1104
1109
|
};
|
|
1105
1110
|
}
|
|
1106
|
-
async isValidType(e, r,
|
|
1107
|
-
const { value:
|
|
1108
|
-
return !
|
|
1111
|
+
async isValidType(e, r, a) {
|
|
1112
|
+
const { value: i, unitId: s, subUnitId: n } = e, { formula1: l, formula2: u, originFormula1: c, originFormula2: d } = await this.parseFormula(a, s, n);
|
|
1113
|
+
return !N.isDefine(l) || !N.isDefine(u) ? !0 : N.isDefine(i) && (String(i) === String(l) || String(i) === String(u) || String(i) === String(c != null ? c : "") || String(i) === String(d != null ? d : ""));
|
|
1109
1114
|
}
|
|
1110
1115
|
generateRuleErrorMessage(e) {
|
|
1111
1116
|
return this.localeService.t("dataValidation.checkbox.error");
|
|
1112
1117
|
}
|
|
1113
1118
|
}
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
var e = 1e3, r = 6e4, i = 36e5, a = "millisecond", n = "second", o = "minute", l = "hour", u = "day", c = "week", d = "month", m = "quarter", v = "year", S = "date", w = "Invalid Date", I = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, M = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, x = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(y) {
|
|
1124
|
-
var f = ["th", "st", "nd", "rd"], h = y % 100;
|
|
1125
|
-
return "[" + y + (f[(h - 20) % 10] || f[h] || f[0]) + "]";
|
|
1126
|
-
} }, O = function(y, f, h) {
|
|
1127
|
-
var R = String(y);
|
|
1128
|
-
return !R || R.length >= f ? y : "" + Array(f + 1 - R.length).join(h) + y;
|
|
1129
|
-
}, H = { s: O, z: function(y) {
|
|
1130
|
-
var f = -y.utcOffset(), h = Math.abs(f), R = Math.floor(h / 60), p = h % 60;
|
|
1131
|
-
return (f <= 0 ? "+" : "-") + O(R, 2, "0") + ":" + O(p, 2, "0");
|
|
1132
|
-
}, m: function y(f, h) {
|
|
1133
|
-
if (f.date() < h.date()) return -y(h, f);
|
|
1134
|
-
var R = 12 * (h.year() - f.year()) + (h.month() - f.month()), p = f.clone().add(R, d), N = h - p < 0, V = f.clone().add(R + (N ? -1 : 1), d);
|
|
1135
|
-
return +(-(R + (h - p) / (N ? p - V : V - p)) || 0);
|
|
1136
|
-
}, a: function(y) {
|
|
1137
|
-
return y < 0 ? Math.ceil(y) || 0 : Math.floor(y);
|
|
1138
|
-
}, p: function(y) {
|
|
1139
|
-
return { M: d, y: v, w: c, d: u, D: S, h: l, m: o, s: n, ms: a, Q: m }[y] || String(y || "").toLowerCase().replace(/s$/, "");
|
|
1140
|
-
}, u: function(y) {
|
|
1141
|
-
return y === void 0;
|
|
1142
|
-
} }, L = "en", q = {};
|
|
1143
|
-
q[L] = x;
|
|
1144
|
-
var se = "$isDayjsObject", he = function(y) {
|
|
1145
|
-
return y instanceof Re || !(!y || !y[se]);
|
|
1146
|
-
}, ae = function y(f, h, R) {
|
|
1147
|
-
var p;
|
|
1148
|
-
if (!f) return L;
|
|
1149
|
-
if (typeof f == "string") {
|
|
1150
|
-
var N = f.toLowerCase();
|
|
1151
|
-
q[N] && (p = N), h && (q[N] = h, p = N);
|
|
1152
|
-
var V = f.split("-");
|
|
1153
|
-
if (!p && V.length > 1) return y(V[0]);
|
|
1154
|
-
} else {
|
|
1155
|
-
var D = f.name;
|
|
1156
|
-
q[D] = f, p = D;
|
|
1157
|
-
}
|
|
1158
|
-
return !R && p && (L = p), p || !R && L;
|
|
1159
|
-
}, U = function(y, f) {
|
|
1160
|
-
if (he(y)) return y.clone();
|
|
1161
|
-
var h = typeof f == "object" ? f : {};
|
|
1162
|
-
return h.date = y, h.args = arguments, new Re(h);
|
|
1163
|
-
}, T = H;
|
|
1164
|
-
T.l = ae, T.i = he, T.w = function(y, f) {
|
|
1165
|
-
return U(y, { locale: f.$L, utc: f.$u, x: f.$x, $offset: f.$offset });
|
|
1166
|
-
};
|
|
1167
|
-
var Re = function() {
|
|
1168
|
-
function y(h) {
|
|
1169
|
-
this.$L = ae(h.locale, null, !0), this.parse(h), this.$x = this.$x || h.x || {}, this[se] = !0;
|
|
1170
|
-
}
|
|
1171
|
-
var f = y.prototype;
|
|
1172
|
-
return f.parse = function(h) {
|
|
1173
|
-
this.$d = function(R) {
|
|
1174
|
-
var p = R.date, N = R.utc;
|
|
1175
|
-
if (p === null) return /* @__PURE__ */ new Date(NaN);
|
|
1176
|
-
if (T.u(p)) return /* @__PURE__ */ new Date();
|
|
1177
|
-
if (p instanceof Date) return new Date(p);
|
|
1178
|
-
if (typeof p == "string" && !/Z$/i.test(p)) {
|
|
1179
|
-
var V = p.match(I);
|
|
1180
|
-
if (V) {
|
|
1181
|
-
var D = V[2] - 1 || 0, A = (V[7] || "0").substring(0, 3);
|
|
1182
|
-
return N ? new Date(Date.UTC(V[1], D, V[3] || 1, V[4] || 0, V[5] || 0, V[6] || 0, A)) : new Date(V[1], D, V[3] || 1, V[4] || 0, V[5] || 0, V[6] || 0, A);
|
|
1183
|
-
}
|
|
1184
|
-
}
|
|
1185
|
-
return new Date(p);
|
|
1186
|
-
}(h), this.init();
|
|
1187
|
-
}, f.init = function() {
|
|
1188
|
-
var h = this.$d;
|
|
1189
|
-
this.$y = h.getFullYear(), this.$M = h.getMonth(), this.$D = h.getDate(), this.$W = h.getDay(), this.$H = h.getHours(), this.$m = h.getMinutes(), this.$s = h.getSeconds(), this.$ms = h.getMilliseconds();
|
|
1190
|
-
}, f.$utils = function() {
|
|
1191
|
-
return T;
|
|
1192
|
-
}, f.isValid = function() {
|
|
1193
|
-
return this.$d.toString() !== w;
|
|
1194
|
-
}, f.isSame = function(h, R) {
|
|
1195
|
-
var p = U(h);
|
|
1196
|
-
return this.startOf(R) <= p && p <= this.endOf(R);
|
|
1197
|
-
}, f.isAfter = function(h, R) {
|
|
1198
|
-
return U(h) < this.startOf(R);
|
|
1199
|
-
}, f.isBefore = function(h, R) {
|
|
1200
|
-
return this.endOf(R) < U(h);
|
|
1201
|
-
}, f.$g = function(h, R, p) {
|
|
1202
|
-
return T.u(h) ? this[R] : this.set(p, h);
|
|
1203
|
-
}, f.unix = function() {
|
|
1204
|
-
return Math.floor(this.valueOf() / 1e3);
|
|
1205
|
-
}, f.valueOf = function() {
|
|
1206
|
-
return this.$d.getTime();
|
|
1207
|
-
}, f.startOf = function(h, R) {
|
|
1208
|
-
var p = this, N = !!T.u(R) || R, V = T.p(h), D = function(fe, G) {
|
|
1209
|
-
var ne = T.w(p.$u ? Date.UTC(p.$y, G, fe) : new Date(p.$y, G, fe), p);
|
|
1210
|
-
return N ? ne : ne.endOf(u);
|
|
1211
|
-
}, A = function(fe, G) {
|
|
1212
|
-
return T.w(p.toDate()[fe].apply(p.toDate("s"), (N ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(G)), p);
|
|
1213
|
-
}, B = this.$W, k = this.$M, J = this.$D, ye = "set" + (this.$u ? "UTC" : "");
|
|
1214
|
-
switch (V) {
|
|
1215
|
-
case v:
|
|
1216
|
-
return N ? D(1, 0) : D(31, 11);
|
|
1217
|
-
case d:
|
|
1218
|
-
return N ? D(1, k) : D(0, k + 1);
|
|
1219
|
-
case c:
|
|
1220
|
-
var me = this.$locale().weekStart || 0, Te = (B < me ? B + 7 : B) - me;
|
|
1221
|
-
return D(N ? J - Te : J + (6 - Te), k);
|
|
1222
|
-
case u:
|
|
1223
|
-
case S:
|
|
1224
|
-
return A(ye + "Hours", 0);
|
|
1225
|
-
case l:
|
|
1226
|
-
return A(ye + "Minutes", 1);
|
|
1227
|
-
case o:
|
|
1228
|
-
return A(ye + "Seconds", 2);
|
|
1229
|
-
case n:
|
|
1230
|
-
return A(ye + "Milliseconds", 3);
|
|
1231
|
-
default:
|
|
1232
|
-
return this.clone();
|
|
1233
|
-
}
|
|
1234
|
-
}, f.endOf = function(h) {
|
|
1235
|
-
return this.startOf(h, !1);
|
|
1236
|
-
}, f.$set = function(h, R) {
|
|
1237
|
-
var p, N = T.p(h), V = "set" + (this.$u ? "UTC" : ""), D = (p = {}, p[u] = V + "Date", p[S] = V + "Date", p[d] = V + "Month", p[v] = V + "FullYear", p[l] = V + "Hours", p[o] = V + "Minutes", p[n] = V + "Seconds", p[a] = V + "Milliseconds", p)[N], A = N === u ? this.$D + (R - this.$W) : R;
|
|
1238
|
-
if (N === d || N === v) {
|
|
1239
|
-
var B = this.clone().set(S, 1);
|
|
1240
|
-
B.$d[D](A), B.init(), this.$d = B.set(S, Math.min(this.$D, B.daysInMonth())).$d;
|
|
1241
|
-
} else D && this.$d[D](A);
|
|
1242
|
-
return this.init(), this;
|
|
1243
|
-
}, f.set = function(h, R) {
|
|
1244
|
-
return this.clone().$set(h, R);
|
|
1245
|
-
}, f.get = function(h) {
|
|
1246
|
-
return this[T.p(h)]();
|
|
1247
|
-
}, f.add = function(h, R) {
|
|
1248
|
-
var p, N = this;
|
|
1249
|
-
h = Number(h);
|
|
1250
|
-
var V = T.p(R), D = function(k) {
|
|
1251
|
-
var J = U(N);
|
|
1252
|
-
return T.w(J.date(J.date() + Math.round(k * h)), N);
|
|
1253
|
-
};
|
|
1254
|
-
if (V === d) return this.set(d, this.$M + h);
|
|
1255
|
-
if (V === v) return this.set(v, this.$y + h);
|
|
1256
|
-
if (V === u) return D(1);
|
|
1257
|
-
if (V === c) return D(7);
|
|
1258
|
-
var A = (p = {}, p[o] = r, p[l] = i, p[n] = e, p)[V] || 1, B = this.$d.getTime() + h * A;
|
|
1259
|
-
return T.w(B, this);
|
|
1260
|
-
}, f.subtract = function(h, R) {
|
|
1261
|
-
return this.add(-1 * h, R);
|
|
1262
|
-
}, f.format = function(h) {
|
|
1263
|
-
var R = this, p = this.$locale();
|
|
1264
|
-
if (!this.isValid()) return p.invalidDate || w;
|
|
1265
|
-
var N = h || "YYYY-MM-DDTHH:mm:ssZ", V = T.z(this), D = this.$H, A = this.$m, B = this.$M, k = p.weekdays, J = p.months, ye = p.meridiem, me = function(G, ne, Fe, be) {
|
|
1266
|
-
return G && (G[ne] || G(R, N)) || Fe[ne].slice(0, be);
|
|
1267
|
-
}, Te = function(G) {
|
|
1268
|
-
return T.s(D % 12 || 12, G, "0");
|
|
1269
|
-
}, fe = ye || function(G, ne, Fe) {
|
|
1270
|
-
var be = G < 12 ? "AM" : "PM";
|
|
1271
|
-
return Fe ? be.toLowerCase() : be;
|
|
1272
|
-
};
|
|
1273
|
-
return N.replace(M, function(G, ne) {
|
|
1274
|
-
return ne || function(Fe) {
|
|
1275
|
-
switch (Fe) {
|
|
1276
|
-
case "YY":
|
|
1277
|
-
return String(R.$y).slice(-2);
|
|
1278
|
-
case "YYYY":
|
|
1279
|
-
return T.s(R.$y, 4, "0");
|
|
1280
|
-
case "M":
|
|
1281
|
-
return B + 1;
|
|
1282
|
-
case "MM":
|
|
1283
|
-
return T.s(B + 1, 2, "0");
|
|
1284
|
-
case "MMM":
|
|
1285
|
-
return me(p.monthsShort, B, J, 3);
|
|
1286
|
-
case "MMMM":
|
|
1287
|
-
return me(J, B);
|
|
1288
|
-
case "D":
|
|
1289
|
-
return R.$D;
|
|
1290
|
-
case "DD":
|
|
1291
|
-
return T.s(R.$D, 2, "0");
|
|
1292
|
-
case "d":
|
|
1293
|
-
return String(R.$W);
|
|
1294
|
-
case "dd":
|
|
1295
|
-
return me(p.weekdaysMin, R.$W, k, 2);
|
|
1296
|
-
case "ddd":
|
|
1297
|
-
return me(p.weekdaysShort, R.$W, k, 3);
|
|
1298
|
-
case "dddd":
|
|
1299
|
-
return k[R.$W];
|
|
1300
|
-
case "H":
|
|
1301
|
-
return String(D);
|
|
1302
|
-
case "HH":
|
|
1303
|
-
return T.s(D, 2, "0");
|
|
1304
|
-
case "h":
|
|
1305
|
-
return Te(1);
|
|
1306
|
-
case "hh":
|
|
1307
|
-
return Te(2);
|
|
1308
|
-
case "a":
|
|
1309
|
-
return fe(D, A, !0);
|
|
1310
|
-
case "A":
|
|
1311
|
-
return fe(D, A, !1);
|
|
1312
|
-
case "m":
|
|
1313
|
-
return String(A);
|
|
1314
|
-
case "mm":
|
|
1315
|
-
return T.s(A, 2, "0");
|
|
1316
|
-
case "s":
|
|
1317
|
-
return String(R.$s);
|
|
1318
|
-
case "ss":
|
|
1319
|
-
return T.s(R.$s, 2, "0");
|
|
1320
|
-
case "SSS":
|
|
1321
|
-
return T.s(R.$ms, 3, "0");
|
|
1322
|
-
case "Z":
|
|
1323
|
-
return V;
|
|
1324
|
-
}
|
|
1325
|
-
return null;
|
|
1326
|
-
}(G) || V.replace(":", "");
|
|
1327
|
-
});
|
|
1328
|
-
}, f.utcOffset = function() {
|
|
1329
|
-
return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
|
|
1330
|
-
}, f.diff = function(h, R, p) {
|
|
1331
|
-
var N, V = this, D = T.p(R), A = U(h), B = (A.utcOffset() - this.utcOffset()) * r, k = this - A, J = function() {
|
|
1332
|
-
return T.m(V, A);
|
|
1333
|
-
};
|
|
1334
|
-
switch (D) {
|
|
1335
|
-
case v:
|
|
1336
|
-
N = J() / 12;
|
|
1337
|
-
break;
|
|
1338
|
-
case d:
|
|
1339
|
-
N = J();
|
|
1340
|
-
break;
|
|
1341
|
-
case m:
|
|
1342
|
-
N = J() / 3;
|
|
1343
|
-
break;
|
|
1344
|
-
case c:
|
|
1345
|
-
N = (k - B) / 6048e5;
|
|
1346
|
-
break;
|
|
1347
|
-
case u:
|
|
1348
|
-
N = (k - B) / 864e5;
|
|
1349
|
-
break;
|
|
1350
|
-
case l:
|
|
1351
|
-
N = k / i;
|
|
1352
|
-
break;
|
|
1353
|
-
case o:
|
|
1354
|
-
N = k / r;
|
|
1355
|
-
break;
|
|
1356
|
-
case n:
|
|
1357
|
-
N = k / e;
|
|
1358
|
-
break;
|
|
1359
|
-
default:
|
|
1360
|
-
N = k;
|
|
1361
|
-
}
|
|
1362
|
-
return p ? N : T.a(N);
|
|
1363
|
-
}, f.daysInMonth = function() {
|
|
1364
|
-
return this.endOf(d).$D;
|
|
1365
|
-
}, f.$locale = function() {
|
|
1366
|
-
return q[this.$L];
|
|
1367
|
-
}, f.locale = function(h, R) {
|
|
1368
|
-
if (!h) return this.$L;
|
|
1369
|
-
var p = this.clone(), N = ae(h, R, !0);
|
|
1370
|
-
return N && (p.$L = N), p;
|
|
1371
|
-
}, f.clone = function() {
|
|
1372
|
-
return T.w(this.$d, this);
|
|
1373
|
-
}, f.toDate = function() {
|
|
1374
|
-
return new Date(this.valueOf());
|
|
1375
|
-
}, f.toJSON = function() {
|
|
1376
|
-
return this.isValid() ? this.toISOString() : null;
|
|
1377
|
-
}, f.toISOString = function() {
|
|
1378
|
-
return this.$d.toISOString();
|
|
1379
|
-
}, f.toString = function() {
|
|
1380
|
-
return this.$d.toUTCString();
|
|
1381
|
-
}, y;
|
|
1382
|
-
}(), Oe = Re.prototype;
|
|
1383
|
-
return U.prototype = Oe, [["$ms", a], ["$s", n], ["$m", o], ["$H", l], ["$W", u], ["$M", d], ["$y", v], ["$D", S]].forEach(function(y) {
|
|
1384
|
-
Oe[y[1]] = function(f) {
|
|
1385
|
-
return this.$g(f, y[0], y[1]);
|
|
1386
|
-
};
|
|
1387
|
-
}), U.extend = function(y, f) {
|
|
1388
|
-
return y.$i || (y(f, Re, U), y.$i = !0), U;
|
|
1389
|
-
}, U.locale = ae, U.isDayjs = he, U.unix = function(y) {
|
|
1390
|
-
return U(1e3 * y);
|
|
1391
|
-
}, U.en = q[L], U.Ls = q, U.p = {}, U;
|
|
1392
|
-
});
|
|
1393
|
-
})(Vt);
|
|
1394
|
-
var Vr = Vt.exports;
|
|
1395
|
-
const wt = /* @__PURE__ */ Nr(Vr), wr = {
|
|
1396
|
-
[_.BETWEEN]: "dataValidation.date.operators.between",
|
|
1397
|
-
[_.EQUAL]: "dataValidation.date.operators.equal",
|
|
1398
|
-
[_.GREATER_THAN]: "dataValidation.date.operators.greaterThan",
|
|
1399
|
-
[_.GREATER_THAN_OR_EQUAL]: "dataValidation.date.operators.greaterThanOrEqual",
|
|
1400
|
-
[_.LESS_THAN]: "dataValidation.date.operators.lessThan",
|
|
1401
|
-
[_.LESS_THAN_OR_EQUAL]: "dataValidation.date.operators.lessThanOrEqual",
|
|
1402
|
-
[_.NOT_BETWEEN]: "dataValidation.date.operators.notBetween",
|
|
1403
|
-
[_.NOT_EQUAL]: "dataValidation.date.operators.notEqual"
|
|
1119
|
+
const dr = {
|
|
1120
|
+
[h.BETWEEN]: "dataValidation.date.operators.between",
|
|
1121
|
+
[h.EQUAL]: "dataValidation.date.operators.equal",
|
|
1122
|
+
[h.GREATER_THAN]: "dataValidation.date.operators.greaterThan",
|
|
1123
|
+
[h.GREATER_THAN_OR_EQUAL]: "dataValidation.date.operators.greaterThanOrEqual",
|
|
1124
|
+
[h.LESS_THAN]: "dataValidation.date.operators.lessThan",
|
|
1125
|
+
[h.LESS_THAN_OR_EQUAL]: "dataValidation.date.operators.lessThanOrEqual",
|
|
1126
|
+
[h.NOT_BETWEEN]: "dataValidation.date.operators.notBetween",
|
|
1127
|
+
[h.NOT_EQUAL]: "dataValidation.date.operators.notEqual"
|
|
1404
1128
|
};
|
|
1405
|
-
|
|
1406
|
-
const
|
|
1407
|
-
[
|
|
1408
|
-
[
|
|
1409
|
-
[
|
|
1410
|
-
[
|
|
1411
|
-
[
|
|
1412
|
-
[
|
|
1413
|
-
[
|
|
1414
|
-
[
|
|
1415
|
-
},
|
|
1416
|
-
[
|
|
1417
|
-
[
|
|
1418
|
-
[
|
|
1419
|
-
[
|
|
1420
|
-
[
|
|
1421
|
-
[
|
|
1422
|
-
[
|
|
1423
|
-
[
|
|
1424
|
-
},
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
],
|
|
1129
|
+
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 + "";
|
|
1130
|
+
const hr = {
|
|
1131
|
+
[h.BETWEEN]: "dataValidation.date.ruleName.between",
|
|
1132
|
+
[h.EQUAL]: "dataValidation.date.ruleName.equal",
|
|
1133
|
+
[h.GREATER_THAN]: "dataValidation.date.ruleName.greaterThan",
|
|
1134
|
+
[h.GREATER_THAN_OR_EQUAL]: "dataValidation.date.ruleName.greaterThanOrEqual",
|
|
1135
|
+
[h.LESS_THAN]: "dataValidation.date.ruleName.lessThan",
|
|
1136
|
+
[h.LESS_THAN_OR_EQUAL]: "dataValidation.date.ruleName.lessThanOrEqual",
|
|
1137
|
+
[h.NOT_BETWEEN]: "dataValidation.date.ruleName.notBetween",
|
|
1138
|
+
[h.NOT_EQUAL]: "dataValidation.date.ruleName.notEqual"
|
|
1139
|
+
}, mr = {
|
|
1140
|
+
[h.BETWEEN]: "dataValidation.date.errorMsg.between",
|
|
1141
|
+
[h.EQUAL]: "dataValidation.date.errorMsg.equal",
|
|
1142
|
+
[h.GREATER_THAN]: "dataValidation.date.errorMsg.greaterThan",
|
|
1143
|
+
[h.GREATER_THAN_OR_EQUAL]: "dataValidation.date.errorMsg.greaterThanOrEqual",
|
|
1144
|
+
[h.LESS_THAN]: "dataValidation.date.errorMsg.lessThan",
|
|
1145
|
+
[h.LESS_THAN_OR_EQUAL]: "dataValidation.date.errorMsg.lessThanOrEqual",
|
|
1146
|
+
[h.NOT_BETWEEN]: "dataValidation.date.errorMsg.notBetween",
|
|
1147
|
+
[h.NOT_EQUAL]: "dataValidation.date.errorMsg.notEqual"
|
|
1148
|
+
}, be = [
|
|
1149
|
+
h.BETWEEN,
|
|
1150
|
+
h.NOT_BETWEEN
|
|
1151
|
+
], oe = "{FORMULA1}", ne = "{FORMULA2}";
|
|
1152
|
+
function la(o) {
|
|
1153
|
+
return o.filter(Boolean).join(",");
|
|
1154
|
+
}
|
|
1155
|
+
function pe(o) {
|
|
1156
|
+
return o.split(",").filter(Boolean);
|
|
1157
|
+
}
|
|
1158
|
+
function ua(o) {
|
|
1159
|
+
const t = ae(o);
|
|
1160
|
+
return t == null ? "" : t.toString();
|
|
1161
|
+
}
|
|
1162
|
+
function Ie(o, t, e) {
|
|
1163
|
+
const { formula1: r, formula2: a } = t, i = t.ranges[0].startRow, s = t.ranges[0].startColumn, n = e.row - i, l = e.col - s, u = R(r) ? o.moveFormulaRefOffset(r, l, n, !0) : r, c = R(a) ? o.moveFormulaRefOffset(a, l, n, !0) : a;
|
|
1164
|
+
return {
|
|
1165
|
+
transformedFormula1: u,
|
|
1166
|
+
transformedFormula2: c
|
|
1167
|
+
};
|
|
1168
|
+
}
|
|
1169
|
+
const Be = (o) => {
|
|
1428
1170
|
var e, r;
|
|
1429
|
-
if (
|
|
1171
|
+
if (o == null || typeof o == "boolean")
|
|
1430
1172
|
return;
|
|
1431
|
-
if (typeof
|
|
1432
|
-
return +
|
|
1433
|
-
const t = (e =
|
|
1434
|
-
return
|
|
1173
|
+
if (typeof o == "number" || !Number.isNaN(+o))
|
|
1174
|
+
return +o;
|
|
1175
|
+
const t = (e = k.parseDate(o)) == null ? void 0 : e.v;
|
|
1176
|
+
return N.isDefine(t) ? t : (r = k.parseDate(it(o).format("YYYY-MM-DD HH:mm:ss"))) == null ? void 0 : r.v;
|
|
1435
1177
|
};
|
|
1436
|
-
class
|
|
1178
|
+
class fr extends q {
|
|
1437
1179
|
constructor() {
|
|
1438
1180
|
super(...arguments);
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1181
|
+
f(this, "id", M.DATE);
|
|
1182
|
+
f(this, "title", "dataValidation.date.title");
|
|
1183
|
+
f(this, "operators", [
|
|
1184
|
+
h.BETWEEN,
|
|
1185
|
+
h.EQUAL,
|
|
1186
|
+
h.GREATER_THAN,
|
|
1187
|
+
h.GREATER_THAN_OR_EQUAL,
|
|
1188
|
+
h.LESS_THAN,
|
|
1189
|
+
h.LESS_THAN_OR_EQUAL,
|
|
1190
|
+
h.NOT_BETWEEN,
|
|
1191
|
+
h.NOT_EQUAL
|
|
1450
1192
|
]);
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
async parseFormula(e, r, i) {
|
|
1455
|
-
var d, m, v, S;
|
|
1456
|
-
const a = await this._formulaService.getRuleFormulaResult(r, i, e.uid), { formula1: n, formula2: o } = e, l = z((m = (d = a == null ? void 0 : a[0]) == null ? void 0 : d.result) == null ? void 0 : m[0][0]), u = z((S = (v = a == null ? void 0 : a[1]) == null ? void 0 : v.result) == null ? void 0 : S[0][0]), c = W(String(l)) && W(String(u));
|
|
1457
|
-
return {
|
|
1458
|
-
formula1: Ee(F(n) ? l : n),
|
|
1459
|
-
formula2: Ee(F(o) ? u : o),
|
|
1460
|
-
isFormulaValid: c
|
|
1461
|
-
};
|
|
1193
|
+
f(this, "scopes", ["sheet"]);
|
|
1194
|
+
f(this, "_customFormulaService", this.injector.get($));
|
|
1195
|
+
f(this, "_lexerTreeBuilder", this.injector.get(Z));
|
|
1462
1196
|
}
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
const a = this._formulaService.getRuleFormulaResultSync(r, i, e.uid), { formula1: n, formula2: o } = e;
|
|
1197
|
+
async parseFormula(e, r, a, i, s) {
|
|
1198
|
+
const n = await this._customFormulaService.getCellFormulaValue(r, a, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(r, a, e.uid, i, s), { formula1: u, formula2: c } = e, d = O(String(n == null ? void 0 : n.v)) && O(String(l == null ? void 0 : l.v));
|
|
1466
1199
|
return {
|
|
1467
|
-
formula1:
|
|
1468
|
-
formula2:
|
|
1200
|
+
formula1: Be(R(u) ? n == null ? void 0 : n.v : u),
|
|
1201
|
+
formula2: Be(R(c) ? l == null ? void 0 : l.v : c),
|
|
1202
|
+
isFormulaValid: d
|
|
1469
1203
|
};
|
|
1470
1204
|
}
|
|
1471
1205
|
async isValidType(e) {
|
|
1472
|
-
const { interceptValue: r, value:
|
|
1473
|
-
return typeof
|
|
1206
|
+
const { interceptValue: r, value: a } = e;
|
|
1207
|
+
return typeof a == "number" && typeof r == "string" ? !0 : typeof r == "string" ? !!k.parseDate(r) : !1;
|
|
1474
1208
|
}
|
|
1475
1209
|
_validatorSingleFormula(e) {
|
|
1476
|
-
return !
|
|
1210
|
+
return !N.isBlank(e) && (R(e) || !Number.isNaN(+e) || !!(e && k.parseDate(e)));
|
|
1477
1211
|
}
|
|
1478
|
-
validatorFormula(e, r,
|
|
1479
|
-
const
|
|
1480
|
-
if (!
|
|
1212
|
+
validatorFormula(e, r, a) {
|
|
1213
|
+
const i = e.operator;
|
|
1214
|
+
if (!i)
|
|
1481
1215
|
return {
|
|
1482
1216
|
success: !1
|
|
1483
1217
|
};
|
|
1484
|
-
const
|
|
1485
|
-
if (
|
|
1218
|
+
const s = this._validatorSingleFormula(e.formula1), n = this.localeService.t("dataValidation.validFail.date");
|
|
1219
|
+
if (be.includes(i)) {
|
|
1486
1220
|
const u = this._validatorSingleFormula(e.formula2);
|
|
1487
1221
|
return {
|
|
1488
|
-
success:
|
|
1489
|
-
formula1:
|
|
1490
|
-
formula2: u ? void 0 :
|
|
1222
|
+
success: s && u,
|
|
1223
|
+
formula1: s ? void 0 : n,
|
|
1224
|
+
formula2: u ? void 0 : n
|
|
1491
1225
|
};
|
|
1492
1226
|
}
|
|
1493
1227
|
return {
|
|
1494
|
-
success:
|
|
1495
|
-
formula1:
|
|
1228
|
+
success: s,
|
|
1229
|
+
formula1: s ? void 0 : n
|
|
1496
1230
|
};
|
|
1497
1231
|
}
|
|
1498
|
-
normalizeFormula(e, r,
|
|
1499
|
-
const { formula1:
|
|
1232
|
+
normalizeFormula(e, r, a) {
|
|
1233
|
+
const { formula1: i, formula2: s, bizInfo: n } = e, l = (u) => {
|
|
1500
1234
|
var d;
|
|
1501
1235
|
if (!u)
|
|
1502
1236
|
return u;
|
|
1503
1237
|
let c;
|
|
1504
1238
|
if (!Number.isNaN(+u))
|
|
1505
|
-
c =
|
|
1239
|
+
c = k.dateFromSerial(+u);
|
|
1506
1240
|
else {
|
|
1507
|
-
const m = (d =
|
|
1241
|
+
const m = (d = k.parseDate(u)) == null ? void 0 : d.v;
|
|
1508
1242
|
if (m == null)
|
|
1509
1243
|
return "";
|
|
1510
|
-
c =
|
|
1244
|
+
c = k.dateFromSerial(m);
|
|
1511
1245
|
}
|
|
1512
|
-
return
|
|
1246
|
+
return it(`${c[0]}/${c[1]}/${c[2]} ${c[3]}:${c[4]}:${c[5]}`).format(n != null && n.showTime ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD");
|
|
1513
1247
|
};
|
|
1514
1248
|
return {
|
|
1515
|
-
formula1:
|
|
1516
|
-
formula2:
|
|
1249
|
+
formula1: R(i) ? i : l(`${i}`),
|
|
1250
|
+
formula2: R(s) ? s : l(`${s}`)
|
|
1517
1251
|
};
|
|
1518
1252
|
}
|
|
1519
|
-
transform(e, r,
|
|
1520
|
-
const { value:
|
|
1253
|
+
transform(e, r, a) {
|
|
1254
|
+
const { value: i } = e;
|
|
1521
1255
|
return {
|
|
1522
1256
|
...e,
|
|
1523
|
-
value:
|
|
1257
|
+
value: Be(i)
|
|
1524
1258
|
};
|
|
1525
1259
|
}
|
|
1526
|
-
async validatorIsEqual(e, r,
|
|
1527
|
-
const { formula1:
|
|
1528
|
-
return Number.isNaN(
|
|
1260
|
+
async validatorIsEqual(e, r, a) {
|
|
1261
|
+
const { formula1: i } = r, { value: s } = e;
|
|
1262
|
+
return Number.isNaN(i) ? !0 : s === i;
|
|
1529
1263
|
}
|
|
1530
|
-
async validatorIsNotEqual(e, r,
|
|
1531
|
-
const { formula1:
|
|
1532
|
-
return Number.isNaN(
|
|
1264
|
+
async validatorIsNotEqual(e, r, a) {
|
|
1265
|
+
const { formula1: i } = r;
|
|
1266
|
+
return Number.isNaN(i) ? !0 : e.value !== i;
|
|
1533
1267
|
}
|
|
1534
|
-
async validatorIsBetween(e, r,
|
|
1535
|
-
const { formula1:
|
|
1536
|
-
if (Number.isNaN(
|
|
1268
|
+
async validatorIsBetween(e, r, a) {
|
|
1269
|
+
const { formula1: i, formula2: s } = r;
|
|
1270
|
+
if (Number.isNaN(i) || Number.isNaN(s))
|
|
1537
1271
|
return !0;
|
|
1538
|
-
const
|
|
1539
|
-
return e.value >=
|
|
1272
|
+
const n = Math.min(i, s), l = Math.max(i, s);
|
|
1273
|
+
return e.value >= n && e.value <= l;
|
|
1540
1274
|
}
|
|
1541
|
-
async validatorIsNotBetween(e, r,
|
|
1542
|
-
const { formula1:
|
|
1543
|
-
if (Number.isNaN(
|
|
1275
|
+
async validatorIsNotBetween(e, r, a) {
|
|
1276
|
+
const { formula1: i, formula2: s } = r;
|
|
1277
|
+
if (Number.isNaN(i) || Number.isNaN(s))
|
|
1544
1278
|
return !0;
|
|
1545
|
-
const
|
|
1546
|
-
return e.value <
|
|
1279
|
+
const n = Math.min(i, s), l = Math.max(i, s);
|
|
1280
|
+
return e.value < n || e.value > l;
|
|
1547
1281
|
}
|
|
1548
|
-
async validatorIsGreaterThan(e, r,
|
|
1549
|
-
const { formula1:
|
|
1550
|
-
return Number.isNaN(
|
|
1282
|
+
async validatorIsGreaterThan(e, r, a) {
|
|
1283
|
+
const { formula1: i } = r;
|
|
1284
|
+
return Number.isNaN(i) ? !0 : e.value > i;
|
|
1551
1285
|
}
|
|
1552
|
-
async validatorIsGreaterThanOrEqual(e, r,
|
|
1553
|
-
const { formula1:
|
|
1554
|
-
return Number.isNaN(
|
|
1286
|
+
async validatorIsGreaterThanOrEqual(e, r, a) {
|
|
1287
|
+
const { formula1: i } = r;
|
|
1288
|
+
return Number.isNaN(i) ? !0 : e.value >= i;
|
|
1555
1289
|
}
|
|
1556
|
-
async validatorIsLessThan(e, r,
|
|
1557
|
-
const { formula1:
|
|
1558
|
-
return Number.isNaN(
|
|
1290
|
+
async validatorIsLessThan(e, r, a) {
|
|
1291
|
+
const { formula1: i } = r;
|
|
1292
|
+
return Number.isNaN(i) ? !0 : e.value < i;
|
|
1559
1293
|
}
|
|
1560
|
-
async validatorIsLessThanOrEqual(e, r,
|
|
1561
|
-
const { formula1:
|
|
1562
|
-
return Number.isNaN(
|
|
1294
|
+
async validatorIsLessThanOrEqual(e, r, a) {
|
|
1295
|
+
const { formula1: i } = r;
|
|
1296
|
+
return Number.isNaN(i) ? !0 : e.value <= i;
|
|
1563
1297
|
}
|
|
1564
1298
|
get operatorNames() {
|
|
1565
|
-
return this.operators.map((e) => this.localeService.t(
|
|
1299
|
+
return this.operators.map((e) => this.localeService.t(dr[e]));
|
|
1566
1300
|
}
|
|
1567
1301
|
generateRuleName(e) {
|
|
1568
|
-
var
|
|
1302
|
+
var a, i;
|
|
1569
1303
|
if (!e.operator)
|
|
1570
1304
|
return this.titleStr;
|
|
1571
|
-
const r = this.localeService.t(
|
|
1305
|
+
const r = this.localeService.t(hr[e.operator]).replace(oe, (a = e.formula1) != null ? a : "").replace(ne, (i = e.formula2) != null ? i : "");
|
|
1572
1306
|
return `${this.titleStr} ${r}`;
|
|
1573
1307
|
}
|
|
1574
|
-
generateRuleErrorMessage(e) {
|
|
1575
|
-
|
|
1576
|
-
|
|
1308
|
+
generateRuleErrorMessage(e, r) {
|
|
1309
|
+
if (!e.operator)
|
|
1310
|
+
return this.titleStr;
|
|
1311
|
+
const { transformedFormula1: a, transformedFormula2: i } = Ie(this._lexerTreeBuilder, e, r);
|
|
1312
|
+
return `${this.localeService.t(mr[e.operator]).replace(oe, a != null ? a : "").replace(ne, i != null ? i : "")}`;
|
|
1577
1313
|
}
|
|
1578
1314
|
}
|
|
1579
|
-
|
|
1580
|
-
|
|
1581
|
-
|
|
1315
|
+
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 + "";
|
|
1316
|
+
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 + "";
|
|
1317
|
+
const ht = {
|
|
1318
|
+
[h.BETWEEN]: "dataValidation.errorMsg.between",
|
|
1319
|
+
[h.EQUAL]: "dataValidation.errorMsg.equal",
|
|
1320
|
+
[h.GREATER_THAN]: "dataValidation.errorMsg.greaterThan",
|
|
1321
|
+
[h.GREATER_THAN_OR_EQUAL]: "dataValidation.errorMsg.greaterThanOrEqual",
|
|
1322
|
+
[h.LESS_THAN]: "dataValidation.errorMsg.lessThan",
|
|
1323
|
+
[h.LESS_THAN_OR_EQUAL]: "dataValidation.errorMsg.lessThanOrEqual",
|
|
1324
|
+
[h.NOT_BETWEEN]: "dataValidation.errorMsg.notBetween",
|
|
1325
|
+
[h.NOT_EQUAL]: "dataValidation.errorMsg.notEqual"
|
|
1326
|
+
};
|
|
1327
|
+
function Ne(o) {
|
|
1328
|
+
let t = o;
|
|
1329
|
+
return typeof o == "string" ? ((o.startsWith("¥") || o.startsWith("$")) && (t = o.slice(1)), +t) : +o;
|
|
1582
1330
|
}
|
|
1583
|
-
class
|
|
1331
|
+
class _r extends q {
|
|
1584
1332
|
constructor() {
|
|
1585
1333
|
super(...arguments);
|
|
1586
|
-
|
|
1587
|
-
|
|
1588
|
-
|
|
1589
|
-
|
|
1590
|
-
|
|
1591
|
-
|
|
1592
|
-
|
|
1593
|
-
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1334
|
+
f(this, "_customFormulaService", this.injector.get($));
|
|
1335
|
+
f(this, "id", M.DECIMAL);
|
|
1336
|
+
f(this, "_lexerTreeBuilder", this.injector.get(Z));
|
|
1337
|
+
f(this, "title", "dataValidation.decimal.title");
|
|
1338
|
+
f(this, "operators", [
|
|
1339
|
+
h.BETWEEN,
|
|
1340
|
+
h.EQUAL,
|
|
1341
|
+
h.GREATER_THAN,
|
|
1342
|
+
h.GREATER_THAN_OR_EQUAL,
|
|
1343
|
+
h.LESS_THAN,
|
|
1344
|
+
h.LESS_THAN_OR_EQUAL,
|
|
1345
|
+
h.NOT_BETWEEN,
|
|
1346
|
+
h.NOT_EQUAL
|
|
1598
1347
|
]);
|
|
1599
|
-
|
|
1348
|
+
f(this, "scopes", ["sheet"]);
|
|
1600
1349
|
}
|
|
1601
1350
|
_isFormulaOrNumber(e) {
|
|
1602
|
-
return !
|
|
1351
|
+
return !N.isBlank(e) && (R(e) || !Number.isNaN(+e));
|
|
1603
1352
|
}
|
|
1604
|
-
async isValidType(e, r,
|
|
1605
|
-
const { value:
|
|
1606
|
-
return !Number.isNaN(
|
|
1353
|
+
async isValidType(e, r, a) {
|
|
1354
|
+
const { value: i } = e;
|
|
1355
|
+
return !Number.isNaN(Ne(i));
|
|
1607
1356
|
}
|
|
1608
|
-
transform(e, r,
|
|
1609
|
-
const { value:
|
|
1357
|
+
transform(e, r, a) {
|
|
1358
|
+
const { value: i } = e;
|
|
1610
1359
|
return {
|
|
1611
1360
|
...e,
|
|
1612
|
-
value:
|
|
1361
|
+
value: Ne(i)
|
|
1613
1362
|
};
|
|
1614
1363
|
}
|
|
1615
1364
|
_parseNumber(e) {
|
|
1616
1365
|
return e == null ? Number.NaN : +e;
|
|
1617
1366
|
}
|
|
1618
|
-
async parseFormula(e, r, i) {
|
|
1619
|
-
|
|
1620
|
-
const a = await this._formulaService.getRuleFormulaResult(r, i, e.uid), { formula1: n, formula2: o } = e, l = z((v = (m = a == null ? void 0 : a[0]) == null ? void 0 : m.result) == null ? void 0 : v[0][0]), u = z((w = (S = a == null ? void 0 : a[1]) == null ? void 0 : S.result) == null ? void 0 : w[0][0]), c = W(String(l)) && W(String(u));
|
|
1367
|
+
async parseFormula(e, r, a, i, s) {
|
|
1368
|
+
const n = await this._customFormulaService.getCellFormulaValue(r, a, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(r, a, e.uid, i, s), { formula1: u, formula2: c } = e, d = O(String(n == null ? void 0 : n.v)) && O(String(l == null ? void 0 : l.v));
|
|
1621
1369
|
return {
|
|
1622
|
-
formula1: this._parseNumber(
|
|
1623
|
-
formula2: this._parseNumber(
|
|
1624
|
-
isFormulaValid:
|
|
1370
|
+
formula1: this._parseNumber(R(u) ? n == null ? void 0 : n.v : u),
|
|
1371
|
+
formula2: this._parseNumber(R(c) ? l == null ? void 0 : l.v : c),
|
|
1372
|
+
isFormulaValid: d
|
|
1625
1373
|
};
|
|
1626
1374
|
}
|
|
1627
|
-
validatorFormula(e, r,
|
|
1628
|
-
const
|
|
1629
|
-
if (!
|
|
1375
|
+
validatorFormula(e, r, a) {
|
|
1376
|
+
const i = e.operator;
|
|
1377
|
+
if (!i)
|
|
1630
1378
|
return {
|
|
1631
1379
|
success: !1
|
|
1632
1380
|
};
|
|
1633
|
-
const
|
|
1381
|
+
const s = N.isDefine(e.formula1) && this._isFormulaOrNumber(e.formula1), n = N.isDefine(e.formula2) && this._isFormulaOrNumber(e.formula2), l = be.includes(i), u = this.localeService.t("dataValidation.validFail.number");
|
|
1634
1382
|
return l ? {
|
|
1635
|
-
success:
|
|
1636
|
-
formula1:
|
|
1637
|
-
formula2:
|
|
1383
|
+
success: s && n,
|
|
1384
|
+
formula1: s ? void 0 : u,
|
|
1385
|
+
formula2: n ? void 0 : u
|
|
1638
1386
|
} : {
|
|
1639
|
-
success:
|
|
1640
|
-
formula1:
|
|
1387
|
+
success: s,
|
|
1388
|
+
formula1: s ? "" : u
|
|
1641
1389
|
};
|
|
1642
1390
|
}
|
|
1643
|
-
async validatorIsEqual(e, r,
|
|
1644
|
-
const { formula1:
|
|
1645
|
-
return Number.isNaN(
|
|
1391
|
+
async validatorIsEqual(e, r, a) {
|
|
1392
|
+
const { formula1: i } = r, { value: s } = e;
|
|
1393
|
+
return Number.isNaN(i) ? !0 : s === i;
|
|
1646
1394
|
}
|
|
1647
|
-
async validatorIsNotEqual(e, r,
|
|
1648
|
-
const { formula1:
|
|
1649
|
-
return Number.isNaN(
|
|
1395
|
+
async validatorIsNotEqual(e, r, a) {
|
|
1396
|
+
const { formula1: i } = r;
|
|
1397
|
+
return Number.isNaN(i) ? !0 : e.value !== i;
|
|
1650
1398
|
}
|
|
1651
|
-
async validatorIsBetween(e, r,
|
|
1652
|
-
const { formula1:
|
|
1653
|
-
if (Number.isNaN(
|
|
1399
|
+
async validatorIsBetween(e, r, a) {
|
|
1400
|
+
const { formula1: i, formula2: s } = r;
|
|
1401
|
+
if (Number.isNaN(i) || Number.isNaN(s))
|
|
1654
1402
|
return !0;
|
|
1655
|
-
const
|
|
1656
|
-
return e.value >=
|
|
1403
|
+
const n = Math.min(i, s), l = Math.max(i, s);
|
|
1404
|
+
return e.value >= n && e.value <= l;
|
|
1657
1405
|
}
|
|
1658
|
-
async validatorIsNotBetween(e, r,
|
|
1659
|
-
const { formula1:
|
|
1660
|
-
if (Number.isNaN(
|
|
1406
|
+
async validatorIsNotBetween(e, r, a) {
|
|
1407
|
+
const { formula1: i, formula2: s } = r;
|
|
1408
|
+
if (Number.isNaN(i) || Number.isNaN(s))
|
|
1661
1409
|
return !0;
|
|
1662
|
-
const
|
|
1663
|
-
return e.value <
|
|
1410
|
+
const n = Math.min(i, s), l = Math.max(i, s);
|
|
1411
|
+
return e.value < n || e.value > l;
|
|
1664
1412
|
}
|
|
1665
|
-
async validatorIsGreaterThan(e, r,
|
|
1666
|
-
const { formula1:
|
|
1667
|
-
return Number.isNaN(
|
|
1413
|
+
async validatorIsGreaterThan(e, r, a) {
|
|
1414
|
+
const { formula1: i } = r;
|
|
1415
|
+
return Number.isNaN(i) ? !0 : e.value > i;
|
|
1668
1416
|
}
|
|
1669
|
-
async validatorIsGreaterThanOrEqual(e, r,
|
|
1670
|
-
const { formula1:
|
|
1671
|
-
return Number.isNaN(
|
|
1417
|
+
async validatorIsGreaterThanOrEqual(e, r, a) {
|
|
1418
|
+
const { formula1: i } = r;
|
|
1419
|
+
return Number.isNaN(i) ? !0 : e.value >= i;
|
|
1672
1420
|
}
|
|
1673
|
-
async validatorIsLessThan(e, r,
|
|
1674
|
-
const { formula1:
|
|
1675
|
-
return Number.isNaN(
|
|
1421
|
+
async validatorIsLessThan(e, r, a) {
|
|
1422
|
+
const { formula1: i } = r;
|
|
1423
|
+
return Number.isNaN(i) ? !0 : e.value < i;
|
|
1676
1424
|
}
|
|
1677
|
-
async validatorIsLessThanOrEqual(e, r,
|
|
1678
|
-
const { formula1:
|
|
1679
|
-
return Number.isNaN(
|
|
1425
|
+
async validatorIsLessThanOrEqual(e, r, a) {
|
|
1426
|
+
const { formula1: i } = r;
|
|
1427
|
+
return Number.isNaN(i) ? !0 : e.value <= i;
|
|
1428
|
+
}
|
|
1429
|
+
generateRuleErrorMessage(e, r) {
|
|
1430
|
+
if (!e.operator)
|
|
1431
|
+
return this.titleStr;
|
|
1432
|
+
const { transformedFormula1: a, transformedFormula2: i } = Ie(this._lexerTreeBuilder, e, r);
|
|
1433
|
+
return `${this.localeService.t(ht[e.operator]).replace(oe, a != null ? a : "").replace(ne, i != null ? i : "")}`;
|
|
1680
1434
|
}
|
|
1681
1435
|
}
|
|
1682
|
-
function
|
|
1683
|
-
|
|
1684
|
-
}
|
|
1685
|
-
function xe(s) {
|
|
1686
|
-
return s.split(",").filter(Boolean);
|
|
1687
|
-
}
|
|
1688
|
-
function Ma(s) {
|
|
1689
|
-
const t = Ve(s);
|
|
1690
|
-
return t == null ? "" : t.toString();
|
|
1691
|
-
}
|
|
1692
|
-
function Ze(s) {
|
|
1693
|
-
if (!s)
|
|
1436
|
+
function Pe(o) {
|
|
1437
|
+
if (!o)
|
|
1694
1438
|
return [];
|
|
1695
1439
|
const t = /* @__PURE__ */ new Set();
|
|
1696
|
-
return
|
|
1440
|
+
return o.forEach(
|
|
1697
1441
|
(e) => {
|
|
1698
1442
|
e.forEach((r) => {
|
|
1699
|
-
var
|
|
1700
|
-
const
|
|
1701
|
-
if (
|
|
1702
|
-
if (typeof
|
|
1703
|
-
t.add(
|
|
1443
|
+
var i, s;
|
|
1444
|
+
const a = ae(r);
|
|
1445
|
+
if (a != null) {
|
|
1446
|
+
if (typeof a != "string" && typeof (r == null ? void 0 : r.s) == "object" && ((s = (i = r.s) == null ? void 0 : i.n) != null && s.pattern)) {
|
|
1447
|
+
t.add(k.format(r.s.n.pattern, a, { throws: !1 }));
|
|
1704
1448
|
return;
|
|
1705
1449
|
}
|
|
1706
|
-
|
|
1450
|
+
O(a.toString()) && t.add(a.toString());
|
|
1707
1451
|
}
|
|
1708
1452
|
});
|
|
1709
1453
|
}
|
|
1710
1454
|
), [...t];
|
|
1711
1455
|
}
|
|
1712
|
-
const
|
|
1456
|
+
const pr = [
|
|
1713
1457
|
"if",
|
|
1714
1458
|
"indirect",
|
|
1715
1459
|
"choose",
|
|
1716
1460
|
"offset"
|
|
1717
1461
|
];
|
|
1718
|
-
function
|
|
1719
|
-
if (!
|
|
1462
|
+
function gr(o, t) {
|
|
1463
|
+
if (!R(o) || ct(o.slice(1)))
|
|
1720
1464
|
return !0;
|
|
1721
|
-
const r = t.sequenceNodesBuilder(
|
|
1722
|
-
return r && r.some((
|
|
1465
|
+
const r = t.sequenceNodesBuilder(o);
|
|
1466
|
+
return r && r.some((a) => typeof a == "object" && a.nodeType === Gt.FUNCTION && pr.indexOf(a.token.toLowerCase()) > -1);
|
|
1723
1467
|
}
|
|
1724
|
-
function
|
|
1725
|
-
const { formula1: e = "", ranges: r } =
|
|
1726
|
-
if (
|
|
1727
|
-
const
|
|
1728
|
-
if ((!
|
|
1468
|
+
function vr(o, t) {
|
|
1469
|
+
const { formula1: e = "", ranges: r } = o;
|
|
1470
|
+
if (ct(e.slice(1))) {
|
|
1471
|
+
const i = Qt(e.slice(1));
|
|
1472
|
+
if ((!i.sheetName || i.sheetName === t) && r.some((s) => B.intersects(s, i.range)))
|
|
1729
1473
|
return !0;
|
|
1730
1474
|
}
|
|
1731
1475
|
return !1;
|
|
1732
1476
|
}
|
|
1733
|
-
class
|
|
1477
|
+
class mt extends q {
|
|
1734
1478
|
constructor() {
|
|
1735
1479
|
super(...arguments);
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
|
|
1743
|
-
|
|
1744
|
-
}
|
|
1745
|
-
validatorFormula(e, r,
|
|
1480
|
+
f(this, "formulaService", this.injector.get(X));
|
|
1481
|
+
f(this, "_lexer", this.injector.get(Z));
|
|
1482
|
+
f(this, "_univerInstanceService", this.injector.get(D));
|
|
1483
|
+
f(this, "id", M.LIST);
|
|
1484
|
+
f(this, "title", "dataValidation.list.title");
|
|
1485
|
+
f(this, "operators", []);
|
|
1486
|
+
f(this, "scopes", ["sheet"]);
|
|
1487
|
+
f(this, "skipDefaultFontRender", (e) => e.renderMode !== Le.TEXT);
|
|
1488
|
+
}
|
|
1489
|
+
validatorFormula(e, r, a) {
|
|
1746
1490
|
var u, c, d;
|
|
1747
|
-
const
|
|
1491
|
+
const i = !N.isBlank(e.formula1), s = gr((u = e.formula1) != null ? u : "", this._lexer), n = (d = (c = this._univerInstanceService.getUnit(r, A.UNIVER_SHEET)) == null ? void 0 : c.getSheetBySheetId(a)) == null ? void 0 : d.getName(), l = vr(e, n != null ? n : "");
|
|
1748
1492
|
return {
|
|
1749
|
-
success: !!(
|
|
1750
|
-
formula1:
|
|
1493
|
+
success: !!(i && s && !l),
|
|
1494
|
+
formula1: i ? s ? l ? this.localeService.t("dataValidation.validFail.listIntersects") : void 0 : this.localeService.t("dataValidation.validFail.listInvalid") : this.localeService.t("dataValidation.validFail.list")
|
|
1751
1495
|
};
|
|
1752
1496
|
}
|
|
1753
|
-
getExtraStyle(e, r, { style:
|
|
1754
|
-
var
|
|
1755
|
-
const
|
|
1756
|
-
if (e.type ===
|
|
1757
|
-
const
|
|
1497
|
+
getExtraStyle(e, r, { style: a }) {
|
|
1498
|
+
var s;
|
|
1499
|
+
const i = (s = a.tb !== ve.OVERFLOW ? a.tb : ve.CLIP) != null ? s : ve.WRAP;
|
|
1500
|
+
if (e.type === M.LIST && (e.renderMode === Le.ARROW || e.renderMode === Le.TEXT)) {
|
|
1501
|
+
const n = this.getListWithColorMap(e), l = `${r != null ? r : ""}`, u = n[l];
|
|
1758
1502
|
if (u)
|
|
1759
1503
|
return {
|
|
1760
1504
|
bg: {
|
|
1761
1505
|
rgb: u
|
|
1762
1506
|
},
|
|
1763
|
-
tb:
|
|
1507
|
+
tb: i
|
|
1764
1508
|
};
|
|
1765
1509
|
}
|
|
1766
1510
|
return {
|
|
1767
|
-
tb:
|
|
1511
|
+
tb: i
|
|
1768
1512
|
};
|
|
1769
1513
|
}
|
|
1770
1514
|
parseCellValue(e) {
|
|
1771
1515
|
const r = e.toString();
|
|
1772
|
-
return
|
|
1516
|
+
return pe(r);
|
|
1773
1517
|
}
|
|
1774
|
-
async parseFormula(e, r,
|
|
1518
|
+
async parseFormula(e, r, a) {
|
|
1775
1519
|
var u, c, d, m;
|
|
1776
|
-
const { formula1:
|
|
1520
|
+
const { formula1: i = "" } = e, s = await this.formulaService.getRuleFormulaResult(r, a, e.uid), n = ie((c = (u = s == null ? void 0 : s[0]) == null ? void 0 : u.result) == null ? void 0 : c[0][0]), l = O(String(n));
|
|
1777
1521
|
return {
|
|
1778
|
-
formula1:
|
|
1522
|
+
formula1: R(i) ? Pe((m = (d = s == null ? void 0 : s[0]) == null ? void 0 : d.result) == null ? void 0 : m[0][0]) : pe(i),
|
|
1779
1523
|
formula2: void 0,
|
|
1780
1524
|
isFormulaValid: l
|
|
1781
1525
|
};
|
|
1782
1526
|
}
|
|
1783
|
-
async isValidType(e, r,
|
|
1784
|
-
const { value:
|
|
1785
|
-
return this.parseCellValue(
|
|
1527
|
+
async isValidType(e, r, a) {
|
|
1528
|
+
const { value: i } = e, { formula1: s = [] } = r;
|
|
1529
|
+
return this.parseCellValue(i).every((l) => s.includes(l));
|
|
1786
1530
|
}
|
|
1787
1531
|
generateRuleName() {
|
|
1788
1532
|
return this.localeService.t("dataValidation.list.name");
|
|
@@ -1790,70 +1534,70 @@ class Tt extends de {
|
|
|
1790
1534
|
generateRuleErrorMessage() {
|
|
1791
1535
|
return this.localeService.t("dataValidation.list.error");
|
|
1792
1536
|
}
|
|
1793
|
-
getList(e, r,
|
|
1794
|
-
var m,
|
|
1795
|
-
const { formula1:
|
|
1796
|
-
if (!
|
|
1797
|
-
const l = (
|
|
1537
|
+
getList(e, r, a) {
|
|
1538
|
+
var m, _, p, S;
|
|
1539
|
+
const { formula1: i = "" } = e, s = this.injector.get(D), n = (m = r ? s.getUniverSheetInstance(r) : void 0) != null ? m : s.getCurrentUnitForType(A.UNIVER_SHEET);
|
|
1540
|
+
if (!n) return [];
|
|
1541
|
+
const l = (_ = a ? n.getSheetBySheetId(a) : void 0) != null ? _ : n.getActiveSheet();
|
|
1798
1542
|
if (!l) return [];
|
|
1799
|
-
const u =
|
|
1800
|
-
return
|
|
1801
|
-
}
|
|
1802
|
-
async getListAsync(e, r,
|
|
1803
|
-
var m,
|
|
1804
|
-
const { formula1:
|
|
1805
|
-
if (!
|
|
1806
|
-
const l = (
|
|
1543
|
+
const u = n.getUnitId(), c = l.getSheetId(), d = this.formulaService.getRuleFormulaResultSync(u, c, e.uid);
|
|
1544
|
+
return R(i) ? Pe((S = (p = d == null ? void 0 : d[0]) == null ? void 0 : p.result) == null ? void 0 : S[0][0]) : pe(i);
|
|
1545
|
+
}
|
|
1546
|
+
async getListAsync(e, r, a) {
|
|
1547
|
+
var m, _, p, S;
|
|
1548
|
+
const { formula1: i = "" } = e, s = this.injector.get(D), n = (m = r ? s.getUniverSheetInstance(r) : void 0) != null ? m : s.getCurrentUnitForType(A.UNIVER_SHEET);
|
|
1549
|
+
if (!n) return [];
|
|
1550
|
+
const l = (_ = a ? n.getSheetBySheetId(a) : void 0) != null ? _ : n.getActiveSheet();
|
|
1807
1551
|
if (!l) return [];
|
|
1808
|
-
const u =
|
|
1809
|
-
return
|
|
1552
|
+
const u = n.getUnitId(), c = l.getSheetId(), d = await this.formulaService.getRuleFormulaResult(u, c, e.uid);
|
|
1553
|
+
return R(i) ? Pe((S = (p = d == null ? void 0 : d[0]) == null ? void 0 : p.result) == null ? void 0 : S[0][0]) : pe(i);
|
|
1810
1554
|
}
|
|
1811
|
-
getListWithColor(e, r,
|
|
1812
|
-
const
|
|
1813
|
-
return
|
|
1555
|
+
getListWithColor(e, r, a) {
|
|
1556
|
+
const i = this.getList(e, r, a), s = (e.formula2 || "").split(",");
|
|
1557
|
+
return i.map((n, l) => ({ label: n, color: s[l] }));
|
|
1814
1558
|
}
|
|
1815
|
-
getListWithColorMap(e, r,
|
|
1816
|
-
const
|
|
1817
|
-
return
|
|
1818
|
-
|
|
1819
|
-
}),
|
|
1559
|
+
getListWithColorMap(e, r, a) {
|
|
1560
|
+
const i = this.getListWithColor(e, r, a), s = {};
|
|
1561
|
+
return i.forEach((n) => {
|
|
1562
|
+
n.color && (s[n.label] = n.color);
|
|
1563
|
+
}), s;
|
|
1820
1564
|
}
|
|
1821
1565
|
}
|
|
1822
|
-
|
|
1823
|
-
class xr extends de {
|
|
1566
|
+
class Rr extends q {
|
|
1824
1567
|
constructor() {
|
|
1825
1568
|
super(...arguments);
|
|
1826
|
-
|
|
1827
|
-
|
|
1828
|
-
|
|
1829
|
-
|
|
1830
|
-
|
|
1831
|
-
|
|
1832
|
-
|
|
1833
|
-
|
|
1834
|
-
|
|
1835
|
-
|
|
1836
|
-
|
|
1569
|
+
f(this, "id", M.TEXT_LENGTH);
|
|
1570
|
+
f(this, "title", "dataValidation.textLength.title");
|
|
1571
|
+
f(this, "_lexerTreeBuilder", this.injector.get(Z));
|
|
1572
|
+
f(this, "operators", [
|
|
1573
|
+
h.BETWEEN,
|
|
1574
|
+
h.EQUAL,
|
|
1575
|
+
h.GREATER_THAN,
|
|
1576
|
+
h.GREATER_THAN_OR_EQUAL,
|
|
1577
|
+
h.LESS_THAN,
|
|
1578
|
+
h.LESS_THAN_OR_EQUAL,
|
|
1579
|
+
h.NOT_BETWEEN,
|
|
1580
|
+
h.NOT_EQUAL
|
|
1837
1581
|
]);
|
|
1838
|
-
|
|
1839
|
-
|
|
1582
|
+
f(this, "scopes", ["sheet"]);
|
|
1583
|
+
f(this, "_customFormulaService", this.injector.get($));
|
|
1840
1584
|
}
|
|
1841
1585
|
_isFormulaOrInt(e) {
|
|
1842
|
-
return !
|
|
1586
|
+
return !N.isBlank(e) && (R(e) || !Number.isNaN(+e) && Number.isInteger(+e));
|
|
1843
1587
|
}
|
|
1844
|
-
validatorFormula(e, r,
|
|
1845
|
-
const
|
|
1846
|
-
if (!
|
|
1588
|
+
validatorFormula(e, r, a) {
|
|
1589
|
+
const i = e.operator;
|
|
1590
|
+
if (!i)
|
|
1847
1591
|
return {
|
|
1848
1592
|
success: !1
|
|
1849
1593
|
};
|
|
1850
|
-
const
|
|
1594
|
+
const s = N.isDefine(e.formula1) && this._isFormulaOrInt(e.formula1), n = N.isDefine(e.formula2) && this._isFormulaOrInt(e.formula2), l = be.includes(i), u = this.localeService.t("dataValidation.validFail.number");
|
|
1851
1595
|
return l ? {
|
|
1852
|
-
success:
|
|
1853
|
-
formula1:
|
|
1854
|
-
formula2:
|
|
1596
|
+
success: s && n,
|
|
1597
|
+
formula1: s ? void 0 : u,
|
|
1598
|
+
formula2: n ? void 0 : u
|
|
1855
1599
|
} : {
|
|
1856
|
-
success:
|
|
1600
|
+
success: s,
|
|
1857
1601
|
formula1: u
|
|
1858
1602
|
};
|
|
1859
1603
|
}
|
|
@@ -1863,527 +1607,537 @@ class xr extends de {
|
|
|
1863
1607
|
_isValidFormula(e) {
|
|
1864
1608
|
return !Number.isNaN(e);
|
|
1865
1609
|
}
|
|
1866
|
-
async parseFormula(e, r, i) {
|
|
1867
|
-
|
|
1868
|
-
const a = await this._formulaService.getRuleFormulaResult(r, i, e.uid), { formula1: n, formula2: o } = e, l = z((m = (d = a == null ? void 0 : a[0]) == null ? void 0 : d.result) == null ? void 0 : m[0][0]), u = z((S = (v = a == null ? void 0 : a[1]) == null ? void 0 : v.result) == null ? void 0 : S[0][0]), c = W(String(l)) && W(String(u));
|
|
1610
|
+
async parseFormula(e, r, a, i, s) {
|
|
1611
|
+
const n = await this._customFormulaService.getCellFormulaValue(r, a, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(r, a, e.uid, i, s), { formula1: u, formula2: c } = e, d = O(String(n == null ? void 0 : n.v)) && O(String(l == null ? void 0 : l.v));
|
|
1869
1612
|
return {
|
|
1870
|
-
formula1: this._parseNumber(
|
|
1871
|
-
formula2: this._parseNumber(
|
|
1872
|
-
isFormulaValid:
|
|
1613
|
+
formula1: this._parseNumber(R(u) ? n == null ? void 0 : n.v : u),
|
|
1614
|
+
formula2: this._parseNumber(R(c) ? l == null ? void 0 : l.v : c),
|
|
1615
|
+
isFormulaValid: d
|
|
1873
1616
|
};
|
|
1874
1617
|
}
|
|
1875
|
-
transform(e, r,
|
|
1618
|
+
transform(e, r, a) {
|
|
1876
1619
|
return {
|
|
1877
1620
|
...e,
|
|
1878
1621
|
value: e.value.toString().length
|
|
1879
1622
|
};
|
|
1880
1623
|
}
|
|
1881
|
-
async isValidType(e, r,
|
|
1882
|
-
const { value:
|
|
1883
|
-
return typeof
|
|
1624
|
+
async isValidType(e, r, a) {
|
|
1625
|
+
const { value: i } = e;
|
|
1626
|
+
return typeof i == "string" || typeof i == "number";
|
|
1884
1627
|
}
|
|
1885
|
-
async validatorIsEqual(e, r,
|
|
1886
|
-
const { formula1:
|
|
1887
|
-
return
|
|
1628
|
+
async validatorIsEqual(e, r, a) {
|
|
1629
|
+
const { formula1: i } = r;
|
|
1630
|
+
return N.isDefine(i) ? e.value === i : !1;
|
|
1888
1631
|
}
|
|
1889
|
-
async validatorIsNotEqual(e, r,
|
|
1890
|
-
const { formula1:
|
|
1891
|
-
return
|
|
1632
|
+
async validatorIsNotEqual(e, r, a) {
|
|
1633
|
+
const { formula1: i } = r;
|
|
1634
|
+
return N.isDefine(i) ? e.value !== i : !1;
|
|
1892
1635
|
}
|
|
1893
|
-
async validatorIsBetween(e, r,
|
|
1894
|
-
const { formula1:
|
|
1895
|
-
if (!this._isValidFormula(
|
|
1636
|
+
async validatorIsBetween(e, r, a) {
|
|
1637
|
+
const { formula1: i, formula2: s } = r, { value: n } = e;
|
|
1638
|
+
if (!this._isValidFormula(i) || !this._isValidFormula(s))
|
|
1896
1639
|
return !1;
|
|
1897
|
-
const l = Math.max(
|
|
1898
|
-
return
|
|
1640
|
+
const l = Math.max(i, s), u = Math.min(i, s);
|
|
1641
|
+
return n >= u && n <= l;
|
|
1899
1642
|
}
|
|
1900
|
-
async validatorIsNotBetween(e, r,
|
|
1901
|
-
const { formula1:
|
|
1902
|
-
if (!this._isValidFormula(
|
|
1643
|
+
async validatorIsNotBetween(e, r, a) {
|
|
1644
|
+
const { formula1: i, formula2: s } = r, { value: n } = e;
|
|
1645
|
+
if (!this._isValidFormula(i) || !this._isValidFormula(s))
|
|
1903
1646
|
return !1;
|
|
1904
|
-
const l = Math.max(
|
|
1905
|
-
return
|
|
1647
|
+
const l = Math.max(i, s), u = Math.min(i, s);
|
|
1648
|
+
return n < u || n > l;
|
|
1906
1649
|
}
|
|
1907
|
-
async validatorIsGreaterThan(e, r,
|
|
1908
|
-
const { formula1:
|
|
1909
|
-
return this._isValidFormula(
|
|
1650
|
+
async validatorIsGreaterThan(e, r, a) {
|
|
1651
|
+
const { formula1: i } = r, { value: s } = e;
|
|
1652
|
+
return this._isValidFormula(i) ? s > i : !1;
|
|
1910
1653
|
}
|
|
1911
|
-
async validatorIsGreaterThanOrEqual(e, r,
|
|
1912
|
-
const { formula1:
|
|
1913
|
-
return this._isValidFormula(
|
|
1654
|
+
async validatorIsGreaterThanOrEqual(e, r, a) {
|
|
1655
|
+
const { formula1: i } = r, { value: s } = e;
|
|
1656
|
+
return this._isValidFormula(i) ? s >= i : !1;
|
|
1914
1657
|
}
|
|
1915
|
-
async validatorIsLessThan(e, r,
|
|
1916
|
-
const { formula1:
|
|
1917
|
-
return this._isValidFormula(
|
|
1658
|
+
async validatorIsLessThan(e, r, a) {
|
|
1659
|
+
const { formula1: i } = r, { value: s } = e;
|
|
1660
|
+
return this._isValidFormula(i) ? s < i : !1;
|
|
1918
1661
|
}
|
|
1919
|
-
async validatorIsLessThanOrEqual(e, r,
|
|
1920
|
-
const { formula1:
|
|
1921
|
-
return this._isValidFormula(
|
|
1662
|
+
async validatorIsLessThanOrEqual(e, r, a) {
|
|
1663
|
+
const { formula1: i } = r, { value: s } = e;
|
|
1664
|
+
return this._isValidFormula(i) ? s <= i : !1;
|
|
1922
1665
|
}
|
|
1923
|
-
generateRuleErrorMessage(e) {
|
|
1924
|
-
|
|
1925
|
-
|
|
1666
|
+
generateRuleErrorMessage(e, r) {
|
|
1667
|
+
if (!e.operator)
|
|
1668
|
+
return this.titleStr;
|
|
1669
|
+
const { transformedFormula1: a, transformedFormula2: i } = Ie(this._lexerTreeBuilder, e, r);
|
|
1670
|
+
return `${this.localeService.t(Dt[e.operator]).replace(oe, a != null ? a : "").replace(ne, i != null ? i : "")}`;
|
|
1926
1671
|
}
|
|
1927
1672
|
}
|
|
1928
|
-
function
|
|
1673
|
+
function ft(o) {
|
|
1929
1674
|
var e, r;
|
|
1930
|
-
return
|
|
1675
|
+
return o ? o.p ? !((r = (e = o.p.body) == null ? void 0 : e.dataStream) != null ? r : "").slice(0, -2).trim() : N.isBlank(o.v) : !0;
|
|
1931
1676
|
}
|
|
1932
|
-
function
|
|
1933
|
-
const
|
|
1677
|
+
function Ae(o, t, e, r, a = "command", i = !0) {
|
|
1678
|
+
const s = r.get(Z), n = [], l = [], u = r.get(F), c = r.get(D), d = Ye(c, { unitId: o, subUnitId: t });
|
|
1934
1679
|
if (!d)
|
|
1935
1680
|
return {
|
|
1936
|
-
redoMutations:
|
|
1681
|
+
redoMutations: n,
|
|
1937
1682
|
undoMutations: l
|
|
1938
1683
|
};
|
|
1939
|
-
const { worksheet: m } = d,
|
|
1940
|
-
function
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
const
|
|
1944
|
-
(
|
|
1945
|
-
v:
|
|
1684
|
+
const { worksheet: m } = d, _ = new Re();
|
|
1685
|
+
function p(g, C) {
|
|
1686
|
+
i && g.forEach((E) => {
|
|
1687
|
+
I.foreach(E, (x, L) => {
|
|
1688
|
+
const J = m.getCellRaw(x, L), ee = dt(J);
|
|
1689
|
+
(ft(J) || ee === C) && _.setValue(x, L, {
|
|
1690
|
+
v: C,
|
|
1946
1691
|
p: null
|
|
1947
1692
|
});
|
|
1948
1693
|
});
|
|
1949
1694
|
});
|
|
1950
1695
|
}
|
|
1951
|
-
e.forEach((
|
|
1952
|
-
switch (
|
|
1696
|
+
e.forEach((g) => {
|
|
1697
|
+
switch (g.type) {
|
|
1953
1698
|
case "delete":
|
|
1954
|
-
|
|
1955
|
-
id:
|
|
1699
|
+
n.push({
|
|
1700
|
+
id: P.id,
|
|
1956
1701
|
params: {
|
|
1957
|
-
unitId:
|
|
1702
|
+
unitId: o,
|
|
1958
1703
|
subUnitId: t,
|
|
1959
|
-
ruleId:
|
|
1960
|
-
source:
|
|
1704
|
+
ruleId: g.rule.uid,
|
|
1705
|
+
source: a
|
|
1961
1706
|
}
|
|
1962
1707
|
}), l.unshift({
|
|
1963
|
-
id:
|
|
1708
|
+
id: U.id,
|
|
1964
1709
|
params: {
|
|
1965
|
-
unitId:
|
|
1710
|
+
unitId: o,
|
|
1966
1711
|
subUnitId: t,
|
|
1967
|
-
rule:
|
|
1968
|
-
index:
|
|
1969
|
-
source:
|
|
1712
|
+
rule: g.rule,
|
|
1713
|
+
index: g.index,
|
|
1714
|
+
source: a
|
|
1970
1715
|
}
|
|
1971
1716
|
});
|
|
1972
1717
|
break;
|
|
1973
1718
|
case "update": {
|
|
1974
|
-
if (
|
|
1975
|
-
|
|
1976
|
-
|
|
1977
|
-
|
|
1978
|
-
subUnitId: t,
|
|
1979
|
-
ruleId: M.ruleId,
|
|
1980
|
-
payload: {
|
|
1981
|
-
type: Y.RANGE,
|
|
1982
|
-
payload: M.newRanges
|
|
1983
|
-
},
|
|
1984
|
-
source: i
|
|
1985
|
-
}
|
|
1986
|
-
}), l.unshift({
|
|
1987
|
-
id: X.id,
|
|
1988
|
-
params: {
|
|
1989
|
-
unitId: s,
|
|
1990
|
-
subUnitId: t,
|
|
1991
|
-
ruleId: M.ruleId,
|
|
1992
|
-
payload: {
|
|
1993
|
-
type: Y.RANGE,
|
|
1994
|
-
payload: M.oldRanges
|
|
1995
|
-
},
|
|
1996
|
-
source: i
|
|
1997
|
-
}
|
|
1998
|
-
}), M.rule.type === $.CUSTOM) {
|
|
1999
|
-
const O = M.oldRanges[0].startRow, H = M.oldRanges[0].startColumn, L = M.newRanges[0].startRow, q = M.newRanges[0].startColumn, se = L - O, he = q - H, ae = n.moveFormulaRefOffset(M.rule.formula1, he, se);
|
|
2000
|
-
ae !== M.rule.formula1 && (o.push({
|
|
2001
|
-
id: X.id,
|
|
1719
|
+
if (le(g.rule.type)) {
|
|
1720
|
+
const E = g.oldRanges[0].startRow, x = g.oldRanges[0].startColumn, L = g.newRanges[0].startRow, J = g.newRanges[0].startColumn, ee = L - E, ue = J - x, ce = R(g.rule.formula1) ? s.moveFormulaRefOffset(g.rule.formula1, ue, ee) : g.rule.formula1, de = R(g.rule.formula2) ? s.moveFormulaRefOffset(g.rule.formula2, ue, ee) : g.rule.formula2;
|
|
1721
|
+
(ce !== g.rule.formula1 || de !== g.rule.formula2) && (n.push({
|
|
1722
|
+
id: b.id,
|
|
2002
1723
|
params: {
|
|
2003
|
-
unitId:
|
|
1724
|
+
unitId: o,
|
|
2004
1725
|
subUnitId: t,
|
|
2005
|
-
ruleId:
|
|
1726
|
+
ruleId: g.ruleId,
|
|
2006
1727
|
payload: {
|
|
2007
|
-
type:
|
|
1728
|
+
type: w.ALL,
|
|
2008
1729
|
payload: {
|
|
2009
|
-
|
|
2010
|
-
|
|
1730
|
+
formula1: ce,
|
|
1731
|
+
formula2: de,
|
|
1732
|
+
ranges: g.newRanges
|
|
2011
1733
|
}
|
|
2012
1734
|
}
|
|
2013
1735
|
}
|
|
2014
1736
|
}), l.unshift({
|
|
2015
|
-
id:
|
|
1737
|
+
id: b.id,
|
|
2016
1738
|
params: {
|
|
2017
|
-
unitId:
|
|
1739
|
+
unitId: o,
|
|
2018
1740
|
subUnitId: t,
|
|
2019
|
-
ruleId:
|
|
1741
|
+
ruleId: g.ruleId,
|
|
2020
1742
|
payload: {
|
|
2021
|
-
type:
|
|
2022
|
-
payload:
|
|
1743
|
+
type: w.ALL,
|
|
1744
|
+
payload: {
|
|
1745
|
+
formula1: g.rule.formula1,
|
|
1746
|
+
formula2: g.rule.formula2,
|
|
1747
|
+
ranges: g.oldRanges
|
|
1748
|
+
}
|
|
2023
1749
|
}
|
|
2024
1750
|
}
|
|
2025
1751
|
}));
|
|
2026
|
-
}
|
|
2027
|
-
|
|
2028
|
-
|
|
2029
|
-
|
|
2030
|
-
|
|
1752
|
+
} else
|
|
1753
|
+
n.push({
|
|
1754
|
+
id: b.id,
|
|
1755
|
+
params: {
|
|
1756
|
+
unitId: o,
|
|
1757
|
+
subUnitId: t,
|
|
1758
|
+
ruleId: g.ruleId,
|
|
1759
|
+
payload: {
|
|
1760
|
+
type: w.RANGE,
|
|
1761
|
+
payload: g.newRanges
|
|
1762
|
+
},
|
|
1763
|
+
source: a
|
|
1764
|
+
}
|
|
1765
|
+
}), l.unshift({
|
|
1766
|
+
id: b.id,
|
|
1767
|
+
params: {
|
|
1768
|
+
unitId: o,
|
|
1769
|
+
subUnitId: t,
|
|
1770
|
+
ruleId: g.ruleId,
|
|
1771
|
+
payload: {
|
|
1772
|
+
type: w.RANGE,
|
|
1773
|
+
payload: g.oldRanges
|
|
1774
|
+
},
|
|
1775
|
+
source: a
|
|
1776
|
+
}
|
|
1777
|
+
});
|
|
1778
|
+
const C = u.getRuleById(o, t, g.ruleId);
|
|
1779
|
+
if (C && C.type === M.CHECKBOX) {
|
|
1780
|
+
const x = u.getValidator(M.CHECKBOX).parseFormulaSync(C, o, t);
|
|
1781
|
+
p(g.newRanges, x.formula2);
|
|
2031
1782
|
}
|
|
2032
1783
|
break;
|
|
2033
1784
|
}
|
|
2034
1785
|
case "add": {
|
|
2035
|
-
if (
|
|
2036
|
-
id:
|
|
1786
|
+
if (n.push({
|
|
1787
|
+
id: U.id,
|
|
2037
1788
|
params: {
|
|
2038
|
-
unitId:
|
|
1789
|
+
unitId: o,
|
|
2039
1790
|
subUnitId: t,
|
|
2040
|
-
rule:
|
|
2041
|
-
source:
|
|
1791
|
+
rule: g.rule,
|
|
1792
|
+
source: a
|
|
2042
1793
|
}
|
|
2043
1794
|
}), l.unshift({
|
|
2044
|
-
id:
|
|
1795
|
+
id: P.id,
|
|
2045
1796
|
params: {
|
|
2046
|
-
unitId:
|
|
1797
|
+
unitId: o,
|
|
2047
1798
|
subUnitId: t,
|
|
2048
|
-
ruleId:
|
|
2049
|
-
source:
|
|
1799
|
+
ruleId: g.rule.uid,
|
|
1800
|
+
source: a
|
|
2050
1801
|
}
|
|
2051
|
-
}),
|
|
2052
|
-
const
|
|
2053
|
-
|
|
1802
|
+
}), g.rule.type === M.CHECKBOX) {
|
|
1803
|
+
const E = u.getValidator(M.CHECKBOX).parseFormulaSync(g.rule, o, t);
|
|
1804
|
+
p(g.rule.ranges, E.originFormula2);
|
|
2054
1805
|
}
|
|
2055
1806
|
break;
|
|
2056
1807
|
}
|
|
2057
1808
|
}
|
|
2058
1809
|
});
|
|
2059
|
-
const
|
|
2060
|
-
id:
|
|
1810
|
+
const S = {
|
|
1811
|
+
id: se.id,
|
|
2061
1812
|
params: {
|
|
2062
|
-
unitId:
|
|
1813
|
+
unitId: o,
|
|
2063
1814
|
subUnitId: t,
|
|
2064
|
-
cellValue:
|
|
1815
|
+
cellValue: _.getData()
|
|
2065
1816
|
}
|
|
2066
|
-
},
|
|
2067
|
-
id:
|
|
2068
|
-
params:
|
|
1817
|
+
}, y = {
|
|
1818
|
+
id: se.id,
|
|
1819
|
+
params: st(r, S.params)
|
|
2069
1820
|
};
|
|
2070
|
-
return
|
|
2071
|
-
redoMutations:
|
|
1821
|
+
return n.push(S), l.push(y), {
|
|
1822
|
+
redoMutations: n,
|
|
2072
1823
|
undoMutations: l
|
|
2073
1824
|
};
|
|
2074
1825
|
}
|
|
2075
|
-
const
|
|
2076
|
-
type:
|
|
1826
|
+
const Sr = {
|
|
1827
|
+
type: K.COMMAND,
|
|
2077
1828
|
id: "sheet.command.updateDataValidationRuleRange",
|
|
2078
|
-
handler(
|
|
1829
|
+
handler(o, t) {
|
|
2079
1830
|
if (!t)
|
|
2080
1831
|
return !1;
|
|
2081
|
-
const { unitId: e, subUnitId: r, ranges:
|
|
2082
|
-
if (!
|
|
1832
|
+
const { unitId: e, subUnitId: r, ranges: a, ruleId: i } = t, s = o.get(F), n = o.get(H), l = o.get(z);
|
|
1833
|
+
if (!s.getRuleById(e, r, i))
|
|
2083
1834
|
return !1;
|
|
2084
|
-
const c =
|
|
2085
|
-
c.updateRange(
|
|
2086
|
-
const d = c.diff(
|
|
1835
|
+
const c = s.getRuleObjectMatrix(e, r).clone();
|
|
1836
|
+
c.updateRange(i, a);
|
|
1837
|
+
const d = c.diff(s.getRules(e, r)), { redoMutations: m, undoMutations: _ } = Ae(e, r, d, o);
|
|
2087
1838
|
return l.pushUndoRedo({
|
|
2088
|
-
undoMutations:
|
|
1839
|
+
undoMutations: _,
|
|
2089
1840
|
redoMutations: m,
|
|
2090
1841
|
unitID: e
|
|
2091
|
-
}),
|
|
1842
|
+
}), Oe(m, n), !0;
|
|
2092
1843
|
}
|
|
2093
|
-
},
|
|
2094
|
-
type:
|
|
1844
|
+
}, Vr = {
|
|
1845
|
+
type: K.COMMAND,
|
|
2095
1846
|
id: "sheet.command.addDataValidation",
|
|
2096
|
-
handler(
|
|
1847
|
+
handler(o, t) {
|
|
2097
1848
|
if (!t)
|
|
2098
1849
|
return !1;
|
|
2099
|
-
const { unitId: e, subUnitId: r, rule:
|
|
2100
|
-
l.addRule(
|
|
2101
|
-
const u = l.diff(
|
|
1850
|
+
const { unitId: e, subUnitId: r, rule: a } = t, i = o.get(F), s = o.get(H), n = o.get(z), l = i.getRuleObjectMatrix(e, r).clone();
|
|
1851
|
+
l.addRule(a);
|
|
1852
|
+
const u = l.diff(i.getRules(e, r)), c = i.getValidator(a.type), d = {
|
|
2102
1853
|
unitId: e,
|
|
2103
1854
|
subUnitId: r,
|
|
2104
|
-
rule:
|
|
2105
|
-
|
|
2106
|
-
|
|
2107
|
-
|
|
2108
|
-
|
|
2109
|
-
|
|
2110
|
-
id:
|
|
1855
|
+
rule: {
|
|
1856
|
+
...a,
|
|
1857
|
+
...c == null ? void 0 : c.normalizeFormula(a, e, r)
|
|
1858
|
+
}
|
|
1859
|
+
}, { redoMutations: m, undoMutations: _ } = Ae(e, r, u, o);
|
|
1860
|
+
return m.push({
|
|
1861
|
+
id: U.id,
|
|
1862
|
+
params: d
|
|
1863
|
+
}), _.unshift({
|
|
1864
|
+
id: P.id,
|
|
2111
1865
|
params: {
|
|
2112
1866
|
unitId: e,
|
|
2113
1867
|
subUnitId: r,
|
|
2114
|
-
ruleId:
|
|
1868
|
+
ruleId: a.uid
|
|
2115
1869
|
}
|
|
2116
|
-
}),
|
|
1870
|
+
}), n.pushUndoRedo({
|
|
2117
1871
|
unitID: e,
|
|
2118
|
-
redoMutations:
|
|
2119
|
-
undoMutations:
|
|
2120
|
-
}),
|
|
1872
|
+
redoMutations: m,
|
|
1873
|
+
undoMutations: _
|
|
1874
|
+
}), Oe(m, s), !0;
|
|
2121
1875
|
}
|
|
2122
|
-
},
|
|
2123
|
-
type:
|
|
1876
|
+
}, Nr = {
|
|
1877
|
+
type: K.COMMAND,
|
|
2124
1878
|
id: "sheets.command.update-data-validation-setting",
|
|
2125
1879
|
// eslint-disable-next-line max-lines-per-function
|
|
2126
|
-
handler(
|
|
1880
|
+
handler(o, t) {
|
|
2127
1881
|
if (!t)
|
|
2128
1882
|
return !1;
|
|
2129
|
-
const e =
|
|
1883
|
+
const e = o.get(H), r = o.get(z), a = o.get(F), i = o.get(Qe), { unitId: s, subUnitId: n, ruleId: l, setting: u } = t, c = i.getValidatorItem(u.type);
|
|
2130
1884
|
if (!c)
|
|
2131
1885
|
return !1;
|
|
2132
|
-
const d =
|
|
1886
|
+
const d = a.getRuleById(s, n, l);
|
|
2133
1887
|
if (!d)
|
|
2134
1888
|
return !1;
|
|
2135
1889
|
const m = { ...d, ...u };
|
|
2136
|
-
if (!c.validatorFormula(m,
|
|
1890
|
+
if (!c.validatorFormula(m, s, n).success)
|
|
2137
1891
|
return !1;
|
|
2138
|
-
const
|
|
2139
|
-
unitId:
|
|
2140
|
-
subUnitId:
|
|
1892
|
+
const _ = {
|
|
1893
|
+
unitId: s,
|
|
1894
|
+
subUnitId: n,
|
|
2141
1895
|
ruleId: l,
|
|
2142
1896
|
payload: {
|
|
2143
|
-
type:
|
|
1897
|
+
type: w.SETTING,
|
|
2144
1898
|
payload: {
|
|
2145
1899
|
...u,
|
|
2146
|
-
...c.normalizeFormula(m,
|
|
1900
|
+
...c.normalizeFormula(m, s, n)
|
|
2147
1901
|
}
|
|
2148
1902
|
}
|
|
2149
|
-
},
|
|
2150
|
-
id:
|
|
2151
|
-
params:
|
|
2152
|
-
}],
|
|
2153
|
-
unitId:
|
|
2154
|
-
subUnitId:
|
|
1903
|
+
}, p = [{
|
|
1904
|
+
id: b.id,
|
|
1905
|
+
params: _
|
|
1906
|
+
}], S = {
|
|
1907
|
+
unitId: s,
|
|
1908
|
+
subUnitId: n,
|
|
2155
1909
|
ruleId: l,
|
|
2156
1910
|
payload: {
|
|
2157
|
-
type:
|
|
2158
|
-
payload:
|
|
1911
|
+
type: w.SETTING,
|
|
1912
|
+
payload: xt(d)
|
|
2159
1913
|
}
|
|
2160
|
-
},
|
|
2161
|
-
id:
|
|
2162
|
-
params:
|
|
1914
|
+
}, y = [{
|
|
1915
|
+
id: b.id,
|
|
1916
|
+
params: S
|
|
2163
1917
|
}];
|
|
2164
|
-
if (u.type ===
|
|
2165
|
-
const
|
|
2166
|
-
if (
|
|
2167
|
-
const L = new
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
const
|
|
2171
|
-
|
|
2172
|
-
v:
|
|
1918
|
+
if (u.type === M.CHECKBOX) {
|
|
1919
|
+
const C = d.ranges, E = o.get(D), x = Ye(E, { unitId: s, subUnitId: n });
|
|
1920
|
+
if (x) {
|
|
1921
|
+
const L = new Re(), { worksheet: J } = x, { formula2: ee = Ve, formula1: ue = Se } = d, { formula2: ce = Ve, formula1: de = Se } = u;
|
|
1922
|
+
C.forEach((Rt) => {
|
|
1923
|
+
I.foreach(Rt, (De, xe) => {
|
|
1924
|
+
const Ze = J.getCellRaw(De, xe), Je = dt(Ze);
|
|
1925
|
+
ft(Ze) || Je === String(ee) ? L.setValue(De, xe, {
|
|
1926
|
+
v: ce,
|
|
2173
1927
|
p: null
|
|
2174
|
-
}) :
|
|
2175
|
-
v:
|
|
1928
|
+
}) : Je === String(ue) && L.setValue(De, xe, {
|
|
1929
|
+
v: de,
|
|
2176
1930
|
p: null
|
|
2177
1931
|
});
|
|
2178
1932
|
});
|
|
2179
1933
|
});
|
|
2180
|
-
const
|
|
2181
|
-
id:
|
|
1934
|
+
const ze = {
|
|
1935
|
+
id: se.id,
|
|
2182
1936
|
params: {
|
|
2183
|
-
unitId:
|
|
2184
|
-
subUnitId:
|
|
1937
|
+
unitId: s,
|
|
1938
|
+
subUnitId: n,
|
|
2185
1939
|
cellValue: L.getData()
|
|
2186
1940
|
}
|
|
2187
|
-
},
|
|
2188
|
-
id:
|
|
2189
|
-
params:
|
|
1941
|
+
}, vt = {
|
|
1942
|
+
id: se.id,
|
|
1943
|
+
params: st(o, ze.params)
|
|
2190
1944
|
};
|
|
2191
|
-
|
|
1945
|
+
p.push(ze), y.push(vt);
|
|
2192
1946
|
}
|
|
2193
1947
|
}
|
|
2194
|
-
return
|
|
2195
|
-
unitID:
|
|
2196
|
-
redoMutations:
|
|
2197
|
-
undoMutations:
|
|
1948
|
+
return Oe(p, e).result ? (r.pushUndoRedo({
|
|
1949
|
+
unitID: s,
|
|
1950
|
+
redoMutations: p,
|
|
1951
|
+
undoMutations: y
|
|
2198
1952
|
}), !0) : !1;
|
|
2199
1953
|
}
|
|
2200
|
-
},
|
|
2201
|
-
type:
|
|
1954
|
+
}, Mr = {
|
|
1955
|
+
type: K.COMMAND,
|
|
2202
1956
|
id: "sheets.command.update-data-validation-options",
|
|
2203
|
-
handler(
|
|
1957
|
+
handler(o, t) {
|
|
2204
1958
|
if (!t)
|
|
2205
1959
|
return !1;
|
|
2206
|
-
const e =
|
|
1960
|
+
const e = o.get(H), r = o.get(z), a = o.get(F), { unitId: i, subUnitId: s, ruleId: n, options: l } = t, u = a.getRuleById(i, s, n);
|
|
2207
1961
|
if (!u)
|
|
2208
1962
|
return !1;
|
|
2209
1963
|
const c = {
|
|
2210
|
-
unitId:
|
|
2211
|
-
subUnitId:
|
|
2212
|
-
ruleId:
|
|
1964
|
+
unitId: i,
|
|
1965
|
+
subUnitId: s,
|
|
1966
|
+
ruleId: n,
|
|
2213
1967
|
payload: {
|
|
2214
|
-
type:
|
|
1968
|
+
type: w.OPTIONS,
|
|
2215
1969
|
payload: l
|
|
2216
1970
|
}
|
|
2217
1971
|
}, d = [{
|
|
2218
|
-
id:
|
|
1972
|
+
id: b.id,
|
|
2219
1973
|
params: c
|
|
2220
1974
|
}], m = {
|
|
2221
|
-
unitId:
|
|
2222
|
-
subUnitId:
|
|
2223
|
-
ruleId:
|
|
1975
|
+
unitId: i,
|
|
1976
|
+
subUnitId: s,
|
|
1977
|
+
ruleId: n,
|
|
2224
1978
|
payload: {
|
|
2225
|
-
type:
|
|
2226
|
-
payload:
|
|
1979
|
+
type: w.OPTIONS,
|
|
1980
|
+
payload: Lt(u)
|
|
2227
1981
|
}
|
|
2228
|
-
},
|
|
2229
|
-
id:
|
|
1982
|
+
}, _ = [{
|
|
1983
|
+
id: b.id,
|
|
2230
1984
|
params: m
|
|
2231
1985
|
}];
|
|
2232
1986
|
return r.pushUndoRedo({
|
|
2233
|
-
unitID:
|
|
1987
|
+
unitID: i,
|
|
2234
1988
|
redoMutations: d,
|
|
2235
|
-
undoMutations:
|
|
2236
|
-
}), e.executeCommand(
|
|
1989
|
+
undoMutations: _
|
|
1990
|
+
}), e.executeCommand(b.id, c), !0;
|
|
2237
1991
|
}
|
|
2238
|
-
},
|
|
2239
|
-
type:
|
|
1992
|
+
}, yr = {
|
|
1993
|
+
type: K.COMMAND,
|
|
2240
1994
|
id: "sheets.command.clear-range-data-validation",
|
|
2241
|
-
handler(
|
|
1995
|
+
handler(o, t) {
|
|
2242
1996
|
if (!t)
|
|
2243
1997
|
return !1;
|
|
2244
|
-
const { unitId: e, subUnitId: r, ranges:
|
|
2245
|
-
if (!
|
|
2246
|
-
const u =
|
|
2247
|
-
c.removeRange(
|
|
2248
|
-
const d = c.diff(l.getRules(e, r)), { redoMutations: m, undoMutations:
|
|
1998
|
+
const { unitId: e, subUnitId: r, ranges: a } = t, i = o.get(H), s = o.get(D), n = Ye(s, { unitId: e, subUnitId: r }), l = o.get(F);
|
|
1999
|
+
if (!n) return !1;
|
|
2000
|
+
const u = o.get(z), c = l.getRuleObjectMatrix(e, r).clone();
|
|
2001
|
+
c.removeRange(a);
|
|
2002
|
+
const d = c.diff(l.getRules(e, r)), { redoMutations: m, undoMutations: _ } = Ae(e, r, d, o);
|
|
2249
2003
|
return u.pushUndoRedo({
|
|
2250
2004
|
unitID: e,
|
|
2251
2005
|
redoMutations: m,
|
|
2252
|
-
undoMutations:
|
|
2253
|
-
}),
|
|
2006
|
+
undoMutations: _
|
|
2007
|
+
}), Oe(m, i).result;
|
|
2254
2008
|
}
|
|
2255
|
-
},
|
|
2256
|
-
type:
|
|
2009
|
+
}, Er = {
|
|
2010
|
+
type: K.COMMAND,
|
|
2257
2011
|
id: "sheet.command.remove-all-data-validation",
|
|
2258
|
-
handler(
|
|
2012
|
+
handler(o, t) {
|
|
2259
2013
|
if (!t)
|
|
2260
2014
|
return !1;
|
|
2261
|
-
const { unitId: e, subUnitId: r } = t,
|
|
2015
|
+
const { unitId: e, subUnitId: r } = t, a = o.get(H), i = o.get(F), s = o.get(z), n = [...i.getRules(e, r)], l = {
|
|
2262
2016
|
unitId: e,
|
|
2263
2017
|
subUnitId: r,
|
|
2264
|
-
ruleId:
|
|
2018
|
+
ruleId: n.map((d) => d.uid)
|
|
2265
2019
|
}, u = [{
|
|
2266
|
-
id:
|
|
2020
|
+
id: P.id,
|
|
2267
2021
|
params: l
|
|
2268
2022
|
}], c = [{
|
|
2269
|
-
id:
|
|
2023
|
+
id: U.id,
|
|
2270
2024
|
params: {
|
|
2271
2025
|
unitId: e,
|
|
2272
2026
|
subUnitId: r,
|
|
2273
|
-
rule:
|
|
2027
|
+
rule: n
|
|
2274
2028
|
}
|
|
2275
2029
|
}];
|
|
2276
|
-
return
|
|
2030
|
+
return s.pushUndoRedo({
|
|
2277
2031
|
redoMutations: u,
|
|
2278
2032
|
undoMutations: c,
|
|
2279
2033
|
unitID: e
|
|
2280
|
-
}),
|
|
2034
|
+
}), a.executeCommand(P.id, l), !0;
|
|
2281
2035
|
}
|
|
2282
|
-
},
|
|
2283
|
-
const e =
|
|
2284
|
-
if (Array.isArray(
|
|
2285
|
-
const l =
|
|
2036
|
+
}, Tr = (o, t) => {
|
|
2037
|
+
const e = o.get(F), { unitId: r, subUnitId: a, ruleId: i, source: s } = t;
|
|
2038
|
+
if (Array.isArray(i)) {
|
|
2039
|
+
const l = i.map((u) => e.getRuleById(r, a, u)).filter(Boolean);
|
|
2286
2040
|
return [{
|
|
2287
|
-
id:
|
|
2041
|
+
id: U.id,
|
|
2288
2042
|
params: {
|
|
2289
2043
|
unitId: r,
|
|
2290
|
-
subUnitId:
|
|
2044
|
+
subUnitId: a,
|
|
2291
2045
|
rule: l,
|
|
2292
|
-
source:
|
|
2046
|
+
source: s
|
|
2293
2047
|
}
|
|
2294
2048
|
}];
|
|
2295
2049
|
}
|
|
2296
2050
|
return [{
|
|
2297
|
-
id:
|
|
2051
|
+
id: U.id,
|
|
2298
2052
|
params: {
|
|
2299
2053
|
unitId: r,
|
|
2300
|
-
subUnitId:
|
|
2054
|
+
subUnitId: a,
|
|
2301
2055
|
rule: {
|
|
2302
|
-
...e.getRuleById(r,
|
|
2056
|
+
...e.getRuleById(r, a, i)
|
|
2303
2057
|
},
|
|
2304
|
-
index: e.getRuleIndex(r,
|
|
2058
|
+
index: e.getRuleIndex(r, a, i)
|
|
2305
2059
|
}
|
|
2306
2060
|
}];
|
|
2307
|
-
},
|
|
2308
|
-
type:
|
|
2061
|
+
}, wr = {
|
|
2062
|
+
type: K.COMMAND,
|
|
2309
2063
|
id: "sheet.command.remove-data-validation-rule",
|
|
2310
|
-
handler(
|
|
2064
|
+
handler(o, t) {
|
|
2311
2065
|
if (!t)
|
|
2312
2066
|
return !1;
|
|
2313
|
-
const { unitId: e, subUnitId: r, ruleId:
|
|
2314
|
-
id:
|
|
2067
|
+
const { unitId: e, subUnitId: r, ruleId: a } = t, i = o.get(H), s = o.get(z), n = o.get(F), l = [{
|
|
2068
|
+
id: P.id,
|
|
2315
2069
|
params: t
|
|
2316
2070
|
}], u = [{
|
|
2317
|
-
id:
|
|
2071
|
+
id: U.id,
|
|
2318
2072
|
params: {
|
|
2319
2073
|
unitId: e,
|
|
2320
2074
|
subUnitId: r,
|
|
2321
2075
|
rule: {
|
|
2322
|
-
...
|
|
2076
|
+
...n.getRuleById(e, r, a)
|
|
2323
2077
|
},
|
|
2324
|
-
index:
|
|
2078
|
+
index: n.getRuleIndex(e, r, a)
|
|
2325
2079
|
}
|
|
2326
2080
|
}];
|
|
2327
|
-
return
|
|
2081
|
+
return s.pushUndoRedo({
|
|
2328
2082
|
undoMutations: u,
|
|
2329
2083
|
redoMutations: l,
|
|
2330
2084
|
unitID: t.unitId
|
|
2331
|
-
}),
|
|
2085
|
+
}), i.executeCommand(P.id, t), !0;
|
|
2332
2086
|
}
|
|
2333
|
-
},
|
|
2334
|
-
class
|
|
2087
|
+
}, Fr = "sheets-data-validation.config", Cr = {};
|
|
2088
|
+
class Or extends q {
|
|
2335
2089
|
constructor() {
|
|
2336
2090
|
super(...arguments);
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2091
|
+
f(this, "id", M.ANY);
|
|
2092
|
+
f(this, "title", "dataValidation.any.title");
|
|
2093
|
+
f(this, "operators", []);
|
|
2094
|
+
f(this, "scopes", ["sheet"]);
|
|
2341
2095
|
}
|
|
2342
|
-
async parseFormula(e, r,
|
|
2096
|
+
async parseFormula(e, r, a) {
|
|
2343
2097
|
return {
|
|
2344
2098
|
formula1: e.formula1,
|
|
2345
2099
|
formula2: e.formula2,
|
|
2346
2100
|
isFormulaValid: !0
|
|
2347
2101
|
};
|
|
2348
2102
|
}
|
|
2349
|
-
validatorFormula(e, r,
|
|
2103
|
+
validatorFormula(e, r, a) {
|
|
2350
2104
|
return {
|
|
2351
2105
|
success: !0
|
|
2352
2106
|
};
|
|
2353
2107
|
}
|
|
2354
|
-
async isValidType(e, r,
|
|
2108
|
+
async isValidType(e, r, a) {
|
|
2355
2109
|
return !0;
|
|
2356
2110
|
}
|
|
2357
2111
|
generateRuleErrorMessage(e) {
|
|
2358
2112
|
return this.localeService.t("dataValidation.any.error");
|
|
2359
2113
|
}
|
|
2360
2114
|
}
|
|
2361
|
-
class
|
|
2115
|
+
class br extends q {
|
|
2362
2116
|
constructor() {
|
|
2363
2117
|
super(...arguments);
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
}
|
|
2370
|
-
validatorFormula(e, r,
|
|
2371
|
-
const
|
|
2118
|
+
f(this, "id", M.CUSTOM);
|
|
2119
|
+
f(this, "title", "dataValidation.custom.title");
|
|
2120
|
+
f(this, "operators", []);
|
|
2121
|
+
f(this, "scopes", ["sheet"]);
|
|
2122
|
+
f(this, "_customFormulaService", this.injector.get($));
|
|
2123
|
+
}
|
|
2124
|
+
validatorFormula(e, r, a) {
|
|
2125
|
+
const i = R(e.formula1);
|
|
2372
2126
|
return {
|
|
2373
|
-
success:
|
|
2374
|
-
formula1:
|
|
2127
|
+
success: i,
|
|
2128
|
+
formula1: i ? "" : this.localeService.t("dataValidation.validFail.formula")
|
|
2375
2129
|
};
|
|
2376
2130
|
}
|
|
2377
|
-
async parseFormula(e, r,
|
|
2131
|
+
async parseFormula(e, r, a) {
|
|
2378
2132
|
return {
|
|
2379
2133
|
formula1: void 0,
|
|
2380
2134
|
formula2: void 0,
|
|
2381
2135
|
isFormulaValid: !0
|
|
2382
2136
|
};
|
|
2383
2137
|
}
|
|
2384
|
-
async isValidType(e, r,
|
|
2385
|
-
const { column:
|
|
2386
|
-
return
|
|
2138
|
+
async isValidType(e, r, a) {
|
|
2139
|
+
const { column: i, row: s, unitId: n, subUnitId: l } = e, u = await this._customFormulaService.getCellFormulaValue(n, l, a.uid, s, i), c = u == null ? void 0 : u.v;
|
|
2140
|
+
return O(String(c)) && N.isDefine(c) && c !== "" ? u.t === yt.BOOLEAN ? !!c : typeof c == "boolean" ? c : typeof c == "number" ? !!c : typeof c == "string" ? O(c) : !!c : !1;
|
|
2387
2141
|
}
|
|
2388
2142
|
generateRuleErrorMessage(e) {
|
|
2389
2143
|
return this.localeService.t("dataValidation.custom.error");
|
|
@@ -2393,152 +2147,158 @@ class Qr extends de {
|
|
|
2393
2147
|
return this.localeService.t("dataValidation.custom.ruleName").replace("{FORMULA1}", (r = e.formula1) != null ? r : "");
|
|
2394
2148
|
}
|
|
2395
2149
|
}
|
|
2396
|
-
class
|
|
2150
|
+
class Ir extends mt {
|
|
2397
2151
|
constructor() {
|
|
2398
2152
|
super(...arguments);
|
|
2399
|
-
|
|
2400
|
-
|
|
2401
|
-
|
|
2153
|
+
f(this, "id", M.LIST_MULTIPLE);
|
|
2154
|
+
f(this, "title", "dataValidation.listMultiple.title");
|
|
2155
|
+
f(this, "skipDefaultFontRender", () => !0);
|
|
2402
2156
|
}
|
|
2403
2157
|
}
|
|
2404
|
-
class
|
|
2158
|
+
class Ar extends q {
|
|
2405
2159
|
constructor() {
|
|
2406
2160
|
super(...arguments);
|
|
2407
|
-
|
|
2408
|
-
|
|
2409
|
-
|
|
2410
|
-
|
|
2411
|
-
|
|
2412
|
-
|
|
2413
|
-
|
|
2414
|
-
|
|
2415
|
-
|
|
2416
|
-
|
|
2417
|
-
|
|
2418
|
-
|
|
2161
|
+
f(this, "_customFormulaService", this.injector.get($));
|
|
2162
|
+
f(this, "_lexerTreeBuilder", this.injector.get(Z));
|
|
2163
|
+
f(this, "id", M.WHOLE);
|
|
2164
|
+
f(this, "title", "dataValidation.whole.title");
|
|
2165
|
+
f(this, "operators", [
|
|
2166
|
+
h.BETWEEN,
|
|
2167
|
+
h.EQUAL,
|
|
2168
|
+
h.GREATER_THAN,
|
|
2169
|
+
h.GREATER_THAN_OR_EQUAL,
|
|
2170
|
+
h.LESS_THAN,
|
|
2171
|
+
h.LESS_THAN_OR_EQUAL,
|
|
2172
|
+
h.NOT_BETWEEN,
|
|
2173
|
+
h.NOT_EQUAL
|
|
2419
2174
|
]);
|
|
2420
|
-
|
|
2175
|
+
f(this, "scopes", ["sheet"]);
|
|
2421
2176
|
}
|
|
2422
2177
|
_isFormulaOrInt(e) {
|
|
2423
|
-
return !
|
|
2178
|
+
return !N.isBlank(e) && (R(e) || !Number.isNaN(+e) && Number.isInteger(+e));
|
|
2424
2179
|
}
|
|
2425
|
-
async isValidType(e, r,
|
|
2426
|
-
const { value:
|
|
2427
|
-
return !Number.isNaN(
|
|
2180
|
+
async isValidType(e, r, a) {
|
|
2181
|
+
const { value: i } = e, s = Ne(i);
|
|
2182
|
+
return !Number.isNaN(s) && Number.isInteger(s);
|
|
2428
2183
|
}
|
|
2429
|
-
transform(e, r,
|
|
2430
|
-
const { value:
|
|
2184
|
+
transform(e, r, a) {
|
|
2185
|
+
const { value: i } = e;
|
|
2431
2186
|
return {
|
|
2432
2187
|
...e,
|
|
2433
|
-
value:
|
|
2188
|
+
value: Ne(i)
|
|
2434
2189
|
};
|
|
2435
2190
|
}
|
|
2436
2191
|
_parseNumber(e) {
|
|
2437
2192
|
return e == null ? Number.NaN : +e;
|
|
2438
2193
|
}
|
|
2439
|
-
async parseFormula(e, r, i) {
|
|
2440
|
-
|
|
2441
|
-
const a = await this._formulaService.getRuleFormulaResult(r, i, e.uid), { formula1: n, formula2: o } = e, l = F(n) ? (I = (w = (S = (v = (m = a == null ? void 0 : a[0]) == null ? void 0 : m.result) == null ? void 0 : v[0]) == null ? void 0 : S[0]) == null ? void 0 : w[0][0]) == null ? void 0 : I.v : n, u = F(o) ? (L = (H = (O = (x = (M = a == null ? void 0 : a[1]) == null ? void 0 : M.result) == null ? void 0 : x[0]) == null ? void 0 : O[0]) == null ? void 0 : H[0][0]) == null ? void 0 : L.v : o, c = W(`${l}`) && W(`${u}`);
|
|
2194
|
+
async parseFormula(e, r, a, i, s) {
|
|
2195
|
+
const n = await this._customFormulaService.getCellFormulaValue(r, a, e.uid, i, s), l = await this._customFormulaService.getCellFormula2Value(r, a, e.uid, i, s), { formula1: u, formula2: c } = e, d = R(u) ? n == null ? void 0 : n.v : u, m = R(c) ? l == null ? void 0 : l.v : c, _ = O(`${d}`) && O(`${m}`);
|
|
2442
2196
|
return {
|
|
2443
|
-
formula1: this._parseNumber(
|
|
2444
|
-
formula2: this._parseNumber(
|
|
2445
|
-
isFormulaValid:
|
|
2197
|
+
formula1: this._parseNumber(d),
|
|
2198
|
+
formula2: this._parseNumber(m),
|
|
2199
|
+
isFormulaValid: _
|
|
2446
2200
|
};
|
|
2447
2201
|
}
|
|
2448
|
-
validatorFormula(e, r,
|
|
2449
|
-
const
|
|
2450
|
-
if (!
|
|
2202
|
+
validatorFormula(e, r, a) {
|
|
2203
|
+
const i = e.operator;
|
|
2204
|
+
if (!i)
|
|
2451
2205
|
return {
|
|
2452
2206
|
success: !1
|
|
2453
2207
|
};
|
|
2454
|
-
const
|
|
2208
|
+
const s = N.isDefine(e.formula1) && this._isFormulaOrInt(e.formula1), n = N.isDefine(e.formula2) && this._isFormulaOrInt(e.formula2), l = be.includes(i), u = this.localeService.t("dataValidation.validFail.number");
|
|
2455
2209
|
return l ? {
|
|
2456
|
-
success:
|
|
2457
|
-
formula1:
|
|
2458
|
-
formula2:
|
|
2210
|
+
success: s && n,
|
|
2211
|
+
formula1: s ? void 0 : u,
|
|
2212
|
+
formula2: n ? void 0 : u
|
|
2459
2213
|
} : {
|
|
2460
|
-
success:
|
|
2214
|
+
success: s,
|
|
2461
2215
|
formula1: u
|
|
2462
2216
|
};
|
|
2463
2217
|
}
|
|
2464
|
-
async validatorIsEqual(e, r,
|
|
2465
|
-
const { formula1:
|
|
2466
|
-
return Number.isNaN(
|
|
2218
|
+
async validatorIsEqual(e, r, a) {
|
|
2219
|
+
const { formula1: i } = r, { value: s } = e;
|
|
2220
|
+
return Number.isNaN(i) ? !0 : s === i;
|
|
2467
2221
|
}
|
|
2468
|
-
async validatorIsNotEqual(e, r,
|
|
2469
|
-
const { formula1:
|
|
2470
|
-
return Number.isNaN(
|
|
2222
|
+
async validatorIsNotEqual(e, r, a) {
|
|
2223
|
+
const { formula1: i } = r;
|
|
2224
|
+
return Number.isNaN(i) ? !0 : e.value !== i;
|
|
2471
2225
|
}
|
|
2472
|
-
async validatorIsBetween(e, r,
|
|
2473
|
-
const { formula1:
|
|
2474
|
-
if (Number.isNaN(
|
|
2226
|
+
async validatorIsBetween(e, r, a) {
|
|
2227
|
+
const { formula1: i, formula2: s } = r;
|
|
2228
|
+
if (Number.isNaN(i) || Number.isNaN(s))
|
|
2475
2229
|
return !0;
|
|
2476
|
-
const
|
|
2477
|
-
return e.value >=
|
|
2230
|
+
const n = Math.min(i, s), l = Math.max(i, s);
|
|
2231
|
+
return e.value >= n && e.value <= l;
|
|
2478
2232
|
}
|
|
2479
|
-
async validatorIsNotBetween(e, r,
|
|
2480
|
-
const { formula1:
|
|
2481
|
-
if (Number.isNaN(
|
|
2233
|
+
async validatorIsNotBetween(e, r, a) {
|
|
2234
|
+
const { formula1: i, formula2: s } = r;
|
|
2235
|
+
if (Number.isNaN(i) || Number.isNaN(s))
|
|
2482
2236
|
return !0;
|
|
2483
|
-
const
|
|
2484
|
-
return e.value <
|
|
2237
|
+
const n = Math.min(i, s), l = Math.max(i, s);
|
|
2238
|
+
return e.value < n || e.value > l;
|
|
2239
|
+
}
|
|
2240
|
+
async validatorIsGreaterThan(e, r, a) {
|
|
2241
|
+
const { formula1: i } = r;
|
|
2242
|
+
return Number.isNaN(i) ? !0 : e.value > i;
|
|
2485
2243
|
}
|
|
2486
|
-
async
|
|
2487
|
-
const { formula1:
|
|
2488
|
-
return Number.isNaN(
|
|
2244
|
+
async validatorIsGreaterThanOrEqual(e, r, a) {
|
|
2245
|
+
const { formula1: i } = r;
|
|
2246
|
+
return Number.isNaN(i) ? !0 : e.value >= i;
|
|
2489
2247
|
}
|
|
2490
|
-
async
|
|
2491
|
-
const { formula1:
|
|
2492
|
-
return Number.isNaN(
|
|
2248
|
+
async validatorIsLessThan(e, r, a) {
|
|
2249
|
+
const { formula1: i } = r;
|
|
2250
|
+
return Number.isNaN(i) ? !0 : e.value < i;
|
|
2493
2251
|
}
|
|
2494
|
-
async
|
|
2495
|
-
const { formula1:
|
|
2496
|
-
return Number.isNaN(
|
|
2252
|
+
async validatorIsLessThanOrEqual(e, r, a) {
|
|
2253
|
+
const { formula1: i } = r;
|
|
2254
|
+
return Number.isNaN(i) ? !0 : e.value <= i;
|
|
2497
2255
|
}
|
|
2498
|
-
|
|
2499
|
-
|
|
2500
|
-
|
|
2256
|
+
generateRuleErrorMessage(e, r) {
|
|
2257
|
+
if (!e.operator)
|
|
2258
|
+
return this.titleStr;
|
|
2259
|
+
const { transformedFormula1: a, transformedFormula2: i } = Ie(this._lexerTreeBuilder, e, r);
|
|
2260
|
+
return `${this.localeService.t(ht[e.operator]).replace(oe, a != null ? a : "").replace(ne, i != null ? i : "")}`;
|
|
2501
2261
|
}
|
|
2502
2262
|
}
|
|
2503
|
-
var
|
|
2504
|
-
for (var
|
|
2505
|
-
(
|
|
2506
|
-
return r &&
|
|
2507
|
-
},
|
|
2508
|
-
let
|
|
2509
|
-
constructor(
|
|
2510
|
-
super(), this._univerInstanceService =
|
|
2263
|
+
var Dr = Object.defineProperty, xr = Object.getOwnPropertyDescriptor, Lr = (o, t, e, r) => {
|
|
2264
|
+
for (var a = r > 1 ? void 0 : r ? xr(t, e) : t, i = o.length - 1, s; i >= 0; i--)
|
|
2265
|
+
(s = o[i]) && (a = (r ? s(t, e, a) : s(a)) || a);
|
|
2266
|
+
return r && a && Dr(t, e, a), a;
|
|
2267
|
+
}, te = (o, t) => (e, r) => t(e, r, o);
|
|
2268
|
+
let Me = class extends Et {
|
|
2269
|
+
constructor(o, t, e, r, a, i) {
|
|
2270
|
+
super(), this._univerInstanceService = o, this._dataValidatorRegistryService = t, this._injector = e, this._selectionManagerService = r, this._sheetInterceptorService = a, this._sheetDataValidationModel = i, this._init();
|
|
2511
2271
|
}
|
|
2512
2272
|
_init() {
|
|
2513
2273
|
this._registerValidators(), this._initCommandInterceptor();
|
|
2514
2274
|
}
|
|
2515
2275
|
_registerValidators() {
|
|
2516
2276
|
[
|
|
2517
|
-
|
|
2518
|
-
|
|
2519
|
-
|
|
2520
|
-
|
|
2521
|
-
|
|
2522
|
-
|
|
2523
|
-
|
|
2524
|
-
|
|
2525
|
-
|
|
2526
|
-
].forEach((
|
|
2527
|
-
const t = this._injector.createInstance(
|
|
2528
|
-
this.disposeWithMe(this._dataValidatorRegistryService.register(t)), this.disposeWithMe(
|
|
2277
|
+
Or,
|
|
2278
|
+
_r,
|
|
2279
|
+
Ar,
|
|
2280
|
+
Rr,
|
|
2281
|
+
fr,
|
|
2282
|
+
cr,
|
|
2283
|
+
mt,
|
|
2284
|
+
Ir,
|
|
2285
|
+
br
|
|
2286
|
+
].forEach((o) => {
|
|
2287
|
+
const t = this._injector.createInstance(o);
|
|
2288
|
+
this.disposeWithMe(this._dataValidatorRegistryService.register(t)), this.disposeWithMe(qe(() => this._injector.delete(o)));
|
|
2529
2289
|
});
|
|
2530
2290
|
}
|
|
2531
2291
|
_initCommandInterceptor() {
|
|
2532
2292
|
this._sheetInterceptorService.interceptCommand({
|
|
2533
|
-
getMutations: (
|
|
2293
|
+
getMutations: (o) => {
|
|
2534
2294
|
var t;
|
|
2535
|
-
if (
|
|
2536
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
2537
|
-
if (!
|
|
2295
|
+
if (o.id === Ut.id) {
|
|
2296
|
+
const e = this._univerInstanceService.getCurrentUnitForType(A.UNIVER_SHEET), r = e.getUnitId(), a = e.getActiveSheet();
|
|
2297
|
+
if (!a)
|
|
2538
2298
|
throw new Error("No active sheet found");
|
|
2539
|
-
const
|
|
2540
|
-
|
|
2541
|
-
const l =
|
|
2299
|
+
const i = a.getSheetId(), s = (t = this._selectionManagerService.getCurrentSelections()) == null ? void 0 : t.map((d) => d.range), n = this._sheetDataValidationModel.getRuleObjectMatrix(r, i).clone();
|
|
2300
|
+
s && n.removeRange(s);
|
|
2301
|
+
const l = n.diff(this._sheetDataValidationModel.getRules(r, i)), { redoMutations: u, undoMutations: c } = Ae(r, i, l, this._injector, "patched");
|
|
2542
2302
|
return {
|
|
2543
2303
|
undos: c,
|
|
2544
2304
|
redos: u
|
|
@@ -2552,97 +2312,236 @@ let ke = class extends At {
|
|
|
2552
2312
|
});
|
|
2553
2313
|
}
|
|
2554
2314
|
};
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
2558
|
-
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
2562
|
-
],
|
|
2563
|
-
var
|
|
2564
|
-
for (var
|
|
2565
|
-
(
|
|
2566
|
-
return r &&
|
|
2567
|
-
},
|
|
2568
|
-
let
|
|
2569
|
-
constructor(
|
|
2570
|
-
super(), this._univerInstanceService =
|
|
2571
|
-
}
|
|
2572
|
-
getFormulaRefCheck(
|
|
2315
|
+
Me = Lr([
|
|
2316
|
+
te(0, D),
|
|
2317
|
+
te(1, v(Qe)),
|
|
2318
|
+
te(2, v(je)),
|
|
2319
|
+
te(3, v(ot)),
|
|
2320
|
+
te(4, v(nt)),
|
|
2321
|
+
te(5, v(F))
|
|
2322
|
+
], Me);
|
|
2323
|
+
var _t = /* @__PURE__ */ ((o) => (o[o.View = 0] = "View", o[o.Edit = 1] = "Edit", o[o.ManageCollaborator = 2] = "ManageCollaborator", o[o.Print = 3] = "Print", o[o.Duplicate = 4] = "Duplicate", o[o.Comment = 5] = "Comment", o[o.Copy = 6] = "Copy", o[o.Share = 7] = "Share", o[o.Export = 8] = "Export", o[o.MoveWorksheet = 9] = "MoveWorksheet", o[o.DeleteWorksheet = 10] = "DeleteWorksheet", o[o.HideWorksheet = 11] = "HideWorksheet", o[o.RenameWorksheet = 12] = "RenameWorksheet", o[o.CreateWorksheet = 13] = "CreateWorksheet", o[o.SetWorksheetStyle = 14] = "SetWorksheetStyle", o[o.EditWorksheetCell = 15] = "EditWorksheetCell", o[o.InsertHyperlink = 16] = "InsertHyperlink", o[o.Sort = 17] = "Sort", o[o.Filter = 18] = "Filter", o[o.PivotTable = 19] = "PivotTable", o[o.FloatImg = 20] = "FloatImg", o[o.History = 21] = "History", o[o.RwHgtClWdt = 22] = "RwHgtClWdt", o[o.ViemRwHgtClWdt = 23] = "ViemRwHgtClWdt", o[o.ViewFilter = 24] = "ViewFilter", o[o.MoveSheet = 25] = "MoveSheet", o[o.DeleteSheet = 26] = "DeleteSheet", o[o.HideSheet = 27] = "HideSheet", o[o.CopySheet = 28] = "CopySheet", o[o.RenameSheet = 29] = "RenameSheet", o[o.CreateSheet = 30] = "CreateSheet", o[o.SelectProtectedCells = 31] = "SelectProtectedCells", o[o.SelectUnProtectedCells = 32] = "SelectUnProtectedCells", o[o.SetCellStyle = 33] = "SetCellStyle", o[o.SetCellValue = 34] = "SetCellValue", o[o.SetRowStyle = 35] = "SetRowStyle", o[o.SetColumnStyle = 36] = "SetColumnStyle", o[o.InsertRow = 37] = "InsertRow", o[o.InsertColumn = 38] = "InsertColumn", o[o.DeleteRow = 39] = "DeleteRow", o[o.DeleteColumn = 40] = "DeleteColumn", o[o.EditExtraObject = 41] = "EditExtraObject", o[o.Delete = 42] = "Delete", o[o.RecoverHistory = 43] = "RecoverHistory", o[o.ViewHistory = 44] = "ViewHistory", o[o.CreatePermissionObject = 45] = "CreatePermissionObject", o[o.UNRECOGNIZED = -1] = "UNRECOGNIZED", o))(_t || {}), Br = Object.defineProperty, Pr = Object.getOwnPropertyDescriptor, Ur = (o, t, e, r) => {
|
|
2324
|
+
for (var a = r > 1 ? void 0 : r ? Pr(t, e) : t, i = o.length - 1, s; i >= 0; i--)
|
|
2325
|
+
(s = o[i]) && (a = (r ? s(t, e, a) : s(a)) || a);
|
|
2326
|
+
return r && a && Br(t, e, a), a;
|
|
2327
|
+
}, Ue = (o, t) => (e, r) => t(e, r, o);
|
|
2328
|
+
let ye = class extends W {
|
|
2329
|
+
constructor(o, t, e) {
|
|
2330
|
+
super(), this._univerInstanceService = o, this._permissionService = t, this._lexerTreeBuilder = e;
|
|
2331
|
+
}
|
|
2332
|
+
getFormulaRefCheck(o) {
|
|
2573
2333
|
var e, r;
|
|
2574
|
-
const t = this._lexerTreeBuilder.sequenceNodesBuilder(
|
|
2334
|
+
const t = this._lexerTreeBuilder.sequenceNodesBuilder(o);
|
|
2575
2335
|
if (!t)
|
|
2576
2336
|
return !0;
|
|
2577
|
-
for (let
|
|
2578
|
-
const
|
|
2579
|
-
if (typeof
|
|
2337
|
+
for (let a = 0; a < t.length; a++) {
|
|
2338
|
+
const i = t[a];
|
|
2339
|
+
if (typeof i == "string")
|
|
2580
2340
|
continue;
|
|
2581
|
-
const { token:
|
|
2341
|
+
const { token: s } = i, n = Yt(s), l = this._univerInstanceService.getCurrentUnitForType(A.UNIVER_SHEET);
|
|
2582
2342
|
let u = l.getActiveSheet();
|
|
2583
2343
|
const c = l.getUnitId();
|
|
2584
|
-
if (
|
|
2585
|
-
if (u = l.getSheetBySheetName(
|
|
2344
|
+
if (n.sheetName) {
|
|
2345
|
+
if (u = l.getSheetBySheetName(n.sheetName), !u)
|
|
2586
2346
|
return !1;
|
|
2587
|
-
const
|
|
2588
|
-
if (!this._permissionService.getPermissionPoint(new
|
|
2347
|
+
const S = u == null ? void 0 : u.getSheetId();
|
|
2348
|
+
if (!this._permissionService.getPermissionPoint(new $t(c, S).id)) return !1;
|
|
2589
2349
|
}
|
|
2590
2350
|
if (!u)
|
|
2591
2351
|
return !1;
|
|
2592
|
-
const { startRow: d, endRow: m, startColumn:
|
|
2593
|
-
for (let
|
|
2594
|
-
for (let
|
|
2595
|
-
const
|
|
2596
|
-
if ((
|
|
2352
|
+
const { startRow: d, endRow: m, startColumn: _, endColumn: p } = n.range;
|
|
2353
|
+
for (let S = d; S <= m; S++)
|
|
2354
|
+
for (let y = _; y <= p; y++) {
|
|
2355
|
+
const g = (r = (e = u.getCell(S, y)) == null ? void 0 : e.selectionProtection) == null ? void 0 : r[0];
|
|
2356
|
+
if ((g == null ? void 0 : g[_t.View]) === !1)
|
|
2597
2357
|
return !1;
|
|
2598
2358
|
}
|
|
2599
2359
|
}
|
|
2600
2360
|
return !0;
|
|
2601
2361
|
}
|
|
2602
2362
|
};
|
|
2603
|
-
|
|
2604
|
-
|
|
2605
|
-
|
|
2606
|
-
|
|
2607
|
-
],
|
|
2608
|
-
var
|
|
2609
|
-
for (var
|
|
2610
|
-
(
|
|
2611
|
-
return r &&
|
|
2612
|
-
},
|
|
2613
|
-
let
|
|
2614
|
-
constructor(t, e
|
|
2363
|
+
ye = Ur([
|
|
2364
|
+
Ue(0, D),
|
|
2365
|
+
Ue(1, Tt),
|
|
2366
|
+
Ue(2, v(Z))
|
|
2367
|
+
], ye);
|
|
2368
|
+
var $r = Object.defineProperty, Hr = Object.getOwnPropertyDescriptor, Wr = (o, t, e, r) => {
|
|
2369
|
+
for (var a = r > 1 ? void 0 : r ? Hr(t, e) : t, i = o.length - 1, s; i >= 0; i--)
|
|
2370
|
+
(s = o[i]) && (a = (r ? s(t, e, a) : s(a)) || a);
|
|
2371
|
+
return r && a && $r(t, e, a), a;
|
|
2372
|
+
}, at = (o, t) => (e, r) => t(e, r, o);
|
|
2373
|
+
let Ee = class extends W {
|
|
2374
|
+
constructor(t, e) {
|
|
2615
2375
|
super();
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2376
|
+
f(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
2377
|
+
f(this, "registerRule", (t, e, r) => {
|
|
2378
|
+
le(r.type) && this.register(t, e, r);
|
|
2619
2379
|
});
|
|
2620
|
-
this._dataValidationModel = t, this.
|
|
2380
|
+
this._dataValidationModel = t, this._formulaRefRangeService = e, this._initRefRange();
|
|
2621
2381
|
}
|
|
2622
2382
|
_getIdWithUnitId(t, e, r) {
|
|
2623
2383
|
return `${t}_${e}_${r}`;
|
|
2624
2384
|
}
|
|
2625
2385
|
// eslint-disable-next-line max-lines-per-function
|
|
2386
|
+
register(t, e, r) {
|
|
2387
|
+
const a = r.ranges, i = r.formula1, s = r.formula2, n = this._formulaRefRangeService.registerRangeFormula(t, e, a, [i != null ? i : "", s != null ? s : ""], (u) => {
|
|
2388
|
+
if (u.length === 0)
|
|
2389
|
+
return {
|
|
2390
|
+
undos: [{
|
|
2391
|
+
id: U.id,
|
|
2392
|
+
params: {
|
|
2393
|
+
unitId: t,
|
|
2394
|
+
subUnitId: e,
|
|
2395
|
+
rule: r
|
|
2396
|
+
}
|
|
2397
|
+
}],
|
|
2398
|
+
redos: [{
|
|
2399
|
+
id: P.id,
|
|
2400
|
+
params: {
|
|
2401
|
+
unitId: t,
|
|
2402
|
+
subUnitId: e,
|
|
2403
|
+
ruleId: r.uid
|
|
2404
|
+
}
|
|
2405
|
+
}]
|
|
2406
|
+
};
|
|
2407
|
+
const c = [], d = [], m = u[0];
|
|
2408
|
+
c.push({
|
|
2409
|
+
id: b.id,
|
|
2410
|
+
params: {
|
|
2411
|
+
unitId: t,
|
|
2412
|
+
subUnitId: e,
|
|
2413
|
+
ruleId: r.uid,
|
|
2414
|
+
payload: {
|
|
2415
|
+
type: w.ALL,
|
|
2416
|
+
payload: {
|
|
2417
|
+
ranges: m.ranges,
|
|
2418
|
+
formula1: m.formulas[0],
|
|
2419
|
+
formula2: m.formulas[1]
|
|
2420
|
+
}
|
|
2421
|
+
}
|
|
2422
|
+
}
|
|
2423
|
+
}), d.push({
|
|
2424
|
+
id: b.id,
|
|
2425
|
+
params: {
|
|
2426
|
+
unitId: t,
|
|
2427
|
+
subUnitId: e,
|
|
2428
|
+
ruleId: r.uid,
|
|
2429
|
+
payload: {
|
|
2430
|
+
type: w.ALL,
|
|
2431
|
+
payload: {
|
|
2432
|
+
ranges: a,
|
|
2433
|
+
formula1: i,
|
|
2434
|
+
formula2: s
|
|
2435
|
+
}
|
|
2436
|
+
}
|
|
2437
|
+
}
|
|
2438
|
+
});
|
|
2439
|
+
for (let _ = 1; _ < u.length; _++) {
|
|
2440
|
+
const p = u[_], S = wt();
|
|
2441
|
+
c.push({
|
|
2442
|
+
id: U.id,
|
|
2443
|
+
params: {
|
|
2444
|
+
unitId: t,
|
|
2445
|
+
subUnitId: e,
|
|
2446
|
+
rule: {
|
|
2447
|
+
...r,
|
|
2448
|
+
uid: S,
|
|
2449
|
+
formula1: p.formulas[0],
|
|
2450
|
+
formula2: p.formulas[1],
|
|
2451
|
+
ranges: p.ranges
|
|
2452
|
+
}
|
|
2453
|
+
}
|
|
2454
|
+
}), d.push({
|
|
2455
|
+
id: P.id,
|
|
2456
|
+
params: {
|
|
2457
|
+
unitId: t,
|
|
2458
|
+
subUnitId: e,
|
|
2459
|
+
ruleId: S
|
|
2460
|
+
}
|
|
2461
|
+
});
|
|
2462
|
+
}
|
|
2463
|
+
return {
|
|
2464
|
+
undos: d,
|
|
2465
|
+
redos: c
|
|
2466
|
+
};
|
|
2467
|
+
}), l = this._getIdWithUnitId(t, e, r.uid);
|
|
2468
|
+
this._disposableMap.set(l, n);
|
|
2469
|
+
}
|
|
2470
|
+
_initRefRange() {
|
|
2471
|
+
const t = this._dataValidationModel.getAll();
|
|
2472
|
+
for (const [e, r] of t)
|
|
2473
|
+
for (const [a, i] of r)
|
|
2474
|
+
for (const s of i)
|
|
2475
|
+
this.registerRule(e, a, s);
|
|
2476
|
+
this.disposeWithMe(
|
|
2477
|
+
this._dataValidationModel.ruleChange$.subscribe((e) => {
|
|
2478
|
+
const { unitId: r, subUnitId: a, rule: i } = e;
|
|
2479
|
+
switch (e.type) {
|
|
2480
|
+
case "add": {
|
|
2481
|
+
const s = e.rule;
|
|
2482
|
+
this.registerRule(e.unitId, e.subUnitId, s);
|
|
2483
|
+
break;
|
|
2484
|
+
}
|
|
2485
|
+
case "remove": {
|
|
2486
|
+
const s = this._disposableMap.get(this._getIdWithUnitId(r, a, i.uid));
|
|
2487
|
+
s && s.dispose();
|
|
2488
|
+
break;
|
|
2489
|
+
}
|
|
2490
|
+
case "update": {
|
|
2491
|
+
const s = e.rule, n = this._disposableMap.get(this._getIdWithUnitId(r, a, s.uid));
|
|
2492
|
+
n && n.dispose(), this.registerRule(e.unitId, e.subUnitId, s);
|
|
2493
|
+
break;
|
|
2494
|
+
}
|
|
2495
|
+
}
|
|
2496
|
+
})
|
|
2497
|
+
), this.disposeWithMe(qe(() => {
|
|
2498
|
+
this._disposableMap.forEach((e) => {
|
|
2499
|
+
e.dispose();
|
|
2500
|
+
}), this._disposableMap.clear();
|
|
2501
|
+
}));
|
|
2502
|
+
}
|
|
2503
|
+
};
|
|
2504
|
+
Ee = Wr([
|
|
2505
|
+
at(0, v(F)),
|
|
2506
|
+
at(1, v(ut))
|
|
2507
|
+
], Ee);
|
|
2508
|
+
var kr = Object.defineProperty, jr = Object.getOwnPropertyDescriptor, qr = (o, t, e, r) => {
|
|
2509
|
+
for (var a = r > 1 ? void 0 : r ? jr(t, e) : t, i = o.length - 1, s; i >= 0; i--)
|
|
2510
|
+
(s = o[i]) && (a = (r ? s(t, e, a) : s(a)) || a);
|
|
2511
|
+
return r && a && kr(t, e, a), a;
|
|
2512
|
+
}, re = (o, t) => (e, r) => t(e, r, o);
|
|
2513
|
+
let Te = class extends W {
|
|
2514
|
+
constructor(t, e, r, a, i, s) {
|
|
2515
|
+
super();
|
|
2516
|
+
f(this, "_disposableMap", /* @__PURE__ */ new Map());
|
|
2517
|
+
f(this, "registerRule", (t, e, r) => {
|
|
2518
|
+
le(r.type) || (this.register(t, e, r), this.registerFormula(t, e, r));
|
|
2519
|
+
});
|
|
2520
|
+
this._dataValidationModel = t, this._injector = e, this._refRangeService = r, this._dataValidationCustomFormulaService = a, this._dataValidationFormulaService = i, this._formulaRefRangeService = s, this._initRefRange();
|
|
2521
|
+
}
|
|
2522
|
+
_getIdWithUnitId(t, e, r) {
|
|
2523
|
+
return `${t}_${e}_${r}`;
|
|
2524
|
+
}
|
|
2626
2525
|
registerFormula(t, e, r) {
|
|
2627
|
-
var
|
|
2628
|
-
const
|
|
2629
|
-
const
|
|
2630
|
-
if (!
|
|
2526
|
+
var u;
|
|
2527
|
+
const a = r.uid, i = this._getIdWithUnitId(t, e, a), s = (u = this._disposableMap.get(i)) != null ? u : /* @__PURE__ */ new Set(), n = (c, d) => {
|
|
2528
|
+
const m = this._dataValidationModel.getRuleById(t, e, a);
|
|
2529
|
+
if (!m)
|
|
2631
2530
|
return { redos: [], undos: [] };
|
|
2632
|
-
const
|
|
2633
|
-
if (!
|
|
2531
|
+
const _ = m[c];
|
|
2532
|
+
if (!_ || _ === d)
|
|
2634
2533
|
return { redos: [], undos: [] };
|
|
2635
|
-
const
|
|
2534
|
+
const p = {
|
|
2636
2535
|
unitId: t,
|
|
2637
2536
|
subUnitId: e,
|
|
2638
2537
|
ruleId: r.uid,
|
|
2639
2538
|
payload: {
|
|
2640
|
-
type:
|
|
2539
|
+
type: w.SETTING,
|
|
2641
2540
|
payload: {
|
|
2642
|
-
type:
|
|
2643
|
-
formula1:
|
|
2644
|
-
formula2:
|
|
2645
|
-
[
|
|
2541
|
+
type: m.type,
|
|
2542
|
+
formula1: m.formula1,
|
|
2543
|
+
formula2: m.formula2,
|
|
2544
|
+
[c]: d
|
|
2646
2545
|
}
|
|
2647
2546
|
}
|
|
2648
2547
|
}, S = {
|
|
@@ -2650,188 +2549,174 @@ let je = class extends ce {
|
|
|
2650
2549
|
subUnitId: e,
|
|
2651
2550
|
ruleId: r.uid,
|
|
2652
2551
|
payload: {
|
|
2653
|
-
type:
|
|
2552
|
+
type: w.SETTING,
|
|
2654
2553
|
payload: {
|
|
2655
|
-
type:
|
|
2656
|
-
formula1:
|
|
2657
|
-
formula2:
|
|
2554
|
+
type: m.type,
|
|
2555
|
+
formula1: m.formula1,
|
|
2556
|
+
formula2: m.formula2
|
|
2658
2557
|
}
|
|
2659
2558
|
}
|
|
2660
|
-
},
|
|
2559
|
+
}, y = [
|
|
2661
2560
|
{
|
|
2662
|
-
id:
|
|
2663
|
-
params:
|
|
2561
|
+
id: b.id,
|
|
2562
|
+
params: p
|
|
2664
2563
|
}
|
|
2665
|
-
],
|
|
2564
|
+
], g = [
|
|
2666
2565
|
{
|
|
2667
|
-
id:
|
|
2566
|
+
id: b.id,
|
|
2668
2567
|
params: S
|
|
2669
2568
|
}
|
|
2670
2569
|
];
|
|
2671
|
-
return { redos:
|
|
2672
|
-
};
|
|
2673
|
-
if (
|
|
2674
|
-
const
|
|
2675
|
-
if (
|
|
2676
|
-
const
|
|
2570
|
+
return { redos: y, undos: g };
|
|
2571
|
+
}, l = this._dataValidationFormulaService.getRuleFormulaInfo(t, e, a);
|
|
2572
|
+
if (l) {
|
|
2573
|
+
const [c, d] = l;
|
|
2574
|
+
if (c) {
|
|
2575
|
+
const m = this._formulaRefRangeService.registerFormula(
|
|
2677
2576
|
t,
|
|
2678
2577
|
e,
|
|
2679
|
-
|
|
2680
|
-
(
|
|
2578
|
+
c.text,
|
|
2579
|
+
(_) => n("formula1", _)
|
|
2681
2580
|
);
|
|
2682
|
-
|
|
2581
|
+
s.add(() => m.dispose());
|
|
2683
2582
|
}
|
|
2684
|
-
|
|
2685
|
-
|
|
2686
|
-
|
|
2687
|
-
|
|
2688
|
-
|
|
2689
|
-
|
|
2690
|
-
|
|
2691
|
-
|
|
2692
|
-
c.text,
|
|
2693
|
-
(v) => o("formula1", v)
|
|
2694
|
-
);
|
|
2695
|
-
n.add(() => m.dispose());
|
|
2696
|
-
}
|
|
2697
|
-
if (d) {
|
|
2698
|
-
const m = this._formulaRefRangeService.registerFormula(
|
|
2699
|
-
t,
|
|
2700
|
-
e,
|
|
2701
|
-
d.text,
|
|
2702
|
-
(v) => o("formula2", v)
|
|
2703
|
-
);
|
|
2704
|
-
n.add(() => m.dispose());
|
|
2705
|
-
}
|
|
2583
|
+
if (d) {
|
|
2584
|
+
const m = this._formulaRefRangeService.registerFormula(
|
|
2585
|
+
t,
|
|
2586
|
+
e,
|
|
2587
|
+
d.text,
|
|
2588
|
+
(_) => n("formula2", _)
|
|
2589
|
+
);
|
|
2590
|
+
s.add(() => m.dispose());
|
|
2706
2591
|
}
|
|
2707
2592
|
}
|
|
2708
2593
|
}
|
|
2709
2594
|
register(t, e, r) {
|
|
2710
2595
|
var l;
|
|
2711
|
-
const
|
|
2712
|
-
const c = [...r.ranges], m = c.map((
|
|
2713
|
-
if (
|
|
2596
|
+
const a = (u) => {
|
|
2597
|
+
const c = [...r.ranges], m = c.map((p) => Wt(p, u)).filter((p) => !!p).flat();
|
|
2598
|
+
if (Ft(m, c))
|
|
2714
2599
|
return { redos: [], undos: [] };
|
|
2715
2600
|
if (m.length) {
|
|
2716
|
-
const
|
|
2601
|
+
const p = {
|
|
2717
2602
|
unitId: t,
|
|
2718
2603
|
subUnitId: e,
|
|
2719
2604
|
ruleId: r.uid,
|
|
2720
2605
|
payload: {
|
|
2721
|
-
type:
|
|
2606
|
+
type: w.RANGE,
|
|
2722
2607
|
payload: m
|
|
2723
2608
|
},
|
|
2724
2609
|
source: "patched"
|
|
2725
|
-
},
|
|
2726
|
-
id:
|
|
2610
|
+
}, S = [{ id: b.id, params: p }], y = [{
|
|
2611
|
+
id: b.id,
|
|
2727
2612
|
params: {
|
|
2728
2613
|
unitId: t,
|
|
2729
2614
|
subUnitId: e,
|
|
2730
2615
|
ruleId: r.uid,
|
|
2731
2616
|
payload: {
|
|
2732
|
-
type:
|
|
2617
|
+
type: w.RANGE,
|
|
2733
2618
|
payload: c
|
|
2734
2619
|
},
|
|
2735
2620
|
source: "patched"
|
|
2736
2621
|
}
|
|
2737
2622
|
}];
|
|
2738
|
-
return { redos:
|
|
2623
|
+
return { redos: S, undos: y };
|
|
2739
2624
|
} else {
|
|
2740
|
-
const
|
|
2741
|
-
return { redos:
|
|
2625
|
+
const p = { unitId: t, subUnitId: e, ruleId: r.uid }, S = [{ id: P.id, params: p }], y = Tr(this._injector, p);
|
|
2626
|
+
return { redos: S, undos: y };
|
|
2742
2627
|
}
|
|
2743
|
-
},
|
|
2628
|
+
}, i = [];
|
|
2744
2629
|
r.ranges.forEach((u) => {
|
|
2745
|
-
const c = this._refRangeService.registerRefRange(u,
|
|
2746
|
-
|
|
2630
|
+
const c = this._refRangeService.registerRefRange(u, a, t, e);
|
|
2631
|
+
i.push(() => c.dispose());
|
|
2747
2632
|
});
|
|
2748
|
-
const
|
|
2749
|
-
|
|
2633
|
+
const s = this._getIdWithUnitId(t, e, r.uid), n = (l = this._disposableMap.get(s)) != null ? l : /* @__PURE__ */ new Set();
|
|
2634
|
+
n.add(() => i.forEach((u) => u())), this._disposableMap.set(s, n);
|
|
2750
2635
|
}
|
|
2751
2636
|
_initRefRange() {
|
|
2752
2637
|
const t = this._dataValidationModel.getAll();
|
|
2753
2638
|
for (const [e, r] of t)
|
|
2754
|
-
for (const [
|
|
2755
|
-
for (const
|
|
2756
|
-
this.registerRule(e,
|
|
2639
|
+
for (const [a, i] of r)
|
|
2640
|
+
for (const s of i)
|
|
2641
|
+
this.registerRule(e, a, s);
|
|
2757
2642
|
this.disposeWithMe(
|
|
2758
2643
|
this._dataValidationModel.ruleChange$.subscribe((e) => {
|
|
2759
|
-
const { unitId: r, subUnitId:
|
|
2644
|
+
const { unitId: r, subUnitId: a, rule: i } = e;
|
|
2760
2645
|
switch (e.type) {
|
|
2761
2646
|
case "add": {
|
|
2762
|
-
const
|
|
2763
|
-
this.registerRule(e.unitId, e.subUnitId,
|
|
2647
|
+
const s = e.rule;
|
|
2648
|
+
this.registerRule(e.unitId, e.subUnitId, s);
|
|
2764
2649
|
break;
|
|
2765
2650
|
}
|
|
2766
2651
|
case "remove": {
|
|
2767
|
-
const
|
|
2768
|
-
|
|
2652
|
+
const s = this._disposableMap.get(this._getIdWithUnitId(r, a, i.uid));
|
|
2653
|
+
s && s.forEach((n) => n());
|
|
2769
2654
|
break;
|
|
2770
2655
|
}
|
|
2771
2656
|
case "update": {
|
|
2772
|
-
const
|
|
2773
|
-
|
|
2657
|
+
const s = e.rule, n = this._disposableMap.get(this._getIdWithUnitId(r, a, s.uid));
|
|
2658
|
+
n && n.forEach((l) => l()), this.registerRule(e.unitId, e.subUnitId, s);
|
|
2774
2659
|
break;
|
|
2775
2660
|
}
|
|
2776
2661
|
}
|
|
2777
2662
|
})
|
|
2778
|
-
), this.disposeWithMe(
|
|
2663
|
+
), this.disposeWithMe(qe(() => {
|
|
2779
2664
|
this._disposableMap.forEach((e) => {
|
|
2780
2665
|
e.forEach((r) => r());
|
|
2781
2666
|
}), this._disposableMap.clear();
|
|
2782
2667
|
}));
|
|
2783
2668
|
}
|
|
2784
2669
|
};
|
|
2785
|
-
|
|
2786
|
-
|
|
2787
|
-
|
|
2788
|
-
|
|
2789
|
-
|
|
2790
|
-
|
|
2791
|
-
|
|
2792
|
-
],
|
|
2793
|
-
var
|
|
2794
|
-
for (var
|
|
2795
|
-
(
|
|
2796
|
-
return r &&
|
|
2797
|
-
},
|
|
2798
|
-
let
|
|
2799
|
-
constructor(
|
|
2800
|
-
super(), this._sheetInterceptorService =
|
|
2670
|
+
Te = qr([
|
|
2671
|
+
re(0, v(F)),
|
|
2672
|
+
re(1, v(je)),
|
|
2673
|
+
re(2, v(Ht)),
|
|
2674
|
+
re(3, v($)),
|
|
2675
|
+
re(4, v(X)),
|
|
2676
|
+
re(5, v(ut))
|
|
2677
|
+
], Te);
|
|
2678
|
+
var Gr = Object.defineProperty, Qr = Object.getOwnPropertyDescriptor, Yr = (o, t, e, r) => {
|
|
2679
|
+
for (var a = r > 1 ? void 0 : r ? Qr(t, e) : t, i = o.length - 1, s; i >= 0; i--)
|
|
2680
|
+
(s = o[i]) && (a = (r ? s(t, e, a) : s(a)) || a);
|
|
2681
|
+
return r && a && Gr(t, e, a), a;
|
|
2682
|
+
}, $e = (o, t) => (e, r) => t(e, r, o);
|
|
2683
|
+
let we = class extends W {
|
|
2684
|
+
constructor(o, t, e) {
|
|
2685
|
+
super(), this._sheetInterceptorService = o, this._univerInstanceService = t, this._sheetDataValidationModel = e, this._initSheetChange();
|
|
2801
2686
|
}
|
|
2802
2687
|
_initSheetChange() {
|
|
2803
2688
|
this.disposeWithMe(
|
|
2804
2689
|
this._sheetInterceptorService.interceptCommand({
|
|
2805
|
-
getMutations: (
|
|
2690
|
+
getMutations: (o) => {
|
|
2806
2691
|
var t;
|
|
2807
|
-
if (
|
|
2808
|
-
const e =
|
|
2809
|
-
if (!i)
|
|
2810
|
-
return { redos: [], undos: [] };
|
|
2811
|
-
const a = e.subUnitId || ((t = i.getActiveSheet()) == null ? void 0 : t.getSheetId());
|
|
2692
|
+
if (o.id === kt.id) {
|
|
2693
|
+
const e = o.params, r = e.unitId || this._univerInstanceService.getCurrentUnitForType(A.UNIVER_SHEET).getUnitId(), a = this._univerInstanceService.getUniverSheetInstance(r);
|
|
2812
2694
|
if (!a)
|
|
2813
2695
|
return { redos: [], undos: [] };
|
|
2814
|
-
const
|
|
2815
|
-
if (
|
|
2696
|
+
const i = e.subUnitId || ((t = a.getActiveSheet()) == null ? void 0 : t.getSheetId());
|
|
2697
|
+
if (!i)
|
|
2698
|
+
return { redos: [], undos: [] };
|
|
2699
|
+
const s = this._sheetDataValidationModel.getRules(r, i);
|
|
2700
|
+
if (s.length === 0)
|
|
2816
2701
|
return { redos: [], undos: [] };
|
|
2817
|
-
const
|
|
2702
|
+
const n = s.map((c) => c.uid), l = {
|
|
2818
2703
|
unitId: r,
|
|
2819
|
-
subUnitId:
|
|
2820
|
-
ruleId:
|
|
2704
|
+
subUnitId: i,
|
|
2705
|
+
ruleId: n,
|
|
2821
2706
|
source: "patched"
|
|
2822
2707
|
}, u = {
|
|
2823
2708
|
unitId: r,
|
|
2824
|
-
subUnitId:
|
|
2825
|
-
rule: [...
|
|
2709
|
+
subUnitId: i,
|
|
2710
|
+
rule: [...s],
|
|
2826
2711
|
source: "patched"
|
|
2827
2712
|
};
|
|
2828
2713
|
return {
|
|
2829
2714
|
redos: [{
|
|
2830
|
-
id:
|
|
2715
|
+
id: P.id,
|
|
2831
2716
|
params: l
|
|
2832
2717
|
}],
|
|
2833
2718
|
undos: [{
|
|
2834
|
-
id:
|
|
2719
|
+
id: U.id,
|
|
2835
2720
|
params: u
|
|
2836
2721
|
}]
|
|
2837
2722
|
};
|
|
@@ -2842,188 +2727,189 @@ let qe = class extends ce {
|
|
|
2842
2727
|
);
|
|
2843
2728
|
}
|
|
2844
2729
|
};
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
],
|
|
2850
|
-
var
|
|
2851
|
-
for (var
|
|
2852
|
-
(
|
|
2853
|
-
return r &&
|
|
2854
|
-
},
|
|
2855
|
-
let
|
|
2856
|
-
constructor(
|
|
2857
|
-
super(), this._univerInstanceService =
|
|
2730
|
+
we = Yr([
|
|
2731
|
+
$e(0, v(nt)),
|
|
2732
|
+
$e(1, v(D)),
|
|
2733
|
+
$e(2, v(F))
|
|
2734
|
+
], we);
|
|
2735
|
+
var Xr = Object.defineProperty, Kr = Object.getOwnPropertyDescriptor, zr = (o, t, e, r) => {
|
|
2736
|
+
for (var a = r > 1 ? void 0 : r ? Kr(t, e) : t, i = o.length - 1, s; i >= 0; i--)
|
|
2737
|
+
(s = o[i]) && (a = (r ? s(t, e, a) : s(a)) || a);
|
|
2738
|
+
return r && a && Xr(t, e, a), a;
|
|
2739
|
+
}, ge = (o, t) => (e, r) => t(e, r, o);
|
|
2740
|
+
let Fe = class extends W {
|
|
2741
|
+
constructor(o, t, e, r) {
|
|
2742
|
+
super(), this._univerInstanceService = o, this._sheetDataValidationModel = t, this._dataValidationCacheService = e, this._lifecycleService = r, this._initRecalculate();
|
|
2858
2743
|
}
|
|
2859
2744
|
_initRecalculate() {
|
|
2860
|
-
const
|
|
2745
|
+
const o = (t) => {
|
|
2861
2746
|
if (t.length === 0)
|
|
2862
2747
|
return;
|
|
2863
|
-
const e = this._univerInstanceService.getCurrentUnitForType(
|
|
2864
|
-
t.flat().forEach((
|
|
2865
|
-
i
|
|
2866
|
-
const
|
|
2867
|
-
|
|
2868
|
-
}), Object.entries(
|
|
2869
|
-
Object.entries(
|
|
2870
|
-
(e == null ? void 0 : e.getUnitId()) ===
|
|
2871
|
-
this.validatorRanges(
|
|
2748
|
+
const e = this._univerInstanceService.getCurrentUnitForType(A.UNIVER_SHEET), r = e == null ? void 0 : e.getActiveSheet(), a = {};
|
|
2749
|
+
t.flat().forEach((i) => {
|
|
2750
|
+
a[i.unitId] || (a[i.unitId] = {}), a[i.unitId][i.subUnitId] || (a[i.unitId][i.subUnitId] = []);
|
|
2751
|
+
const s = this._univerInstanceService.getUnit(i.unitId, A.UNIVER_SHEET), n = s == null ? void 0 : s.getSheetBySheetId(i.subUnitId);
|
|
2752
|
+
n && a[i.unitId][i.subUnitId].push(...i.ranges.map((l) => I.transformRange(l, n)));
|
|
2753
|
+
}), Object.entries(a).forEach(([i, s]) => {
|
|
2754
|
+
Object.entries(s).forEach(([n, l]) => {
|
|
2755
|
+
(e == null ? void 0 : e.getUnitId()) === i && (r == null ? void 0 : r.getSheetId()) === n ? this.validatorRanges(i, n, l) : requestIdleCallback(() => {
|
|
2756
|
+
this.validatorRanges(i, n, l);
|
|
2872
2757
|
});
|
|
2873
2758
|
});
|
|
2874
2759
|
});
|
|
2875
2760
|
};
|
|
2876
|
-
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(
|
|
2761
|
+
this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(jt(() => this._lifecycleService.lifecycle$.pipe(tt((t) => t === et.Rendered)))).subscribe(o)), this.disposeWithMe(this._dataValidationCacheService.dirtyRanges$.pipe(tt(() => this._lifecycleService.stage >= et.Rendered), Ot(20)).subscribe(o));
|
|
2877
2762
|
}
|
|
2878
|
-
async validatorCell(
|
|
2879
|
-
const
|
|
2880
|
-
if (!i)
|
|
2881
|
-
throw new Error(`cannot find current workbook, unitId: ${s}`);
|
|
2882
|
-
const a = i.getSheetBySheetId(t);
|
|
2763
|
+
async validatorCell(o, t, e, r) {
|
|
2764
|
+
const a = this._univerInstanceService.getUnit(o, A.UNIVER_SHEET);
|
|
2883
2765
|
if (!a)
|
|
2766
|
+
throw new Error(`cannot find current workbook, unitId: ${o}`);
|
|
2767
|
+
const i = a.getSheetBySheetId(t);
|
|
2768
|
+
if (!i)
|
|
2884
2769
|
throw new Error(`cannot find current worksheet, sheetId: ${t}`);
|
|
2885
|
-
if (!
|
|
2770
|
+
if (!N.isDefine(e) || !N.isDefine(r))
|
|
2886
2771
|
throw new Error(`row or col is not defined, row: ${e}, col: ${r}`);
|
|
2887
|
-
const
|
|
2888
|
-
return
|
|
2889
|
-
this._sheetDataValidationModel.validator(
|
|
2890
|
-
|
|
2772
|
+
const s = this._sheetDataValidationModel.getRuleByLocation(o, t, e, r);
|
|
2773
|
+
return s ? new Promise((n) => {
|
|
2774
|
+
this._sheetDataValidationModel.validator(s, { unitId: o, subUnitId: t, row: e, col: r, worksheet: i, workbook: a }, (l) => {
|
|
2775
|
+
n(l);
|
|
2891
2776
|
});
|
|
2892
|
-
}) :
|
|
2777
|
+
}) : Y.VALID;
|
|
2893
2778
|
}
|
|
2894
|
-
validatorRanges(
|
|
2779
|
+
validatorRanges(o, t, e) {
|
|
2895
2780
|
return Promise.all(e.map((r) => {
|
|
2896
|
-
const i = [];
|
|
2897
|
-
return Q.foreach(r, (a, n) => {
|
|
2898
|
-
i.push(this.validatorCell(s, t, a, n));
|
|
2899
|
-
}), i;
|
|
2900
|
-
}));
|
|
2901
|
-
}
|
|
2902
|
-
async validatorWorksheet(s, t) {
|
|
2903
|
-
const e = this._sheetDataValidationModel.getRules(s, t);
|
|
2904
|
-
return await Promise.all(e.map((r) => Promise.all(r.ranges.map((i) => {
|
|
2905
2781
|
const a = [];
|
|
2906
|
-
return
|
|
2907
|
-
a.push(this.validatorCell(
|
|
2782
|
+
return I.foreach(r, (i, s) => {
|
|
2783
|
+
a.push(this.validatorCell(o, t, i, s));
|
|
2908
2784
|
}), a;
|
|
2909
|
-
}))
|
|
2785
|
+
}));
|
|
2786
|
+
}
|
|
2787
|
+
async validatorWorksheet(o, t) {
|
|
2788
|
+
const e = this._sheetDataValidationModel.getRules(o, t);
|
|
2789
|
+
return await Promise.all(e.map((r) => Promise.all(r.ranges.map((a) => {
|
|
2790
|
+
const i = [];
|
|
2791
|
+
return I.foreach(a, (s, n) => {
|
|
2792
|
+
i.push(this.validatorCell(o, t, s, n));
|
|
2793
|
+
}), i;
|
|
2794
|
+
})))), this._dataValidationCacheService.ensureCache(o, t);
|
|
2910
2795
|
}
|
|
2911
|
-
async validatorWorkbook(
|
|
2912
|
-
const t = this._sheetDataValidationModel.getSubUnitIds(
|
|
2913
|
-
return e.forEach((
|
|
2914
|
-
r[t[
|
|
2796
|
+
async validatorWorkbook(o) {
|
|
2797
|
+
const t = this._sheetDataValidationModel.getSubUnitIds(o), e = await Promise.all(t.map((a) => this.validatorWorksheet(o, a))), r = {};
|
|
2798
|
+
return e.forEach((a, i) => {
|
|
2799
|
+
r[t[i]] = a;
|
|
2915
2800
|
}), r;
|
|
2916
2801
|
}
|
|
2917
|
-
getDataValidations(
|
|
2918
|
-
const r = this._sheetDataValidationModel.getRuleObjectMatrix(
|
|
2919
|
-
return e.forEach((
|
|
2920
|
-
|
|
2921
|
-
const u = r.getValue(
|
|
2922
|
-
u &&
|
|
2802
|
+
getDataValidations(o, t, e) {
|
|
2803
|
+
const r = this._sheetDataValidationModel.getRuleObjectMatrix(o, t), a = /* @__PURE__ */ new Set();
|
|
2804
|
+
return e.forEach((s) => {
|
|
2805
|
+
I.foreach(s, (n, l) => {
|
|
2806
|
+
const u = r.getValue(n, l);
|
|
2807
|
+
u && a.add(u);
|
|
2923
2808
|
});
|
|
2924
|
-
}), Array.from(
|
|
2809
|
+
}), Array.from(a).map((s) => this._sheetDataValidationModel.getRuleById(o, t, s)).filter(Boolean);
|
|
2925
2810
|
}
|
|
2926
|
-
getDataValidation(
|
|
2927
|
-
return this.getDataValidations(
|
|
2811
|
+
getDataValidation(o, t, e) {
|
|
2812
|
+
return this.getDataValidations(o, t, e)[0];
|
|
2928
2813
|
}
|
|
2929
2814
|
};
|
|
2930
|
-
|
|
2931
|
-
|
|
2932
|
-
|
|
2933
|
-
|
|
2934
|
-
|
|
2935
|
-
],
|
|
2936
|
-
var
|
|
2937
|
-
for (var
|
|
2938
|
-
(
|
|
2939
|
-
return r &&
|
|
2940
|
-
},
|
|
2941
|
-
let
|
|
2942
|
-
constructor(
|
|
2943
|
-
super(), this._config =
|
|
2944
|
-
const { ...
|
|
2945
|
-
this._configService.setConfig(
|
|
2815
|
+
Fe = zr([
|
|
2816
|
+
ge(0, D),
|
|
2817
|
+
ge(1, v(F)),
|
|
2818
|
+
ge(2, v(j)),
|
|
2819
|
+
ge(3, v(Ct))
|
|
2820
|
+
], Fe);
|
|
2821
|
+
var pt = Object.defineProperty, Zr = Object.getOwnPropertyDescriptor, Jr = (o, t, e) => t in o ? pt(o, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : o[t] = e, ea = (o, t, e, r) => {
|
|
2822
|
+
for (var a = r > 1 ? void 0 : r ? Zr(t, e) : t, i = o.length - 1, s; i >= 0; i--)
|
|
2823
|
+
(s = o[i]) && (a = (r ? s(t, e, a) : s(a)) || a);
|
|
2824
|
+
return r && a && pt(t, e, a), a;
|
|
2825
|
+
}, He = (o, t) => (e, r) => t(e, r, o), gt = (o, t, e) => Jr(o, typeof t != "symbol" ? t + "" : t, e);
|
|
2826
|
+
let Ce = class extends It {
|
|
2827
|
+
constructor(o = Cr, t, e, r) {
|
|
2828
|
+
super(), this._config = o, this._injector = t, this._commandService = e, this._configService = r;
|
|
2829
|
+
const { ...a } = this._config;
|
|
2830
|
+
this._configService.setConfig(Fr, a);
|
|
2946
2831
|
}
|
|
2947
2832
|
onStarting() {
|
|
2948
2833
|
[
|
|
2949
|
-
[ue],
|
|
2950
|
-
[te],
|
|
2951
|
-
[we],
|
|
2952
|
-
[Ge],
|
|
2953
2834
|
[j],
|
|
2954
|
-
[
|
|
2955
|
-
[
|
|
2956
|
-
[
|
|
2957
|
-
[
|
|
2958
|
-
|
|
2959
|
-
|
|
2835
|
+
[X],
|
|
2836
|
+
[$],
|
|
2837
|
+
[Fe],
|
|
2838
|
+
[F],
|
|
2839
|
+
[Me],
|
|
2840
|
+
[ye],
|
|
2841
|
+
[we],
|
|
2842
|
+
[Te],
|
|
2843
|
+
[Ee]
|
|
2844
|
+
].forEach((o) => {
|
|
2845
|
+
this._injector.add(o);
|
|
2960
2846
|
}), [
|
|
2961
|
-
|
|
2962
|
-
|
|
2963
|
-
|
|
2964
|
-
|
|
2965
|
-
|
|
2966
|
-
|
|
2967
|
-
|
|
2968
|
-
].forEach((
|
|
2969
|
-
this._commandService.registerCommand(
|
|
2970
|
-
}), this._injector.get(
|
|
2847
|
+
Vr,
|
|
2848
|
+
Sr,
|
|
2849
|
+
Nr,
|
|
2850
|
+
Mr,
|
|
2851
|
+
wr,
|
|
2852
|
+
Er,
|
|
2853
|
+
yr
|
|
2854
|
+
].forEach((o) => {
|
|
2855
|
+
this._commandService.registerCommand(o);
|
|
2856
|
+
}), this._injector.get(j), this._injector.get(Fe), this._injector.get(Ee), this._injector.get(Te);
|
|
2971
2857
|
}
|
|
2972
2858
|
onReady() {
|
|
2973
|
-
this._injector.get(
|
|
2859
|
+
this._injector.get(we);
|
|
2974
2860
|
}
|
|
2975
2861
|
onRendered() {
|
|
2976
|
-
this._injector.get(
|
|
2862
|
+
this._injector.get(Me), this._injector.get(ye);
|
|
2977
2863
|
}
|
|
2978
2864
|
};
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
2985
|
-
|
|
2986
|
-
],
|
|
2987
|
-
function
|
|
2988
|
-
const e =
|
|
2865
|
+
gt(Ce, "pluginName", Xt);
|
|
2866
|
+
gt(Ce, "type", A.UNIVER_SHEET);
|
|
2867
|
+
Ce = ea([
|
|
2868
|
+
bt(Bt),
|
|
2869
|
+
He(1, v(je)),
|
|
2870
|
+
He(2, H),
|
|
2871
|
+
He(3, At)
|
|
2872
|
+
], Ce);
|
|
2873
|
+
function ca(o) {
|
|
2874
|
+
const e = o.get(ot).getCurrentSelections().map((i) => i.range);
|
|
2989
2875
|
return {
|
|
2990
|
-
uid:
|
|
2991
|
-
type:
|
|
2992
|
-
operator:
|
|
2876
|
+
uid: N.generateRandomId(6),
|
|
2877
|
+
type: M.DECIMAL,
|
|
2878
|
+
operator: h.EQUAL,
|
|
2993
2879
|
formula1: "100",
|
|
2994
2880
|
ranges: e != null ? e : [{ startColumn: 0, endColumn: 0, startRow: 0, endRow: 0 }]
|
|
2995
2881
|
};
|
|
2996
2882
|
}
|
|
2997
2883
|
export {
|
|
2998
|
-
|
|
2999
|
-
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
|
|
3004
|
-
|
|
3005
|
-
|
|
3006
|
-
|
|
3007
|
-
|
|
3008
|
-
|
|
3009
|
-
|
|
3010
|
-
|
|
3011
|
-
|
|
3012
|
-
|
|
3013
|
-
|
|
3014
|
-
|
|
3015
|
-
|
|
3016
|
-
|
|
3017
|
-
|
|
3018
|
-
|
|
3019
|
-
|
|
3020
|
-
|
|
3021
|
-
|
|
3022
|
-
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
|
|
3026
|
-
|
|
3027
|
-
|
|
3028
|
-
|
|
2884
|
+
Vr as AddSheetDataValidationCommand,
|
|
2885
|
+
Se as CHECKBOX_FORMULA_1,
|
|
2886
|
+
Ve as CHECKBOX_FORMULA_2,
|
|
2887
|
+
cr as CheckboxValidator,
|
|
2888
|
+
yr as ClearRangeDataValidationCommand,
|
|
2889
|
+
Xt as DATA_VALIDATION_PLUGIN_NAME,
|
|
2890
|
+
j as DataValidationCacheService,
|
|
2891
|
+
$ as DataValidationCustomFormulaService,
|
|
2892
|
+
ye as DataValidationFormulaController,
|
|
2893
|
+
X as DataValidationFormulaService,
|
|
2894
|
+
fr as DateValidator,
|
|
2895
|
+
Ir as ListMultipleValidator,
|
|
2896
|
+
mt as ListValidator,
|
|
2897
|
+
Er as RemoveSheetAllDataValidationCommand,
|
|
2898
|
+
wr as RemoveSheetDataValidationCommand,
|
|
2899
|
+
F as SheetDataValidationModel,
|
|
2900
|
+
Fe as SheetsDataValidationValidatorService,
|
|
2901
|
+
Ce as UniverSheetsDataValidationPlugin,
|
|
2902
|
+
Mr as UpdateSheetDataValidationOptionsCommand,
|
|
2903
|
+
Sr as UpdateSheetDataValidationRangeCommand,
|
|
2904
|
+
Nr as UpdateSheetDataValidationSettingCommand,
|
|
2905
|
+
ca as createDefaultNewRule,
|
|
2906
|
+
pe as deserializeListOptions,
|
|
2907
|
+
ae as getCellValueOrigin,
|
|
2908
|
+
ua as getDataValidationCellValue,
|
|
2909
|
+
Ae as getDataValidationDiffMutations,
|
|
2910
|
+
he as getFormulaCellData,
|
|
2911
|
+
ie as getFormulaResult,
|
|
2912
|
+
O as isLegalFormulaResult,
|
|
2913
|
+
la as serializeListOptions,
|
|
2914
|
+
_e as transformCheckboxValue
|
|
3029
2915
|
};
|