@univerjs/sheets-data-validation 0.6.3 → 0.6.4-nightly.202503101606
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 +142 -141
- package/lib/es/index.js +64 -48
- package/lib/types/services/dv-cache.service.d.ts +2 -1
- package/lib/types/services/dv-custom-formula.service.d.ts +3 -0
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +10 -10
- package/LICENSE +0 -176
package/lib/es/facade.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
var H = Object.defineProperty;
|
|
2
|
-
var
|
|
3
|
-
var
|
|
4
|
-
import { UpdateSheetDataValidationSettingCommand as b, UpdateSheetDataValidationOptionsCommand as U, UpdateSheetDataValidationRangeCommand as C, RemoveSheetDataValidationCommand as A, ClearRangeDataValidationCommand as
|
|
5
|
-
import { FRange as y, FWorkbook as x, FWorksheet as
|
|
6
|
-
import { DataValidationType as
|
|
2
|
+
var q = (h, e, t) => e in h ? H(h, e, { enumerable: !0, configurable: !0, writable: !0, value: t }) : h[e] = t;
|
|
3
|
+
var _ = (h, e, t) => q(h, typeof e != "symbol" ? e + "" : e, t);
|
|
4
|
+
import { UpdateSheetDataValidationSettingCommand as b, UpdateSheetDataValidationOptionsCommand as U, UpdateSheetDataValidationRangeCommand as C, RemoveSheetDataValidationCommand as A, ClearRangeDataValidationCommand as j, AddSheetDataValidationCommand as T, SheetsDataValidationValidatorService as S, SheetDataValidationModel as f, RemoveSheetAllDataValidationCommand as O } from "@univerjs/sheets-data-validation";
|
|
5
|
+
import { FRange as y, FWorkbook as x, FWorksheet as M } from "@univerjs/sheets/facade";
|
|
6
|
+
import { DataValidationType as a, generateRandomId as L, DataValidationErrorStyle as k, DataValidationOperator as u, IUniverInstanceService as W, ICommandService as p, CanceledError as c, toDisposable as g } from "@univerjs/core";
|
|
7
7
|
import { DataValidationModel as w, getRuleOptions as $ } from "@univerjs/data-validation";
|
|
8
8
|
import { serializeRangeToRefString as F } from "@univerjs/engine-formula";
|
|
9
|
-
import { FUniver as
|
|
9
|
+
import { FUniver as N, FEventName as P } from "@univerjs/core/facade";
|
|
10
10
|
import { filter as R } from "rxjs";
|
|
11
11
|
class E {
|
|
12
12
|
constructor(e) {
|
|
13
|
-
|
|
13
|
+
_(this, "_rule");
|
|
14
14
|
this._rule = e != null ? e : {
|
|
15
15
|
uid: L(),
|
|
16
16
|
ranges: void 0,
|
|
17
|
-
type:
|
|
17
|
+
type: a.CUSTOM
|
|
18
18
|
};
|
|
19
19
|
}
|
|
20
20
|
/**
|
|
@@ -39,7 +39,7 @@ class E {
|
|
|
39
39
|
* ```
|
|
40
40
|
*/
|
|
41
41
|
build() {
|
|
42
|
-
return new
|
|
42
|
+
return new m(this._rule);
|
|
43
43
|
}
|
|
44
44
|
/**
|
|
45
45
|
* Creates a duplicate of the current DataValidationBuilder object
|
|
@@ -82,7 +82,7 @@ class E {
|
|
|
82
82
|
* ```
|
|
83
83
|
*/
|
|
84
84
|
getAllowInvalid() {
|
|
85
|
-
return this._rule.errorStyle !==
|
|
85
|
+
return this._rule.errorStyle !== k.STOP;
|
|
86
86
|
}
|
|
87
87
|
/**
|
|
88
88
|
* Gets the data validation type of the rule
|
|
@@ -159,7 +159,7 @@ class E {
|
|
|
159
159
|
* ```
|
|
160
160
|
*/
|
|
161
161
|
requireCheckbox(e, t) {
|
|
162
|
-
return this._rule.type =
|
|
162
|
+
return this._rule.type = a.CHECKBOX, this._rule.formula1 = e, this._rule.formula2 = t, this;
|
|
163
163
|
}
|
|
164
164
|
/**
|
|
165
165
|
* Set the data validation type to DATE and configure the validation rules to be after a specific date.
|
|
@@ -189,7 +189,7 @@ class E {
|
|
|
189
189
|
* ```
|
|
190
190
|
*/
|
|
191
191
|
requireDateAfter(e) {
|
|
192
|
-
return this._rule.type =
|
|
192
|
+
return this._rule.type = a.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.operator = u.GREATER_THAN, this;
|
|
193
193
|
}
|
|
194
194
|
/**
|
|
195
195
|
* Set the data validation type to DATE and configure the validation rules to be before a specific date.
|
|
@@ -219,7 +219,7 @@ class E {
|
|
|
219
219
|
* ```
|
|
220
220
|
*/
|
|
221
221
|
requireDateBefore(e) {
|
|
222
|
-
return this._rule.type =
|
|
222
|
+
return this._rule.type = a.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = u.LESS_THAN, this;
|
|
223
223
|
}
|
|
224
224
|
/**
|
|
225
225
|
* Set the data validation type to DATE and configure the validation rules to be within a specific date range.
|
|
@@ -250,7 +250,7 @@ class E {
|
|
|
250
250
|
* ```
|
|
251
251
|
*/
|
|
252
252
|
requireDateBetween(e, t) {
|
|
253
|
-
return this._rule.type =
|
|
253
|
+
return this._rule.type = a.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = t.toLocaleDateString(), this._rule.operator = u.BETWEEN, this;
|
|
254
254
|
}
|
|
255
255
|
/**
|
|
256
256
|
* Set the data validation type to DATE and configure the validation rules to be equal to a specific date.
|
|
@@ -284,7 +284,7 @@ class E {
|
|
|
284
284
|
* ```
|
|
285
285
|
*/
|
|
286
286
|
requireDateEqualTo(e) {
|
|
287
|
-
return this._rule.type =
|
|
287
|
+
return this._rule.type = a.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = u.EQUAL, this;
|
|
288
288
|
}
|
|
289
289
|
/**
|
|
290
290
|
* Set the data validation type to DATE and configure the validation rules to be not within a specific date range.
|
|
@@ -315,7 +315,7 @@ class E {
|
|
|
315
315
|
* ```
|
|
316
316
|
*/
|
|
317
317
|
requireDateNotBetween(e, t) {
|
|
318
|
-
return this._rule.type =
|
|
318
|
+
return this._rule.type = a.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = t.toLocaleDateString(), this._rule.operator = u.NOT_BETWEEN, this;
|
|
319
319
|
}
|
|
320
320
|
/**
|
|
321
321
|
* Set the data validation type to DATE and configure the validation rules to be on or after a specific date.
|
|
@@ -345,7 +345,7 @@ class E {
|
|
|
345
345
|
* ```
|
|
346
346
|
*/
|
|
347
347
|
requireDateOnOrAfter(e) {
|
|
348
|
-
return this._rule.type =
|
|
348
|
+
return this._rule.type = a.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = u.GREATER_THAN_OR_EQUAL, this;
|
|
349
349
|
}
|
|
350
350
|
/**
|
|
351
351
|
* Set the data validation type to DATE and configure the validation rules to be on or before a specific date.
|
|
@@ -375,7 +375,7 @@ class E {
|
|
|
375
375
|
* ```
|
|
376
376
|
*/
|
|
377
377
|
requireDateOnOrBefore(e) {
|
|
378
|
-
return this._rule.type =
|
|
378
|
+
return this._rule.type = a.DATE, this._rule.formula1 = e.toLocaleDateString(), this._rule.formula2 = void 0, this._rule.operator = u.LESS_THAN_OR_EQUAL, this;
|
|
379
379
|
}
|
|
380
380
|
/**
|
|
381
381
|
* Sets the data validation rule to require that the given formula evaluates to `true`.
|
|
@@ -414,7 +414,7 @@ class E {
|
|
|
414
414
|
* ```
|
|
415
415
|
*/
|
|
416
416
|
requireFormulaSatisfied(e) {
|
|
417
|
-
return this._rule.type =
|
|
417
|
+
return this._rule.type = a.CUSTOM, this._rule.formula1 = e, this._rule.formula2 = void 0, this;
|
|
418
418
|
}
|
|
419
419
|
/**
|
|
420
420
|
* Sets the data validation rule to require a number that falls between, or is either of, two specified numbers.
|
|
@@ -441,7 +441,7 @@ class E {
|
|
|
441
441
|
* ```
|
|
442
442
|
*/
|
|
443
443
|
requireNumberBetween(e, t, i) {
|
|
444
|
-
return this._rule.formula1 = `${e}`, this._rule.formula2 = `${t}`, this._rule.operator =
|
|
444
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = `${t}`, this._rule.operator = u.BETWEEN, this._rule.type = i ? a.WHOLE : a.DECIMAL, this;
|
|
445
445
|
}
|
|
446
446
|
/**
|
|
447
447
|
* Sets the data validation rule to require a number equal to the given value.
|
|
@@ -467,7 +467,7 @@ class E {
|
|
|
467
467
|
* ```
|
|
468
468
|
*/
|
|
469
469
|
requireNumberEqualTo(e, t) {
|
|
470
|
-
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator =
|
|
470
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = u.EQUAL, this._rule.type = t ? a.WHOLE : a.DECIMAL, this;
|
|
471
471
|
}
|
|
472
472
|
/**
|
|
473
473
|
* Sets the data validation rule to require a number greater than the given value.
|
|
@@ -493,7 +493,7 @@ class E {
|
|
|
493
493
|
* ```
|
|
494
494
|
*/
|
|
495
495
|
requireNumberGreaterThan(e, t) {
|
|
496
|
-
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator =
|
|
496
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = u.GREATER_THAN, this._rule.type = t ? a.WHOLE : a.DECIMAL, this;
|
|
497
497
|
}
|
|
498
498
|
/**
|
|
499
499
|
* Sets the data validation rule to require a number greater than or equal to the given value.
|
|
@@ -519,7 +519,7 @@ class E {
|
|
|
519
519
|
* ```
|
|
520
520
|
*/
|
|
521
521
|
requireNumberGreaterThanOrEqualTo(e, t) {
|
|
522
|
-
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator =
|
|
522
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = u.GREATER_THAN_OR_EQUAL, this._rule.type = t ? a.WHOLE : a.DECIMAL, this;
|
|
523
523
|
}
|
|
524
524
|
/**
|
|
525
525
|
* Sets the data validation rule to require a number less than the given value.
|
|
@@ -545,7 +545,7 @@ class E {
|
|
|
545
545
|
* ```
|
|
546
546
|
*/
|
|
547
547
|
requireNumberLessThan(e, t) {
|
|
548
|
-
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator =
|
|
548
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = u.LESS_THAN, this._rule.type = t ? a.WHOLE : a.DECIMAL, this;
|
|
549
549
|
}
|
|
550
550
|
/**
|
|
551
551
|
* Sets the data validation rule to require a number less than or equal to the given value.
|
|
@@ -571,7 +571,7 @@ class E {
|
|
|
571
571
|
* ```
|
|
572
572
|
*/
|
|
573
573
|
requireNumberLessThanOrEqualTo(e, t) {
|
|
574
|
-
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator =
|
|
574
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = u.LESS_THAN_OR_EQUAL, this._rule.type = t ? a.WHOLE : a.DECIMAL, this;
|
|
575
575
|
}
|
|
576
576
|
/**
|
|
577
577
|
* Sets the data validation rule to require a number that does not fall between, and is neither of, two specified numbers.
|
|
@@ -598,7 +598,7 @@ class E {
|
|
|
598
598
|
* ```
|
|
599
599
|
*/
|
|
600
600
|
requireNumberNotBetween(e, t, i) {
|
|
601
|
-
return this._rule.formula1 = `${e}`, this._rule.formula2 = `${t}`, this._rule.operator =
|
|
601
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = `${t}`, this._rule.operator = u.NOT_BETWEEN, this._rule.type = i ? a.WHOLE : a.DECIMAL, this;
|
|
602
602
|
}
|
|
603
603
|
/**
|
|
604
604
|
* Sets the data validation rule to require a number not equal to the given value.
|
|
@@ -624,7 +624,7 @@ class E {
|
|
|
624
624
|
* ```
|
|
625
625
|
*/
|
|
626
626
|
requireNumberNotEqualTo(e, t) {
|
|
627
|
-
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator =
|
|
627
|
+
return this._rule.formula1 = `${e}`, this._rule.formula2 = void 0, this._rule.operator = u.NOT_EQUAL, this._rule.type = t ? a.WHOLE : a.DECIMAL, this;
|
|
628
628
|
}
|
|
629
629
|
/**
|
|
630
630
|
* Sets a data validation rule that requires the user to enter a value from a list of specific values.
|
|
@@ -652,7 +652,7 @@ class E {
|
|
|
652
652
|
* ```
|
|
653
653
|
*/
|
|
654
654
|
requireValueInList(e, t, i) {
|
|
655
|
-
return this._rule.type = t ?
|
|
655
|
+
return this._rule.type = t ? a.LIST_MULTIPLE : a.LIST, this._rule.formula1 = e.join(","), this._rule.formula2 = void 0, this._rule.showDropDown = i != null ? i : !0, this;
|
|
656
656
|
}
|
|
657
657
|
/**
|
|
658
658
|
* Sets a data validation rule that requires the user to enter a value within a specific range.
|
|
@@ -687,7 +687,7 @@ class E {
|
|
|
687
687
|
* ```
|
|
688
688
|
*/
|
|
689
689
|
requireValueInRange(e, t, i) {
|
|
690
|
-
return this._rule.type = t ?
|
|
690
|
+
return this._rule.type = t ? a.LIST_MULTIPLE : a.LIST, this._rule.formula1 = `=${F({
|
|
691
691
|
unitId: e.getUnitId(),
|
|
692
692
|
sheetName: e.getSheetName(),
|
|
693
693
|
range: e.getRange()
|
|
@@ -722,7 +722,7 @@ class E {
|
|
|
722
722
|
* ```
|
|
723
723
|
*/
|
|
724
724
|
setAllowInvalid(e) {
|
|
725
|
-
return this._rule.errorStyle = e ?
|
|
725
|
+
return this._rule.errorStyle = e ? k.WARNING : k.STOP, this;
|
|
726
726
|
}
|
|
727
727
|
/**
|
|
728
728
|
* Sets whether to allow blank values.
|
|
@@ -780,11 +780,11 @@ class E {
|
|
|
780
780
|
return Object.assign(this._rule, e), this;
|
|
781
781
|
}
|
|
782
782
|
}
|
|
783
|
-
class
|
|
783
|
+
class m {
|
|
784
784
|
constructor(e, t, i) {
|
|
785
|
-
|
|
786
|
-
|
|
787
|
-
|
|
785
|
+
_(this, "rule");
|
|
786
|
+
_(this, "_worksheet");
|
|
787
|
+
_(this, "_injector");
|
|
788
788
|
this._injector = i, this.rule = e, this._worksheet = t;
|
|
789
789
|
}
|
|
790
790
|
/**
|
|
@@ -801,7 +801,7 @@ class _ {
|
|
|
801
801
|
* ```
|
|
802
802
|
*/
|
|
803
803
|
getAllowInvalid() {
|
|
804
|
-
return this.rule.errorStyle !==
|
|
804
|
+
return this.rule.errorStyle !== k.STOP;
|
|
805
805
|
}
|
|
806
806
|
/**
|
|
807
807
|
* Gets the data validation type of the rule
|
|
@@ -1106,7 +1106,7 @@ class _ {
|
|
|
1106
1106
|
class G extends y {
|
|
1107
1107
|
setDataValidation(e) {
|
|
1108
1108
|
if (!e)
|
|
1109
|
-
return this._commandService.syncExecuteCommand(
|
|
1109
|
+
return this._commandService.syncExecuteCommand(j.id, {
|
|
1110
1110
|
unitId: this._workbook.getUnitId(),
|
|
1111
1111
|
subUnitId: this._worksheet.getSheetId(),
|
|
1112
1112
|
ranges: [this._range]
|
|
@@ -1127,14 +1127,14 @@ class G extends y {
|
|
|
1127
1127
|
this._worksheet.getSheetId(),
|
|
1128
1128
|
[this._range]
|
|
1129
1129
|
);
|
|
1130
|
-
return t && new
|
|
1130
|
+
return t && new m(t, this._worksheet, this._injector);
|
|
1131
1131
|
}
|
|
1132
1132
|
getDataValidations() {
|
|
1133
1133
|
return this._injector.get(S).getDataValidations(
|
|
1134
1134
|
this._workbook.getUnitId(),
|
|
1135
1135
|
this._worksheet.getSheetId(),
|
|
1136
1136
|
[this._range]
|
|
1137
|
-
).map((t) => new
|
|
1137
|
+
).map((t) => new m(t, this._worksheet, this._injector));
|
|
1138
1138
|
}
|
|
1139
1139
|
async getValidatorStatus() {
|
|
1140
1140
|
return this._injector.get(S).validatorRanges(
|
|
@@ -1145,7 +1145,7 @@ class G extends y {
|
|
|
1145
1145
|
}
|
|
1146
1146
|
}
|
|
1147
1147
|
y.extend(G);
|
|
1148
|
-
class Q extends
|
|
1148
|
+
class Q extends N {
|
|
1149
1149
|
/**
|
|
1150
1150
|
* @deprecated use `univerAPI.newDataValidation()` as instead.
|
|
1151
1151
|
* @returns {FDataValidationBuilder} A new instance of the FDataValidationBuilder class
|
|
@@ -1161,164 +1161,165 @@ class Q extends M {
|
|
|
1161
1161
|
*/
|
|
1162
1162
|
// eslint-disable-next-line max-lines-per-function
|
|
1163
1163
|
_initialize(e) {
|
|
1164
|
-
|
|
1165
|
-
const t = e.get(k), i = e.get(p);
|
|
1164
|
+
const t = e.get(p);
|
|
1166
1165
|
this.registerEventHandler(
|
|
1167
1166
|
this.Event.SheetDataValidationChanged,
|
|
1168
|
-
() =>
|
|
1169
|
-
const { unitId:
|
|
1170
|
-
if (!
|
|
1167
|
+
() => e.has(f) ? e.get(f).ruleChange$.subscribe((r) => {
|
|
1168
|
+
const { unitId: o, subUnitId: l, rule: s, oldRule: n, type: d } = r, D = this.getSheetTarget(o, l);
|
|
1169
|
+
if (!D)
|
|
1171
1170
|
return;
|
|
1172
|
-
const { workbook:
|
|
1171
|
+
const { workbook: I, worksheet: V } = D, v = new m(s, V.getSheet(), this._injector);
|
|
1173
1172
|
this.fireEvent(this.Event.SheetDataValidationChanged, {
|
|
1174
1173
|
origin: r,
|
|
1175
|
-
worksheet:
|
|
1176
|
-
workbook:
|
|
1177
|
-
changeType:
|
|
1178
|
-
oldRule:
|
|
1174
|
+
worksheet: V,
|
|
1175
|
+
workbook: I,
|
|
1176
|
+
changeType: d,
|
|
1177
|
+
oldRule: n,
|
|
1179
1178
|
rule: v
|
|
1180
1179
|
});
|
|
1181
|
-
})
|
|
1180
|
+
}) : { dispose: () => {
|
|
1181
|
+
} }
|
|
1182
1182
|
), this.registerEventHandler(
|
|
1183
1183
|
this.Event.SheetDataValidatorStatusChanged,
|
|
1184
|
-
() =>
|
|
1185
|
-
const { unitId:
|
|
1186
|
-
if (!
|
|
1184
|
+
() => e.has(f) ? e.get(f).validStatusChange$.subscribe((r) => {
|
|
1185
|
+
const { unitId: o, subUnitId: l, ruleId: s, status: n, row: d, col: D } = r, I = this.getSheetTarget(o, l);
|
|
1186
|
+
if (!I)
|
|
1187
1187
|
return;
|
|
1188
|
-
const { workbook:
|
|
1188
|
+
const { workbook: V, worksheet: v } = I, B = v.getDataValidation(s);
|
|
1189
1189
|
B && this.fireEvent(this.Event.SheetDataValidatorStatusChanged, {
|
|
1190
|
-
workbook:
|
|
1190
|
+
workbook: V,
|
|
1191
1191
|
worksheet: v,
|
|
1192
|
-
row:
|
|
1193
|
-
column:
|
|
1192
|
+
row: d,
|
|
1193
|
+
column: D,
|
|
1194
1194
|
rule: B,
|
|
1195
|
-
status:
|
|
1195
|
+
status: n
|
|
1196
1196
|
});
|
|
1197
|
-
})
|
|
1197
|
+
}) : { dispose: () => {
|
|
1198
|
+
} }
|
|
1198
1199
|
), this.registerEventHandler(
|
|
1199
1200
|
this.Event.BeforeSheetDataValidationAdd,
|
|
1200
|
-
() =>
|
|
1201
|
-
if (
|
|
1202
|
-
const
|
|
1203
|
-
if (!
|
|
1201
|
+
() => t.beforeCommandExecuted((i) => {
|
|
1202
|
+
if (i.id === T.id) {
|
|
1203
|
+
const r = i.params, o = this.getSheetTarget(r.unitId, r.subUnitId);
|
|
1204
|
+
if (!o)
|
|
1204
1205
|
return;
|
|
1205
|
-
const { workbook:
|
|
1206
|
-
worksheet:
|
|
1207
|
-
workbook:
|
|
1208
|
-
rule:
|
|
1206
|
+
const { workbook: l, worksheet: s } = o, n = {
|
|
1207
|
+
worksheet: s,
|
|
1208
|
+
workbook: l,
|
|
1209
|
+
rule: r.rule
|
|
1209
1210
|
};
|
|
1210
|
-
if (this.fireEvent(this.Event.BeforeSheetDataValidationAdd,
|
|
1211
|
-
throw new
|
|
1211
|
+
if (this.fireEvent(this.Event.BeforeSheetDataValidationAdd, n), n.cancel)
|
|
1212
|
+
throw new c();
|
|
1212
1213
|
}
|
|
1213
1214
|
})
|
|
1214
1215
|
), this.registerEventHandler(
|
|
1215
1216
|
this.Event.BeforeSheetDataValidationCriteriaUpdate,
|
|
1216
|
-
() =>
|
|
1217
|
-
if (
|
|
1218
|
-
const
|
|
1219
|
-
if (!
|
|
1217
|
+
() => t.beforeCommandExecuted((i) => {
|
|
1218
|
+
if (i.id === b.id) {
|
|
1219
|
+
const r = i.params, o = this.getSheetTarget(r.unitId, r.subUnitId);
|
|
1220
|
+
if (!o)
|
|
1220
1221
|
return;
|
|
1221
|
-
const { workbook:
|
|
1222
|
-
if (!
|
|
1222
|
+
const { workbook: l, worksheet: s } = o, n = s.getDataValidation(r.ruleId);
|
|
1223
|
+
if (!n)
|
|
1223
1224
|
return;
|
|
1224
1225
|
const d = {
|
|
1225
|
-
worksheet:
|
|
1226
|
-
workbook:
|
|
1227
|
-
rule:
|
|
1228
|
-
ruleId:
|
|
1229
|
-
newCriteria:
|
|
1226
|
+
worksheet: s,
|
|
1227
|
+
workbook: l,
|
|
1228
|
+
rule: n,
|
|
1229
|
+
ruleId: r.ruleId,
|
|
1230
|
+
newCriteria: r.setting
|
|
1230
1231
|
};
|
|
1231
1232
|
if (this.fireEvent(this.Event.BeforeSheetDataValidationCriteriaUpdate, d), d.cancel)
|
|
1232
|
-
throw new
|
|
1233
|
+
throw new c();
|
|
1233
1234
|
}
|
|
1234
1235
|
})
|
|
1235
1236
|
), this.registerEventHandler(
|
|
1236
1237
|
this.Event.BeforeSheetDataValidationRangeUpdate,
|
|
1237
|
-
() =>
|
|
1238
|
-
if (
|
|
1239
|
-
const
|
|
1240
|
-
if (!
|
|
1238
|
+
() => t.beforeCommandExecuted((i) => {
|
|
1239
|
+
if (i.id === C.id) {
|
|
1240
|
+
const r = i.params, o = this.getSheetTarget(r.unitId, r.subUnitId);
|
|
1241
|
+
if (!o)
|
|
1241
1242
|
return;
|
|
1242
|
-
const { workbook:
|
|
1243
|
-
if (!
|
|
1243
|
+
const { workbook: l, worksheet: s } = o, n = s.getDataValidation(r.ruleId);
|
|
1244
|
+
if (!n)
|
|
1244
1245
|
return;
|
|
1245
1246
|
const d = {
|
|
1246
|
-
worksheet:
|
|
1247
|
-
workbook:
|
|
1248
|
-
rule:
|
|
1249
|
-
ruleId:
|
|
1250
|
-
newRanges:
|
|
1247
|
+
worksheet: s,
|
|
1248
|
+
workbook: l,
|
|
1249
|
+
rule: n,
|
|
1250
|
+
ruleId: r.ruleId,
|
|
1251
|
+
newRanges: r.ranges
|
|
1251
1252
|
};
|
|
1252
1253
|
if (this.fireEvent(this.Event.BeforeSheetDataValidationRangeUpdate, d), d.cancel)
|
|
1253
|
-
throw new
|
|
1254
|
+
throw new c();
|
|
1254
1255
|
}
|
|
1255
1256
|
})
|
|
1256
1257
|
), this.registerEventHandler(
|
|
1257
1258
|
this.Event.BeforeSheetDataValidationOptionsUpdate,
|
|
1258
|
-
() =>
|
|
1259
|
-
if (
|
|
1260
|
-
const
|
|
1261
|
-
if (!
|
|
1259
|
+
() => t.beforeCommandExecuted((i) => {
|
|
1260
|
+
if (i.id === U.id) {
|
|
1261
|
+
const r = i.params, o = this.getSheetTarget(r.unitId, r.subUnitId);
|
|
1262
|
+
if (!o)
|
|
1262
1263
|
return;
|
|
1263
|
-
const { workbook:
|
|
1264
|
-
if (!
|
|
1264
|
+
const { workbook: l, worksheet: s } = o, n = s.getDataValidation(r.ruleId);
|
|
1265
|
+
if (!n)
|
|
1265
1266
|
return;
|
|
1266
1267
|
const d = {
|
|
1267
|
-
worksheet:
|
|
1268
|
-
workbook:
|
|
1269
|
-
rule:
|
|
1270
|
-
ruleId:
|
|
1271
|
-
newOptions:
|
|
1268
|
+
worksheet: s,
|
|
1269
|
+
workbook: l,
|
|
1270
|
+
rule: n,
|
|
1271
|
+
ruleId: r.ruleId,
|
|
1272
|
+
newOptions: r.options
|
|
1272
1273
|
};
|
|
1273
1274
|
if (this.fireEvent(this.Event.BeforeSheetDataValidationOptionsUpdate, d), d.cancel)
|
|
1274
|
-
throw new
|
|
1275
|
+
throw new c();
|
|
1275
1276
|
}
|
|
1276
1277
|
})
|
|
1277
1278
|
), this.registerEventHandler(
|
|
1278
1279
|
this.Event.BeforeSheetDataValidationDelete,
|
|
1279
|
-
() =>
|
|
1280
|
-
if (
|
|
1281
|
-
const
|
|
1282
|
-
if (!
|
|
1280
|
+
() => t.beforeCommandExecuted((i) => {
|
|
1281
|
+
if (i.id === A.id) {
|
|
1282
|
+
const r = i.params, o = this.getSheetTarget(r.unitId, r.subUnitId);
|
|
1283
|
+
if (!o)
|
|
1283
1284
|
return;
|
|
1284
|
-
const { workbook:
|
|
1285
|
-
if (!
|
|
1285
|
+
const { workbook: l, worksheet: s } = o, n = s.getDataValidation(r.ruleId);
|
|
1286
|
+
if (!n)
|
|
1286
1287
|
return;
|
|
1287
1288
|
const d = {
|
|
1288
|
-
worksheet:
|
|
1289
|
-
workbook:
|
|
1290
|
-
rule:
|
|
1291
|
-
ruleId:
|
|
1289
|
+
worksheet: s,
|
|
1290
|
+
workbook: l,
|
|
1291
|
+
rule: n,
|
|
1292
|
+
ruleId: r.ruleId
|
|
1292
1293
|
};
|
|
1293
1294
|
if (this.fireEvent(this.Event.BeforeSheetDataValidationDelete, d), d.cancel)
|
|
1294
|
-
throw new
|
|
1295
|
+
throw new c();
|
|
1295
1296
|
}
|
|
1296
1297
|
})
|
|
1297
1298
|
), this.registerEventHandler(
|
|
1298
1299
|
this.Event.BeforeSheetDataValidationDeleteAll,
|
|
1299
|
-
() =>
|
|
1300
|
-
if (
|
|
1301
|
-
const
|
|
1302
|
-
if (!
|
|
1300
|
+
() => t.beforeCommandExecuted((i) => {
|
|
1301
|
+
if (i.id === O.id) {
|
|
1302
|
+
const r = i.params, o = this.getSheetTarget(r.unitId, r.subUnitId);
|
|
1303
|
+
if (!o)
|
|
1303
1304
|
return;
|
|
1304
|
-
const { workbook:
|
|
1305
|
-
worksheet:
|
|
1306
|
-
workbook:
|
|
1307
|
-
rules:
|
|
1305
|
+
const { workbook: l, worksheet: s } = o, n = {
|
|
1306
|
+
worksheet: s,
|
|
1307
|
+
workbook: l,
|
|
1308
|
+
rules: s.getDataValidations()
|
|
1308
1309
|
};
|
|
1309
|
-
if (this.fireEvent(this.Event.BeforeSheetDataValidationDeleteAll,
|
|
1310
|
-
throw new
|
|
1310
|
+
if (this.fireEvent(this.Event.BeforeSheetDataValidationDeleteAll, n), n.cancel)
|
|
1311
|
+
throw new c();
|
|
1311
1312
|
}
|
|
1312
1313
|
})
|
|
1313
1314
|
);
|
|
1314
1315
|
}
|
|
1315
1316
|
}
|
|
1316
|
-
|
|
1317
|
+
N.extend(Q);
|
|
1317
1318
|
class z extends x {
|
|
1318
1319
|
_initialize() {
|
|
1319
1320
|
Object.defineProperty(this, "_dataValidationModel", {
|
|
1320
1321
|
get() {
|
|
1321
|
-
return this._injector.get(
|
|
1322
|
+
return this._injector.get(f);
|
|
1322
1323
|
}
|
|
1323
1324
|
});
|
|
1324
1325
|
}
|
|
@@ -1327,13 +1328,13 @@ class z extends x {
|
|
|
1327
1328
|
}
|
|
1328
1329
|
// region DataValidationHooks
|
|
1329
1330
|
onDataValidationChange(e) {
|
|
1330
|
-
return
|
|
1331
|
+
return g(this._dataValidationModel.ruleChange$.pipe(R((t) => t.unitId === this._workbook.getUnitId())).subscribe(e));
|
|
1331
1332
|
}
|
|
1332
1333
|
onDataValidationStatusChange(e) {
|
|
1333
|
-
return
|
|
1334
|
+
return g(this._dataValidationModel.validStatusChange$.pipe(R((t) => t.unitId === this._workbook.getUnitId())).subscribe(e));
|
|
1334
1335
|
}
|
|
1335
1336
|
onBeforeAddDataValidation(e) {
|
|
1336
|
-
return
|
|
1337
|
+
return g(this._commandService.beforeCommandExecuted((t, i) => {
|
|
1337
1338
|
const r = t.params;
|
|
1338
1339
|
if (t.id === T.id) {
|
|
1339
1340
|
if (r.unitId !== this._workbook.getUnitId())
|
|
@@ -1344,7 +1345,7 @@ class z extends x {
|
|
|
1344
1345
|
}));
|
|
1345
1346
|
}
|
|
1346
1347
|
onBeforeUpdateDataValidationCriteria(e) {
|
|
1347
|
-
return
|
|
1348
|
+
return g(this._commandService.beforeCommandExecuted((t, i) => {
|
|
1348
1349
|
const r = t.params;
|
|
1349
1350
|
if (t.id === b.id) {
|
|
1350
1351
|
if (r.unitId !== this._workbook.getUnitId())
|
|
@@ -1355,7 +1356,7 @@ class z extends x {
|
|
|
1355
1356
|
}));
|
|
1356
1357
|
}
|
|
1357
1358
|
onBeforeUpdateDataValidationRange(e) {
|
|
1358
|
-
return
|
|
1359
|
+
return g(this._commandService.beforeCommandExecuted((t, i) => {
|
|
1359
1360
|
const r = t.params;
|
|
1360
1361
|
if (t.id === C.id) {
|
|
1361
1362
|
if (r.unitId !== this._workbook.getUnitId())
|
|
@@ -1366,7 +1367,7 @@ class z extends x {
|
|
|
1366
1367
|
}));
|
|
1367
1368
|
}
|
|
1368
1369
|
onBeforeUpdateDataValidationOptions(e) {
|
|
1369
|
-
return
|
|
1370
|
+
return g(this._commandService.beforeCommandExecuted((t, i) => {
|
|
1370
1371
|
const r = t.params;
|
|
1371
1372
|
if (t.id === U.id) {
|
|
1372
1373
|
if (r.unitId !== this._workbook.getUnitId())
|
|
@@ -1377,7 +1378,7 @@ class z extends x {
|
|
|
1377
1378
|
}));
|
|
1378
1379
|
}
|
|
1379
1380
|
onBeforeDeleteDataValidation(e) {
|
|
1380
|
-
return
|
|
1381
|
+
return g(this._commandService.beforeCommandExecuted((t, i) => {
|
|
1381
1382
|
const r = t.params;
|
|
1382
1383
|
if (t.id === A.id) {
|
|
1383
1384
|
if (r.unitId !== this._workbook.getUnitId())
|
|
@@ -1388,7 +1389,7 @@ class z extends x {
|
|
|
1388
1389
|
}));
|
|
1389
1390
|
}
|
|
1390
1391
|
onBeforeDeleteAllDataValidation(e) {
|
|
1391
|
-
return
|
|
1392
|
+
return g(this._commandService.beforeCommandExecuted((t, i) => {
|
|
1392
1393
|
const r = t.params;
|
|
1393
1394
|
if (t.id === O.id) {
|
|
1394
1395
|
if (r.unitId !== this._workbook.getUnitId())
|
|
@@ -1400,9 +1401,9 @@ class z extends x {
|
|
|
1400
1401
|
}
|
|
1401
1402
|
}
|
|
1402
1403
|
x.extend(z);
|
|
1403
|
-
class K extends
|
|
1404
|
+
class K extends M {
|
|
1404
1405
|
getDataValidations() {
|
|
1405
|
-
return this._injector.get(w).getRules(this._workbook.getUnitId(), this._worksheet.getSheetId()).map((t) => new
|
|
1406
|
+
return this._injector.get(w).getRules(this._workbook.getUnitId(), this._worksheet.getSheetId()).map((t) => new m(t, this._worksheet, this._injector));
|
|
1406
1407
|
}
|
|
1407
1408
|
getValidatorStatus() {
|
|
1408
1409
|
return this._injector.get(S).validatorWorksheet(
|
|
@@ -1415,10 +1416,10 @@ class K extends N {
|
|
|
1415
1416
|
}
|
|
1416
1417
|
getDataValidation(e) {
|
|
1417
1418
|
const i = this._injector.get(w).getRuleById(this._workbook.getUnitId(), this._worksheet.getSheetId(), e);
|
|
1418
|
-
return i ? new
|
|
1419
|
+
return i ? new m(i, this._worksheet, this._injector) : null;
|
|
1419
1420
|
}
|
|
1420
1421
|
}
|
|
1421
|
-
|
|
1422
|
+
M.extend(K);
|
|
1422
1423
|
class X {
|
|
1423
1424
|
get SheetDataValidationChanged() {
|
|
1424
1425
|
return "SheetDataValidationChanged";
|
|
@@ -1447,6 +1448,6 @@ class X {
|
|
|
1447
1448
|
}
|
|
1448
1449
|
P.extend(X);
|
|
1449
1450
|
export {
|
|
1450
|
-
|
|
1451
|
+
m as FDataValidation,
|
|
1451
1452
|
E as FDataValidationBuilder
|
|
1452
1453
|
};
|