@univerjs/sheets-data-validation 0.6.0-nightly.202502111606 → 0.6.0-nightly.202502131606
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/es/facade.js +71 -70
- package/lib/es/index.js +751 -751
- package/lib/types/common/const.d.ts +1 -1
- package/lib/types/controllers/config.schema.d.ts +1 -1
- package/lib/types/facade/f-event.d.ts +3 -2
- package/lib/types/facade/f-univer.d.ts +3 -2
- package/lib/types/facade/index.d.ts +1 -1
- package/lib/types/index.d.ts +1 -1
- package/lib/types/types/const/index.d.ts +1 -1
- package/lib/types/types/index.d.ts +1 -1
- package/lib/types/types/interface/i-update-rule-formula.d.ts +1 -1
- package/lib/types/types/interface/index.d.ts +1 -1
- package/lib/types/validators/const.d.ts +1 -1
- package/lib/types/validators/index.d.ts +1 -1
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +8 -8
package/lib/es/facade.js
CHANGED
|
@@ -1,19 +1,20 @@
|
|
|
1
1
|
var H = Object.defineProperty;
|
|
2
2
|
var j = (g, e, t) => e in g ? H(g, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : g[e] = t;
|
|
3
|
-
var
|
|
4
|
-
import { UpdateSheetDataValidationSettingCommand as b, UpdateSheetDataValidationOptionsCommand as U, UpdateSheetDataValidationRangeCommand as C, RemoveSheetDataValidationCommand as A, ClearRangeDataValidationCommand as q, AddSheetDataValidationCommand as T, SheetsDataValidationValidatorService as S, SheetDataValidationModel as
|
|
3
|
+
var f = (g, e, t) => j(g, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { UpdateSheetDataValidationSettingCommand as b, UpdateSheetDataValidationOptionsCommand as U, UpdateSheetDataValidationRangeCommand as C, RemoveSheetDataValidationCommand as A, ClearRangeDataValidationCommand as q, AddSheetDataValidationCommand as T, SheetsDataValidationValidatorService as S, SheetDataValidationModel as k, RemoveSheetAllDataValidationCommand as O } from "@univerjs/sheets-data-validation";
|
|
5
5
|
import { FRange as y, FWorkbook as x, FWorksheet as N } from "@univerjs/sheets/facade";
|
|
6
|
-
import {
|
|
7
|
-
import { DataValidationModel as
|
|
8
|
-
import { serializeRangeToRefString as
|
|
6
|
+
import { DataValidationType as o, generateRandomId as L, DataValidationErrorStyle as V, DataValidationOperator as h, IUniverInstanceService as W, ICommandService as p, CanceledError as m, toDisposable as c } from "@univerjs/core";
|
|
7
|
+
import { DataValidationModel as w, getRuleOptions as $ } from "@univerjs/data-validation";
|
|
8
|
+
import { serializeRangeToRefString as F } from "@univerjs/engine-formula";
|
|
9
|
+
import { FUniver as M, FEventName as P } from "@univerjs/core/facade";
|
|
9
10
|
import { filter as R } from "rxjs";
|
|
10
11
|
class E {
|
|
11
12
|
constructor(e) {
|
|
12
|
-
|
|
13
|
+
f(this, "_rule");
|
|
13
14
|
this._rule = e != null ? e : {
|
|
14
15
|
uid: L(),
|
|
15
16
|
ranges: void 0,
|
|
16
|
-
type:
|
|
17
|
+
type: o.CUSTOM
|
|
17
18
|
};
|
|
18
19
|
}
|
|
19
20
|
/**
|
|
@@ -53,7 +54,7 @@ class E {
|
|
|
53
54
|
* ```
|
|
54
55
|
*/
|
|
55
56
|
getAllowInvalid() {
|
|
56
|
-
return this._rule.errorStyle !==
|
|
57
|
+
return this._rule.errorStyle !== V.STOP;
|
|
57
58
|
}
|
|
58
59
|
/**
|
|
59
60
|
* Gets the data validation type of the rule
|
|
@@ -103,7 +104,7 @@ class E {
|
|
|
103
104
|
* ```
|
|
104
105
|
*/
|
|
105
106
|
requireCheckbox(e, t) {
|
|
106
|
-
return this._rule.type =
|
|
107
|
+
return this._rule.type = o.CHECKBOX, this._rule.formula1 = e, this._rule.formula2 = t, this;
|
|
107
108
|
}
|
|
108
109
|
/**
|
|
109
110
|
* Set the data validation type to DATE and configure the validation rules to be after a specific date
|
|
@@ -116,7 +117,7 @@ class E {
|
|
|
116
117
|
* ```
|
|
117
118
|
*/
|
|
118
119
|
requireDateAfter(e) {
|
|
119
|
-
return this._rule.type =
|
|
120
|
+
return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.operator = h.GREATER_THAN, this;
|
|
120
121
|
}
|
|
121
122
|
/**
|
|
122
123
|
* Set the data validation type to DATE and configure the validation rules to be before a specific date
|
|
@@ -129,7 +130,7 @@ class E {
|
|
|
129
130
|
* ```
|
|
130
131
|
*/
|
|
131
132
|
requireDateBefore(e) {
|
|
132
|
-
return this._rule.type =
|
|
133
|
+
return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = h.LESS_THAN, this;
|
|
133
134
|
}
|
|
134
135
|
/**
|
|
135
136
|
* Set the data validation type to DATE and configure the validation rules to be within a specific date range
|
|
@@ -145,7 +146,7 @@ class E {
|
|
|
145
146
|
* ```
|
|
146
147
|
*/
|
|
147
148
|
requireDateBetween(e, t) {
|
|
148
|
-
return this._rule.type =
|
|
149
|
+
return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = t.toLocaleDateString(), this._rule.operator = h.BETWEEN, this;
|
|
149
150
|
}
|
|
150
151
|
/**
|
|
151
152
|
* Set the data validation type to DATE and configure the validation rules to be equal to a specific date
|
|
@@ -158,7 +159,7 @@ class E {
|
|
|
158
159
|
* ```
|
|
159
160
|
*/
|
|
160
161
|
requireDateEqualTo(e) {
|
|
161
|
-
return this._rule.type =
|
|
162
|
+
return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = h.EQUAL, this;
|
|
162
163
|
}
|
|
163
164
|
/**
|
|
164
165
|
* Set the data validation type to DATE and configure the validation rules to be not within a specific date range
|
|
@@ -174,7 +175,7 @@ class E {
|
|
|
174
175
|
* ```
|
|
175
176
|
*/
|
|
176
177
|
requireDateNotBetween(e, t) {
|
|
177
|
-
return this._rule.type =
|
|
178
|
+
return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = t.toLocaleDateString(), this._rule.operator = h.NOT_BETWEEN, this;
|
|
178
179
|
}
|
|
179
180
|
/**
|
|
180
181
|
* Set the data validation type to DATE and configure the validation rules to be on or after a specific date
|
|
@@ -187,7 +188,7 @@ class E {
|
|
|
187
188
|
* ```
|
|
188
189
|
*/
|
|
189
190
|
requireDateOnOrAfter(e) {
|
|
190
|
-
return this._rule.type =
|
|
191
|
+
return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = h.GREATER_THAN_OR_EQUAL, this;
|
|
191
192
|
}
|
|
192
193
|
/**
|
|
193
194
|
* Set the data validation type to DATE and configure the validation rules to be on or before a specific date
|
|
@@ -200,7 +201,7 @@ class E {
|
|
|
200
201
|
* ```
|
|
201
202
|
*/
|
|
202
203
|
requireDateOnOrBefore(e) {
|
|
203
|
-
return this._rule.type =
|
|
204
|
+
return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = h.LESS_THAN_OR_EQUAL, this;
|
|
204
205
|
}
|
|
205
206
|
/**
|
|
206
207
|
* Requires that a custom formula be satisfied
|
|
@@ -213,7 +214,7 @@ class E {
|
|
|
213
214
|
* ```
|
|
214
215
|
*/
|
|
215
216
|
requireFormulaSatisfied(e) {
|
|
216
|
-
return this._rule.type =
|
|
217
|
+
return this._rule.type = o.CUSTOM, this._rule.formula1 = e, this._rule.formula2 = void 0, this;
|
|
217
218
|
}
|
|
218
219
|
/**
|
|
219
220
|
* Requires the user to enter a number within a specific range, which can be integer or decimal
|
|
@@ -228,7 +229,7 @@ class E {
|
|
|
228
229
|
* ```
|
|
229
230
|
*/
|
|
230
231
|
requireNumberBetween(e, t, i) {
|
|
231
|
-
return this._rule.formula1 = `${e}`, this._rule.formula2 = `${t}`, this._rule.operator = h.BETWEEN, this._rule.type = i ?
|
|
232
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = `${t}`, this._rule.operator = h.BETWEEN, this._rule.type = i ? o.WHOLE : o.DECIMAL, this;
|
|
232
233
|
}
|
|
233
234
|
/**
|
|
234
235
|
* Requires the user to enter a number that is equal to a specific value, which can be an integer or a decimal
|
|
@@ -242,7 +243,7 @@ class E {
|
|
|
242
243
|
* ```
|
|
243
244
|
*/
|
|
244
245
|
requireNumberEqualTo(e, t) {
|
|
245
|
-
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.EQUAL, this._rule.type = t ?
|
|
246
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.EQUAL, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
|
|
246
247
|
}
|
|
247
248
|
/**
|
|
248
249
|
* Requires the user to enter a number that is greater than a specific value, which can be an integer or a decimal
|
|
@@ -256,7 +257,7 @@ class E {
|
|
|
256
257
|
* ```
|
|
257
258
|
*/
|
|
258
259
|
requireNumberGreaterThan(e, t) {
|
|
259
|
-
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.GREATER_THAN, this._rule.type = t ?
|
|
260
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.GREATER_THAN, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
|
|
260
261
|
}
|
|
261
262
|
/**
|
|
262
263
|
* Requires the user to enter a number that is greater than or equal to a specific value, which can be an integer or a decimal
|
|
@@ -270,7 +271,7 @@ class E {
|
|
|
270
271
|
* ```
|
|
271
272
|
*/
|
|
272
273
|
requireNumberGreaterThanOrEqualTo(e, t) {
|
|
273
|
-
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.GREATER_THAN_OR_EQUAL, this._rule.type = t ?
|
|
274
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.GREATER_THAN_OR_EQUAL, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
|
|
274
275
|
}
|
|
275
276
|
/**
|
|
276
277
|
* Requires the user to enter a number that is less than a specific value, which can be an integer or a decimal
|
|
@@ -284,7 +285,7 @@ class E {
|
|
|
284
285
|
* ```
|
|
285
286
|
*/
|
|
286
287
|
requireNumberLessThan(e, t) {
|
|
287
|
-
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.LESS_THAN, this._rule.type = t ?
|
|
288
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.LESS_THAN, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
|
|
288
289
|
}
|
|
289
290
|
/**
|
|
290
291
|
* Sets the data validation rule to require a number less than or equal to a specified value
|
|
@@ -299,7 +300,7 @@ class E {
|
|
|
299
300
|
* ```
|
|
300
301
|
*/
|
|
301
302
|
requireNumberLessThanOrEqualTo(e, t) {
|
|
302
|
-
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.LESS_THAN_OR_EQUAL, this._rule.type = t ?
|
|
303
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.LESS_THAN_OR_EQUAL, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
|
|
303
304
|
}
|
|
304
305
|
/**
|
|
305
306
|
* Sets a data validation rule that requires the user to enter a number outside a specified range
|
|
@@ -315,7 +316,7 @@ class E {
|
|
|
315
316
|
* ```
|
|
316
317
|
*/
|
|
317
318
|
requireNumberNotBetween(e, t, i) {
|
|
318
|
-
return this._rule.formula1 = `${e}`, this._rule.formula2 = `${t}`, this._rule.operator = h.NOT_BETWEEN, this._rule.type = i ?
|
|
319
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = `${t}`, this._rule.operator = h.NOT_BETWEEN, this._rule.type = i ? o.WHOLE : o.DECIMAL, this;
|
|
319
320
|
}
|
|
320
321
|
/**
|
|
321
322
|
* Creates a data validation rule that requires the user to enter a number that is not equal to a specific value
|
|
@@ -330,7 +331,7 @@ class E {
|
|
|
330
331
|
* ```
|
|
331
332
|
*/
|
|
332
333
|
requireNumberNotEqualTo(e, t) {
|
|
333
|
-
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.NOT_EQUAL, this._rule.type = t ?
|
|
334
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.NOT_EQUAL, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
|
|
334
335
|
}
|
|
335
336
|
/**
|
|
336
337
|
* Sets a data validation rule that requires the user to enter a value from a list of specific values
|
|
@@ -346,7 +347,7 @@ class E {
|
|
|
346
347
|
* ```
|
|
347
348
|
*/
|
|
348
349
|
requireValueInList(e, t, i) {
|
|
349
|
-
return this._rule.type = t ?
|
|
350
|
+
return this._rule.type = t ? o.LIST_MULTIPLE : o.LIST, this._rule.formula1 = e.join(","), this._rule.formula2 = void 0, this._rule.showDropDown = i != null ? i : !0, this;
|
|
350
351
|
}
|
|
351
352
|
/**
|
|
352
353
|
* Sets a data validation rule that requires the user to enter a value within a specific range
|
|
@@ -363,7 +364,7 @@ class E {
|
|
|
363
364
|
* ```
|
|
364
365
|
*/
|
|
365
366
|
requireValueInRange(e, t, i) {
|
|
366
|
-
return this._rule.type = t ?
|
|
367
|
+
return this._rule.type = t ? o.LIST_MULTIPLE : o.LIST, this._rule.formula1 = `=${F({
|
|
367
368
|
unitId: e.getUnitId(),
|
|
368
369
|
sheetName: e.getSheetName(),
|
|
369
370
|
range: e.getRange()
|
|
@@ -382,7 +383,7 @@ class E {
|
|
|
382
383
|
* ```
|
|
383
384
|
*/
|
|
384
385
|
setAllowInvalid(e) {
|
|
385
|
-
return this._rule.errorStyle = e ?
|
|
386
|
+
return this._rule.errorStyle = e ? V.WARNING : V.STOP, this;
|
|
386
387
|
}
|
|
387
388
|
/**
|
|
388
389
|
* Sets whether to allow blank values
|
|
@@ -417,9 +418,9 @@ class E {
|
|
|
417
418
|
}
|
|
418
419
|
class _ {
|
|
419
420
|
constructor(e, t, i) {
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
421
|
+
f(this, "rule");
|
|
422
|
+
f(this, "_worksheet");
|
|
423
|
+
f(this, "_injector");
|
|
423
424
|
this._injector = i, this.rule = e, this._worksheet = t;
|
|
424
425
|
}
|
|
425
426
|
/**
|
|
@@ -436,7 +437,7 @@ class _ {
|
|
|
436
437
|
* ```
|
|
437
438
|
*/
|
|
438
439
|
getAllowInvalid() {
|
|
439
|
-
return this.rule.errorStyle !==
|
|
440
|
+
return this.rule.errorStyle !== V.STOP;
|
|
440
441
|
}
|
|
441
442
|
/**
|
|
442
443
|
* Gets the data validation type of the rule
|
|
@@ -519,7 +520,7 @@ class _ {
|
|
|
519
520
|
getApplied() {
|
|
520
521
|
if (!this._worksheet)
|
|
521
522
|
return !1;
|
|
522
|
-
const t = this._injector.get(
|
|
523
|
+
const t = this._injector.get(w).getRuleById(this._worksheet.getUnitId(), this._worksheet.getSheetId(), this.rule.uid);
|
|
523
524
|
return !!(t && t.ranges.length);
|
|
524
525
|
}
|
|
525
526
|
/**
|
|
@@ -635,7 +636,7 @@ class _ {
|
|
|
635
636
|
subUnitId: this.getSheetId(),
|
|
636
637
|
ruleId: this.rule.uid,
|
|
637
638
|
options: {
|
|
638
|
-
|
|
639
|
+
...$(this.rule),
|
|
639
640
|
...e
|
|
640
641
|
}
|
|
641
642
|
}))
|
|
@@ -746,34 +747,34 @@ class Q extends M {
|
|
|
746
747
|
*/
|
|
747
748
|
// eslint-disable-next-line max-lines-per-function
|
|
748
749
|
_initialize(e) {
|
|
749
|
-
if (!e.has(
|
|
750
|
-
const t = e.get(
|
|
750
|
+
if (!e.has(k)) return;
|
|
751
|
+
const t = e.get(k), i = e.get(p);
|
|
751
752
|
this.registerEventHandler(
|
|
752
753
|
this.Event.SheetDataValidationChanged,
|
|
753
754
|
() => t.ruleChange$.subscribe((r) => {
|
|
754
|
-
const { unitId: a, subUnitId:
|
|
755
|
+
const { unitId: a, subUnitId: n, rule: u, oldRule: l, type: s } = r, d = this.getSheetTarget(a, n);
|
|
755
756
|
if (!d)
|
|
756
757
|
return;
|
|
757
|
-
const { workbook: D, worksheet: I } = d,
|
|
758
|
+
const { workbook: D, worksheet: I } = d, v = new _(u, I.getSheet(), this._injector);
|
|
758
759
|
this.fireEvent(this.Event.SheetDataValidationChanged, {
|
|
759
760
|
origin: r,
|
|
760
761
|
worksheet: I,
|
|
761
762
|
workbook: D,
|
|
762
763
|
changeType: s,
|
|
763
764
|
oldRule: l,
|
|
764
|
-
rule:
|
|
765
|
+
rule: v
|
|
765
766
|
});
|
|
766
767
|
})
|
|
767
768
|
), this.registerEventHandler(
|
|
768
769
|
this.Event.SheetDataValidatorStatusChanged,
|
|
769
770
|
() => t.validStatusChange$.subscribe((r) => {
|
|
770
|
-
const { unitId: a, subUnitId:
|
|
771
|
+
const { unitId: a, subUnitId: n, ruleId: u, status: l, row: s, col: d } = r, D = this.getSheetTarget(a, n);
|
|
771
772
|
if (!D)
|
|
772
773
|
return;
|
|
773
|
-
const { workbook: I, worksheet:
|
|
774
|
+
const { workbook: I, worksheet: v } = D, B = v.getDataValidation(u);
|
|
774
775
|
B && this.fireEvent(this.Event.SheetDataValidatorStatusChanged, {
|
|
775
776
|
workbook: I,
|
|
776
|
-
worksheet:
|
|
777
|
+
worksheet: v,
|
|
777
778
|
row: s,
|
|
778
779
|
column: d,
|
|
779
780
|
rule: B,
|
|
@@ -784,26 +785,26 @@ class Q extends M {
|
|
|
784
785
|
this.Event.BeforeSheetDataValidationAdd,
|
|
785
786
|
() => i.beforeCommandExecuted((r) => {
|
|
786
787
|
if (r.id === T.id) {
|
|
787
|
-
const a = r.params,
|
|
788
|
-
if (!
|
|
788
|
+
const a = r.params, n = this.getSheetTarget(a.unitId, a.subUnitId);
|
|
789
|
+
if (!n)
|
|
789
790
|
return;
|
|
790
|
-
const { workbook: u, worksheet: l } =
|
|
791
|
+
const { workbook: u, worksheet: l } = n, s = {
|
|
791
792
|
worksheet: l,
|
|
792
793
|
workbook: u,
|
|
793
794
|
rule: a.rule
|
|
794
795
|
};
|
|
795
796
|
if (this.fireEvent(this.Event.BeforeSheetDataValidationAdd, s), s.cancel)
|
|
796
|
-
throw new
|
|
797
|
+
throw new m();
|
|
797
798
|
}
|
|
798
799
|
})
|
|
799
800
|
), this.registerEventHandler(
|
|
800
801
|
this.Event.BeforeSheetDataValidationCriteriaUpdate,
|
|
801
802
|
() => i.beforeCommandExecuted((r) => {
|
|
802
803
|
if (r.id === b.id) {
|
|
803
|
-
const a = r.params,
|
|
804
|
-
if (!
|
|
804
|
+
const a = r.params, n = this.getSheetTarget(a.unitId, a.subUnitId);
|
|
805
|
+
if (!n)
|
|
805
806
|
return;
|
|
806
|
-
const { workbook: u, worksheet: l } =
|
|
807
|
+
const { workbook: u, worksheet: l } = n, s = l.getDataValidation(a.ruleId);
|
|
807
808
|
if (!s)
|
|
808
809
|
return;
|
|
809
810
|
const d = {
|
|
@@ -814,17 +815,17 @@ class Q extends M {
|
|
|
814
815
|
newCriteria: a.setting
|
|
815
816
|
};
|
|
816
817
|
if (this.fireEvent(this.Event.BeforeSheetDataValidationCriteriaUpdate, d), d.cancel)
|
|
817
|
-
throw new
|
|
818
|
+
throw new m();
|
|
818
819
|
}
|
|
819
820
|
})
|
|
820
821
|
), this.registerEventHandler(
|
|
821
822
|
this.Event.BeforeSheetDataValidationRangeUpdate,
|
|
822
823
|
() => i.beforeCommandExecuted((r) => {
|
|
823
824
|
if (r.id === C.id) {
|
|
824
|
-
const a = r.params,
|
|
825
|
-
if (!
|
|
825
|
+
const a = r.params, n = this.getSheetTarget(a.unitId, a.subUnitId);
|
|
826
|
+
if (!n)
|
|
826
827
|
return;
|
|
827
|
-
const { workbook: u, worksheet: l } =
|
|
828
|
+
const { workbook: u, worksheet: l } = n, s = l.getDataValidation(a.ruleId);
|
|
828
829
|
if (!s)
|
|
829
830
|
return;
|
|
830
831
|
const d = {
|
|
@@ -835,17 +836,17 @@ class Q extends M {
|
|
|
835
836
|
newRanges: a.ranges
|
|
836
837
|
};
|
|
837
838
|
if (this.fireEvent(this.Event.BeforeSheetDataValidationRangeUpdate, d), d.cancel)
|
|
838
|
-
throw new
|
|
839
|
+
throw new m();
|
|
839
840
|
}
|
|
840
841
|
})
|
|
841
842
|
), this.registerEventHandler(
|
|
842
843
|
this.Event.BeforeSheetDataValidationOptionsUpdate,
|
|
843
844
|
() => i.beforeCommandExecuted((r) => {
|
|
844
845
|
if (r.id === U.id) {
|
|
845
|
-
const a = r.params,
|
|
846
|
-
if (!
|
|
846
|
+
const a = r.params, n = this.getSheetTarget(a.unitId, a.subUnitId);
|
|
847
|
+
if (!n)
|
|
847
848
|
return;
|
|
848
|
-
const { workbook: u, worksheet: l } =
|
|
849
|
+
const { workbook: u, worksheet: l } = n, s = l.getDataValidation(a.ruleId);
|
|
849
850
|
if (!s)
|
|
850
851
|
return;
|
|
851
852
|
const d = {
|
|
@@ -856,17 +857,17 @@ class Q extends M {
|
|
|
856
857
|
newOptions: a.options
|
|
857
858
|
};
|
|
858
859
|
if (this.fireEvent(this.Event.BeforeSheetDataValidationOptionsUpdate, d), d.cancel)
|
|
859
|
-
throw new
|
|
860
|
+
throw new m();
|
|
860
861
|
}
|
|
861
862
|
})
|
|
862
863
|
), this.registerEventHandler(
|
|
863
864
|
this.Event.BeforeSheetDataValidationDelete,
|
|
864
865
|
() => i.beforeCommandExecuted((r) => {
|
|
865
866
|
if (r.id === A.id) {
|
|
866
|
-
const a = r.params,
|
|
867
|
-
if (!
|
|
867
|
+
const a = r.params, n = this.getSheetTarget(a.unitId, a.subUnitId);
|
|
868
|
+
if (!n)
|
|
868
869
|
return;
|
|
869
|
-
const { workbook: u, worksheet: l } =
|
|
870
|
+
const { workbook: u, worksheet: l } = n, s = l.getDataValidation(a.ruleId);
|
|
870
871
|
if (!s)
|
|
871
872
|
return;
|
|
872
873
|
const d = {
|
|
@@ -876,23 +877,23 @@ class Q extends M {
|
|
|
876
877
|
ruleId: a.ruleId
|
|
877
878
|
};
|
|
878
879
|
if (this.fireEvent(this.Event.BeforeSheetDataValidationDelete, d), d.cancel)
|
|
879
|
-
throw new
|
|
880
|
+
throw new m();
|
|
880
881
|
}
|
|
881
882
|
})
|
|
882
883
|
), this.registerEventHandler(
|
|
883
884
|
this.Event.BeforeSheetDataValidationDeleteAll,
|
|
884
885
|
() => i.beforeCommandExecuted((r) => {
|
|
885
886
|
if (r.id === O.id) {
|
|
886
|
-
const a = r.params,
|
|
887
|
-
if (!
|
|
887
|
+
const a = r.params, n = this.getSheetTarget(a.unitId, a.subUnitId);
|
|
888
|
+
if (!n)
|
|
888
889
|
return;
|
|
889
|
-
const { workbook: u, worksheet: l } =
|
|
890
|
+
const { workbook: u, worksheet: l } = n, s = {
|
|
890
891
|
worksheet: l,
|
|
891
892
|
workbook: u,
|
|
892
893
|
rules: l.getDataValidations()
|
|
893
894
|
};
|
|
894
895
|
if (this.fireEvent(this.Event.BeforeSheetDataValidationDeleteAll, s), s.cancel)
|
|
895
|
-
throw new
|
|
896
|
+
throw new m();
|
|
896
897
|
}
|
|
897
898
|
})
|
|
898
899
|
);
|
|
@@ -903,7 +904,7 @@ class z extends x {
|
|
|
903
904
|
_initialize() {
|
|
904
905
|
Object.defineProperty(this, "_dataValidationModel", {
|
|
905
906
|
get() {
|
|
906
|
-
return this._injector.get(
|
|
907
|
+
return this._injector.get(k);
|
|
907
908
|
}
|
|
908
909
|
});
|
|
909
910
|
}
|
|
@@ -987,7 +988,7 @@ class z extends x {
|
|
|
987
988
|
x.extend(z);
|
|
988
989
|
class K extends N {
|
|
989
990
|
getDataValidations() {
|
|
990
|
-
return this._injector.get(
|
|
991
|
+
return this._injector.get(w).getRules(this._workbook.getUnitId(), this._worksheet.getSheetId()).map((t) => new _(t, this._worksheet, this._injector));
|
|
991
992
|
}
|
|
992
993
|
getValidatorStatus() {
|
|
993
994
|
return this._injector.get(S).validatorWorksheet(
|
|
@@ -999,7 +1000,7 @@ class K extends N {
|
|
|
999
1000
|
return this.getValidatorStatus();
|
|
1000
1001
|
}
|
|
1001
1002
|
getDataValidation(e) {
|
|
1002
|
-
const i = this._injector.get(
|
|
1003
|
+
const i = this._injector.get(w).getRuleById(this._workbook.getUnitId(), this._worksheet.getSheetId(), e);
|
|
1003
1004
|
return i ? new _(i, this._worksheet, this._injector) : null;
|
|
1004
1005
|
}
|
|
1005
1006
|
}
|
|
@@ -1030,7 +1031,7 @@ class X {
|
|
|
1030
1031
|
return "BeforeSheetDataValidationOptionsUpdate";
|
|
1031
1032
|
}
|
|
1032
1033
|
}
|
|
1033
|
-
|
|
1034
|
+
P.extend(X);
|
|
1034
1035
|
export {
|
|
1035
1036
|
_ as FDataValidation,
|
|
1036
1037
|
E as FDataValidationBuilder
|