@univerjs/sheets-data-validation 0.5.5 → 0.6.0-experimental.20250125-1d060b9
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/facade.js +56 -63
- package/lib/types/facade/f-data-validation-builder.d.ts +3 -2
- package/lib/types/facade/f-data-validation.d.ts +55 -52
- package/lib/types/facade/f-event.d.ts +12 -0
- package/lib/types/facade/f-range.d.ts +6 -0
- package/lib/types/facade/f-univer.d.ts +24 -6
- package/lib/types/facade/f-workbook.d.ts +6 -0
- package/lib/types/facade/f-worksheet.d.ts +6 -0
- package/package.json +9 -9
- package/LICENSE +0 -176
package/lib/es/facade.js
CHANGED
|
@@ -428,10 +428,10 @@ class m {
|
|
|
428
428
|
* @example
|
|
429
429
|
* ```typescript
|
|
430
430
|
* const dataValidation = univerAPI
|
|
431
|
-
*
|
|
432
|
-
*
|
|
433
|
-
*
|
|
434
|
-
*
|
|
431
|
+
* .getActiveWorkbook()
|
|
432
|
+
* .getActiveWorksheet()
|
|
433
|
+
* .getActiveRange()
|
|
434
|
+
* .getDataValidation();
|
|
435
435
|
* const allowsInvalid = dataValidation.getAllowInvalid();
|
|
436
436
|
* ```
|
|
437
437
|
*/
|
|
@@ -444,10 +444,10 @@ class m {
|
|
|
444
444
|
* @example
|
|
445
445
|
* ```typescript
|
|
446
446
|
* const dataValidation = univerAPI
|
|
447
|
-
*
|
|
448
|
-
*
|
|
449
|
-
*
|
|
450
|
-
*
|
|
447
|
+
* .getActiveWorkbook()
|
|
448
|
+
* .getActiveWorksheet()
|
|
449
|
+
* .getActiveRange()
|
|
450
|
+
* .getDataValidation();
|
|
451
451
|
* const type = dataValidation.getCriteriaType();
|
|
452
452
|
* ```
|
|
453
453
|
*/
|
|
@@ -460,10 +460,10 @@ class m {
|
|
|
460
460
|
* @example
|
|
461
461
|
* ```typescript
|
|
462
462
|
* const dataValidation = univerAPI
|
|
463
|
-
*
|
|
464
|
-
*
|
|
465
|
-
*
|
|
466
|
-
*
|
|
463
|
+
* .getActiveWorkbook()
|
|
464
|
+
* .getActiveWorksheet()
|
|
465
|
+
* .getActiveRange()
|
|
466
|
+
* .getDataValidation();
|
|
467
467
|
* const [operator, formula1, formula2] = dataValidation.getCriteriaValues();
|
|
468
468
|
* ```
|
|
469
469
|
*/
|
|
@@ -476,10 +476,10 @@ class m {
|
|
|
476
476
|
* @example
|
|
477
477
|
* ```typescript
|
|
478
478
|
* const dataValidation = univerAPI
|
|
479
|
-
*
|
|
480
|
-
*
|
|
481
|
-
*
|
|
482
|
-
*
|
|
479
|
+
* .getActiveWorkbook()
|
|
480
|
+
* .getActiveWorksheet()
|
|
481
|
+
* .getActiveRange()
|
|
482
|
+
* .getDataValidation();
|
|
483
483
|
* const helpText = dataValidation.getHelpText();
|
|
484
484
|
* ```
|
|
485
485
|
*/
|
|
@@ -492,10 +492,10 @@ class m {
|
|
|
492
492
|
* @example
|
|
493
493
|
* ```typescript
|
|
494
494
|
* const dataValidation = univerAPI
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
*
|
|
498
|
-
*
|
|
495
|
+
* .getActiveWorkbook()
|
|
496
|
+
* .getActiveWorksheet()
|
|
497
|
+
* .getActiveRange()
|
|
498
|
+
* .getDataValidation();
|
|
499
499
|
* const builder = dataValidation.copy();
|
|
500
500
|
* const newRule = builder.setAllowInvalid(true).build();
|
|
501
501
|
* ```
|
|
@@ -509,10 +509,10 @@ class m {
|
|
|
509
509
|
* @example
|
|
510
510
|
* ```typescript
|
|
511
511
|
* const dataValidation = univerAPI
|
|
512
|
-
*
|
|
513
|
-
*
|
|
514
|
-
*
|
|
515
|
-
*
|
|
512
|
+
* .getActiveWorkbook()
|
|
513
|
+
* .getActiveWorksheet()
|
|
514
|
+
* .getActiveRange()
|
|
515
|
+
* .getDataValidation();
|
|
516
516
|
* const isApplied = dataValidation.getApplied();
|
|
517
517
|
* ```
|
|
518
518
|
*/
|
|
@@ -528,10 +528,10 @@ class m {
|
|
|
528
528
|
* @example
|
|
529
529
|
* ```typescript
|
|
530
530
|
* const dataValidation = univerAPI
|
|
531
|
-
*
|
|
532
|
-
*
|
|
533
|
-
*
|
|
534
|
-
*
|
|
531
|
+
* .getActiveWorkbook()
|
|
532
|
+
* .getActiveWorksheet()
|
|
533
|
+
* .getActiveRange()
|
|
534
|
+
* .getDataValidation();
|
|
535
535
|
* const ranges = dataValidation.getRanges();
|
|
536
536
|
* ```
|
|
537
537
|
*/
|
|
@@ -547,10 +547,10 @@ class m {
|
|
|
547
547
|
* @example
|
|
548
548
|
* ```typescript
|
|
549
549
|
* const dataValidation = univerAPI
|
|
550
|
-
*
|
|
551
|
-
*
|
|
552
|
-
*
|
|
553
|
-
*
|
|
550
|
+
* .getActiveWorkbook()
|
|
551
|
+
* .getActiveWorksheet()
|
|
552
|
+
* .getActiveRange()
|
|
553
|
+
* .getDataValidation();
|
|
554
554
|
* const unitId = dataValidation.getUnitId();
|
|
555
555
|
* ```
|
|
556
556
|
*/
|
|
@@ -564,10 +564,10 @@ class m {
|
|
|
564
564
|
* @example
|
|
565
565
|
* ```typescript
|
|
566
566
|
* const dataValidation = univerAPI
|
|
567
|
-
*
|
|
568
|
-
*
|
|
569
|
-
*
|
|
570
|
-
*
|
|
567
|
+
* .getActiveWorkbook()
|
|
568
|
+
* .getActiveWorksheet()
|
|
569
|
+
* .getActiveRange()
|
|
570
|
+
* .getDataValidation();
|
|
571
571
|
* const sheetId = dataValidation.getSheetId();
|
|
572
572
|
* ```
|
|
573
573
|
*/
|
|
@@ -584,10 +584,10 @@ class m {
|
|
|
584
584
|
* @example
|
|
585
585
|
* ```typescript
|
|
586
586
|
* const dataValidation = univerAPI
|
|
587
|
-
*
|
|
588
|
-
*
|
|
589
|
-
*
|
|
590
|
-
*
|
|
587
|
+
* .getActiveWorkbook()
|
|
588
|
+
* .getActiveWorksheet()
|
|
589
|
+
* .getActiveRange()
|
|
590
|
+
* .getDataValidation();
|
|
591
591
|
* dataValidation.setCriteria(
|
|
592
592
|
* DataValidationType.DECIMAL,
|
|
593
593
|
* [DataValidationOperator.BETWEEN, '1', '10'],
|
|
@@ -618,10 +618,10 @@ class m {
|
|
|
618
618
|
* @example
|
|
619
619
|
* ```typescript
|
|
620
620
|
* const dataValidation = univerAPI
|
|
621
|
-
*
|
|
622
|
-
*
|
|
623
|
-
*
|
|
624
|
-
*
|
|
621
|
+
* .getActiveWorkbook()
|
|
622
|
+
* .getActiveWorksheet()
|
|
623
|
+
* .getActiveRange()
|
|
624
|
+
* .getDataValidation();
|
|
625
625
|
* dataValidation.setOptions({
|
|
626
626
|
* allowBlank: true,
|
|
627
627
|
* showErrorMessage: true,
|
|
@@ -649,10 +649,10 @@ class m {
|
|
|
649
649
|
* @example
|
|
650
650
|
* ```typescript
|
|
651
651
|
* const dataValidation = univerAPI
|
|
652
|
-
*
|
|
653
|
-
*
|
|
654
|
-
*
|
|
655
|
-
*
|
|
652
|
+
* .getActiveWorkbook()
|
|
653
|
+
* .getActiveWorksheet()
|
|
654
|
+
* .getActiveRange()
|
|
655
|
+
* .getDataValidation();
|
|
656
656
|
* const range = FRange.create('Sheet1', 'A1:B10');
|
|
657
657
|
* dataValidation.setRanges([range]);
|
|
658
658
|
* ```
|
|
@@ -673,10 +673,10 @@ class m {
|
|
|
673
673
|
* @example
|
|
674
674
|
* ```typescript
|
|
675
675
|
* const dataValidation = univerAPI
|
|
676
|
-
*
|
|
677
|
-
*
|
|
678
|
-
*
|
|
679
|
-
*
|
|
676
|
+
* .getActiveWorkbook()
|
|
677
|
+
* .getActiveWorksheet()
|
|
678
|
+
* .getActiveRange()
|
|
679
|
+
* .getDataValidation();
|
|
680
680
|
* const isDeleted = dataValidation.delete();
|
|
681
681
|
* ```
|
|
682
682
|
*/
|
|
@@ -731,26 +731,19 @@ class G extends y {
|
|
|
731
731
|
}
|
|
732
732
|
y.extend(G);
|
|
733
733
|
class Q extends x {
|
|
734
|
-
// eslint-disable-next-line jsdoc/require-returns
|
|
735
|
-
/**
|
|
736
734
|
/**
|
|
737
735
|
* @deprecated use `univerAPI.newDataValidation()` as instead.
|
|
736
|
+
* @returns {FDataValidationBuilder} A new instance of the FDataValidationBuilder class
|
|
738
737
|
*/
|
|
739
738
|
static newDataValidation() {
|
|
740
739
|
return new D();
|
|
741
740
|
}
|
|
742
|
-
/**
|
|
743
|
-
* Creates a new instance of FDataValidationBuilder
|
|
744
|
-
* @returns {FDataValidationBuilder} A new instance of the FDataValidationBuilder class
|
|
745
|
-
* @example
|
|
746
|
-
* ```ts
|
|
747
|
-
* const rule = FUnvier.newDataValidation();
|
|
748
|
-
* cell.setDataValidation(rule.requireValueInRange(range));
|
|
749
|
-
* ```
|
|
750
|
-
*/
|
|
751
741
|
newDataValidation() {
|
|
752
742
|
return new D();
|
|
753
743
|
}
|
|
744
|
+
/**
|
|
745
|
+
* @ignore
|
|
746
|
+
*/
|
|
754
747
|
// eslint-disable-next-line max-lines-per-function
|
|
755
748
|
_initialize(e) {
|
|
756
749
|
if (!e.has(V)) return;
|
|
@@ -2,14 +2,15 @@ import { IDataValidationRule, IDataValidationRuleOptions, DataValidationType } f
|
|
|
2
2
|
import { FRange } from '@univerjs/sheets/facade';
|
|
3
3
|
import { FDataValidation } from './f-data-validation';
|
|
4
4
|
/**
|
|
5
|
-
* Builder for data validation rules.
|
|
5
|
+
* Builder for data validation rules. use {@link FUniver} `univerAPI.newDataValidation()` to create a new builder.
|
|
6
6
|
* @example
|
|
7
7
|
* ```typescript
|
|
8
8
|
* // Set the data validation for cell A1 to require a value from B1:B10
|
|
9
9
|
* const range = FRange.create('Sheet1', 'B1:B10');
|
|
10
|
-
* const rule =
|
|
10
|
+
* const rule = univerAPI.newDataValidation().requireValueInRange(range).build();
|
|
11
11
|
* cell.setDataValidation(rule);
|
|
12
12
|
* ```
|
|
13
|
+
* @hideconstructor
|
|
13
14
|
*/
|
|
14
15
|
export declare class FDataValidationBuilder {
|
|
15
16
|
private _rule;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { DataValidationOperator, DataValidationType, IDataValidationRule, IDataValidationRuleOptions, Injector, Worksheet } from '@univerjs/core';
|
|
2
2
|
import { FRange } from '@univerjs/sheets/facade';
|
|
3
3
|
import { FDataValidationBuilder } from './f-data-validation-builder';
|
|
4
|
+
/**
|
|
5
|
+
* @hideconstructor
|
|
6
|
+
*/
|
|
4
7
|
export declare class FDataValidation {
|
|
5
8
|
rule: IDataValidationRule;
|
|
6
9
|
private _worksheet;
|
|
@@ -12,10 +15,10 @@ export declare class FDataValidation {
|
|
|
12
15
|
* @example
|
|
13
16
|
* ```typescript
|
|
14
17
|
* const dataValidation = univerAPI
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
18
|
+
* .getActiveWorkbook()
|
|
19
|
+
* .getActiveWorksheet()
|
|
20
|
+
* .getActiveRange()
|
|
21
|
+
* .getDataValidation();
|
|
19
22
|
* const allowsInvalid = dataValidation.getAllowInvalid();
|
|
20
23
|
* ```
|
|
21
24
|
*/
|
|
@@ -26,10 +29,10 @@ export declare class FDataValidation {
|
|
|
26
29
|
* @example
|
|
27
30
|
* ```typescript
|
|
28
31
|
* const dataValidation = univerAPI
|
|
29
|
-
*
|
|
30
|
-
*
|
|
31
|
-
*
|
|
32
|
-
*
|
|
32
|
+
* .getActiveWorkbook()
|
|
33
|
+
* .getActiveWorksheet()
|
|
34
|
+
* .getActiveRange()
|
|
35
|
+
* .getDataValidation();
|
|
33
36
|
* const type = dataValidation.getCriteriaType();
|
|
34
37
|
* ```
|
|
35
38
|
*/
|
|
@@ -40,10 +43,10 @@ export declare class FDataValidation {
|
|
|
40
43
|
* @example
|
|
41
44
|
* ```typescript
|
|
42
45
|
* const dataValidation = univerAPI
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
46
|
+
* .getActiveWorkbook()
|
|
47
|
+
* .getActiveWorksheet()
|
|
48
|
+
* .getActiveRange()
|
|
49
|
+
* .getDataValidation();
|
|
47
50
|
* const [operator, formula1, formula2] = dataValidation.getCriteriaValues();
|
|
48
51
|
* ```
|
|
49
52
|
*/
|
|
@@ -54,10 +57,10 @@ export declare class FDataValidation {
|
|
|
54
57
|
* @example
|
|
55
58
|
* ```typescript
|
|
56
59
|
* const dataValidation = univerAPI
|
|
57
|
-
*
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
*
|
|
60
|
+
* .getActiveWorkbook()
|
|
61
|
+
* .getActiveWorksheet()
|
|
62
|
+
* .getActiveRange()
|
|
63
|
+
* .getDataValidation();
|
|
61
64
|
* const helpText = dataValidation.getHelpText();
|
|
62
65
|
* ```
|
|
63
66
|
*/
|
|
@@ -68,10 +71,10 @@ export declare class FDataValidation {
|
|
|
68
71
|
* @example
|
|
69
72
|
* ```typescript
|
|
70
73
|
* const dataValidation = univerAPI
|
|
71
|
-
*
|
|
72
|
-
*
|
|
73
|
-
*
|
|
74
|
-
*
|
|
74
|
+
* .getActiveWorkbook()
|
|
75
|
+
* .getActiveWorksheet()
|
|
76
|
+
* .getActiveRange()
|
|
77
|
+
* .getDataValidation();
|
|
75
78
|
* const builder = dataValidation.copy();
|
|
76
79
|
* const newRule = builder.setAllowInvalid(true).build();
|
|
77
80
|
* ```
|
|
@@ -83,10 +86,10 @@ export declare class FDataValidation {
|
|
|
83
86
|
* @example
|
|
84
87
|
* ```typescript
|
|
85
88
|
* const dataValidation = univerAPI
|
|
86
|
-
*
|
|
87
|
-
*
|
|
88
|
-
*
|
|
89
|
-
*
|
|
89
|
+
* .getActiveWorkbook()
|
|
90
|
+
* .getActiveWorksheet()
|
|
91
|
+
* .getActiveRange()
|
|
92
|
+
* .getDataValidation();
|
|
90
93
|
* const isApplied = dataValidation.getApplied();
|
|
91
94
|
* ```
|
|
92
95
|
*/
|
|
@@ -97,10 +100,10 @@ export declare class FDataValidation {
|
|
|
97
100
|
* @example
|
|
98
101
|
* ```typescript
|
|
99
102
|
* const dataValidation = univerAPI
|
|
100
|
-
*
|
|
101
|
-
*
|
|
102
|
-
*
|
|
103
|
-
*
|
|
103
|
+
* .getActiveWorkbook()
|
|
104
|
+
* .getActiveWorksheet()
|
|
105
|
+
* .getActiveRange()
|
|
106
|
+
* .getDataValidation();
|
|
104
107
|
* const ranges = dataValidation.getRanges();
|
|
105
108
|
* ```
|
|
106
109
|
*/
|
|
@@ -111,10 +114,10 @@ export declare class FDataValidation {
|
|
|
111
114
|
* @example
|
|
112
115
|
* ```typescript
|
|
113
116
|
* const dataValidation = univerAPI
|
|
114
|
-
*
|
|
115
|
-
*
|
|
116
|
-
*
|
|
117
|
-
*
|
|
117
|
+
* .getActiveWorkbook()
|
|
118
|
+
* .getActiveWorksheet()
|
|
119
|
+
* .getActiveRange()
|
|
120
|
+
* .getDataValidation();
|
|
118
121
|
* const unitId = dataValidation.getUnitId();
|
|
119
122
|
* ```
|
|
120
123
|
*/
|
|
@@ -125,10 +128,10 @@ export declare class FDataValidation {
|
|
|
125
128
|
* @example
|
|
126
129
|
* ```typescript
|
|
127
130
|
* const dataValidation = univerAPI
|
|
128
|
-
*
|
|
129
|
-
*
|
|
130
|
-
*
|
|
131
|
-
*
|
|
131
|
+
* .getActiveWorkbook()
|
|
132
|
+
* .getActiveWorksheet()
|
|
133
|
+
* .getActiveRange()
|
|
134
|
+
* .getDataValidation();
|
|
132
135
|
* const sheetId = dataValidation.getSheetId();
|
|
133
136
|
* ```
|
|
134
137
|
*/
|
|
@@ -142,10 +145,10 @@ export declare class FDataValidation {
|
|
|
142
145
|
* @example
|
|
143
146
|
* ```typescript
|
|
144
147
|
* const dataValidation = univerAPI
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
148
|
-
*
|
|
148
|
+
* .getActiveWorkbook()
|
|
149
|
+
* .getActiveWorksheet()
|
|
150
|
+
* .getActiveRange()
|
|
151
|
+
* .getDataValidation();
|
|
149
152
|
* dataValidation.setCriteria(
|
|
150
153
|
* DataValidationType.DECIMAL,
|
|
151
154
|
* [DataValidationOperator.BETWEEN, '1', '10'],
|
|
@@ -161,10 +164,10 @@ export declare class FDataValidation {
|
|
|
161
164
|
* @example
|
|
162
165
|
* ```typescript
|
|
163
166
|
* const dataValidation = univerAPI
|
|
164
|
-
*
|
|
165
|
-
*
|
|
166
|
-
*
|
|
167
|
-
*
|
|
167
|
+
* .getActiveWorkbook()
|
|
168
|
+
* .getActiveWorksheet()
|
|
169
|
+
* .getActiveRange()
|
|
170
|
+
* .getDataValidation();
|
|
168
171
|
* dataValidation.setOptions({
|
|
169
172
|
* allowBlank: true,
|
|
170
173
|
* showErrorMessage: true,
|
|
@@ -180,10 +183,10 @@ export declare class FDataValidation {
|
|
|
180
183
|
* @example
|
|
181
184
|
* ```typescript
|
|
182
185
|
* const dataValidation = univerAPI
|
|
183
|
-
*
|
|
184
|
-
*
|
|
185
|
-
*
|
|
186
|
-
*
|
|
186
|
+
* .getActiveWorkbook()
|
|
187
|
+
* .getActiveWorksheet()
|
|
188
|
+
* .getActiveRange()
|
|
189
|
+
* .getDataValidation();
|
|
187
190
|
* const range = FRange.create('Sheet1', 'A1:B10');
|
|
188
191
|
* dataValidation.setRanges([range]);
|
|
189
192
|
* ```
|
|
@@ -195,10 +198,10 @@ export declare class FDataValidation {
|
|
|
195
198
|
* @example
|
|
196
199
|
* ```typescript
|
|
197
200
|
* const dataValidation = univerAPI
|
|
198
|
-
*
|
|
199
|
-
*
|
|
200
|
-
*
|
|
201
|
-
*
|
|
201
|
+
* .getActiveWorkbook()
|
|
202
|
+
* .getActiveWorksheet()
|
|
203
|
+
* .getActiveRange()
|
|
204
|
+
* .getDataValidation();
|
|
202
205
|
* const isDeleted = dataValidation.delete();
|
|
203
206
|
* ```
|
|
204
207
|
*/
|
|
@@ -132,6 +132,9 @@ export interface IBeforeSheetDataValidationDeleteAllEvent extends IEventBase {
|
|
|
132
132
|
/** Array of all validation rules to be deleted */
|
|
133
133
|
rules: FDataValidation[];
|
|
134
134
|
}
|
|
135
|
+
/**
|
|
136
|
+
* @ignore
|
|
137
|
+
*/
|
|
135
138
|
export interface IDataValidationEventParamConfig {
|
|
136
139
|
SheetDataValidationChanged: ISheetDataValidationChangedEvent;
|
|
137
140
|
SheetDataValidatorStatusChanged: ISheetDataValidatorStatusChangedEvent;
|
|
@@ -142,6 +145,9 @@ export interface IDataValidationEventParamConfig {
|
|
|
142
145
|
BeforeSheetDataValidationRangeUpdate: IBeforeSheetDataValidationRangeUpdateEvent;
|
|
143
146
|
BeforeSheetDataValidationOptionsUpdate: IBeforeSheetDataValidationOptionsUpdateEvent;
|
|
144
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* @ignore
|
|
150
|
+
*/
|
|
145
151
|
interface IDataValidationEvent {
|
|
146
152
|
/**
|
|
147
153
|
* Event fired when a rule is added, deleted, or modified
|
|
@@ -240,6 +246,9 @@ interface IDataValidationEvent {
|
|
|
240
246
|
*/
|
|
241
247
|
readonly BeforeSheetDataValidationOptionsUpdate: 'BeforeSheetDataValidationOptionsUpdate';
|
|
242
248
|
}
|
|
249
|
+
/**
|
|
250
|
+
* @ignore
|
|
251
|
+
*/
|
|
243
252
|
export declare class FDataValidationEvent implements IDataValidationEvent {
|
|
244
253
|
get SheetDataValidationChanged(): 'SheetDataValidationChanged';
|
|
245
254
|
get SheetDataValidatorStatusChanged(): 'SheetDataValidatorStatusChanged';
|
|
@@ -250,6 +259,9 @@ export declare class FDataValidationEvent implements IDataValidationEvent {
|
|
|
250
259
|
get BeforeSheetDataValidationRangeUpdate(): 'BeforeSheetDataValidationRangeUpdate';
|
|
251
260
|
get BeforeSheetDataValidationOptionsUpdate(): 'BeforeSheetDataValidationOptionsUpdate';
|
|
252
261
|
}
|
|
262
|
+
/**
|
|
263
|
+
* @ignore
|
|
264
|
+
*/
|
|
253
265
|
export interface IDataValidationEventConfig {
|
|
254
266
|
SheetDataValidationChanged: ISheetDataValidationChangedEvent;
|
|
255
267
|
SheetDataValidatorStatusChanged: ISheetDataValidatorStatusChangedEvent;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { DataValidationStatus, Nullable } from '@univerjs/core';
|
|
2
2
|
import { FRange } from '@univerjs/sheets/facade';
|
|
3
3
|
import { FDataValidation } from './f-data-validation';
|
|
4
|
+
/**
|
|
5
|
+
* @ignore
|
|
6
|
+
*/
|
|
4
7
|
export interface IFRangeDataValidationMixin {
|
|
5
8
|
/**
|
|
6
9
|
* Set a data validation rule to current range. if rule is null, clear data validation rule.
|
|
@@ -47,6 +50,9 @@ export interface IFRangeDataValidationMixin {
|
|
|
47
50
|
*/
|
|
48
51
|
getValidatorStatus(): Promise<DataValidationStatus[][]>;
|
|
49
52
|
}
|
|
53
|
+
/**
|
|
54
|
+
* @ignore
|
|
55
|
+
*/
|
|
50
56
|
export declare class FRangeDataValidationMixin extends FRange implements IFRangeDataValidationMixin {
|
|
51
57
|
setDataValidation(rule: Nullable<FDataValidation>): FRange;
|
|
52
58
|
getDataValidation(): Nullable<FDataValidation>;
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { Injector, FUniver } from '@univerjs/core';
|
|
2
2
|
import { FDataValidationBuilder } from './f-data-validation-builder';
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
*/
|
|
8
|
-
static newDataValidation(): FDataValidationBuilder;
|
|
3
|
+
/**
|
|
4
|
+
* @ignore
|
|
5
|
+
*/
|
|
6
|
+
export interface IFUnvierDataValidationMixin {
|
|
9
7
|
/**
|
|
10
8
|
* Creates a new instance of FDataValidationBuilder
|
|
11
9
|
* @returns {FDataValidationBuilder} A new instance of the FDataValidationBuilder class
|
|
@@ -16,10 +14,30 @@ export declare class FUnvierDataValidationMixin extends FUniver {
|
|
|
16
14
|
* ```
|
|
17
15
|
*/
|
|
18
16
|
newDataValidation(): FDataValidationBuilder;
|
|
17
|
+
}
|
|
18
|
+
export declare class FUnvierDataValidationMixin extends FUniver implements IFUnvierDataValidationMixin {
|
|
19
|
+
/**
|
|
20
|
+
* @deprecated use `univerAPI.newDataValidation()` as instead.
|
|
21
|
+
* @returns {FDataValidationBuilder} A new instance of the FDataValidationBuilder class
|
|
22
|
+
*/
|
|
23
|
+
static newDataValidation(): FDataValidationBuilder;
|
|
24
|
+
newDataValidation(): FDataValidationBuilder;
|
|
25
|
+
/**
|
|
26
|
+
* @ignore
|
|
27
|
+
*/
|
|
19
28
|
_initialize(injector: Injector): void;
|
|
20
29
|
}
|
|
21
30
|
declare module '@univerjs/core' {
|
|
31
|
+
/**
|
|
32
|
+
* @ignore
|
|
33
|
+
*/
|
|
22
34
|
namespace FUniver {
|
|
35
|
+
/**
|
|
36
|
+
* @deprecated use `univerAPI.newDataValidation()` as instead.
|
|
37
|
+
* @returns {FDataValidationBuilder} A new instance of the FDataValidationBuilder class
|
|
38
|
+
*/
|
|
23
39
|
function newDataValidation(): FDataValidationBuilder;
|
|
24
40
|
}
|
|
41
|
+
interface FUniver extends IFUnvierDataValidationMixin {
|
|
42
|
+
}
|
|
25
43
|
}
|
|
@@ -2,6 +2,9 @@ import { IRuleChange } from '@univerjs/data-validation';
|
|
|
2
2
|
import { IAddSheetDataValidationCommandParams, IRemoveSheetAllDataValidationCommandParams, IRemoveSheetDataValidationCommandParams, IUpdateSheetDataValidationOptionsCommandParams, IUpdateSheetDataValidationRangeCommandParams, IUpdateSheetDataValidationSettingCommandParams, IValidStatusChange, SheetDataValidationModel } from '@univerjs/sheets-data-validation';
|
|
3
3
|
import { DataValidationStatus, IDisposable, IExecutionOptions, Nullable, ObjectMatrix } from '@univerjs/core';
|
|
4
4
|
import { FWorkbook } from '@univerjs/sheets/facade';
|
|
5
|
+
/**
|
|
6
|
+
* @ignore
|
|
7
|
+
*/
|
|
5
8
|
export interface IFWorkbookDataValidationMixin {
|
|
6
9
|
/**
|
|
7
10
|
* Get data validation validator status for current workbook.
|
|
@@ -45,6 +48,9 @@ export interface IFWorkbookDataValidationMixin {
|
|
|
45
48
|
*/
|
|
46
49
|
onBeforeDeleteAllDataValidation(this: FWorkbook, callback: (params: IRemoveSheetAllDataValidationCommandParams, options: IExecutionOptions | undefined) => void | false): IDisposable;
|
|
47
50
|
}
|
|
51
|
+
/**
|
|
52
|
+
* @ignore
|
|
53
|
+
*/
|
|
48
54
|
export declare class FWorkbookDataValidationMixin extends FWorkbook implements IFWorkbookDataValidationMixin {
|
|
49
55
|
_dataValidationModel: SheetDataValidationModel;
|
|
50
56
|
_initialize(): void;
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import { DataValidationStatus, Nullable, ObjectMatrix } from '@univerjs/core';
|
|
2
2
|
import { FWorksheet } from '@univerjs/sheets/facade';
|
|
3
3
|
import { FDataValidation } from './f-data-validation';
|
|
4
|
+
/**
|
|
5
|
+
* @ignore
|
|
6
|
+
*/
|
|
4
7
|
export interface IFWorksheetDataValidationMixin {
|
|
5
8
|
/**
|
|
6
9
|
* Get all data validation rules in current sheet.
|
|
@@ -38,6 +41,9 @@ export interface IFWorksheetDataValidationMixin {
|
|
|
38
41
|
*/
|
|
39
42
|
getDataValidation(ruleId: string): Nullable<FDataValidation>;
|
|
40
43
|
}
|
|
44
|
+
/**
|
|
45
|
+
* @ignore
|
|
46
|
+
*/
|
|
41
47
|
export declare class FWorksheetDataValidationMixin extends FWorksheet implements IFWorksheetDataValidationMixin {
|
|
42
48
|
getDataValidations(): FDataValidation[];
|
|
43
49
|
getValidatorStatus(): Promise<ObjectMatrix<Nullable<DataValidationStatus>>>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@univerjs/sheets-data-validation",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.0-experimental.20250125-1d060b9",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Data validation for Univer Sheets",
|
|
6
6
|
"author": "DreamNum <developer@univer.ai>",
|
|
@@ -53,20 +53,20 @@
|
|
|
53
53
|
"rxjs": ">=7.0.0"
|
|
54
54
|
},
|
|
55
55
|
"dependencies": {
|
|
56
|
-
"@univerjs/protocol": "0.1.
|
|
57
|
-
"@univerjs/core": "0.
|
|
58
|
-
"@univerjs/
|
|
59
|
-
"@univerjs/
|
|
60
|
-
"@univerjs/sheets": "0.
|
|
61
|
-
"@univerjs/sheets-formula": "0.
|
|
56
|
+
"@univerjs/protocol": "0.1.43",
|
|
57
|
+
"@univerjs/core": "0.6.0-experimental.20250125-1d060b9",
|
|
58
|
+
"@univerjs/data-validation": "0.6.0-experimental.20250125-1d060b9",
|
|
59
|
+
"@univerjs/engine-formula": "0.6.0-experimental.20250125-1d060b9",
|
|
60
|
+
"@univerjs/sheets": "0.6.0-experimental.20250125-1d060b9",
|
|
61
|
+
"@univerjs/sheets-formula": "0.6.0-experimental.20250125-1d060b9"
|
|
62
62
|
},
|
|
63
63
|
"devDependencies": {
|
|
64
64
|
"less": "^4.2.1",
|
|
65
65
|
"rxjs": "^7.8.1",
|
|
66
|
-
"typescript": "^5.7.
|
|
66
|
+
"typescript": "^5.7.3",
|
|
67
67
|
"vite": "^6.0.7",
|
|
68
68
|
"vitest": "^2.1.8",
|
|
69
|
-
"@univerjs-infra/shared": "0.
|
|
69
|
+
"@univerjs-infra/shared": "0.6.0-alpha.0"
|
|
70
70
|
},
|
|
71
71
|
"scripts": {
|
|
72
72
|
"dev": "vite",
|
package/LICENSE
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
Apache License
|
|
2
|
-
Version 2.0, January 2004
|
|
3
|
-
http://www.apache.org/licenses/
|
|
4
|
-
|
|
5
|
-
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
-
|
|
7
|
-
1. Definitions.
|
|
8
|
-
|
|
9
|
-
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
-
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
-
|
|
12
|
-
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
-
the copyright owner that is granting the License.
|
|
14
|
-
|
|
15
|
-
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
-
other entities that control, are controlled by, or are under common
|
|
17
|
-
control with that entity. For the purposes of this definition,
|
|
18
|
-
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
-
direction or management of such entity, whether by contract or
|
|
20
|
-
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
-
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
-
|
|
23
|
-
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
-
exercising permissions granted by this License.
|
|
25
|
-
|
|
26
|
-
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
-
including but not limited to software source code, documentation
|
|
28
|
-
source, and configuration files.
|
|
29
|
-
|
|
30
|
-
"Object" form shall mean any form resulting from mechanical
|
|
31
|
-
transformation or translation of a Source form, including but
|
|
32
|
-
not limited to compiled object code, generated documentation,
|
|
33
|
-
and conversions to other media types.
|
|
34
|
-
|
|
35
|
-
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
-
Object form, made available under the License, as indicated by a
|
|
37
|
-
copyright notice that is included in or attached to the work
|
|
38
|
-
(an example is provided in the Appendix below).
|
|
39
|
-
|
|
40
|
-
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
-
form, that is based on (or derived from) the Work and for which the
|
|
42
|
-
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
-
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
-
of this License, Derivative Works shall not include works that remain
|
|
45
|
-
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
-
the Work and Derivative Works thereof.
|
|
47
|
-
|
|
48
|
-
"Contribution" shall mean any work of authorship, including
|
|
49
|
-
the original version of the Work and any modifications or additions
|
|
50
|
-
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
-
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
-
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
-
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
-
means any form of electronic, verbal, or written communication sent
|
|
55
|
-
to the Licensor or its representatives, including but not limited to
|
|
56
|
-
communication on electronic mailing lists, source code control systems,
|
|
57
|
-
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
-
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
-
excluding communication that is conspicuously marked or otherwise
|
|
60
|
-
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
-
|
|
62
|
-
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
-
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
-
subsequently incorporated within the Work.
|
|
65
|
-
|
|
66
|
-
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
-
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
-
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
-
Work and such Derivative Works in Source or Object form.
|
|
72
|
-
|
|
73
|
-
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
-
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
-
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
-
(except as stated in this section) patent license to make, have made,
|
|
77
|
-
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
-
where such license applies only to those patent claims licensable
|
|
79
|
-
by such Contributor that are necessarily infringed by their
|
|
80
|
-
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
-
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
-
institute patent litigation against any entity (including a
|
|
83
|
-
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
-
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
-
or contributory patent infringement, then any patent licenses
|
|
86
|
-
granted to You under this License for that Work shall terminate
|
|
87
|
-
as of the date such litigation is filed.
|
|
88
|
-
|
|
89
|
-
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
-
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
-
modifications, and in Source or Object form, provided that You
|
|
92
|
-
meet the following conditions:
|
|
93
|
-
|
|
94
|
-
(a) You must give any other recipients of the Work or
|
|
95
|
-
Derivative Works a copy of this License; and
|
|
96
|
-
|
|
97
|
-
(b) You must cause any modified files to carry prominent notices
|
|
98
|
-
stating that You changed the files; and
|
|
99
|
-
|
|
100
|
-
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
-
that You distribute, all copyright, patent, trademark, and
|
|
102
|
-
attribution notices from the Source form of the Work,
|
|
103
|
-
excluding those notices that do not pertain to any part of
|
|
104
|
-
the Derivative Works; and
|
|
105
|
-
|
|
106
|
-
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
-
distribution, then any Derivative Works that You distribute must
|
|
108
|
-
include a readable copy of the attribution notices contained
|
|
109
|
-
within such NOTICE file, excluding those notices that do not
|
|
110
|
-
pertain to any part of the Derivative Works, in at least one
|
|
111
|
-
of the following places: within a NOTICE text file distributed
|
|
112
|
-
as part of the Derivative Works; within the Source form or
|
|
113
|
-
documentation, if provided along with the Derivative Works; or,
|
|
114
|
-
within a display generated by the Derivative Works, if and
|
|
115
|
-
wherever such third-party notices normally appear. The contents
|
|
116
|
-
of the NOTICE file are for informational purposes only and
|
|
117
|
-
do not modify the License. You may add Your own attribution
|
|
118
|
-
notices within Derivative Works that You distribute, alongside
|
|
119
|
-
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
-
that such additional attribution notices cannot be construed
|
|
121
|
-
as modifying the License.
|
|
122
|
-
|
|
123
|
-
You may add Your own copyright statement to Your modifications and
|
|
124
|
-
may provide additional or different license terms and conditions
|
|
125
|
-
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
-
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
-
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
-
the conditions stated in this License.
|
|
129
|
-
|
|
130
|
-
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
-
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
-
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
-
this License, without any additional terms or conditions.
|
|
134
|
-
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
-
the terms of any separate license agreement you may have executed
|
|
136
|
-
with Licensor regarding such Contributions.
|
|
137
|
-
|
|
138
|
-
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
-
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
-
except as required for reasonable and customary use in describing the
|
|
141
|
-
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
-
|
|
143
|
-
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
-
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
-
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
-
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
-
implied, including, without limitation, any warranties or conditions
|
|
148
|
-
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
-
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
-
appropriateness of using or redistributing the Work and assume any
|
|
151
|
-
risks associated with Your exercise of permissions under this License.
|
|
152
|
-
|
|
153
|
-
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
-
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
-
unless required by applicable law (such as deliberate and grossly
|
|
156
|
-
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
-
liable to You for damages, including any direct, indirect, special,
|
|
158
|
-
incidental, or consequential damages of any character arising as a
|
|
159
|
-
result of this License or out of the use or inability to use the
|
|
160
|
-
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
-
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
-
other commercial damages or losses), even if such Contributor
|
|
163
|
-
has been advised of the possibility of such damages.
|
|
164
|
-
|
|
165
|
-
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
-
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
-
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
-
or other liability obligations and/or rights consistent with this
|
|
169
|
-
License. However, in accepting such obligations, You may act only
|
|
170
|
-
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
-
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
-
defend, and hold each Contributor harmless for any liability
|
|
173
|
-
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
-
of your accepting any such warranty or additional liability.
|
|
175
|
-
|
|
176
|
-
END OF TERMS AND CONDITIONS
|