@univerjs/sheets-data-validation 0.5.0 → 0.5.1-nightly.202412011605

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