@univerjs/sheets-data-validation 0.5.5-nightly.202501241606 → 0.6.0-alpha.0
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/LICENSE +176 -0
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/es/facade.js +274 -289
- package/lib/es/index.js +1704 -1741
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +7 -7
package/lib/es/facade.js
CHANGED
|
@@ -1,20 +1,19 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
uid: generateRandomId(),
|
|
1
|
+
var j = Object.defineProperty;
|
|
2
|
+
var q = (c, e, t) => e in c ? j(c, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : c[e] = t;
|
|
3
|
+
var f = (c, e, t) => q(c, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { UpdateSheetDataValidationSettingCommand as U, UpdateSheetDataValidationOptionsCommand as v, UpdateSheetDataValidationRangeCommand as C, RemoveSheetDataValidationCommand as T, ClearRangeDataValidationCommand as W, AddSheetDataValidationCommand as A, SheetsDataValidationValidatorService as S, SheetDataValidationModel as V, RemoveSheetAllDataValidationCommand as O } from "@univerjs/sheets-data-validation";
|
|
5
|
+
import { FRange as y, FWorkbook as M, FWorksheet as N } from "@univerjs/sheets/facade";
|
|
6
|
+
import { generateRandomId as B, DataValidationType as o, DataValidationErrorStyle as w, DataValidationOperator as h, IUniverInstanceService as H, ICommandService as p, FUniver as x, CanceledError as _, toDisposable as g, FEventName as $ } from "@univerjs/core";
|
|
7
|
+
import { DataValidationModel as b, getRuleOptions as F } from "@univerjs/data-validation";
|
|
8
|
+
import { serializeRangeToRefString as P } from "@univerjs/engine-formula";
|
|
9
|
+
import { filter as R } from "rxjs";
|
|
10
|
+
class D {
|
|
11
|
+
constructor(e) {
|
|
12
|
+
f(this, "_rule");
|
|
13
|
+
this._rule = e != null ? e : {
|
|
14
|
+
uid: B(),
|
|
16
15
|
ranges: void 0,
|
|
17
|
-
type:
|
|
16
|
+
type: o.CUSTOM
|
|
18
17
|
};
|
|
19
18
|
}
|
|
20
19
|
/**
|
|
@@ -27,7 +26,7 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
27
26
|
* ```
|
|
28
27
|
*/
|
|
29
28
|
build() {
|
|
30
|
-
return new
|
|
29
|
+
return new m(this._rule);
|
|
31
30
|
}
|
|
32
31
|
/**
|
|
33
32
|
* Creates a duplicate of the current DataValidationBuilder object
|
|
@@ -39,9 +38,9 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
39
38
|
* ```
|
|
40
39
|
*/
|
|
41
40
|
copy() {
|
|
42
|
-
return new
|
|
41
|
+
return new D({
|
|
43
42
|
...this._rule,
|
|
44
|
-
uid:
|
|
43
|
+
uid: B()
|
|
45
44
|
});
|
|
46
45
|
}
|
|
47
46
|
/**
|
|
@@ -54,7 +53,7 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
54
53
|
* ```
|
|
55
54
|
*/
|
|
56
55
|
getAllowInvalid() {
|
|
57
|
-
return this._rule.errorStyle !==
|
|
56
|
+
return this._rule.errorStyle !== w.STOP;
|
|
58
57
|
}
|
|
59
58
|
/**
|
|
60
59
|
* Gets the data validation type of the rule
|
|
@@ -103,8 +102,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
103
102
|
* const rule = builder.requireCheckbox('Yes', 'No').build();
|
|
104
103
|
* ```
|
|
105
104
|
*/
|
|
106
|
-
requireCheckbox(
|
|
107
|
-
return this._rule.type =
|
|
105
|
+
requireCheckbox(e, t) {
|
|
106
|
+
return this._rule.type = o.CHECKBOX, this._rule.formula1 = e, this._rule.formula2 = t, this;
|
|
108
107
|
}
|
|
109
108
|
/**
|
|
110
109
|
* Set the data validation type to DATE and configure the validation rules to be after a specific date
|
|
@@ -116,8 +115,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
116
115
|
* const rule = builder.requireDateAfter(new Date('2024-01-01')).build();
|
|
117
116
|
* ```
|
|
118
117
|
*/
|
|
119
|
-
requireDateAfter(
|
|
120
|
-
return this._rule.type =
|
|
118
|
+
requireDateAfter(e) {
|
|
119
|
+
return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.operator = h.GREATER_THAN, this;
|
|
121
120
|
}
|
|
122
121
|
/**
|
|
123
122
|
* Set the data validation type to DATE and configure the validation rules to be before a specific date
|
|
@@ -129,8 +128,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
129
128
|
* const rule = builder.requireDateBefore(new Date('2024-12-31')).build();
|
|
130
129
|
* ```
|
|
131
130
|
*/
|
|
132
|
-
requireDateBefore(
|
|
133
|
-
return this._rule.type =
|
|
131
|
+
requireDateBefore(e) {
|
|
132
|
+
return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = h.LESS_THAN, this;
|
|
134
133
|
}
|
|
135
134
|
/**
|
|
136
135
|
* Set the data validation type to DATE and configure the validation rules to be within a specific date range
|
|
@@ -145,8 +144,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
145
144
|
* .build();
|
|
146
145
|
* ```
|
|
147
146
|
*/
|
|
148
|
-
requireDateBetween(
|
|
149
|
-
return this._rule.type =
|
|
147
|
+
requireDateBetween(e, t) {
|
|
148
|
+
return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = t.toLocaleDateString(), this._rule.operator = h.BETWEEN, this;
|
|
150
149
|
}
|
|
151
150
|
/**
|
|
152
151
|
* Set the data validation type to DATE and configure the validation rules to be equal to a specific date
|
|
@@ -158,8 +157,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
158
157
|
* const rule = builder.requireDateEqualTo(new Date('2024-01-01')).build();
|
|
159
158
|
* ```
|
|
160
159
|
*/
|
|
161
|
-
requireDateEqualTo(
|
|
162
|
-
return this._rule.type =
|
|
160
|
+
requireDateEqualTo(e) {
|
|
161
|
+
return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = h.EQUAL, this;
|
|
163
162
|
}
|
|
164
163
|
/**
|
|
165
164
|
* Set the data validation type to DATE and configure the validation rules to be not within a specific date range
|
|
@@ -174,8 +173,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
174
173
|
* .build();
|
|
175
174
|
* ```
|
|
176
175
|
*/
|
|
177
|
-
requireDateNotBetween(
|
|
178
|
-
return this._rule.type =
|
|
176
|
+
requireDateNotBetween(e, t) {
|
|
177
|
+
return this._rule.type = o.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = t.toLocaleDateString(), this._rule.operator = h.NOT_BETWEEN, this;
|
|
179
178
|
}
|
|
180
179
|
/**
|
|
181
180
|
* Set the data validation type to DATE and configure the validation rules to be on or after a specific date
|
|
@@ -187,8 +186,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
187
186
|
* const rule = builder.requireDateOnOrAfter(new Date('2024-01-01')).build();
|
|
188
187
|
* ```
|
|
189
188
|
*/
|
|
190
|
-
requireDateOnOrAfter(
|
|
191
|
-
return this._rule.type =
|
|
189
|
+
requireDateOnOrAfter(e) {
|
|
190
|
+
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;
|
|
192
191
|
}
|
|
193
192
|
/**
|
|
194
193
|
* Set the data validation type to DATE and configure the validation rules to be on or before a specific date
|
|
@@ -200,8 +199,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
200
199
|
* const rule = builder.requireDateOnOrBefore(new Date('2024-12-31')).build();
|
|
201
200
|
* ```
|
|
202
201
|
*/
|
|
203
|
-
requireDateOnOrBefore(
|
|
204
|
-
return this._rule.type =
|
|
202
|
+
requireDateOnOrBefore(e) {
|
|
203
|
+
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;
|
|
205
204
|
}
|
|
206
205
|
/**
|
|
207
206
|
* Requires that a custom formula be satisfied
|
|
@@ -213,8 +212,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
213
212
|
* const rule = builder.requireFormulaSatisfied('=A1>0').build();
|
|
214
213
|
* ```
|
|
215
214
|
*/
|
|
216
|
-
requireFormulaSatisfied(
|
|
217
|
-
return this._rule.type =
|
|
215
|
+
requireFormulaSatisfied(e) {
|
|
216
|
+
return this._rule.type = o.CUSTOM, this._rule.formula1 = e, this._rule.formula2 = void 0, this;
|
|
218
217
|
}
|
|
219
218
|
/**
|
|
220
219
|
* Requires the user to enter a number within a specific range, which can be integer or decimal
|
|
@@ -228,8 +227,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
228
227
|
* const rule = builder.requireNumberBetween(1, 10).build();
|
|
229
228
|
* ```
|
|
230
229
|
*/
|
|
231
|
-
requireNumberBetween(
|
|
232
|
-
return this._rule.formula1 = `${
|
|
230
|
+
requireNumberBetween(e, t, r) {
|
|
231
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = `${t}`, this._rule.operator = h.BETWEEN, this._rule.type = r ? o.WHOLE : o.DECIMAL, this;
|
|
233
232
|
}
|
|
234
233
|
/**
|
|
235
234
|
* Requires the user to enter a number that is equal to a specific value, which can be an integer or a decimal
|
|
@@ -242,8 +241,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
242
241
|
* const rule = builder.requireNumberEqualTo(10).build();
|
|
243
242
|
* ```
|
|
244
243
|
*/
|
|
245
|
-
requireNumberEqualTo(
|
|
246
|
-
return this._rule.formula1 = `${
|
|
244
|
+
requireNumberEqualTo(e, t) {
|
|
245
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = h.EQUAL, this._rule.type = t ? o.WHOLE : o.DECIMAL, this;
|
|
247
246
|
}
|
|
248
247
|
/**
|
|
249
248
|
* Requires the user to enter a number that is greater than a specific value, which can be an integer or a decimal
|
|
@@ -256,8 +255,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
256
255
|
* const rule = builder.requireNumberGreaterThan(10).build();
|
|
257
256
|
* ```
|
|
258
257
|
*/
|
|
259
|
-
requireNumberGreaterThan(
|
|
260
|
-
return this._rule.formula1 = `${
|
|
258
|
+
requireNumberGreaterThan(e, t) {
|
|
259
|
+
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;
|
|
261
260
|
}
|
|
262
261
|
/**
|
|
263
262
|
* 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,8 +269,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
270
269
|
* const rule = builder.requireNumberGreaterThanOrEqualTo(10).build();
|
|
271
270
|
* ```
|
|
272
271
|
*/
|
|
273
|
-
requireNumberGreaterThanOrEqualTo(
|
|
274
|
-
return this._rule.formula1 = `${
|
|
272
|
+
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 ? o.WHOLE : o.DECIMAL, this;
|
|
275
274
|
}
|
|
276
275
|
/**
|
|
277
276
|
* Requires the user to enter a number that is less than a specific value, which can be an integer or a decimal
|
|
@@ -284,8 +283,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
284
283
|
* const rule = builder.requireNumberLessThan(10).build();
|
|
285
284
|
* ```
|
|
286
285
|
*/
|
|
287
|
-
requireNumberLessThan(
|
|
288
|
-
return this._rule.formula1 = `${
|
|
286
|
+
requireNumberLessThan(e, t) {
|
|
287
|
+
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;
|
|
289
288
|
}
|
|
290
289
|
/**
|
|
291
290
|
* Sets the data validation rule to require a number less than or equal to a specified value
|
|
@@ -299,8 +298,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
299
298
|
* const rule = builder.requireNumberLessThanOrEqualTo(10).build();
|
|
300
299
|
* ```
|
|
301
300
|
*/
|
|
302
|
-
requireNumberLessThanOrEqualTo(
|
|
303
|
-
return this._rule.formula1 = `${
|
|
301
|
+
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 ? o.WHOLE : o.DECIMAL, this;
|
|
304
303
|
}
|
|
305
304
|
/**
|
|
306
305
|
* Sets a data validation rule that requires the user to enter a number outside a specified range
|
|
@@ -315,8 +314,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
315
314
|
* const rule = builder.requireNumberNotBetween(1, 10).build();
|
|
316
315
|
* ```
|
|
317
316
|
*/
|
|
318
|
-
requireNumberNotBetween(
|
|
319
|
-
return this._rule.formula1 = `${
|
|
317
|
+
requireNumberNotBetween(e, t, r) {
|
|
318
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = `${t}`, this._rule.operator = h.NOT_BETWEEN, this._rule.type = r ? o.WHOLE : o.DECIMAL, this;
|
|
320
319
|
}
|
|
321
320
|
/**
|
|
322
321
|
* Creates a data validation rule that requires the user to enter a number that is not equal to a specific value
|
|
@@ -330,8 +329,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
330
329
|
* const rule = builder.requireNumberNotEqualTo(10).build();
|
|
331
330
|
* ```
|
|
332
331
|
*/
|
|
333
|
-
requireNumberNotEqualTo(
|
|
334
|
-
return this._rule.formula1 = `${
|
|
332
|
+
requireNumberNotEqualTo(e, t) {
|
|
333
|
+
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;
|
|
335
334
|
}
|
|
336
335
|
/**
|
|
337
336
|
* Sets a data validation rule that requires the user to enter a value from a list of specific values
|
|
@@ -346,8 +345,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
346
345
|
* const rule = builder.requireValueInList(['Yes', 'No']).build();
|
|
347
346
|
* ```
|
|
348
347
|
*/
|
|
349
|
-
requireValueInList(
|
|
350
|
-
return this._rule.type =
|
|
348
|
+
requireValueInList(e, t, r) {
|
|
349
|
+
return this._rule.type = t ? o.LIST_MULTIPLE : o.LIST, this._rule.formula1 = e.join(","), this._rule.formula2 = void 0, this._rule.showDropDown = r != null ? r : !0, this;
|
|
351
350
|
}
|
|
352
351
|
/**
|
|
353
352
|
* Sets a data validation rule that requires the user to enter a value within a specific range
|
|
@@ -363,12 +362,12 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
363
362
|
* const rule = builder.requireValueInRange(range).build();
|
|
364
363
|
* ```
|
|
365
364
|
*/
|
|
366
|
-
requireValueInRange(
|
|
367
|
-
return this._rule.type =
|
|
368
|
-
unitId:
|
|
369
|
-
sheetName:
|
|
370
|
-
range:
|
|
371
|
-
})}`, this._rule.formula2 = void 0, this._rule.showDropDown =
|
|
365
|
+
requireValueInRange(e, t, r) {
|
|
366
|
+
return this._rule.type = t ? o.LIST_MULTIPLE : o.LIST, this._rule.formula1 = `=${P({
|
|
367
|
+
unitId: e.getUnitId(),
|
|
368
|
+
sheetName: e.getSheetName(),
|
|
369
|
+
range: e.getRange()
|
|
370
|
+
})}`, this._rule.formula2 = void 0, this._rule.showDropDown = r != null ? r : !0, this;
|
|
372
371
|
}
|
|
373
372
|
/**
|
|
374
373
|
* Sets whether to allow invalid data and configures the error style
|
|
@@ -382,8 +381,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
382
381
|
* const rule = builder.setAllowInvalid(true).build();
|
|
383
382
|
* ```
|
|
384
383
|
*/
|
|
385
|
-
setAllowInvalid(
|
|
386
|
-
return this._rule.errorStyle =
|
|
384
|
+
setAllowInvalid(e) {
|
|
385
|
+
return this._rule.errorStyle = e ? w.WARNING : w.STOP, this;
|
|
387
386
|
}
|
|
388
387
|
/**
|
|
389
388
|
* Sets whether to allow blank values
|
|
@@ -395,8 +394,8 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
395
394
|
* const rule = builder.setAllowBlank(true).build();
|
|
396
395
|
* ```
|
|
397
396
|
*/
|
|
398
|
-
setAllowBlank(
|
|
399
|
-
return this._rule.allowBlank =
|
|
397
|
+
setAllowBlank(e) {
|
|
398
|
+
return this._rule.allowBlank = e, this;
|
|
400
399
|
}
|
|
401
400
|
/**
|
|
402
401
|
* Sets the options for the data validation rule
|
|
@@ -412,18 +411,16 @@ const _FDataValidationBuilder = class _FDataValidationBuilder {
|
|
|
412
411
|
* }).build();
|
|
413
412
|
* ```
|
|
414
413
|
*/
|
|
415
|
-
setOptions(
|
|
416
|
-
return Object.assign(this._rule,
|
|
414
|
+
setOptions(e) {
|
|
415
|
+
return Object.assign(this._rule, e), this;
|
|
417
416
|
}
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
__publicField(this, "_injector");
|
|
426
|
-
this._injector = _injector, this.rule = rule, this._worksheet = worksheet;
|
|
417
|
+
}
|
|
418
|
+
class m {
|
|
419
|
+
constructor(e, t, r) {
|
|
420
|
+
f(this, "rule");
|
|
421
|
+
f(this, "_worksheet");
|
|
422
|
+
f(this, "_injector");
|
|
423
|
+
this._injector = r, this.rule = e, this._worksheet = t;
|
|
427
424
|
}
|
|
428
425
|
/**
|
|
429
426
|
* Gets whether invalid data is allowed based on the error style value
|
|
@@ -439,7 +436,7 @@ const _FDataValidation = class _FDataValidation {
|
|
|
439
436
|
* ```
|
|
440
437
|
*/
|
|
441
438
|
getAllowInvalid() {
|
|
442
|
-
return this.rule.errorStyle !==
|
|
439
|
+
return this.rule.errorStyle !== w.STOP;
|
|
443
440
|
}
|
|
444
441
|
/**
|
|
445
442
|
* Gets the data validation type of the rule
|
|
@@ -504,7 +501,7 @@ const _FDataValidation = class _FDataValidation {
|
|
|
504
501
|
* ```
|
|
505
502
|
*/
|
|
506
503
|
copy() {
|
|
507
|
-
return new
|
|
504
|
+
return new D(this.rule);
|
|
508
505
|
}
|
|
509
506
|
/**
|
|
510
507
|
* Gets whether the data validation rule is applied to the worksheet
|
|
@@ -522,8 +519,8 @@ const _FDataValidation = class _FDataValidation {
|
|
|
522
519
|
getApplied() {
|
|
523
520
|
if (!this._worksheet)
|
|
524
521
|
return !1;
|
|
525
|
-
const
|
|
526
|
-
return !!(
|
|
522
|
+
const t = this._injector.get(b).getRuleById(this._worksheet.getUnitId(), this._worksheet.getSheetId(), this.rule.uid);
|
|
523
|
+
return !!(t && t.ranges.length);
|
|
527
524
|
}
|
|
528
525
|
/**
|
|
529
526
|
* Gets the ranges to which the data validation rule is applied
|
|
@@ -541,8 +538,8 @@ const _FDataValidation = class _FDataValidation {
|
|
|
541
538
|
getRanges() {
|
|
542
539
|
if (!this.getApplied())
|
|
543
540
|
return [];
|
|
544
|
-
const
|
|
545
|
-
return this.rule.ranges.map((
|
|
541
|
+
const e = this._injector.get(H).getUnit(this._worksheet.getUnitId());
|
|
542
|
+
return this.rule.ranges.map((t) => this._injector.createInstance(y, e, this._worksheet, t));
|
|
546
543
|
}
|
|
547
544
|
/**
|
|
548
545
|
* Gets the unit ID of the worksheet
|
|
@@ -558,8 +555,8 @@ const _FDataValidation = class _FDataValidation {
|
|
|
558
555
|
* ```
|
|
559
556
|
*/
|
|
560
557
|
getUnitId() {
|
|
561
|
-
var
|
|
562
|
-
return (
|
|
558
|
+
var e;
|
|
559
|
+
return (e = this._worksheet) == null ? void 0 : e.getUnitId();
|
|
563
560
|
}
|
|
564
561
|
/**
|
|
565
562
|
* Gets the sheet ID of the worksheet
|
|
@@ -575,8 +572,8 @@ const _FDataValidation = class _FDataValidation {
|
|
|
575
572
|
* ```
|
|
576
573
|
*/
|
|
577
574
|
getSheetId() {
|
|
578
|
-
var
|
|
579
|
-
return (
|
|
575
|
+
var e;
|
|
576
|
+
return (e = this._worksheet) == null ? void 0 : e.getSheetId();
|
|
580
577
|
}
|
|
581
578
|
/**
|
|
582
579
|
* Set Criteria for the data validation rule
|
|
@@ -598,21 +595,21 @@ const _FDataValidation = class _FDataValidation {
|
|
|
598
595
|
* );
|
|
599
596
|
* ```
|
|
600
597
|
*/
|
|
601
|
-
setCriteria(
|
|
602
|
-
if (this.getApplied() && !this._injector.get(
|
|
598
|
+
setCriteria(e, t, r = !0) {
|
|
599
|
+
if (this.getApplied() && !this._injector.get(p).syncExecuteCommand(U.id, {
|
|
603
600
|
unitId: this.getUnitId(),
|
|
604
601
|
subUnitId: this.getSheetId(),
|
|
605
602
|
ruleId: this.rule.uid,
|
|
606
603
|
setting: {
|
|
607
|
-
operator:
|
|
608
|
-
formula1:
|
|
609
|
-
formula2:
|
|
604
|
+
operator: t[0],
|
|
605
|
+
formula1: t[1],
|
|
606
|
+
formula2: t[2],
|
|
610
607
|
type: this.rule.type,
|
|
611
|
-
allowBlank
|
|
608
|
+
allowBlank: r
|
|
612
609
|
}
|
|
613
610
|
}))
|
|
614
611
|
throw new Error("setCriteria failed");
|
|
615
|
-
return this.rule.operator =
|
|
612
|
+
return this.rule.operator = t[0], this.rule.formula1 = t[1], this.rule.formula2 = t[2], this.rule.type = e, this.rule.allowBlank = r, this;
|
|
616
613
|
}
|
|
617
614
|
/**
|
|
618
615
|
* Set the options for the data validation rule
|
|
@@ -632,18 +629,18 @@ const _FDataValidation = class _FDataValidation {
|
|
|
632
629
|
* });
|
|
633
630
|
* ```
|
|
634
631
|
*/
|
|
635
|
-
setOptions(
|
|
636
|
-
if (this.getApplied() && !this._injector.get(
|
|
632
|
+
setOptions(e) {
|
|
633
|
+
if (this.getApplied() && !this._injector.get(p).syncExecuteCommand(v.id, {
|
|
637
634
|
unitId: this.getUnitId(),
|
|
638
635
|
subUnitId: this.getSheetId(),
|
|
639
636
|
ruleId: this.rule.uid,
|
|
640
637
|
options: {
|
|
641
|
-
...
|
|
642
|
-
...
|
|
638
|
+
...F(this.rule),
|
|
639
|
+
...e
|
|
643
640
|
}
|
|
644
641
|
}))
|
|
645
642
|
throw new Error("setOptions failed");
|
|
646
|
-
return Object.assign(this.rule,
|
|
643
|
+
return Object.assign(this.rule, e), this;
|
|
647
644
|
}
|
|
648
645
|
/**
|
|
649
646
|
* Set the ranges to the data validation rule
|
|
@@ -660,15 +657,15 @@ const _FDataValidation = class _FDataValidation {
|
|
|
660
657
|
* dataValidation.setRanges([range]);
|
|
661
658
|
* ```
|
|
662
659
|
*/
|
|
663
|
-
setRanges(
|
|
664
|
-
if (this.getApplied() && !this._injector.get(
|
|
660
|
+
setRanges(e) {
|
|
661
|
+
if (this.getApplied() && !this._injector.get(p).syncExecuteCommand(C.id, {
|
|
665
662
|
unitId: this.getUnitId(),
|
|
666
663
|
subUnitId: this.getSheetId(),
|
|
667
664
|
ruleId: this.rule.uid,
|
|
668
|
-
ranges:
|
|
665
|
+
ranges: e.map((a) => a.getRange())
|
|
669
666
|
}))
|
|
670
667
|
throw new Error("setRanges failed");
|
|
671
|
-
return this.rule.ranges =
|
|
668
|
+
return this.rule.ranges = e.map((t) => t.getRange()), this;
|
|
672
669
|
}
|
|
673
670
|
/**
|
|
674
671
|
* Delete the data validation rule from the worksheet
|
|
@@ -684,303 +681,295 @@ const _FDataValidation = class _FDataValidation {
|
|
|
684
681
|
* ```
|
|
685
682
|
*/
|
|
686
683
|
delete() {
|
|
687
|
-
return this.getApplied() ? this._injector.get(
|
|
684
|
+
return this.getApplied() ? this._injector.get(p).syncExecuteCommand(T.id, {
|
|
688
685
|
unitId: this.getUnitId(),
|
|
689
686
|
subUnitId: this.getSheetId(),
|
|
690
687
|
ruleId: this.rule.uid
|
|
691
688
|
}) : !1;
|
|
692
689
|
}
|
|
693
|
-
}
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
if (!rule)
|
|
699
|
-
return this._commandService.syncExecuteCommand(ClearRangeDataValidationCommand.id, {
|
|
690
|
+
}
|
|
691
|
+
class G extends y {
|
|
692
|
+
setDataValidation(e) {
|
|
693
|
+
if (!e)
|
|
694
|
+
return this._commandService.syncExecuteCommand(W.id, {
|
|
700
695
|
unitId: this._workbook.getUnitId(),
|
|
701
696
|
subUnitId: this._worksheet.getSheetId(),
|
|
702
697
|
ranges: [this._range]
|
|
703
698
|
}), this;
|
|
704
|
-
const
|
|
699
|
+
const t = {
|
|
705
700
|
unitId: this._workbook.getUnitId(),
|
|
706
701
|
subUnitId: this._worksheet.getSheetId(),
|
|
707
702
|
rule: {
|
|
708
|
-
...
|
|
703
|
+
...e.rule,
|
|
709
704
|
ranges: [this._range]
|
|
710
705
|
}
|
|
711
706
|
};
|
|
712
|
-
return this._commandService.syncExecuteCommand(
|
|
707
|
+
return this._commandService.syncExecuteCommand(A.id, t), this;
|
|
713
708
|
}
|
|
714
709
|
getDataValidation() {
|
|
715
|
-
const
|
|
710
|
+
const t = this._injector.get(S).getDataValidation(
|
|
716
711
|
this._workbook.getUnitId(),
|
|
717
712
|
this._worksheet.getSheetId(),
|
|
718
713
|
[this._range]
|
|
719
714
|
);
|
|
720
|
-
return
|
|
715
|
+
return t && new m(t, this._worksheet, this._injector);
|
|
721
716
|
}
|
|
722
717
|
getDataValidations() {
|
|
723
|
-
return this._injector.get(
|
|
718
|
+
return this._injector.get(S).getDataValidations(
|
|
724
719
|
this._workbook.getUnitId(),
|
|
725
720
|
this._worksheet.getSheetId(),
|
|
726
721
|
[this._range]
|
|
727
|
-
).map((
|
|
722
|
+
).map((t) => new m(t, this._worksheet, this._injector));
|
|
728
723
|
}
|
|
729
724
|
async getValidatorStatus() {
|
|
730
|
-
return this._injector.get(
|
|
725
|
+
return this._injector.get(S).validatorRanges(
|
|
731
726
|
this._workbook.getUnitId(),
|
|
732
727
|
this._worksheet.getSheetId(),
|
|
733
728
|
[this._range]
|
|
734
729
|
);
|
|
735
730
|
}
|
|
736
|
-
}
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
FRange.extend(FRangeDataValidationMixin);
|
|
740
|
-
const _FUnvierDataValidationMixin = class _FUnvierDataValidationMixin extends FUniver {
|
|
731
|
+
}
|
|
732
|
+
y.extend(G);
|
|
733
|
+
class Q extends x {
|
|
741
734
|
/**
|
|
742
735
|
* @deprecated use `univerAPI.newDataValidation()` as instead.
|
|
743
736
|
* @returns {FDataValidationBuilder} A new instance of the FDataValidationBuilder class
|
|
744
737
|
*/
|
|
745
738
|
static newDataValidation() {
|
|
746
|
-
return new
|
|
739
|
+
return new D();
|
|
747
740
|
}
|
|
748
741
|
newDataValidation() {
|
|
749
|
-
return new
|
|
742
|
+
return new D();
|
|
750
743
|
}
|
|
751
744
|
/**
|
|
752
745
|
* @ignore
|
|
753
746
|
*/
|
|
754
747
|
// eslint-disable-next-line max-lines-per-function
|
|
755
|
-
_initialize(
|
|
756
|
-
if (!
|
|
757
|
-
const
|
|
758
|
-
this.disposeWithMe(
|
|
759
|
-
const { unitId, subUnitId, rule, oldRule, type } =
|
|
760
|
-
if (!
|
|
748
|
+
_initialize(e) {
|
|
749
|
+
if (!e.has(V)) return;
|
|
750
|
+
const t = e.get(V), r = e.get(p);
|
|
751
|
+
this.disposeWithMe(t.ruleChange$.subscribe((a) => {
|
|
752
|
+
const { unitId: i, subUnitId: n, rule: d, oldRule: u, type: s } = a, l = this.getSheetTarget(i, n);
|
|
753
|
+
if (!l)
|
|
761
754
|
return;
|
|
762
|
-
const { workbook, worksheet } =
|
|
755
|
+
const { workbook: I, worksheet: k } = l, E = new m(d, k.getSheet(), this._injector);
|
|
763
756
|
this.fireEvent(this.Event.SheetDataValidationChanged, {
|
|
764
|
-
origin:
|
|
765
|
-
worksheet,
|
|
766
|
-
workbook,
|
|
767
|
-
changeType:
|
|
768
|
-
oldRule,
|
|
769
|
-
rule:
|
|
757
|
+
origin: a,
|
|
758
|
+
worksheet: k,
|
|
759
|
+
workbook: I,
|
|
760
|
+
changeType: s,
|
|
761
|
+
oldRule: u,
|
|
762
|
+
rule: E
|
|
770
763
|
});
|
|
771
|
-
})), this.disposeWithMe(
|
|
772
|
-
const { unitId, subUnitId, ruleId, status, row, col } =
|
|
773
|
-
if (!
|
|
764
|
+
})), this.disposeWithMe(t.validStatusChange$.subscribe((a) => {
|
|
765
|
+
const { unitId: i, subUnitId: n, ruleId: d, status: u, row: s, col: l } = a, I = this.getSheetTarget(i, n);
|
|
766
|
+
if (!I)
|
|
774
767
|
return;
|
|
775
|
-
const { workbook, worksheet } =
|
|
776
|
-
|
|
777
|
-
workbook,
|
|
778
|
-
worksheet,
|
|
779
|
-
row,
|
|
780
|
-
column:
|
|
781
|
-
rule,
|
|
782
|
-
status
|
|
768
|
+
const { workbook: k, worksheet: E } = I, L = E.getDataValidation(d);
|
|
769
|
+
L && this.fireEvent(this.Event.SheetDataValidatorStatusChanged, {
|
|
770
|
+
workbook: k,
|
|
771
|
+
worksheet: E,
|
|
772
|
+
row: s,
|
|
773
|
+
column: l,
|
|
774
|
+
rule: L,
|
|
775
|
+
status: u
|
|
783
776
|
});
|
|
784
|
-
})), this.disposeWithMe(
|
|
785
|
-
switch (
|
|
786
|
-
case
|
|
787
|
-
const
|
|
788
|
-
if (!
|
|
777
|
+
})), this.disposeWithMe(r.beforeCommandExecuted((a) => {
|
|
778
|
+
switch (a.id) {
|
|
779
|
+
case A.id: {
|
|
780
|
+
const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
|
|
781
|
+
if (!n)
|
|
789
782
|
return;
|
|
790
|
-
const { workbook, worksheet } =
|
|
791
|
-
worksheet,
|
|
792
|
-
workbook,
|
|
793
|
-
rule:
|
|
783
|
+
const { workbook: d, worksheet: u } = n, s = {
|
|
784
|
+
worksheet: u,
|
|
785
|
+
workbook: d,
|
|
786
|
+
rule: i.rule
|
|
794
787
|
};
|
|
795
|
-
if (this.fireEvent(this.Event.BeforeSheetDataValidationAdd,
|
|
796
|
-
throw new
|
|
788
|
+
if (this.fireEvent(this.Event.BeforeSheetDataValidationAdd, s), s.cancel)
|
|
789
|
+
throw new _();
|
|
797
790
|
break;
|
|
798
791
|
}
|
|
799
|
-
case
|
|
800
|
-
const
|
|
801
|
-
if (!
|
|
792
|
+
case U.id: {
|
|
793
|
+
const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
|
|
794
|
+
if (!n)
|
|
802
795
|
return;
|
|
803
|
-
const { workbook, worksheet } =
|
|
804
|
-
if (!
|
|
796
|
+
const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
|
|
797
|
+
if (!s)
|
|
805
798
|
return;
|
|
806
|
-
const
|
|
807
|
-
worksheet,
|
|
808
|
-
workbook,
|
|
809
|
-
rule,
|
|
810
|
-
ruleId:
|
|
811
|
-
newCriteria:
|
|
799
|
+
const l = {
|
|
800
|
+
worksheet: u,
|
|
801
|
+
workbook: d,
|
|
802
|
+
rule: s,
|
|
803
|
+
ruleId: i.ruleId,
|
|
804
|
+
newCriteria: i.setting
|
|
812
805
|
};
|
|
813
|
-
if (this.fireEvent(this.Event.BeforeSheetDataValidationCriteriaUpdate,
|
|
814
|
-
throw new
|
|
806
|
+
if (this.fireEvent(this.Event.BeforeSheetDataValidationCriteriaUpdate, l), l.cancel)
|
|
807
|
+
throw new _();
|
|
815
808
|
break;
|
|
816
809
|
}
|
|
817
|
-
case
|
|
818
|
-
const
|
|
819
|
-
if (!
|
|
810
|
+
case C.id: {
|
|
811
|
+
const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
|
|
812
|
+
if (!n)
|
|
820
813
|
return;
|
|
821
|
-
const { workbook, worksheet } =
|
|
822
|
-
if (!
|
|
814
|
+
const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
|
|
815
|
+
if (!s)
|
|
823
816
|
return;
|
|
824
|
-
const
|
|
825
|
-
worksheet,
|
|
826
|
-
workbook,
|
|
827
|
-
rule,
|
|
828
|
-
ruleId:
|
|
829
|
-
newRanges:
|
|
817
|
+
const l = {
|
|
818
|
+
worksheet: u,
|
|
819
|
+
workbook: d,
|
|
820
|
+
rule: s,
|
|
821
|
+
ruleId: i.ruleId,
|
|
822
|
+
newRanges: i.ranges
|
|
830
823
|
};
|
|
831
|
-
if (this.fireEvent(this.Event.BeforeSheetDataValidationRangeUpdate,
|
|
832
|
-
throw new
|
|
824
|
+
if (this.fireEvent(this.Event.BeforeSheetDataValidationRangeUpdate, l), l.cancel)
|
|
825
|
+
throw new _();
|
|
833
826
|
break;
|
|
834
827
|
}
|
|
835
|
-
case
|
|
836
|
-
const
|
|
837
|
-
if (!
|
|
828
|
+
case v.id: {
|
|
829
|
+
const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
|
|
830
|
+
if (!n)
|
|
838
831
|
return;
|
|
839
|
-
const { workbook, worksheet } =
|
|
840
|
-
if (!
|
|
832
|
+
const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
|
|
833
|
+
if (!s)
|
|
841
834
|
return;
|
|
842
|
-
const
|
|
843
|
-
worksheet,
|
|
844
|
-
workbook,
|
|
845
|
-
rule,
|
|
846
|
-
ruleId:
|
|
847
|
-
newOptions:
|
|
835
|
+
const l = {
|
|
836
|
+
worksheet: u,
|
|
837
|
+
workbook: d,
|
|
838
|
+
rule: s,
|
|
839
|
+
ruleId: i.ruleId,
|
|
840
|
+
newOptions: i.options
|
|
848
841
|
};
|
|
849
|
-
if (this.fireEvent(this.Event.BeforeSheetDataValidationOptionsUpdate,
|
|
850
|
-
throw new
|
|
842
|
+
if (this.fireEvent(this.Event.BeforeSheetDataValidationOptionsUpdate, l), l.cancel)
|
|
843
|
+
throw new _();
|
|
851
844
|
break;
|
|
852
845
|
}
|
|
853
|
-
case
|
|
854
|
-
const
|
|
855
|
-
if (!
|
|
846
|
+
case T.id: {
|
|
847
|
+
const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
|
|
848
|
+
if (!n)
|
|
856
849
|
return;
|
|
857
|
-
const { workbook, worksheet } =
|
|
858
|
-
if (!
|
|
850
|
+
const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
|
|
851
|
+
if (!s)
|
|
859
852
|
return;
|
|
860
|
-
const
|
|
861
|
-
worksheet,
|
|
862
|
-
workbook,
|
|
863
|
-
rule,
|
|
864
|
-
ruleId:
|
|
853
|
+
const l = {
|
|
854
|
+
worksheet: u,
|
|
855
|
+
workbook: d,
|
|
856
|
+
rule: s,
|
|
857
|
+
ruleId: i.ruleId
|
|
865
858
|
};
|
|
866
|
-
if (this.fireEvent(this.Event.BeforeSheetDataValidationDelete,
|
|
867
|
-
throw new
|
|
859
|
+
if (this.fireEvent(this.Event.BeforeSheetDataValidationDelete, l), l.cancel)
|
|
860
|
+
throw new _();
|
|
868
861
|
break;
|
|
869
862
|
}
|
|
870
|
-
case
|
|
871
|
-
const
|
|
872
|
-
if (!
|
|
863
|
+
case O.id: {
|
|
864
|
+
const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
|
|
865
|
+
if (!n)
|
|
873
866
|
return;
|
|
874
|
-
const { workbook, worksheet } =
|
|
875
|
-
worksheet,
|
|
876
|
-
workbook,
|
|
877
|
-
rules:
|
|
867
|
+
const { workbook: d, worksheet: u } = n, s = {
|
|
868
|
+
worksheet: u,
|
|
869
|
+
workbook: d,
|
|
870
|
+
rules: u.getDataValidations()
|
|
878
871
|
};
|
|
879
|
-
if (this.fireEvent(this.Event.BeforeSheetDataValidationDeleteAll,
|
|
880
|
-
throw new
|
|
872
|
+
if (this.fireEvent(this.Event.BeforeSheetDataValidationDeleteAll, s), s.cancel)
|
|
873
|
+
throw new _();
|
|
881
874
|
break;
|
|
882
875
|
}
|
|
883
876
|
}
|
|
884
877
|
}));
|
|
885
878
|
}
|
|
886
|
-
}
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
FUniver.extend(FUnvierDataValidationMixin);
|
|
890
|
-
const _FWorkbookDataValidationMixin = class _FWorkbookDataValidationMixin extends FWorkbook {
|
|
879
|
+
}
|
|
880
|
+
x.extend(Q);
|
|
881
|
+
class z extends M {
|
|
891
882
|
_initialize() {
|
|
892
883
|
Object.defineProperty(this, "_dataValidationModel", {
|
|
893
884
|
get() {
|
|
894
|
-
return this._injector.get(
|
|
885
|
+
return this._injector.get(V);
|
|
895
886
|
}
|
|
896
887
|
});
|
|
897
888
|
}
|
|
898
889
|
getValidatorStatus() {
|
|
899
|
-
return this._injector.get(
|
|
890
|
+
return this._injector.get(S).validatorWorkbook(this._workbook.getUnitId());
|
|
900
891
|
}
|
|
901
892
|
// region DataValidationHooks
|
|
902
|
-
onDataValidationChange(
|
|
903
|
-
return
|
|
893
|
+
onDataValidationChange(e) {
|
|
894
|
+
return g(this._dataValidationModel.ruleChange$.pipe(R((t) => t.unitId === this._workbook.getUnitId())).subscribe(e));
|
|
904
895
|
}
|
|
905
|
-
onDataValidationStatusChange(
|
|
906
|
-
return
|
|
896
|
+
onDataValidationStatusChange(e) {
|
|
897
|
+
return g(this._dataValidationModel.validStatusChange$.pipe(R((t) => t.unitId === this._workbook.getUnitId())).subscribe(e));
|
|
907
898
|
}
|
|
908
|
-
onBeforeAddDataValidation(
|
|
909
|
-
return
|
|
910
|
-
const
|
|
911
|
-
if (
|
|
912
|
-
if (
|
|
899
|
+
onBeforeAddDataValidation(e) {
|
|
900
|
+
return g(this._commandService.beforeCommandExecuted((t, r) => {
|
|
901
|
+
const a = t.params;
|
|
902
|
+
if (t.id === A.id) {
|
|
903
|
+
if (a.unitId !== this._workbook.getUnitId())
|
|
913
904
|
return;
|
|
914
|
-
if (
|
|
905
|
+
if (e(a, r) === !1)
|
|
915
906
|
throw new Error("Command is stopped by the hook onBeforeAddDataValidation");
|
|
916
907
|
}
|
|
917
908
|
}));
|
|
918
909
|
}
|
|
919
|
-
onBeforeUpdateDataValidationCriteria(
|
|
920
|
-
return
|
|
921
|
-
const
|
|
922
|
-
if (
|
|
923
|
-
if (
|
|
910
|
+
onBeforeUpdateDataValidationCriteria(e) {
|
|
911
|
+
return g(this._commandService.beforeCommandExecuted((t, r) => {
|
|
912
|
+
const a = t.params;
|
|
913
|
+
if (t.id === U.id) {
|
|
914
|
+
if (a.unitId !== this._workbook.getUnitId())
|
|
924
915
|
return;
|
|
925
|
-
if (
|
|
916
|
+
if (e(a, r) === !1)
|
|
926
917
|
throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationCriteria");
|
|
927
918
|
}
|
|
928
919
|
}));
|
|
929
920
|
}
|
|
930
|
-
onBeforeUpdateDataValidationRange(
|
|
931
|
-
return
|
|
932
|
-
const
|
|
933
|
-
if (
|
|
934
|
-
if (
|
|
921
|
+
onBeforeUpdateDataValidationRange(e) {
|
|
922
|
+
return g(this._commandService.beforeCommandExecuted((t, r) => {
|
|
923
|
+
const a = t.params;
|
|
924
|
+
if (t.id === C.id) {
|
|
925
|
+
if (a.unitId !== this._workbook.getUnitId())
|
|
935
926
|
return;
|
|
936
|
-
if (
|
|
927
|
+
if (e(a, r) === !1)
|
|
937
928
|
throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationRange");
|
|
938
929
|
}
|
|
939
930
|
}));
|
|
940
931
|
}
|
|
941
|
-
onBeforeUpdateDataValidationOptions(
|
|
942
|
-
return
|
|
943
|
-
const
|
|
944
|
-
if (
|
|
945
|
-
if (
|
|
932
|
+
onBeforeUpdateDataValidationOptions(e) {
|
|
933
|
+
return g(this._commandService.beforeCommandExecuted((t, r) => {
|
|
934
|
+
const a = t.params;
|
|
935
|
+
if (t.id === v.id) {
|
|
936
|
+
if (a.unitId !== this._workbook.getUnitId())
|
|
946
937
|
return;
|
|
947
|
-
if (
|
|
938
|
+
if (e(a, r) === !1)
|
|
948
939
|
throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationOptions");
|
|
949
940
|
}
|
|
950
941
|
}));
|
|
951
942
|
}
|
|
952
|
-
onBeforeDeleteDataValidation(
|
|
953
|
-
return
|
|
954
|
-
const
|
|
955
|
-
if (
|
|
956
|
-
if (
|
|
943
|
+
onBeforeDeleteDataValidation(e) {
|
|
944
|
+
return g(this._commandService.beforeCommandExecuted((t, r) => {
|
|
945
|
+
const a = t.params;
|
|
946
|
+
if (t.id === T.id) {
|
|
947
|
+
if (a.unitId !== this._workbook.getUnitId())
|
|
957
948
|
return;
|
|
958
|
-
if (
|
|
949
|
+
if (e(a, r) === !1)
|
|
959
950
|
throw new Error("Command is stopped by the hook onBeforeDeleteDataValidation");
|
|
960
951
|
}
|
|
961
952
|
}));
|
|
962
953
|
}
|
|
963
|
-
onBeforeDeleteAllDataValidation(
|
|
964
|
-
return
|
|
965
|
-
const
|
|
966
|
-
if (
|
|
967
|
-
if (
|
|
954
|
+
onBeforeDeleteAllDataValidation(e) {
|
|
955
|
+
return g(this._commandService.beforeCommandExecuted((t, r) => {
|
|
956
|
+
const a = t.params;
|
|
957
|
+
if (t.id === O.id) {
|
|
958
|
+
if (a.unitId !== this._workbook.getUnitId())
|
|
968
959
|
return;
|
|
969
|
-
if (
|
|
960
|
+
if (e(a, r) === !1)
|
|
970
961
|
throw new Error("Command is stopped by the hook onBeforeDeleteAllDataValidation");
|
|
971
962
|
}
|
|
972
963
|
}));
|
|
973
964
|
}
|
|
974
|
-
}
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
FWorkbook.extend(FWorkbookDataValidationMixin);
|
|
978
|
-
const _FWorksheetDataValidationMixin = class _FWorksheetDataValidationMixin extends FWorksheet {
|
|
965
|
+
}
|
|
966
|
+
M.extend(z);
|
|
967
|
+
class K extends N {
|
|
979
968
|
getDataValidations() {
|
|
980
|
-
return this._injector.get(
|
|
969
|
+
return this._injector.get(b).getRules(this._workbook.getUnitId(), this._worksheet.getSheetId()).map((t) => new m(t, this._worksheet, this._injector));
|
|
981
970
|
}
|
|
982
971
|
getValidatorStatus() {
|
|
983
|
-
return this._injector.get(
|
|
972
|
+
return this._injector.get(S).validatorWorksheet(
|
|
984
973
|
this._workbook.getUnitId(),
|
|
985
974
|
this._worksheet.getSheetId()
|
|
986
975
|
);
|
|
@@ -988,15 +977,13 @@ const _FWorksheetDataValidationMixin = class _FWorksheetDataValidationMixin exte
|
|
|
988
977
|
getValidatorStatusAsync() {
|
|
989
978
|
return this.getValidatorStatus();
|
|
990
979
|
}
|
|
991
|
-
getDataValidation(
|
|
992
|
-
const
|
|
993
|
-
return
|
|
980
|
+
getDataValidation(e) {
|
|
981
|
+
const r = this._injector.get(b).getRuleById(this._workbook.getUnitId(), this._worksheet.getSheetId(), e);
|
|
982
|
+
return r ? new m(r, this._worksheet, this._injector) : null;
|
|
994
983
|
}
|
|
995
|
-
}
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
FWorksheet.extend(FWorksheetDataValidationMixin);
|
|
999
|
-
const _FDataValidationEvent = class _FDataValidationEvent {
|
|
984
|
+
}
|
|
985
|
+
N.extend(K);
|
|
986
|
+
class X {
|
|
1000
987
|
get SheetDataValidationChanged() {
|
|
1001
988
|
return "SheetDataValidationChanged";
|
|
1002
989
|
}
|
|
@@ -1021,11 +1008,9 @@ const _FDataValidationEvent = class _FDataValidationEvent {
|
|
|
1021
1008
|
get BeforeSheetDataValidationOptionsUpdate() {
|
|
1022
1009
|
return "BeforeSheetDataValidationOptionsUpdate";
|
|
1023
1010
|
}
|
|
1024
|
-
}
|
|
1025
|
-
|
|
1026
|
-
let FDataValidationEvent = _FDataValidationEvent;
|
|
1027
|
-
FEventName.extend(FDataValidationEvent);
|
|
1011
|
+
}
|
|
1012
|
+
$.extend(X);
|
|
1028
1013
|
export {
|
|
1029
|
-
FDataValidation,
|
|
1030
|
-
FDataValidationBuilder
|
|
1014
|
+
m as FDataValidation,
|
|
1015
|
+
D as FDataValidationBuilder
|
|
1031
1016
|
};
|