@univerjs/sheets-data-validation 0.24.0 → 0.25.0-insiders.20260608-e4336f7
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 +114 -128
- package/lib/cjs/index.js +185 -160
- package/lib/cjs/locale/ar-SA.js +139 -0
- package/lib/cjs/locale/ca-ES.js +139 -0
- package/lib/cjs/locale/de-DE.js +139 -0
- package/lib/cjs/locale/en-US.js +154 -0
- package/lib/cjs/locale/es-ES.js +139 -0
- package/lib/cjs/locale/fa-IR.js +139 -0
- package/lib/cjs/locale/fr-FR.js +139 -0
- package/lib/cjs/locale/id-ID.js +139 -0
- package/lib/cjs/locale/it-IT.js +139 -0
- package/lib/cjs/locale/ja-JP.js +139 -0
- package/lib/cjs/locale/ko-KR.js +139 -0
- package/lib/cjs/locale/pl-PL.js +139 -0
- package/lib/cjs/locale/pt-BR.js +139 -0
- package/lib/cjs/locale/ru-RU.js +139 -0
- package/lib/cjs/locale/sk-SK.js +139 -0
- package/lib/cjs/locale/vi-VN.js +139 -0
- package/lib/cjs/locale/zh-CN.js +139 -0
- package/lib/cjs/locale/zh-HK.js +139 -0
- package/lib/cjs/locale/zh-TW.js +139 -0
- package/lib/es/facade.js +115 -129
- package/lib/es/index.js +183 -156
- package/lib/es/locale/ar-SA.js +138 -0
- package/lib/es/locale/ca-ES.js +138 -0
- package/lib/es/locale/de-DE.js +138 -0
- package/lib/es/locale/en-US.js +153 -0
- package/lib/es/locale/es-ES.js +138 -0
- package/lib/es/locale/fa-IR.js +138 -0
- package/lib/es/locale/fr-FR.js +138 -0
- package/lib/es/locale/id-ID.js +138 -0
- package/lib/es/locale/it-IT.js +138 -0
- package/lib/es/locale/ja-JP.js +138 -0
- package/lib/es/locale/ko-KR.js +138 -0
- package/lib/es/locale/pl-PL.js +138 -0
- package/lib/es/locale/pt-BR.js +138 -0
- package/lib/es/locale/ru-RU.js +138 -0
- package/lib/es/locale/sk-SK.js +138 -0
- package/lib/es/locale/vi-VN.js +138 -0
- package/lib/es/locale/zh-CN.js +138 -0
- package/lib/es/locale/zh-HK.js +138 -0
- package/lib/es/locale/zh-TW.js +138 -0
- package/lib/facade.js +115 -129
- package/lib/index.js +183 -156
- package/lib/locale/ar-SA.js +138 -0
- package/lib/locale/ca-ES.js +138 -0
- package/lib/locale/de-DE.js +138 -0
- package/lib/locale/en-US.js +153 -0
- package/lib/locale/es-ES.js +138 -0
- package/lib/locale/fa-IR.js +138 -0
- package/lib/locale/fr-FR.js +138 -0
- package/lib/locale/id-ID.js +138 -0
- package/lib/locale/it-IT.js +138 -0
- package/lib/locale/ja-JP.js +138 -0
- package/lib/locale/ko-KR.js +138 -0
- package/lib/locale/pl-PL.js +138 -0
- package/lib/locale/pt-BR.js +138 -0
- package/lib/locale/ru-RU.js +138 -0
- package/lib/locale/sk-SK.js +138 -0
- package/lib/locale/vi-VN.js +138 -0
- package/lib/locale/zh-CN.js +138 -0
- package/lib/locale/zh-HK.js +138 -0
- package/lib/locale/zh-TW.js +138 -0
- package/lib/types/facade/f-data-validation-builder.d.ts +50 -25
- package/lib/types/facade/f-data-validation.d.ts +26 -13
- package/lib/types/facade/f-range.d.ts +10 -5
- package/lib/types/facade/f-univer.d.ts +2 -1
- package/lib/types/facade/f-workbook.d.ts +1 -43
- package/lib/types/facade/f-worksheet.d.ts +8 -9
- package/lib/types/index.d.ts +5 -5
- package/lib/types/locale/ar-SA.d.ts +18 -0
- package/lib/types/locale/ca-ES.d.ts +18 -0
- package/lib/types/locale/de-DE.d.ts +18 -0
- package/lib/types/locale/en-US.d.ts +156 -0
- package/lib/types/locale/es-ES.d.ts +18 -0
- package/lib/types/locale/fa-IR.d.ts +18 -0
- package/lib/types/locale/fr-FR.d.ts +18 -0
- package/lib/types/locale/id-ID.d.ts +18 -0
- package/lib/types/locale/it-IT.d.ts +18 -0
- package/lib/types/locale/ja-JP.d.ts +18 -0
- package/lib/types/locale/ko-KR.d.ts +18 -0
- package/lib/types/locale/pl-PL.d.ts +18 -0
- package/lib/types/locale/pt-BR.d.ts +18 -0
- package/lib/types/locale/ru-RU.d.ts +18 -0
- package/lib/types/locale/sk-SK.d.ts +18 -0
- package/lib/types/locale/vi-VN.d.ts +18 -0
- package/lib/types/locale/zh-CN.d.ts +18 -0
- package/lib/types/locale/zh-HK.d.ts +18 -0
- package/lib/types/locale/zh-TW.d.ts +18 -0
- package/lib/types/types/const/operator-text-map.d.ts +2 -1
- package/lib/types/validators/any-validator.d.ts +2 -2
- package/lib/types/validators/base-sheet-validator.d.ts +26 -0
- package/lib/types/validators/checkbox-validator.d.ts +2 -2
- package/lib/types/validators/custom-validator.d.ts +2 -2
- package/lib/types/validators/date-validator.d.ts +2 -2
- package/lib/types/validators/decimal-validator.d.ts +2 -2
- package/lib/types/validators/list-validator.d.ts +2 -2
- package/lib/types/validators/text-length-validator.d.ts +2 -2
- package/lib/types/validators/util.d.ts +0 -2
- package/lib/types/validators/whole-validator.d.ts +2 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -0
- package/lib/umd/locale/ca-ES.js +1 -0
- package/lib/umd/locale/de-DE.js +1 -0
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/es-ES.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/fr-FR.js +1 -0
- package/lib/umd/locale/id-ID.js +1 -0
- package/lib/umd/locale/it-IT.js +1 -0
- package/lib/umd/locale/ja-JP.js +1 -0
- package/lib/umd/locale/ko-KR.js +1 -0
- package/lib/umd/locale/pl-PL.js +1 -0
- package/lib/umd/locale/pt-BR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/sk-SK.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-HK.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +14 -9
- package/LICENSE +0 -176
package/lib/cjs/facade.js
CHANGED
|
@@ -4,10 +4,10 @@ let _univerjs_sheets_data_validation = require("@univerjs/sheets-data-validation
|
|
|
4
4
|
let _univerjs_sheets_facade = require("@univerjs/sheets/facade");
|
|
5
5
|
let _univerjs_data_validation = require("@univerjs/data-validation");
|
|
6
6
|
let _univerjs_engine_formula = require("@univerjs/engine-formula");
|
|
7
|
+
let _univerjs_sheets = require("@univerjs/sheets");
|
|
7
8
|
let _univerjs_core_facade = require("@univerjs/core/facade");
|
|
8
|
-
let rxjs = require("rxjs");
|
|
9
9
|
|
|
10
|
-
//#region \0@oxc-project+runtime@0.
|
|
10
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/typeof.js
|
|
11
11
|
function _typeof(o) {
|
|
12
12
|
"@babel/helpers - typeof";
|
|
13
13
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -18,7 +18,7 @@ function _typeof(o) {
|
|
|
18
18
|
}
|
|
19
19
|
|
|
20
20
|
//#endregion
|
|
21
|
-
//#region \0@oxc-project+runtime@0.
|
|
21
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPrimitive.js
|
|
22
22
|
function toPrimitive(t, r) {
|
|
23
23
|
if ("object" != _typeof(t) || !t) return t;
|
|
24
24
|
var e = t[Symbol.toPrimitive];
|
|
@@ -31,14 +31,14 @@ function toPrimitive(t, r) {
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
//#endregion
|
|
34
|
-
//#region \0@oxc-project+runtime@0.
|
|
34
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPropertyKey.js
|
|
35
35
|
function toPropertyKey(t) {
|
|
36
36
|
var i = toPrimitive(t, "string");
|
|
37
37
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
38
38
|
}
|
|
39
39
|
|
|
40
40
|
//#endregion
|
|
41
|
-
//#region \0@oxc-project+runtime@0.
|
|
41
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/defineProperty.js
|
|
42
42
|
function _defineProperty(e, r, t) {
|
|
43
43
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
44
44
|
value: t,
|
|
@@ -56,7 +56,8 @@ function _defineProperty(e, r, t) {
|
|
|
56
56
|
* ```typescript
|
|
57
57
|
* // Set the data validation for cell A1 to require a value from B1:B10
|
|
58
58
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
59
|
-
* const fWorksheet = fWorkbook.
|
|
59
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
60
|
+
* if (!fWorksheet) return;
|
|
60
61
|
* const fRange = fWorksheet.getRange('B1:B2');
|
|
61
62
|
* fRange.setValues([
|
|
62
63
|
* ['Yes'],
|
|
@@ -91,7 +92,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
91
92
|
* @example
|
|
92
93
|
* ```typescript
|
|
93
94
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
94
|
-
* const fWorksheet = fWorkbook.
|
|
95
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
96
|
+
* if (!fWorksheet) return;
|
|
95
97
|
*
|
|
96
98
|
* // Create a new data validation rule that requires a number between 1 and 10 for the range A1:B10
|
|
97
99
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
@@ -115,7 +117,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
115
117
|
* @example
|
|
116
118
|
* ```typescript
|
|
117
119
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
118
|
-
* const fWorksheet = fWorkbook.
|
|
120
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
121
|
+
* if (!fWorksheet) return;
|
|
119
122
|
*
|
|
120
123
|
* // Create a new data validation rule that requires a number between 1 and 10 for the range A1:B10
|
|
121
124
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
@@ -213,7 +216,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
213
216
|
* @example
|
|
214
217
|
* ```typescript
|
|
215
218
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
216
|
-
* const fWorksheet = fWorkbook.
|
|
219
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
220
|
+
* if (!fWorksheet) return;
|
|
217
221
|
*
|
|
218
222
|
* // Set the data validation for cell A1:A10 to require a checkbox with default 1 and 0 values
|
|
219
223
|
* const fRange = fWorksheet.getRange('A1:A10');
|
|
@@ -243,7 +247,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
243
247
|
* @example
|
|
244
248
|
* ```typescript
|
|
245
249
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
246
|
-
* const fWorksheet = fWorkbook.
|
|
250
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
251
|
+
* if (!fWorksheet) return;
|
|
247
252
|
*
|
|
248
253
|
* // Set some date values in the range A1:B2
|
|
249
254
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
@@ -276,7 +281,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
276
281
|
* @example
|
|
277
282
|
* ```typescript
|
|
278
283
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
279
|
-
* const fWorksheet = fWorkbook.
|
|
284
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
285
|
+
* if (!fWorksheet) return;
|
|
280
286
|
*
|
|
281
287
|
* // Set some date values in the range A1:B2
|
|
282
288
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
@@ -311,7 +317,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
311
317
|
* @example
|
|
312
318
|
* ```typescript
|
|
313
319
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
314
|
-
* const fWorksheet = fWorkbook.
|
|
320
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
321
|
+
* if (!fWorksheet) return;
|
|
315
322
|
*
|
|
316
323
|
* // Set some date values in the range A1:B2
|
|
317
324
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
@@ -345,7 +352,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
345
352
|
* @example
|
|
346
353
|
* ```typescript
|
|
347
354
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
348
|
-
* const fWorksheet = fWorkbook.
|
|
355
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
356
|
+
* if (!fWorksheet) return;
|
|
349
357
|
*
|
|
350
358
|
* // Set some date values in the range A1:B2
|
|
351
359
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
@@ -384,7 +392,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
384
392
|
* @example
|
|
385
393
|
* ```typescript
|
|
386
394
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
387
|
-
* const fWorksheet = fWorkbook.
|
|
395
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
396
|
+
* if (!fWorksheet) return;
|
|
388
397
|
*
|
|
389
398
|
* // Set some date values in the range A1:B2
|
|
390
399
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
@@ -418,7 +427,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
418
427
|
* @example
|
|
419
428
|
* ```typescript
|
|
420
429
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
421
|
-
* const fWorksheet = fWorkbook.
|
|
430
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
431
|
+
* if (!fWorksheet) return;
|
|
422
432
|
*
|
|
423
433
|
* // Set some date values in the range A1:B2
|
|
424
434
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
@@ -452,7 +462,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
452
462
|
* @example
|
|
453
463
|
* ```typescript
|
|
454
464
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
455
|
-
* const fWorksheet = fWorkbook.
|
|
465
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
466
|
+
* if (!fWorksheet) return;
|
|
456
467
|
*
|
|
457
468
|
* // Set some date values in the range A1:B2
|
|
458
469
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
@@ -486,7 +497,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
486
497
|
* @example
|
|
487
498
|
* ```typescript
|
|
488
499
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
489
|
-
* const fWorksheet = fWorkbook.
|
|
500
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
501
|
+
* if (!fWorksheet) return;
|
|
490
502
|
*
|
|
491
503
|
* // Set some values in the range A1:B2 and C1:D2
|
|
492
504
|
* const cell = fWorksheet.getRange('A1:B2');
|
|
@@ -530,7 +542,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
530
542
|
* @example
|
|
531
543
|
* ```typescript
|
|
532
544
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
533
|
-
* const fWorksheet = fWorkbook.
|
|
545
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
546
|
+
* if (!fWorksheet) return;
|
|
534
547
|
*
|
|
535
548
|
* // Create a new data validation rule that requires a number between 1 and 10 for the range A1:B10
|
|
536
549
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
@@ -560,7 +573,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
560
573
|
* @example
|
|
561
574
|
* ```typescript
|
|
562
575
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
563
|
-
* const fWorksheet = fWorkbook.
|
|
576
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
577
|
+
* if (!fWorksheet) return;
|
|
564
578
|
*
|
|
565
579
|
* // Create a new data validation rule that requires a number equal to 10 for the range A1:B10
|
|
566
580
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
@@ -590,7 +604,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
590
604
|
* @example
|
|
591
605
|
* ```typescript
|
|
592
606
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
593
|
-
* const fWorksheet = fWorkbook.
|
|
607
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
608
|
+
* if (!fWorksheet) return;
|
|
594
609
|
*
|
|
595
610
|
* // Create a new data validation rule that requires a number greater than 10 for the range A1:B10
|
|
596
611
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
@@ -620,7 +635,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
620
635
|
* @example
|
|
621
636
|
* ```typescript
|
|
622
637
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
623
|
-
* const fWorksheet = fWorkbook.
|
|
638
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
639
|
+
* if (!fWorksheet) return;
|
|
624
640
|
*
|
|
625
641
|
* // Create a new data validation rule that requires a number greater than 10 or equal to 10 for the range A1:B10
|
|
626
642
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
@@ -650,7 +666,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
650
666
|
* @example
|
|
651
667
|
* ```typescript
|
|
652
668
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
653
|
-
* const fWorksheet = fWorkbook.
|
|
669
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
670
|
+
* if (!fWorksheet) return;
|
|
654
671
|
*
|
|
655
672
|
* // Create a new data validation rule that requires a number less than 10 for the range A1:B10
|
|
656
673
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
@@ -680,7 +697,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
680
697
|
* @example
|
|
681
698
|
* ```typescript
|
|
682
699
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
683
|
-
* const fWorksheet = fWorkbook.
|
|
700
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
701
|
+
* if (!fWorksheet) return;
|
|
684
702
|
*
|
|
685
703
|
* // Create a new data validation rule that requires a number less than 10 or equal to 10 for the range A1:B10
|
|
686
704
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
@@ -711,7 +729,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
711
729
|
* @example
|
|
712
730
|
* ```typescript
|
|
713
731
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
714
|
-
* const fWorksheet = fWorkbook.
|
|
732
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
733
|
+
* if (!fWorksheet) return;
|
|
715
734
|
*
|
|
716
735
|
* // Create a new data validation rule that requires a number not between 1 and 10 for the range A1:B10
|
|
717
736
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
@@ -741,7 +760,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
741
760
|
* @example
|
|
742
761
|
* ```typescript
|
|
743
762
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
744
|
-
* const fWorksheet = fWorkbook.
|
|
763
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
764
|
+
* if (!fWorksheet) return;
|
|
745
765
|
*
|
|
746
766
|
* // Create a new data validation rule that requires a number not equal to 10 for the range A1:B10
|
|
747
767
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
@@ -773,7 +793,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
773
793
|
* @example
|
|
774
794
|
* ```typescript
|
|
775
795
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
776
|
-
* const fWorksheet = fWorkbook.
|
|
796
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
797
|
+
* if (!fWorksheet) return;
|
|
777
798
|
*
|
|
778
799
|
* // Create a new data validation rule that requires the user to enter a value from the list ['Yes', 'No'] for the range A1:B10
|
|
779
800
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
@@ -790,7 +811,7 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
790
811
|
*/
|
|
791
812
|
requireValueInList(values, multiple, showDropdown) {
|
|
792
813
|
this._rule.type = multiple ? _univerjs_core.DataValidationType.LIST_MULTIPLE : _univerjs_core.DataValidationType.LIST;
|
|
793
|
-
this._rule.formula1 =
|
|
814
|
+
this._rule.formula1 = (0, _univerjs_sheets.serializeListOptions)(values);
|
|
794
815
|
this._rule.formula2 = void 0;
|
|
795
816
|
this._rule.showDropDown = showDropdown !== null && showDropdown !== void 0 ? showDropdown : true;
|
|
796
817
|
return this;
|
|
@@ -805,7 +826,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
805
826
|
* @example
|
|
806
827
|
* ```typescript
|
|
807
828
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
808
|
-
* const fWorksheet = fWorkbook.
|
|
829
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
830
|
+
* if (!fWorksheet) return;
|
|
809
831
|
*
|
|
810
832
|
* // Set the values in the range B1:B2
|
|
811
833
|
* const fRange = fWorksheet.getRange('B1:B2');
|
|
@@ -847,7 +869,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
847
869
|
* @example
|
|
848
870
|
* ```typescript
|
|
849
871
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
850
|
-
* const fWorksheet = fWorkbook.
|
|
872
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
873
|
+
* if (!fWorksheet) return;
|
|
851
874
|
*
|
|
852
875
|
* // Set the data validation for cell A1:B2 to allow invalid data, so A1:B2 will display a warning when invalid data is entered
|
|
853
876
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
@@ -878,7 +901,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
878
901
|
* ```typescript
|
|
879
902
|
* // Assume current sheet is empty data
|
|
880
903
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
881
|
-
* const fWorksheet = fWorkbook.
|
|
904
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
905
|
+
* if (!fWorksheet) return;
|
|
882
906
|
*
|
|
883
907
|
* // Set the data validation for cell A1:B2 to allow blank values
|
|
884
908
|
* const fRange = fWorksheet.getRange('A1:B2');
|
|
@@ -908,7 +932,8 @@ var FDataValidationBuilder = class FDataValidationBuilder {
|
|
|
908
932
|
* @example
|
|
909
933
|
* ```typescript
|
|
910
934
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
911
|
-
* const fWorksheet = fWorkbook.
|
|
935
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
936
|
+
* if (!fWorksheet) return;
|
|
912
937
|
*
|
|
913
938
|
* // Create a new data validation rule that requires the user to enter a value from the list ['Yes', 'No'] for the range A1:B10
|
|
914
939
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
@@ -949,7 +974,8 @@ var FDataValidation = class {
|
|
|
949
974
|
* @example
|
|
950
975
|
* ```typescript
|
|
951
976
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
952
|
-
* const fWorksheet = fWorkbook.
|
|
977
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
978
|
+
* if (!fWorksheet) return;
|
|
953
979
|
* const rules = fWorksheet.getDataValidations();
|
|
954
980
|
* rules.forEach((rule) => {
|
|
955
981
|
* console.log(rule, rule.getAllowInvalid());
|
|
@@ -965,7 +991,8 @@ var FDataValidation = class {
|
|
|
965
991
|
* @example
|
|
966
992
|
* ```typescript
|
|
967
993
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
968
|
-
* const fWorksheet = fWorkbook.
|
|
994
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
995
|
+
* if (!fWorksheet) return;
|
|
969
996
|
* const rules = fWorksheet.getDataValidations();
|
|
970
997
|
* rules.forEach((rule) => {
|
|
971
998
|
* console.log(rule, rule.getCriteriaType());
|
|
@@ -981,7 +1008,8 @@ var FDataValidation = class {
|
|
|
981
1008
|
* @example
|
|
982
1009
|
* ```typescript
|
|
983
1010
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
984
|
-
* const fWorksheet = fWorkbook.
|
|
1011
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1012
|
+
* if (!fWorksheet) return;
|
|
985
1013
|
* const rules = fWorksheet.getDataValidations();
|
|
986
1014
|
* rules.forEach((rule) => {
|
|
987
1015
|
* console.log(rule);
|
|
@@ -1004,7 +1032,8 @@ var FDataValidation = class {
|
|
|
1004
1032
|
* @example
|
|
1005
1033
|
* ```typescript
|
|
1006
1034
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1007
|
-
* const fWorksheet = fWorkbook.
|
|
1035
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1036
|
+
* if (!fWorksheet) return;
|
|
1008
1037
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
1009
1038
|
* const rule = univerAPI.newDataValidation()
|
|
1010
1039
|
* .requireNumberBetween(1, 10)
|
|
@@ -1027,7 +1056,8 @@ var FDataValidation = class {
|
|
|
1027
1056
|
* @example
|
|
1028
1057
|
* ```typescript
|
|
1029
1058
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1030
|
-
* const fWorksheet = fWorkbook.
|
|
1059
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1060
|
+
* if (!fWorksheet) return;
|
|
1031
1061
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
1032
1062
|
* const rule = univerAPI.newDataValidation()
|
|
1033
1063
|
* .requireNumberBetween(1, 10)
|
|
@@ -1058,7 +1088,8 @@ var FDataValidation = class {
|
|
|
1058
1088
|
* @example
|
|
1059
1089
|
* ```typescript
|
|
1060
1090
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1061
|
-
* const fWorksheet = fWorkbook.
|
|
1091
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1092
|
+
* if (!fWorksheet) return;
|
|
1062
1093
|
* const rules = fWorksheet.getDataValidations();
|
|
1063
1094
|
* rules.forEach((rule) => {
|
|
1064
1095
|
* console.log(rule, rule.getApplied());
|
|
@@ -1080,7 +1111,8 @@ var FDataValidation = class {
|
|
|
1080
1111
|
* @example
|
|
1081
1112
|
* ```typescript
|
|
1082
1113
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1083
|
-
* const fWorksheet = fWorkbook.
|
|
1114
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1115
|
+
* if (!fWorksheet) return;
|
|
1084
1116
|
* const rules = fWorksheet.getDataValidations();
|
|
1085
1117
|
* rules.forEach((rule) => {
|
|
1086
1118
|
* console.log(rule);
|
|
@@ -1102,7 +1134,8 @@ var FDataValidation = class {
|
|
|
1102
1134
|
* @example
|
|
1103
1135
|
* ```typescript
|
|
1104
1136
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1105
|
-
* const fWorksheet = fWorkbook.
|
|
1137
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1138
|
+
* if (!fWorksheet) return;
|
|
1106
1139
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
1107
1140
|
* console.log(fRange.getDataValidation().getUnitId());
|
|
1108
1141
|
* ```
|
|
@@ -1117,7 +1150,8 @@ var FDataValidation = class {
|
|
|
1117
1150
|
* @example
|
|
1118
1151
|
* ```typescript
|
|
1119
1152
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1120
|
-
* const fWorksheet = fWorkbook.
|
|
1153
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1154
|
+
* if (!fWorksheet) return;
|
|
1121
1155
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
1122
1156
|
* console.log(fRange.getDataValidation().getSheetId());
|
|
1123
1157
|
* ```
|
|
@@ -1135,7 +1169,8 @@ var FDataValidation = class {
|
|
|
1135
1169
|
* @example
|
|
1136
1170
|
* ```typescript
|
|
1137
1171
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1138
|
-
* const fWorksheet = fWorkbook.
|
|
1172
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1173
|
+
* if (!fWorksheet) return;
|
|
1139
1174
|
*
|
|
1140
1175
|
* // Create a new data validation rule that requires a number equal to 20 for the range A1:B10
|
|
1141
1176
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
@@ -1180,7 +1215,8 @@ var FDataValidation = class {
|
|
|
1180
1215
|
* @example
|
|
1181
1216
|
* ```typescript
|
|
1182
1217
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1183
|
-
* const fWorksheet = fWorkbook.
|
|
1218
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1219
|
+
* if (!fWorksheet) return;
|
|
1184
1220
|
*
|
|
1185
1221
|
* // Create a new data validation rule that requires a number equal to 20 for the range A1:B10
|
|
1186
1222
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
@@ -1219,7 +1255,8 @@ var FDataValidation = class {
|
|
|
1219
1255
|
* @example
|
|
1220
1256
|
* ```typescript
|
|
1221
1257
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1222
|
-
* const fWorksheet = fWorkbook.
|
|
1258
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1259
|
+
* if (!fWorksheet) return;
|
|
1223
1260
|
*
|
|
1224
1261
|
* // Create a new data validation rule that requires a number equal to 20 for the range A1:B10
|
|
1225
1262
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
@@ -1251,7 +1288,8 @@ var FDataValidation = class {
|
|
|
1251
1288
|
* @example
|
|
1252
1289
|
* ```typescript
|
|
1253
1290
|
* const fWorkbook = univerAPI.getActiveWorkbook();
|
|
1254
|
-
* const fWorksheet = fWorkbook.
|
|
1291
|
+
* const fWorksheet = fWorkbook.getSheetByName('Sheet1');
|
|
1292
|
+
* if (!fWorksheet) return;
|
|
1255
1293
|
*
|
|
1256
1294
|
* // Create a new data validation rule that requires a number equal to 20 for the range A1:B10
|
|
1257
1295
|
* const fRange = fWorksheet.getRange('A1:B10');
|
|
@@ -1378,7 +1416,10 @@ var FUniverSheetsDataValidationMixin = class extends _univerjs_core_facade.FUniv
|
|
|
1378
1416
|
if (!injector.has(_univerjs_sheets_data_validation.SheetDataValidationModel)) return { dispose: () => {} };
|
|
1379
1417
|
return injector.get(_univerjs_sheets_data_validation.SheetDataValidationModel).ruleChange$.subscribe((ruleChange) => {
|
|
1380
1418
|
const { unitId, subUnitId, rule, oldRule, type } = ruleChange;
|
|
1381
|
-
const target = this.
|
|
1419
|
+
const target = this.getSheetCommandTarget({
|
|
1420
|
+
unitId,
|
|
1421
|
+
subUnitId
|
|
1422
|
+
});
|
|
1382
1423
|
if (!target) return;
|
|
1383
1424
|
const { workbook, worksheet } = target;
|
|
1384
1425
|
const eventParams = {
|
|
@@ -1396,7 +1437,10 @@ var FUniverSheetsDataValidationMixin = class extends _univerjs_core_facade.FUniv
|
|
|
1396
1437
|
if (!injector.has(_univerjs_sheets_data_validation.SheetDataValidationModel)) return { dispose: () => {} };
|
|
1397
1438
|
return injector.get(_univerjs_sheets_data_validation.SheetDataValidationModel).validStatusChange$.subscribe((statusChange) => {
|
|
1398
1439
|
const { unitId, subUnitId, ruleId, status, row, col } = statusChange;
|
|
1399
|
-
const target = this.
|
|
1440
|
+
const target = this.getSheetCommandTarget({
|
|
1441
|
+
unitId,
|
|
1442
|
+
subUnitId
|
|
1443
|
+
});
|
|
1400
1444
|
if (!target) return;
|
|
1401
1445
|
const { workbook, worksheet } = target;
|
|
1402
1446
|
const rule = worksheet.getDataValidation(ruleId);
|
|
@@ -1415,13 +1459,14 @@ var FUniverSheetsDataValidationMixin = class extends _univerjs_core_facade.FUniv
|
|
|
1415
1459
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDataValidationAdd, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
1416
1460
|
if (commandInfo.id === _univerjs_sheets_data_validation.AddSheetDataValidationCommand.id) {
|
|
1417
1461
|
const params = commandInfo.params;
|
|
1418
|
-
const target = this.
|
|
1462
|
+
const target = this.getSheetCommandTarget(params);
|
|
1419
1463
|
if (!target) return;
|
|
1420
1464
|
const { workbook, worksheet } = target;
|
|
1465
|
+
const { rule } = params;
|
|
1421
1466
|
const eventParams = {
|
|
1422
1467
|
worksheet,
|
|
1423
1468
|
workbook,
|
|
1424
|
-
rule
|
|
1469
|
+
rule
|
|
1425
1470
|
};
|
|
1426
1471
|
this.fireEvent(this.Event.BeforeSheetDataValidationAdd, eventParams);
|
|
1427
1472
|
if (eventParams.cancel) throw new _univerjs_core.CanceledError();
|
|
@@ -1430,17 +1475,18 @@ var FUniverSheetsDataValidationMixin = class extends _univerjs_core_facade.FUniv
|
|
|
1430
1475
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDataValidationCriteriaUpdate, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
1431
1476
|
if (commandInfo.id === _univerjs_sheets_data_validation.UpdateSheetDataValidationSettingCommand.id) {
|
|
1432
1477
|
const params = commandInfo.params;
|
|
1433
|
-
const target = this.
|
|
1478
|
+
const target = this.getSheetCommandTarget(params);
|
|
1434
1479
|
if (!target) return;
|
|
1435
1480
|
const { workbook, worksheet } = target;
|
|
1436
|
-
const
|
|
1481
|
+
const { ruleId, setting: newCriteria } = params;
|
|
1482
|
+
const rule = worksheet.getDataValidation(ruleId);
|
|
1437
1483
|
if (!rule) return;
|
|
1438
1484
|
const eventParams = {
|
|
1439
1485
|
worksheet,
|
|
1440
1486
|
workbook,
|
|
1441
1487
|
rule,
|
|
1442
|
-
ruleId
|
|
1443
|
-
newCriteria
|
|
1488
|
+
ruleId,
|
|
1489
|
+
newCriteria
|
|
1444
1490
|
};
|
|
1445
1491
|
this.fireEvent(this.Event.BeforeSheetDataValidationCriteriaUpdate, eventParams);
|
|
1446
1492
|
if (eventParams.cancel) throw new _univerjs_core.CanceledError();
|
|
@@ -1449,17 +1495,18 @@ var FUniverSheetsDataValidationMixin = class extends _univerjs_core_facade.FUniv
|
|
|
1449
1495
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDataValidationRangeUpdate, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
1450
1496
|
if (commandInfo.id === _univerjs_sheets_data_validation.UpdateSheetDataValidationRangeCommand.id) {
|
|
1451
1497
|
const params = commandInfo.params;
|
|
1452
|
-
const target = this.
|
|
1498
|
+
const target = this.getSheetCommandTarget(params);
|
|
1453
1499
|
if (!target) return;
|
|
1454
1500
|
const { workbook, worksheet } = target;
|
|
1455
|
-
const
|
|
1501
|
+
const { ruleId, ranges: newRanges } = params;
|
|
1502
|
+
const rule = worksheet.getDataValidation(ruleId);
|
|
1456
1503
|
if (!rule) return;
|
|
1457
1504
|
const eventParams = {
|
|
1458
1505
|
worksheet,
|
|
1459
1506
|
workbook,
|
|
1460
1507
|
rule,
|
|
1461
|
-
ruleId
|
|
1462
|
-
newRanges
|
|
1508
|
+
ruleId,
|
|
1509
|
+
newRanges
|
|
1463
1510
|
};
|
|
1464
1511
|
this.fireEvent(this.Event.BeforeSheetDataValidationRangeUpdate, eventParams);
|
|
1465
1512
|
if (eventParams.cancel) throw new _univerjs_core.CanceledError();
|
|
@@ -1468,17 +1515,18 @@ var FUniverSheetsDataValidationMixin = class extends _univerjs_core_facade.FUniv
|
|
|
1468
1515
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDataValidationOptionsUpdate, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
1469
1516
|
if (commandInfo.id === _univerjs_sheets_data_validation.UpdateSheetDataValidationOptionsCommand.id) {
|
|
1470
1517
|
const params = commandInfo.params;
|
|
1471
|
-
const target = this.
|
|
1518
|
+
const target = this.getSheetCommandTarget(params);
|
|
1472
1519
|
if (!target) return;
|
|
1473
1520
|
const { workbook, worksheet } = target;
|
|
1474
|
-
const
|
|
1521
|
+
const { ruleId, options: newOptions } = params;
|
|
1522
|
+
const rule = worksheet.getDataValidation(ruleId);
|
|
1475
1523
|
if (!rule) return;
|
|
1476
1524
|
const eventParams = {
|
|
1477
1525
|
worksheet,
|
|
1478
1526
|
workbook,
|
|
1479
1527
|
rule,
|
|
1480
|
-
ruleId
|
|
1481
|
-
newOptions
|
|
1528
|
+
ruleId,
|
|
1529
|
+
newOptions
|
|
1482
1530
|
};
|
|
1483
1531
|
this.fireEvent(this.Event.BeforeSheetDataValidationOptionsUpdate, eventParams);
|
|
1484
1532
|
if (eventParams.cancel) throw new _univerjs_core.CanceledError();
|
|
@@ -1487,16 +1535,17 @@ var FUniverSheetsDataValidationMixin = class extends _univerjs_core_facade.FUniv
|
|
|
1487
1535
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDataValidationDelete, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
1488
1536
|
if (commandInfo.id === _univerjs_sheets_data_validation.RemoveSheetDataValidationCommand.id) {
|
|
1489
1537
|
const params = commandInfo.params;
|
|
1490
|
-
const target = this.
|
|
1538
|
+
const target = this.getSheetCommandTarget(params);
|
|
1491
1539
|
if (!target) return;
|
|
1492
1540
|
const { workbook, worksheet } = target;
|
|
1493
|
-
const
|
|
1541
|
+
const { ruleId } = params;
|
|
1542
|
+
const rule = worksheet.getDataValidation(ruleId);
|
|
1494
1543
|
if (!rule) return;
|
|
1495
1544
|
const eventParams = {
|
|
1496
1545
|
worksheet,
|
|
1497
1546
|
workbook,
|
|
1498
1547
|
rule,
|
|
1499
|
-
ruleId
|
|
1548
|
+
ruleId
|
|
1500
1549
|
};
|
|
1501
1550
|
this.fireEvent(this.Event.BeforeSheetDataValidationDelete, eventParams);
|
|
1502
1551
|
if (eventParams.cancel) throw new _univerjs_core.CanceledError();
|
|
@@ -1505,7 +1554,7 @@ var FUniverSheetsDataValidationMixin = class extends _univerjs_core_facade.FUniv
|
|
|
1505
1554
|
this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDataValidationDeleteAll, () => commandService.beforeCommandExecuted((commandInfo) => {
|
|
1506
1555
|
if (commandInfo.id === _univerjs_sheets_data_validation.RemoveSheetAllDataValidationCommand.id) {
|
|
1507
1556
|
const params = commandInfo.params;
|
|
1508
|
-
const target = this.
|
|
1557
|
+
const target = this.getSheetCommandTarget(params);
|
|
1509
1558
|
if (!target) return;
|
|
1510
1559
|
const { workbook, worksheet } = target;
|
|
1511
1560
|
const eventParams = {
|
|
@@ -1589,66 +1638,6 @@ var FWorkbookSheetsDataValidationMixin = class extends _univerjs_sheets_facade.F
|
|
|
1589
1638
|
rule
|
|
1590
1639
|
};
|
|
1591
1640
|
}
|
|
1592
|
-
onDataValidationChange(callback) {
|
|
1593
|
-
return (0, _univerjs_core.toDisposable)(this._dataValidationModel.ruleChange$.pipe((0, rxjs.filter)((change) => change.unitId === this._workbook.getUnitId())).subscribe(callback));
|
|
1594
|
-
}
|
|
1595
|
-
onDataValidationStatusChange(callback) {
|
|
1596
|
-
return (0, _univerjs_core.toDisposable)(this._dataValidationModel.validStatusChange$.pipe((0, rxjs.filter)((change) => change.unitId === this._workbook.getUnitId())).subscribe(callback));
|
|
1597
|
-
}
|
|
1598
|
-
onBeforeAddDataValidation(callback) {
|
|
1599
|
-
return (0, _univerjs_core.toDisposable)(this._commandService.beforeCommandExecuted((commandInfo, options) => {
|
|
1600
|
-
const params = commandInfo.params;
|
|
1601
|
-
if (commandInfo.id === _univerjs_sheets_data_validation.AddSheetDataValidationCommand.id) {
|
|
1602
|
-
if (params.unitId !== this._workbook.getUnitId()) return;
|
|
1603
|
-
if (callback(params, options) === false) throw new Error("Command is stopped by the hook onBeforeAddDataValidation");
|
|
1604
|
-
}
|
|
1605
|
-
}));
|
|
1606
|
-
}
|
|
1607
|
-
onBeforeUpdateDataValidationCriteria(callback) {
|
|
1608
|
-
return (0, _univerjs_core.toDisposable)(this._commandService.beforeCommandExecuted((commandInfo, options) => {
|
|
1609
|
-
const params = commandInfo.params;
|
|
1610
|
-
if (commandInfo.id === _univerjs_sheets_data_validation.UpdateSheetDataValidationSettingCommand.id) {
|
|
1611
|
-
if (params.unitId !== this._workbook.getUnitId()) return;
|
|
1612
|
-
if (callback(params, options) === false) throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationCriteria");
|
|
1613
|
-
}
|
|
1614
|
-
}));
|
|
1615
|
-
}
|
|
1616
|
-
onBeforeUpdateDataValidationRange(callback) {
|
|
1617
|
-
return (0, _univerjs_core.toDisposable)(this._commandService.beforeCommandExecuted((commandInfo, options) => {
|
|
1618
|
-
const params = commandInfo.params;
|
|
1619
|
-
if (commandInfo.id === _univerjs_sheets_data_validation.UpdateSheetDataValidationRangeCommand.id) {
|
|
1620
|
-
if (params.unitId !== this._workbook.getUnitId()) return;
|
|
1621
|
-
if (callback(params, options) === false) throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationRange");
|
|
1622
|
-
}
|
|
1623
|
-
}));
|
|
1624
|
-
}
|
|
1625
|
-
onBeforeUpdateDataValidationOptions(callback) {
|
|
1626
|
-
return (0, _univerjs_core.toDisposable)(this._commandService.beforeCommandExecuted((commandInfo, options) => {
|
|
1627
|
-
const params = commandInfo.params;
|
|
1628
|
-
if (commandInfo.id === _univerjs_sheets_data_validation.UpdateSheetDataValidationOptionsCommand.id) {
|
|
1629
|
-
if (params.unitId !== this._workbook.getUnitId()) return;
|
|
1630
|
-
if (callback(params, options) === false) throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationOptions");
|
|
1631
|
-
}
|
|
1632
|
-
}));
|
|
1633
|
-
}
|
|
1634
|
-
onBeforeDeleteDataValidation(callback) {
|
|
1635
|
-
return (0, _univerjs_core.toDisposable)(this._commandService.beforeCommandExecuted((commandInfo, options) => {
|
|
1636
|
-
const params = commandInfo.params;
|
|
1637
|
-
if (commandInfo.id === _univerjs_sheets_data_validation.RemoveSheetDataValidationCommand.id) {
|
|
1638
|
-
if (params.unitId !== this._workbook.getUnitId()) return;
|
|
1639
|
-
if (callback(params, options) === false) throw new Error("Command is stopped by the hook onBeforeDeleteDataValidation");
|
|
1640
|
-
}
|
|
1641
|
-
}));
|
|
1642
|
-
}
|
|
1643
|
-
onBeforeDeleteAllDataValidation(callback) {
|
|
1644
|
-
return (0, _univerjs_core.toDisposable)(this._commandService.beforeCommandExecuted((commandInfo, options) => {
|
|
1645
|
-
const params = commandInfo.params;
|
|
1646
|
-
if (commandInfo.id === _univerjs_sheets_data_validation.RemoveSheetAllDataValidationCommand.id) {
|
|
1647
|
-
if (params.unitId !== this._workbook.getUnitId()) return;
|
|
1648
|
-
if (callback(params, options) === false) throw new Error("Command is stopped by the hook onBeforeDeleteAllDataValidation");
|
|
1649
|
-
}
|
|
1650
|
-
}));
|
|
1651
|
-
}
|
|
1652
1641
|
};
|
|
1653
1642
|
_univerjs_sheets_facade.FWorkbook.extend(FWorkbookSheetsDataValidationMixin);
|
|
1654
1643
|
|
|
@@ -1661,11 +1650,8 @@ var FWorksheetDataValidationMixin = class extends _univerjs_sheets_facade.FWorks
|
|
|
1661
1650
|
getDataValidations() {
|
|
1662
1651
|
return this._injector.get(_univerjs_data_validation.DataValidationModel).getRules(this._workbook.getUnitId(), this._worksheet.getSheetId()).map((rule) => new FDataValidation(rule, this._worksheet, this._injector));
|
|
1663
1652
|
}
|
|
1664
|
-
getValidatorStatus() {
|
|
1665
|
-
return this._injector.get(_univerjs_sheets_data_validation.SheetsDataValidationValidatorService).validatorWorksheet(this._workbook.getUnitId(), this._worksheet.getSheetId());
|
|
1666
|
-
}
|
|
1667
1653
|
getValidatorStatusAsync() {
|
|
1668
|
-
return this.
|
|
1654
|
+
return this._injector.get(_univerjs_sheets_data_validation.SheetsDataValidationValidatorService).validatorWorksheet(this._workbook.getUnitId(), this._worksheet.getSheetId());
|
|
1669
1655
|
}
|
|
1670
1656
|
getDataValidation(ruleId) {
|
|
1671
1657
|
const rule = this._injector.get(_univerjs_data_validation.DataValidationModel).getRuleById(this._workbook.getUnitId(), this._worksheet.getSheetId(), ruleId);
|