@univerjs/sheets-data-validation 0.5.5-experimental.20250122-3362a4a → 0.5.5-nightly.202501201606
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/cjs/facade.js +1 -1
- package/lib/cjs/index.js +1 -1
- package/lib/es/facade.js +274 -292
- package/lib/es/index.js +1704 -1741
- package/lib/types/facade/f-data-validation-builder.d.ts +0 -1
- package/lib/types/facade/f-data-validation.d.ts +0 -3
- package/lib/types/facade/f-univer.d.ts +0 -3
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +6 -6
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,67 +681,63 @@ 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
|
// eslint-disable-next-line jsdoc/require-returns
|
|
742
735
|
/**
|
|
743
736
|
/**
|
|
744
737
|
* @deprecated use `univerAPI.newDataValidation()` as instead.
|
|
745
738
|
*/
|
|
746
739
|
static newDataValidation() {
|
|
747
|
-
return new
|
|
740
|
+
return new D();
|
|
748
741
|
}
|
|
749
742
|
/**
|
|
750
743
|
* Creates a new instance of FDataValidationBuilder
|
|
@@ -756,241 +749,234 @@ const _FUnvierDataValidationMixin = class _FUnvierDataValidationMixin extends FU
|
|
|
756
749
|
* ```
|
|
757
750
|
*/
|
|
758
751
|
newDataValidation() {
|
|
759
|
-
return new
|
|
752
|
+
return new D();
|
|
760
753
|
}
|
|
761
|
-
/**
|
|
762
|
-
* @ignore
|
|
763
|
-
*/
|
|
764
754
|
// eslint-disable-next-line max-lines-per-function
|
|
765
|
-
_initialize(
|
|
766
|
-
if (!
|
|
767
|
-
const
|
|
768
|
-
this.disposeWithMe(
|
|
769
|
-
const { unitId, subUnitId, rule, oldRule, type } =
|
|
770
|
-
if (!
|
|
755
|
+
_initialize(e) {
|
|
756
|
+
if (!e.has(V)) return;
|
|
757
|
+
const t = e.get(V), r = e.get(p);
|
|
758
|
+
this.disposeWithMe(t.ruleChange$.subscribe((a) => {
|
|
759
|
+
const { unitId: i, subUnitId: n, rule: d, oldRule: u, type: s } = a, l = this.getSheetTarget(i, n);
|
|
760
|
+
if (!l)
|
|
771
761
|
return;
|
|
772
|
-
const { workbook, worksheet } =
|
|
762
|
+
const { workbook: I, worksheet: k } = l, E = new m(d, k.getSheet(), this._injector);
|
|
773
763
|
this.fireEvent(this.Event.SheetDataValidationChanged, {
|
|
774
|
-
origin:
|
|
775
|
-
worksheet,
|
|
776
|
-
workbook,
|
|
777
|
-
changeType:
|
|
778
|
-
oldRule,
|
|
779
|
-
rule:
|
|
764
|
+
origin: a,
|
|
765
|
+
worksheet: k,
|
|
766
|
+
workbook: I,
|
|
767
|
+
changeType: s,
|
|
768
|
+
oldRule: u,
|
|
769
|
+
rule: E
|
|
780
770
|
});
|
|
781
|
-
})), this.disposeWithMe(
|
|
782
|
-
const { unitId, subUnitId, ruleId, status, row, col } =
|
|
783
|
-
if (!
|
|
771
|
+
})), this.disposeWithMe(t.validStatusChange$.subscribe((a) => {
|
|
772
|
+
const { unitId: i, subUnitId: n, ruleId: d, status: u, row: s, col: l } = a, I = this.getSheetTarget(i, n);
|
|
773
|
+
if (!I)
|
|
784
774
|
return;
|
|
785
|
-
const { workbook, worksheet } =
|
|
786
|
-
|
|
787
|
-
workbook,
|
|
788
|
-
worksheet,
|
|
789
|
-
row,
|
|
790
|
-
column:
|
|
791
|
-
rule,
|
|
792
|
-
status
|
|
775
|
+
const { workbook: k, worksheet: E } = I, L = E.getDataValidation(d);
|
|
776
|
+
L && this.fireEvent(this.Event.SheetDataValidatorStatusChanged, {
|
|
777
|
+
workbook: k,
|
|
778
|
+
worksheet: E,
|
|
779
|
+
row: s,
|
|
780
|
+
column: l,
|
|
781
|
+
rule: L,
|
|
782
|
+
status: u
|
|
793
783
|
});
|
|
794
|
-
})), this.disposeWithMe(
|
|
795
|
-
switch (
|
|
796
|
-
case
|
|
797
|
-
const
|
|
798
|
-
if (!
|
|
784
|
+
})), this.disposeWithMe(r.beforeCommandExecuted((a) => {
|
|
785
|
+
switch (a.id) {
|
|
786
|
+
case A.id: {
|
|
787
|
+
const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
|
|
788
|
+
if (!n)
|
|
799
789
|
return;
|
|
800
|
-
const { workbook, worksheet } =
|
|
801
|
-
worksheet,
|
|
802
|
-
workbook,
|
|
803
|
-
rule:
|
|
790
|
+
const { workbook: d, worksheet: u } = n, s = {
|
|
791
|
+
worksheet: u,
|
|
792
|
+
workbook: d,
|
|
793
|
+
rule: i.rule
|
|
804
794
|
};
|
|
805
|
-
if (this.fireEvent(this.Event.BeforeSheetDataValidationAdd,
|
|
806
|
-
throw new
|
|
795
|
+
if (this.fireEvent(this.Event.BeforeSheetDataValidationAdd, s), s.cancel)
|
|
796
|
+
throw new _();
|
|
807
797
|
break;
|
|
808
798
|
}
|
|
809
|
-
case
|
|
810
|
-
const
|
|
811
|
-
if (!
|
|
799
|
+
case U.id: {
|
|
800
|
+
const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
|
|
801
|
+
if (!n)
|
|
812
802
|
return;
|
|
813
|
-
const { workbook, worksheet } =
|
|
814
|
-
if (!
|
|
803
|
+
const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
|
|
804
|
+
if (!s)
|
|
815
805
|
return;
|
|
816
|
-
const
|
|
817
|
-
worksheet,
|
|
818
|
-
workbook,
|
|
819
|
-
rule,
|
|
820
|
-
ruleId:
|
|
821
|
-
newCriteria:
|
|
806
|
+
const l = {
|
|
807
|
+
worksheet: u,
|
|
808
|
+
workbook: d,
|
|
809
|
+
rule: s,
|
|
810
|
+
ruleId: i.ruleId,
|
|
811
|
+
newCriteria: i.setting
|
|
822
812
|
};
|
|
823
|
-
if (this.fireEvent(this.Event.BeforeSheetDataValidationCriteriaUpdate,
|
|
824
|
-
throw new
|
|
813
|
+
if (this.fireEvent(this.Event.BeforeSheetDataValidationCriteriaUpdate, l), l.cancel)
|
|
814
|
+
throw new _();
|
|
825
815
|
break;
|
|
826
816
|
}
|
|
827
|
-
case
|
|
828
|
-
const
|
|
829
|
-
if (!
|
|
817
|
+
case C.id: {
|
|
818
|
+
const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
|
|
819
|
+
if (!n)
|
|
830
820
|
return;
|
|
831
|
-
const { workbook, worksheet } =
|
|
832
|
-
if (!
|
|
821
|
+
const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
|
|
822
|
+
if (!s)
|
|
833
823
|
return;
|
|
834
|
-
const
|
|
835
|
-
worksheet,
|
|
836
|
-
workbook,
|
|
837
|
-
rule,
|
|
838
|
-
ruleId:
|
|
839
|
-
newRanges:
|
|
824
|
+
const l = {
|
|
825
|
+
worksheet: u,
|
|
826
|
+
workbook: d,
|
|
827
|
+
rule: s,
|
|
828
|
+
ruleId: i.ruleId,
|
|
829
|
+
newRanges: i.ranges
|
|
840
830
|
};
|
|
841
|
-
if (this.fireEvent(this.Event.BeforeSheetDataValidationRangeUpdate,
|
|
842
|
-
throw new
|
|
831
|
+
if (this.fireEvent(this.Event.BeforeSheetDataValidationRangeUpdate, l), l.cancel)
|
|
832
|
+
throw new _();
|
|
843
833
|
break;
|
|
844
834
|
}
|
|
845
|
-
case
|
|
846
|
-
const
|
|
847
|
-
if (!
|
|
835
|
+
case v.id: {
|
|
836
|
+
const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
|
|
837
|
+
if (!n)
|
|
848
838
|
return;
|
|
849
|
-
const { workbook, worksheet } =
|
|
850
|
-
if (!
|
|
839
|
+
const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
|
|
840
|
+
if (!s)
|
|
851
841
|
return;
|
|
852
|
-
const
|
|
853
|
-
worksheet,
|
|
854
|
-
workbook,
|
|
855
|
-
rule,
|
|
856
|
-
ruleId:
|
|
857
|
-
newOptions:
|
|
842
|
+
const l = {
|
|
843
|
+
worksheet: u,
|
|
844
|
+
workbook: d,
|
|
845
|
+
rule: s,
|
|
846
|
+
ruleId: i.ruleId,
|
|
847
|
+
newOptions: i.options
|
|
858
848
|
};
|
|
859
|
-
if (this.fireEvent(this.Event.BeforeSheetDataValidationOptionsUpdate,
|
|
860
|
-
throw new
|
|
849
|
+
if (this.fireEvent(this.Event.BeforeSheetDataValidationOptionsUpdate, l), l.cancel)
|
|
850
|
+
throw new _();
|
|
861
851
|
break;
|
|
862
852
|
}
|
|
863
|
-
case
|
|
864
|
-
const
|
|
865
|
-
if (!
|
|
853
|
+
case T.id: {
|
|
854
|
+
const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
|
|
855
|
+
if (!n)
|
|
866
856
|
return;
|
|
867
|
-
const { workbook, worksheet } =
|
|
868
|
-
if (!
|
|
857
|
+
const { workbook: d, worksheet: u } = n, s = u.getDataValidation(i.ruleId);
|
|
858
|
+
if (!s)
|
|
869
859
|
return;
|
|
870
|
-
const
|
|
871
|
-
worksheet,
|
|
872
|
-
workbook,
|
|
873
|
-
rule,
|
|
874
|
-
ruleId:
|
|
860
|
+
const l = {
|
|
861
|
+
worksheet: u,
|
|
862
|
+
workbook: d,
|
|
863
|
+
rule: s,
|
|
864
|
+
ruleId: i.ruleId
|
|
875
865
|
};
|
|
876
|
-
if (this.fireEvent(this.Event.BeforeSheetDataValidationDelete,
|
|
877
|
-
throw new
|
|
866
|
+
if (this.fireEvent(this.Event.BeforeSheetDataValidationDelete, l), l.cancel)
|
|
867
|
+
throw new _();
|
|
878
868
|
break;
|
|
879
869
|
}
|
|
880
|
-
case
|
|
881
|
-
const
|
|
882
|
-
if (!
|
|
870
|
+
case O.id: {
|
|
871
|
+
const i = a.params, n = this.getSheetTarget(i.unitId, i.subUnitId);
|
|
872
|
+
if (!n)
|
|
883
873
|
return;
|
|
884
|
-
const { workbook, worksheet } =
|
|
885
|
-
worksheet,
|
|
886
|
-
workbook,
|
|
887
|
-
rules:
|
|
874
|
+
const { workbook: d, worksheet: u } = n, s = {
|
|
875
|
+
worksheet: u,
|
|
876
|
+
workbook: d,
|
|
877
|
+
rules: u.getDataValidations()
|
|
888
878
|
};
|
|
889
|
-
if (this.fireEvent(this.Event.BeforeSheetDataValidationDeleteAll,
|
|
890
|
-
throw new
|
|
879
|
+
if (this.fireEvent(this.Event.BeforeSheetDataValidationDeleteAll, s), s.cancel)
|
|
880
|
+
throw new _();
|
|
891
881
|
break;
|
|
892
882
|
}
|
|
893
883
|
}
|
|
894
884
|
}));
|
|
895
885
|
}
|
|
896
|
-
}
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
FUniver.extend(FUnvierDataValidationMixin);
|
|
900
|
-
const _FWorkbookDataValidationMixin = class _FWorkbookDataValidationMixin extends FWorkbook {
|
|
886
|
+
}
|
|
887
|
+
x.extend(Q);
|
|
888
|
+
class z extends M {
|
|
901
889
|
_initialize() {
|
|
902
890
|
Object.defineProperty(this, "_dataValidationModel", {
|
|
903
891
|
get() {
|
|
904
|
-
return this._injector.get(
|
|
892
|
+
return this._injector.get(V);
|
|
905
893
|
}
|
|
906
894
|
});
|
|
907
895
|
}
|
|
908
896
|
getValidatorStatus() {
|
|
909
|
-
return this._injector.get(
|
|
897
|
+
return this._injector.get(S).validatorWorkbook(this._workbook.getUnitId());
|
|
910
898
|
}
|
|
911
899
|
// region DataValidationHooks
|
|
912
|
-
onDataValidationChange(
|
|
913
|
-
return
|
|
900
|
+
onDataValidationChange(e) {
|
|
901
|
+
return g(this._dataValidationModel.ruleChange$.pipe(R((t) => t.unitId === this._workbook.getUnitId())).subscribe(e));
|
|
914
902
|
}
|
|
915
|
-
onDataValidationStatusChange(
|
|
916
|
-
return
|
|
903
|
+
onDataValidationStatusChange(e) {
|
|
904
|
+
return g(this._dataValidationModel.validStatusChange$.pipe(R((t) => t.unitId === this._workbook.getUnitId())).subscribe(e));
|
|
917
905
|
}
|
|
918
|
-
onBeforeAddDataValidation(
|
|
919
|
-
return
|
|
920
|
-
const
|
|
921
|
-
if (
|
|
922
|
-
if (
|
|
906
|
+
onBeforeAddDataValidation(e) {
|
|
907
|
+
return g(this._commandService.beforeCommandExecuted((t, r) => {
|
|
908
|
+
const a = t.params;
|
|
909
|
+
if (t.id === A.id) {
|
|
910
|
+
if (a.unitId !== this._workbook.getUnitId())
|
|
923
911
|
return;
|
|
924
|
-
if (
|
|
912
|
+
if (e(a, r) === !1)
|
|
925
913
|
throw new Error("Command is stopped by the hook onBeforeAddDataValidation");
|
|
926
914
|
}
|
|
927
915
|
}));
|
|
928
916
|
}
|
|
929
|
-
onBeforeUpdateDataValidationCriteria(
|
|
930
|
-
return
|
|
931
|
-
const
|
|
932
|
-
if (
|
|
933
|
-
if (
|
|
917
|
+
onBeforeUpdateDataValidationCriteria(e) {
|
|
918
|
+
return g(this._commandService.beforeCommandExecuted((t, r) => {
|
|
919
|
+
const a = t.params;
|
|
920
|
+
if (t.id === U.id) {
|
|
921
|
+
if (a.unitId !== this._workbook.getUnitId())
|
|
934
922
|
return;
|
|
935
|
-
if (
|
|
923
|
+
if (e(a, r) === !1)
|
|
936
924
|
throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationCriteria");
|
|
937
925
|
}
|
|
938
926
|
}));
|
|
939
927
|
}
|
|
940
|
-
onBeforeUpdateDataValidationRange(
|
|
941
|
-
return
|
|
942
|
-
const
|
|
943
|
-
if (
|
|
944
|
-
if (
|
|
928
|
+
onBeforeUpdateDataValidationRange(e) {
|
|
929
|
+
return g(this._commandService.beforeCommandExecuted((t, r) => {
|
|
930
|
+
const a = t.params;
|
|
931
|
+
if (t.id === C.id) {
|
|
932
|
+
if (a.unitId !== this._workbook.getUnitId())
|
|
945
933
|
return;
|
|
946
|
-
if (
|
|
934
|
+
if (e(a, r) === !1)
|
|
947
935
|
throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationRange");
|
|
948
936
|
}
|
|
949
937
|
}));
|
|
950
938
|
}
|
|
951
|
-
onBeforeUpdateDataValidationOptions(
|
|
952
|
-
return
|
|
953
|
-
const
|
|
954
|
-
if (
|
|
955
|
-
if (
|
|
939
|
+
onBeforeUpdateDataValidationOptions(e) {
|
|
940
|
+
return g(this._commandService.beforeCommandExecuted((t, r) => {
|
|
941
|
+
const a = t.params;
|
|
942
|
+
if (t.id === v.id) {
|
|
943
|
+
if (a.unitId !== this._workbook.getUnitId())
|
|
956
944
|
return;
|
|
957
|
-
if (
|
|
945
|
+
if (e(a, r) === !1)
|
|
958
946
|
throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationOptions");
|
|
959
947
|
}
|
|
960
948
|
}));
|
|
961
949
|
}
|
|
962
|
-
onBeforeDeleteDataValidation(
|
|
963
|
-
return
|
|
964
|
-
const
|
|
965
|
-
if (
|
|
966
|
-
if (
|
|
950
|
+
onBeforeDeleteDataValidation(e) {
|
|
951
|
+
return g(this._commandService.beforeCommandExecuted((t, r) => {
|
|
952
|
+
const a = t.params;
|
|
953
|
+
if (t.id === T.id) {
|
|
954
|
+
if (a.unitId !== this._workbook.getUnitId())
|
|
967
955
|
return;
|
|
968
|
-
if (
|
|
956
|
+
if (e(a, r) === !1)
|
|
969
957
|
throw new Error("Command is stopped by the hook onBeforeDeleteDataValidation");
|
|
970
958
|
}
|
|
971
959
|
}));
|
|
972
960
|
}
|
|
973
|
-
onBeforeDeleteAllDataValidation(
|
|
974
|
-
return
|
|
975
|
-
const
|
|
976
|
-
if (
|
|
977
|
-
if (
|
|
961
|
+
onBeforeDeleteAllDataValidation(e) {
|
|
962
|
+
return g(this._commandService.beforeCommandExecuted((t, r) => {
|
|
963
|
+
const a = t.params;
|
|
964
|
+
if (t.id === O.id) {
|
|
965
|
+
if (a.unitId !== this._workbook.getUnitId())
|
|
978
966
|
return;
|
|
979
|
-
if (
|
|
967
|
+
if (e(a, r) === !1)
|
|
980
968
|
throw new Error("Command is stopped by the hook onBeforeDeleteAllDataValidation");
|
|
981
969
|
}
|
|
982
970
|
}));
|
|
983
971
|
}
|
|
984
|
-
}
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
FWorkbook.extend(FWorkbookDataValidationMixin);
|
|
988
|
-
const _FWorksheetDataValidationMixin = class _FWorksheetDataValidationMixin extends FWorksheet {
|
|
972
|
+
}
|
|
973
|
+
M.extend(z);
|
|
974
|
+
class K extends N {
|
|
989
975
|
getDataValidations() {
|
|
990
|
-
return this._injector.get(
|
|
976
|
+
return this._injector.get(b).getRules(this._workbook.getUnitId(), this._worksheet.getSheetId()).map((t) => new m(t, this._worksheet, this._injector));
|
|
991
977
|
}
|
|
992
978
|
getValidatorStatus() {
|
|
993
|
-
return this._injector.get(
|
|
979
|
+
return this._injector.get(S).validatorWorksheet(
|
|
994
980
|
this._workbook.getUnitId(),
|
|
995
981
|
this._worksheet.getSheetId()
|
|
996
982
|
);
|
|
@@ -998,15 +984,13 @@ const _FWorksheetDataValidationMixin = class _FWorksheetDataValidationMixin exte
|
|
|
998
984
|
getValidatorStatusAsync() {
|
|
999
985
|
return this.getValidatorStatus();
|
|
1000
986
|
}
|
|
1001
|
-
getDataValidation(
|
|
1002
|
-
const
|
|
1003
|
-
return
|
|
987
|
+
getDataValidation(e) {
|
|
988
|
+
const r = this._injector.get(b).getRuleById(this._workbook.getUnitId(), this._worksheet.getSheetId(), e);
|
|
989
|
+
return r ? new m(r, this._worksheet, this._injector) : null;
|
|
1004
990
|
}
|
|
1005
|
-
}
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
FWorksheet.extend(FWorksheetDataValidationMixin);
|
|
1009
|
-
const _FDataValidationEvent = class _FDataValidationEvent {
|
|
991
|
+
}
|
|
992
|
+
N.extend(K);
|
|
993
|
+
class X {
|
|
1010
994
|
get SheetDataValidationChanged() {
|
|
1011
995
|
return "SheetDataValidationChanged";
|
|
1012
996
|
}
|
|
@@ -1031,11 +1015,9 @@ const _FDataValidationEvent = class _FDataValidationEvent {
|
|
|
1031
1015
|
get BeforeSheetDataValidationOptionsUpdate() {
|
|
1032
1016
|
return "BeforeSheetDataValidationOptionsUpdate";
|
|
1033
1017
|
}
|
|
1034
|
-
}
|
|
1035
|
-
|
|
1036
|
-
let FDataValidationEvent = _FDataValidationEvent;
|
|
1037
|
-
FEventName.extend(FDataValidationEvent);
|
|
1018
|
+
}
|
|
1019
|
+
$.extend(X);
|
|
1038
1020
|
export {
|
|
1039
|
-
FDataValidation,
|
|
1040
|
-
FDataValidationBuilder
|
|
1021
|
+
m as FDataValidation,
|
|
1022
|
+
D as FDataValidationBuilder
|
|
1041
1023
|
};
|