@univerjs/sheets-data-validation 0.17.0 → 0.18.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.
Files changed (46) hide show
  1. package/lib/cjs/facade.js +1 -1
  2. package/lib/cjs/index.js +1 -1
  3. package/lib/es/facade.js +1 -1628
  4. package/lib/es/index.js +1 -2640
  5. package/lib/facade.js +1 -1628
  6. package/lib/index.js +1 -2640
  7. package/lib/types/commands/commands/data-validation.command.d.ts +19 -4
  8. package/lib/types/common/date-text-map.d.ts +15 -0
  9. package/lib/types/controllers/dv-formula-ref-range.controller.d.ts +17 -1
  10. package/lib/types/controllers/dv-formula.controller.d.ts +15 -0
  11. package/lib/types/controllers/dv-ref-range.controller.d.ts +17 -1
  12. package/lib/types/controllers/dv-sheet.controller.d.ts +15 -0
  13. package/lib/types/controllers/dv.controller.d.ts +15 -0
  14. package/lib/types/facade/f-data-validation-builder.d.ts +18 -2
  15. package/lib/types/facade/f-data-validation.d.ts +16 -1
  16. package/lib/types/facade/f-event.d.ts +20 -5
  17. package/lib/types/facade/f-range.d.ts +18 -2
  18. package/lib/types/facade/f-univer.d.ts +16 -1
  19. package/lib/types/facade/f-workbook.d.ts +20 -3
  20. package/lib/types/facade/f-worksheet.d.ts +18 -2
  21. package/lib/types/models/rule-matrix.d.ts +17 -2
  22. package/lib/types/models/sheet-data-validation-model.d.ts +24 -7
  23. package/lib/types/plugin.d.ts +16 -1
  24. package/lib/types/services/dv-cache.service.d.ts +18 -2
  25. package/lib/types/services/dv-custom-formula.service.d.ts +21 -5
  26. package/lib/types/services/dv-formula.service.d.ts +19 -2
  27. package/lib/types/services/dv-list-cache.service.d.ts +18 -2
  28. package/lib/types/services/dv-validator-service.d.ts +17 -1
  29. package/lib/types/types/const/operator-text-map.d.ts +15 -0
  30. package/lib/types/types/const/two-formula-operators.d.ts +15 -0
  31. package/lib/types/utils/create.d.ts +18 -2
  32. package/lib/types/utils/formula.d.ts +18 -3
  33. package/lib/types/utils/get-cell-data-origin.d.ts +17 -2
  34. package/lib/types/validators/any-validator.d.ts +18 -2
  35. package/lib/types/validators/checkbox-validator.d.ts +19 -2
  36. package/lib/types/validators/custom-validator.d.ts +18 -2
  37. package/lib/types/validators/date-validator.d.ts +20 -3
  38. package/lib/types/validators/decimal-validator.d.ts +23 -6
  39. package/lib/types/validators/list-multiple-validator.d.ts +15 -0
  40. package/lib/types/validators/list-validator.d.ts +18 -2
  41. package/lib/types/validators/text-length-validator.d.ts +23 -6
  42. package/lib/types/validators/util.d.ts +18 -3
  43. package/lib/types/validators/whole-validator.d.ts +23 -6
  44. package/lib/umd/facade.js +1 -1
  45. package/lib/umd/index.js +1 -1
  46. package/package.json +11 -10
@@ -1,8 +1,24 @@
1
- import { IAccessor, DataValidationOperator, DataValidationType } from '@univerjs/core';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { IAccessor } from '@univerjs/core';
17
+ import { DataValidationOperator, DataValidationType } from '@univerjs/core';
2
18
  export declare function createDefaultNewRule(accessor: IAccessor): {
3
19
  uid: string;
4
20
  type: DataValidationType;
5
21
  operator: DataValidationOperator;
6
22
  formula1: string;
7
- ranges: import('@univerjs/core').IRange[];
23
+ ranges: import("@univerjs/core").IRange[];
8
24
  };
@@ -1,6 +1,21 @@
1
- import { DataValidationType, ICellData, Nullable } from '@univerjs/core';
2
- import { DataValidatorRegistryService } from '@univerjs/data-validation';
3
- export declare function getFormulaResult(result: Nullable<Nullable<ICellData>[][]>): Nullable<import('@univerjs/core').CellValue>;
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { DataValidationType, ICellData, Nullable } from '@univerjs/core';
17
+ import type { DataValidatorRegistryService } from '@univerjs/data-validation';
18
+ export declare function getFormulaResult(result: Nullable<Nullable<ICellData>[][]>): Nullable<import("@univerjs/core").CellValue>;
4
19
  export declare function getFormulaCellData(result: Nullable<Nullable<ICellData>[][]>): Nullable<ICellData>;
5
20
  export declare function isLegalFormulaResult(res: string): boolean;
6
21
  /**
@@ -1,3 +1,18 @@
1
- import { ICellData, Nullable } from '@univerjs/core';
2
- export declare function getCellValueOrigin(cell: Nullable<ICellData>): Nullable<import('@univerjs/core').CellValue>;
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { ICellData, Nullable } from '@univerjs/core';
17
+ export declare function getCellValueOrigin(cell: Nullable<ICellData>): Nullable<import("@univerjs/core").CellValue>;
3
18
  export declare function getStringCellValue(cell: Nullable<ICellData>): string;
@@ -1,5 +1,21 @@
1
- import { CellValue, DataValidationOperator, IDataValidationRule, IDataValidationRuleBase } from '@univerjs/core';
2
- import { IFormulaResult, IFormulaValidResult, IValidatorCellInfo, BaseDataValidator } from '@univerjs/data-validation';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { CellValue, DataValidationOperator, IDataValidationRule, IDataValidationRuleBase } from '@univerjs/core';
17
+ import type { IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
18
+ import { BaseDataValidator } from '@univerjs/data-validation';
3
19
  export declare class AnyValidator extends BaseDataValidator {
4
20
  id: string;
5
21
  title: string;
@@ -1,5 +1,22 @@
1
- import { CellValue, DataValidationOperator, IDataValidationRule, IDataValidationRuleBase, ISheetDataValidationRule, Nullable, WrapStrategy } from '@univerjs/core';
2
- import { IFormulaResult, IFormulaValidResult, IValidatorCellInfo, BaseDataValidator } from '@univerjs/data-validation';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { CellValue, DataValidationOperator, IDataValidationRule, IDataValidationRuleBase, ISheetDataValidationRule, Nullable } from '@univerjs/core';
17
+ import type { IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
18
+ import { WrapStrategy } from '@univerjs/core';
19
+ import { BaseDataValidator } from '@univerjs/data-validation';
3
20
  export declare const CHECKBOX_FORMULA_1 = 1;
4
21
  export declare const CHECKBOX_FORMULA_2 = 0;
5
22
  interface ICheckboxFormulaResult extends IFormulaResult {
@@ -1,5 +1,21 @@
1
- import { CellValue, DataValidationOperator, IDataValidationRule, IDataValidationRuleBase } from '@univerjs/core';
2
- import { IFormulaResult, IFormulaValidResult, IValidatorCellInfo, BaseDataValidator } from '@univerjs/data-validation';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { CellValue, DataValidationOperator, IDataValidationRule, IDataValidationRuleBase } from '@univerjs/core';
17
+ import type { IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
18
+ import { BaseDataValidator } from '@univerjs/data-validation';
3
19
  export declare class CustomFormulaValidator extends BaseDataValidator {
4
20
  id: string;
5
21
  title: string;
@@ -1,6 +1,23 @@
1
- import { CellValue, IDataValidationRule, IDataValidationRuleBase, DataValidationOperator } from '@univerjs/core';
2
- import { IFormulaResult, IFormulaValidResult, IValidatorCellInfo, BaseDataValidator } from '@univerjs/data-validation';
3
- import { ISheetLocationBase } from '@univerjs/sheets';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { CellValue, IDataValidationRule, IDataValidationRuleBase } from '@univerjs/core';
17
+ import type { IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
18
+ import type { ISheetLocationBase } from '@univerjs/sheets';
19
+ import { DataValidationOperator } from '@univerjs/core';
20
+ import { BaseDataValidator } from '@univerjs/data-validation';
4
21
  export declare class DateValidator extends BaseDataValidator {
5
22
  id: string;
6
23
  title: string;
@@ -1,6 +1,23 @@
1
- import { CellValue, IDataValidationRule, IDataValidationRuleBase, Nullable, DataValidationOperator } from '@univerjs/core';
2
- import { IFormulaResult, IFormulaValidResult, IValidatorCellInfo, BaseDataValidator } from '@univerjs/data-validation';
3
- import { ISheetLocationBase } from '@univerjs/sheets';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { CellValue, IDataValidationRule, IDataValidationRuleBase, Nullable } from '@univerjs/core';
17
+ import type { IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
18
+ import type { ISheetLocationBase } from '@univerjs/sheets';
19
+ import { DataValidationOperator } from '@univerjs/core';
20
+ import { BaseDataValidator } from '@univerjs/data-validation';
4
21
  export declare function getCellValueNumber(cellValue: CellValue): number;
5
22
  export declare class DecimalValidator extends BaseDataValidator {
6
23
  private readonly _customFormulaService;
@@ -19,9 +36,9 @@ export declare class DecimalValidator extends BaseDataValidator {
19
36
  column: number;
20
37
  unitId: string;
21
38
  subUnitId: string;
22
- worksheet: import('@univerjs/core').Worksheet;
23
- workbook: import('@univerjs/core').Workbook;
24
- t: Nullable<import('@univerjs/protocol').CellValueType>;
39
+ worksheet: import("@univerjs/core").Worksheet;
40
+ workbook: import("@univerjs/core").Workbook;
41
+ t: Nullable<import("@univerjs/protocol").CellValueType>;
25
42
  };
26
43
  private _parseNumber;
27
44
  parseFormula(rule: IDataValidationRule, unitId: string, subUnitId: string, row: number, column: number): Promise<IFormulaResult>;
@@ -1,3 +1,18 @@
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
1
16
  import { ListValidator } from './list-validator';
2
17
  export declare class ListMultipleValidator extends ListValidator {
3
18
  id: string;
@@ -1,5 +1,21 @@
1
- import { CellValue, DataValidationOperator, ICellData, IDataValidationRule, ISheetDataValidationRule, IStyleData, Nullable } from '@univerjs/core';
2
- import { IFormulaResult, IFormulaValidResult, IValidatorCellInfo, BaseDataValidator } from '@univerjs/data-validation';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { CellValue, DataValidationOperator, ICellData, IDataValidationRule, ISheetDataValidationRule, IStyleData, Nullable } from '@univerjs/core';
17
+ import type { IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
18
+ import { BaseDataValidator } from '@univerjs/data-validation';
3
19
  import { LexerTreeBuilder } from '@univerjs/engine-formula';
4
20
  import { DataValidationFormulaService } from '../services/dv-formula.service';
5
21
  export declare function getRuleFormulaResultSet(result: Nullable<Nullable<ICellData>[][]>): string[];
@@ -1,6 +1,23 @@
1
- import { CellValue, IDataValidationRule, IDataValidationRuleBase, Nullable, DataValidationOperator } from '@univerjs/core';
2
- import { IFormulaResult, IFormulaValidResult, IValidatorCellInfo, BaseDataValidator } from '@univerjs/data-validation';
3
- import { ISheetLocationBase } from '@univerjs/sheets';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { CellValue, IDataValidationRule, IDataValidationRuleBase, Nullable } from '@univerjs/core';
17
+ import type { IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
18
+ import type { ISheetLocationBase } from '@univerjs/sheets';
19
+ import { DataValidationOperator } from '@univerjs/core';
20
+ import { BaseDataValidator } from '@univerjs/data-validation';
4
21
  export declare class TextLengthValidator extends BaseDataValidator {
5
22
  id: string;
6
23
  title: string;
@@ -20,9 +37,9 @@ export declare class TextLengthValidator extends BaseDataValidator {
20
37
  column: number;
21
38
  unitId: string;
22
39
  subUnitId: string;
23
- worksheet: import('@univerjs/core').Worksheet;
24
- workbook: import('@univerjs/core').Workbook;
25
- t: Nullable<import('@univerjs/protocol').CellValueType>;
40
+ worksheet: import("@univerjs/core").Worksheet;
41
+ workbook: import("@univerjs/core").Workbook;
42
+ t: Nullable<import("@univerjs/protocol").CellValueType>;
26
43
  };
27
44
  isValidType(cellInfo: IValidatorCellInfo<number>, _formula: IFormulaResult, _rule: IDataValidationRule): Promise<boolean>;
28
45
  generateRuleErrorMessage(rule: IDataValidationRuleBase, pos: ISheetLocationBase): string;
@@ -1,6 +1,21 @@
1
- import { ICellData, ISheetDataValidationRule, IUnitRangeName, IUniverInstanceService, Nullable } from '@univerjs/core';
2
- import { LexerTreeBuilder } from '@univerjs/engine-formula';
3
- import { ISheetLocationBase } from '@univerjs/sheets';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { ICellData, ISheetDataValidationRule, IUnitRangeName, IUniverInstanceService, Nullable } from '@univerjs/core';
17
+ import type { LexerTreeBuilder } from '@univerjs/engine-formula';
18
+ import type { ISheetLocationBase } from '@univerjs/sheets';
4
19
  export declare function getSheetRangeValueSet(grid: IUnitRangeName, univerInstanceService: IUniverInstanceService, currUnitId: string, currSubUnitId: string): string[];
5
20
  export declare function serializeListOptions(options: string[]): string;
6
21
  export declare function deserializeListOptions(optionsStr: string): string[];
@@ -1,6 +1,23 @@
1
- import { CellValue, IDataValidationRule, IDataValidationRuleBase, Nullable, DataValidationOperator } from '@univerjs/core';
2
- import { IFormulaResult, IFormulaValidResult, IValidatorCellInfo, BaseDataValidator } from '@univerjs/data-validation';
3
- import { ISheetLocationBase } from '@univerjs/sheets';
1
+ /**
2
+ * Copyright 2023-present DreamNum Co., Ltd.
3
+ *
4
+ * Licensed under the Apache License, Version 2.0 (the "License");
5
+ * you may not use this file except in compliance with the License.
6
+ * You may obtain a copy of the License at
7
+ *
8
+ * http://www.apache.org/licenses/LICENSE-2.0
9
+ *
10
+ * Unless required by applicable law or agreed to in writing, software
11
+ * distributed under the License is distributed on an "AS IS" BASIS,
12
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ * See the License for the specific language governing permissions and
14
+ * limitations under the License.
15
+ */
16
+ import type { CellValue, IDataValidationRule, IDataValidationRuleBase, Nullable } from '@univerjs/core';
17
+ import type { IFormulaResult, IFormulaValidResult, IValidatorCellInfo } from '@univerjs/data-validation';
18
+ import type { ISheetLocationBase } from '@univerjs/sheets';
19
+ import { DataValidationOperator } from '@univerjs/core';
20
+ import { BaseDataValidator } from '@univerjs/data-validation';
4
21
  export declare class WholeValidator extends BaseDataValidator {
5
22
  private readonly _customFormulaService;
6
23
  private readonly _lexerTreeBuilder;
@@ -18,9 +35,9 @@ export declare class WholeValidator extends BaseDataValidator {
18
35
  column: number;
19
36
  unitId: string;
20
37
  subUnitId: string;
21
- worksheet: import('@univerjs/core').Worksheet;
22
- workbook: import('@univerjs/core').Workbook;
23
- t: Nullable<import('@univerjs/protocol').CellValueType>;
38
+ worksheet: import("@univerjs/core").Worksheet;
39
+ workbook: import("@univerjs/core").Workbook;
40
+ t: Nullable<import("@univerjs/protocol").CellValueType>;
24
41
  };
25
42
  private _parseNumber;
26
43
  parseFormula(rule: IDataValidationRule, unitId: string, subUnitId: string, row: number, column: number): Promise<IFormulaResult>;
package/lib/umd/facade.js CHANGED
@@ -1 +1 @@
1
- (function(g,a){typeof exports=="object"&&typeof module<"u"?a(exports,require("@univerjs/core"),require("@univerjs/sheets-data-validation"),require("@univerjs/sheets/facade"),require("@univerjs/data-validation"),require("@univerjs/engine-formula"),require("@univerjs/core/facade"),require("rxjs")):typeof define=="function"&&define.amd?define(["exports","@univerjs/core","@univerjs/sheets-data-validation","@univerjs/sheets/facade","@univerjs/data-validation","@univerjs/engine-formula","@univerjs/core/facade","rxjs"],a):(g=typeof globalThis<"u"?globalThis:g||self,a(g.UniverSheetsDataValidationFacade={},g.UniverCore,g.UniverSheetsDataValidation,g.UniverSheetsFacade,g.UniverDataValidation,g.UniverEngineFormula,g.UniverCoreFacade,g.rxjs))})(this,(function(g,a,n,f,v,b,y,C){"use strict";var O=Object.defineProperty;var B=(g,a,n)=>a in g?O(g,a,{enumerable:!0,configurable:!0,writable:!0,value:n}):g[a]=n;var k=(g,a,n)=>B(g,typeof a!="symbol"?a+"":a,n);class V{constructor(t){k(this,"_rule");this._rule=t!=null?t:{uid:a.generateRandomId(),ranges:void 0,type:a.DataValidationType.CUSTOM}}build(){return new S(this._rule)}copy(){return new V({...this._rule,uid:a.generateRandomId()})}getAllowInvalid(){return this._rule.errorStyle!==a.DataValidationErrorStyle.STOP}getCriteriaType(){return this._rule.type}getCriteriaValues(){return[this._rule.operator,this._rule.formula1,this._rule.formula2]}getHelpText(){return this._rule.error}requireCheckbox(t,e){return this._rule.type=a.DataValidationType.CHECKBOX,this._rule.formula1=t,this._rule.formula2=e,this}requireDateAfter(t){return this._rule.type=a.DataValidationType.DATE,this._rule.formula1=t.toLocaleDateString(),this._rule.operator=a.DataValidationOperator.GREATER_THAN,this}requireDateBefore(t){return this._rule.type=a.DataValidationType.DATE,this._rule.formula1=t.toLocaleDateString(),this._rule.formula2=void 0,this._rule.operator=a.DataValidationOperator.LESS_THAN,this}requireDateBetween(t,e){return this._rule.type=a.DataValidationType.DATE,this._rule.formula1=t.toLocaleDateString(),this._rule.formula2=e.toLocaleDateString(),this._rule.operator=a.DataValidationOperator.BETWEEN,this}requireDateEqualTo(t){return this._rule.type=a.DataValidationType.DATE,this._rule.formula1=t.toLocaleDateString(),this._rule.formula2=void 0,this._rule.operator=a.DataValidationOperator.EQUAL,this}requireDateNotBetween(t,e){return this._rule.type=a.DataValidationType.DATE,this._rule.formula1=t.toLocaleDateString(),this._rule.formula2=e.toLocaleDateString(),this._rule.operator=a.DataValidationOperator.NOT_BETWEEN,this}requireDateOnOrAfter(t){return this._rule.type=a.DataValidationType.DATE,this._rule.formula1=t.toLocaleDateString(),this._rule.formula2=void 0,this._rule.operator=a.DataValidationOperator.GREATER_THAN_OR_EQUAL,this}requireDateOnOrBefore(t){return this._rule.type=a.DataValidationType.DATE,this._rule.formula1=t.toLocaleDateString(),this._rule.formula2=void 0,this._rule.operator=a.DataValidationOperator.LESS_THAN_OR_EQUAL,this}requireFormulaSatisfied(t){return this._rule.type=a.DataValidationType.CUSTOM,this._rule.formula1=t,this._rule.formula2=void 0,this}requireNumberBetween(t,e,r){return this._rule.formula1=`${t}`,this._rule.formula2=`${e}`,this._rule.operator=a.DataValidationOperator.BETWEEN,this._rule.type=r?a.DataValidationType.WHOLE:a.DataValidationType.DECIMAL,this}requireNumberEqualTo(t,e){return this._rule.formula1=`${t}`,this._rule.formula2=void 0,this._rule.operator=a.DataValidationOperator.EQUAL,this._rule.type=e?a.DataValidationType.WHOLE:a.DataValidationType.DECIMAL,this}requireNumberGreaterThan(t,e){return this._rule.formula1=`${t}`,this._rule.formula2=void 0,this._rule.operator=a.DataValidationOperator.GREATER_THAN,this._rule.type=e?a.DataValidationType.WHOLE:a.DataValidationType.DECIMAL,this}requireNumberGreaterThanOrEqualTo(t,e){return this._rule.formula1=`${t}`,this._rule.formula2=void 0,this._rule.operator=a.DataValidationOperator.GREATER_THAN_OR_EQUAL,this._rule.type=e?a.DataValidationType.WHOLE:a.DataValidationType.DECIMAL,this}requireNumberLessThan(t,e){return this._rule.formula1=`${t}`,this._rule.formula2=void 0,this._rule.operator=a.DataValidationOperator.LESS_THAN,this._rule.type=e?a.DataValidationType.WHOLE:a.DataValidationType.DECIMAL,this}requireNumberLessThanOrEqualTo(t,e){return this._rule.formula1=`${t}`,this._rule.formula2=void 0,this._rule.operator=a.DataValidationOperator.LESS_THAN_OR_EQUAL,this._rule.type=e?a.DataValidationType.WHOLE:a.DataValidationType.DECIMAL,this}requireNumberNotBetween(t,e,r){return this._rule.formula1=`${t}`,this._rule.formula2=`${e}`,this._rule.operator=a.DataValidationOperator.NOT_BETWEEN,this._rule.type=r?a.DataValidationType.WHOLE:a.DataValidationType.DECIMAL,this}requireNumberNotEqualTo(t,e){return this._rule.formula1=`${t}`,this._rule.formula2=void 0,this._rule.operator=a.DataValidationOperator.NOT_EQUAL,this._rule.type=e?a.DataValidationType.WHOLE:a.DataValidationType.DECIMAL,this}requireValueInList(t,e,r){return this._rule.type=e?a.DataValidationType.LIST_MULTIPLE:a.DataValidationType.LIST,this._rule.formula1=t.join(","),this._rule.formula2=void 0,this._rule.showDropDown=r!=null?r:!0,this}requireValueInRange(t,e,r){return this._rule.type=e?a.DataValidationType.LIST_MULTIPLE:a.DataValidationType.LIST,this._rule.formula1=`=${b.serializeRangeToRefString({unitId:t.getUnitId(),sheetName:t.getSheetName(),range:t.getRange()})}`,this._rule.formula2=void 0,this._rule.showDropDown=r!=null?r:!0,this}setAllowInvalid(t){return this._rule.errorStyle=t?a.DataValidationErrorStyle.WARNING:a.DataValidationErrorStyle.STOP,this}setAllowBlank(t){return this._rule.allowBlank=t,this}setOptions(t){return Object.assign(this._rule,t),this}}class S{constructor(t,e,r){k(this,"rule");k(this,"_worksheet");k(this,"_injector");this._injector=r,this.rule=t,this._worksheet=e}getAllowInvalid(){return this.rule.errorStyle!==a.DataValidationErrorStyle.STOP}getCriteriaType(){return this.rule.type}getCriteriaValues(){return[this.rule.operator,this.rule.formula1,this.rule.formula2]}getHelpText(){return this.rule.error}copy(){return new V(this.rule)}getApplied(){if(!this._worksheet)return!1;const e=this._injector.get(v.DataValidationModel).getRuleById(this._worksheet.getUnitId(),this._worksheet.getSheetId(),this.rule.uid);return!!(e&&e.ranges.length)}getRanges(){if(!this.getApplied())return[];const t=this._injector.get(a.IUniverInstanceService).getUnit(this._worksheet.getUnitId());return this.rule.ranges.map(e=>this._injector.createInstance(f.FRange,t,this._worksheet,e))}getUnitId(){var t;return(t=this._worksheet)==null?void 0:t.getUnitId()}getSheetId(){var t;return(t=this._worksheet)==null?void 0:t.getSheetId()}setCriteria(t,e,r=!0){if(this.getApplied()&&!this._injector.get(a.ICommandService).syncExecuteCommand(n.UpdateSheetDataValidationSettingCommand.id,{unitId:this.getUnitId(),subUnitId:this.getSheetId(),ruleId:this.rule.uid,setting:{operator:e[0],formula1:e[1],formula2:e[2],type:this.rule.type,allowBlank:r}}))throw new Error("setCriteria failed");return this.rule.operator=e[0],this.rule.formula1=e[1],this.rule.formula2=e[2],this.rule.type=t,this.rule.allowBlank=r,this}setOptions(t){if(this.getApplied()&&!this._injector.get(a.ICommandService).syncExecuteCommand(n.UpdateSheetDataValidationOptionsCommand.id,{unitId:this.getUnitId(),subUnitId:this.getSheetId(),ruleId:this.rule.uid,options:{...v.getRuleOptions(this.rule),...t}}))throw new Error("setOptions failed");return Object.assign(this.rule,t),this}setRanges(t){if(this.getApplied()&&!this._injector.get(a.ICommandService).syncExecuteCommand(n.UpdateSheetDataValidationRangeCommand.id,{unitId:this.getUnitId(),subUnitId:this.getSheetId(),ruleId:this.rule.uid,ranges:t.map(i=>i.getRange())}))throw new Error("setRanges failed");return this.rule.ranges=t.map(e=>e.getRange()),this}delete(){return this.getApplied()?this._injector.get(a.ICommandService).syncExecuteCommand(n.RemoveSheetDataValidationCommand.id,{unitId:this.getUnitId(),subUnitId:this.getSheetId(),ruleId:this.rule.uid}):!1}}class U extends f.FRange{setDataValidation(t){if(!t)return this._commandService.syncExecuteCommand(n.ClearRangeDataValidationCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]}),this;const e={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:{...t.rule,ranges:[this._range]}};return this._commandService.syncExecuteCommand(n.AddSheetDataValidationCommand.id,e),this}getDataValidation(){const e=this._injector.get(n.SheetsDataValidationValidatorService).getDataValidation(this._workbook.getUnitId(),this._worksheet.getSheetId(),[this._range]);return e&&new S(e,this._worksheet,this._injector)}getDataValidations(){return this._injector.get(n.SheetsDataValidationValidatorService).getDataValidations(this._workbook.getUnitId(),this._worksheet.getSheetId(),[this._range]).map(e=>new S(e,this._worksheet,this._injector))}async getValidatorStatus(){return this._injector.get(n.SheetsDataValidationValidatorService).validatorRanges(this._workbook.getUnitId(),this._worksheet.getSheetId(),[this._range])}async getDataValidationErrorAsync(){const t=this._workbook.getUnitId(),e=this._worksheet.getSheetId();return this._collectValidationErrorsForRange(t,e,[this._range])}async _collectValidationErrorsForRange(t,e,r){if(!r.length)return[];const i=this._injector.get(n.SheetsDataValidationValidatorService),o=this._worksheet,h=o.getName(),l=[];for(const s of r){const u=[];for(let c=s.startRow;c<=s.endRow;c++)for(let d=s.startColumn;d<=s.endColumn;d++)u.push((async()=>{var m;try{if(await i.validatorCell(t,e,c,d)!==a.DataValidationStatus.VALID){const _=this._injector.get(n.SheetDataValidationModel).getRuleByLocation(t,e,c,d);if(_){const w=((m=o.getCell(c,d))==null?void 0:m.v)||null,I=this._createDataValidationError(h,c,d,_,w);l.push(I)}}}catch(p){console.warn(`Failed to validate cell [${c}, ${d}]:`,p)}})());await Promise.all(u)}return l}_createDataValidationError(t,e,r,i,o){return{sheetName:t,row:e,column:r,ruleId:i.uid,inputValue:o,rule:i}}}f.FRange.extend(U);class T extends y.FUniver{static newDataValidation(){return new V}newDataValidation(){return new V}_initialize(t){const e=t.get(a.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.SheetDataValidationChanged,()=>t.has(n.SheetDataValidationModel)?t.get(n.SheetDataValidationModel).ruleChange$.subscribe(i=>{const{unitId:o,subUnitId:h,rule:l,oldRule:s,type:u}=i,c=this.getSheetTarget(o,h);if(!c)return;const{workbook:d,worksheet:m}=c,p=new S(l,m.getSheet(),this._injector);this.fireEvent(this.Event.SheetDataValidationChanged,{origin:i,worksheet:m,workbook:d,changeType:u,oldRule:s,rule:p})}):{dispose:()=>{}})),this.disposeWithMe(this.registerEventHandler(this.Event.SheetDataValidatorStatusChanged,()=>t.has(n.SheetDataValidationModel)?t.get(n.SheetDataValidationModel).validStatusChange$.subscribe(i=>{const{unitId:o,subUnitId:h,ruleId:l,status:s,row:u,col:c}=i,d=this.getSheetTarget(o,h);if(!d)return;const{workbook:m,worksheet:p}=d,D=p.getDataValidation(l);D&&this.fireEvent(this.Event.SheetDataValidatorStatusChanged,{workbook:m,worksheet:p,row:u,column:c,rule:D,status:s})}):{dispose:()=>{}})),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDataValidationAdd,()=>e.beforeCommandExecuted(r=>{if(r.id===n.AddSheetDataValidationCommand.id){const i=r.params,o=this.getSheetTarget(i.unitId,i.subUnitId);if(!o)return;const{workbook:h,worksheet:l}=o,s={worksheet:l,workbook:h,rule:i.rule};if(this.fireEvent(this.Event.BeforeSheetDataValidationAdd,s),s.cancel)throw new a.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDataValidationCriteriaUpdate,()=>e.beforeCommandExecuted(r=>{if(r.id===n.UpdateSheetDataValidationSettingCommand.id){const i=r.params,o=this.getSheetTarget(i.unitId,i.subUnitId);if(!o)return;const{workbook:h,worksheet:l}=o,s=l.getDataValidation(i.ruleId);if(!s)return;const u={worksheet:l,workbook:h,rule:s,ruleId:i.ruleId,newCriteria:i.setting};if(this.fireEvent(this.Event.BeforeSheetDataValidationCriteriaUpdate,u),u.cancel)throw new a.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDataValidationRangeUpdate,()=>e.beforeCommandExecuted(r=>{if(r.id===n.UpdateSheetDataValidationRangeCommand.id){const i=r.params,o=this.getSheetTarget(i.unitId,i.subUnitId);if(!o)return;const{workbook:h,worksheet:l}=o,s=l.getDataValidation(i.ruleId);if(!s)return;const u={worksheet:l,workbook:h,rule:s,ruleId:i.ruleId,newRanges:i.ranges};if(this.fireEvent(this.Event.BeforeSheetDataValidationRangeUpdate,u),u.cancel)throw new a.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDataValidationOptionsUpdate,()=>e.beforeCommandExecuted(r=>{if(r.id===n.UpdateSheetDataValidationOptionsCommand.id){const i=r.params,o=this.getSheetTarget(i.unitId,i.subUnitId);if(!o)return;const{workbook:h,worksheet:l}=o,s=l.getDataValidation(i.ruleId);if(!s)return;const u={worksheet:l,workbook:h,rule:s,ruleId:i.ruleId,newOptions:i.options};if(this.fireEvent(this.Event.BeforeSheetDataValidationOptionsUpdate,u),u.cancel)throw new a.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDataValidationDelete,()=>e.beforeCommandExecuted(r=>{if(r.id===n.RemoveSheetDataValidationCommand.id){const i=r.params,o=this.getSheetTarget(i.unitId,i.subUnitId);if(!o)return;const{workbook:h,worksheet:l}=o,s=l.getDataValidation(i.ruleId);if(!s)return;const u={worksheet:l,workbook:h,rule:s,ruleId:i.ruleId};if(this.fireEvent(this.Event.BeforeSheetDataValidationDelete,u),u.cancel)throw new a.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDataValidationDeleteAll,()=>e.beforeCommandExecuted(r=>{if(r.id===n.RemoveSheetAllDataValidationCommand.id){const i=r.params,o=this.getSheetTarget(i.unitId,i.subUnitId);if(!o)return;const{workbook:h,worksheet:l}=o,s={worksheet:l,workbook:h,rules:l.getDataValidations()};if(this.fireEvent(this.Event.BeforeSheetDataValidationDeleteAll,s),s.cancel)throw new a.CanceledError}})))}}y.FUniver.extend(T);class A extends f.FWorkbook{_initialize(){Object.defineProperty(this,"_dataValidationModel",{get(){return this._injector.get(n.SheetDataValidationModel)}})}getValidatorStatus(){return this._injector.get(n.SheetsDataValidationValidatorService).validatorWorkbook(this._workbook.getUnitId())}async getAllDataValidationErrorAsync(){const t=this._workbook.getUnitId(),e=this._dataValidationModel.getSubUnitIds(t),r=[];for(const i of e){const o=await this._collectValidationErrorsForSheet(t,i);r.push(...o)}return r}async _collectValidationErrorsForSheet(t,e){const r=this._dataValidationModel.getRules(t,e);if(!r.length)return[];const i=r.flatMap(o=>o.ranges);return this._collectValidationErrorsForRange(t,e,i)}async _collectValidationErrorsForRange(t,e,r){if(!r.length)return[];const i=this._injector.get(n.SheetsDataValidationValidatorService),h=this._workbook.getSheetBySheetId(e);if(!h)throw new Error(`Cannot find worksheet with sheetId: ${e}`);const l=h.getName(),s=[];for(const u of r){const c=[];for(let d=u.startRow;d<=u.endRow;d++)for(let m=u.startColumn;m<=u.endColumn;m++)c.push((async()=>{var p;try{if(await i.validatorCell(t,e,d,m)!==a.DataValidationStatus.VALID){const _=this._dataValidationModel.getRuleByLocation(t,e,d,m);if(_){const w=((p=h.getCell(d,m))==null?void 0:p.v)||null,I=this._createDataValidationError(l,d,m,_,w);s.push(I)}}}catch(D){console.warn(`Failed to validate cell [${d}, ${m}]:`,D)}})());await Promise.all(c)}return s}_createDataValidationError(t,e,r,i,o){return{sheetName:t,row:e,column:r,ruleId:i.uid,inputValue:o,rule:i}}onDataValidationChange(t){return a.toDisposable(this._dataValidationModel.ruleChange$.pipe(C.filter(e=>e.unitId===this._workbook.getUnitId())).subscribe(t))}onDataValidationStatusChange(t){return a.toDisposable(this._dataValidationModel.validStatusChange$.pipe(C.filter(e=>e.unitId===this._workbook.getUnitId())).subscribe(t))}onBeforeAddDataValidation(t){return a.toDisposable(this._commandService.beforeCommandExecuted((e,r)=>{const i=e.params;if(e.id===n.AddSheetDataValidationCommand.id){if(i.unitId!==this._workbook.getUnitId())return;if(t(i,r)===!1)throw new Error("Command is stopped by the hook onBeforeAddDataValidation")}}))}onBeforeUpdateDataValidationCriteria(t){return a.toDisposable(this._commandService.beforeCommandExecuted((e,r)=>{const i=e.params;if(e.id===n.UpdateSheetDataValidationSettingCommand.id){if(i.unitId!==this._workbook.getUnitId())return;if(t(i,r)===!1)throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationCriteria")}}))}onBeforeUpdateDataValidationRange(t){return a.toDisposable(this._commandService.beforeCommandExecuted((e,r)=>{const i=e.params;if(e.id===n.UpdateSheetDataValidationRangeCommand.id){if(i.unitId!==this._workbook.getUnitId())return;if(t(i,r)===!1)throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationRange")}}))}onBeforeUpdateDataValidationOptions(t){return a.toDisposable(this._commandService.beforeCommandExecuted((e,r)=>{const i=e.params;if(e.id===n.UpdateSheetDataValidationOptionsCommand.id){if(i.unitId!==this._workbook.getUnitId())return;if(t(i,r)===!1)throw new Error("Command is stopped by the hook onBeforeUpdateDataValidationOptions")}}))}onBeforeDeleteDataValidation(t){return a.toDisposable(this._commandService.beforeCommandExecuted((e,r)=>{const i=e.params;if(e.id===n.RemoveSheetDataValidationCommand.id){if(i.unitId!==this._workbook.getUnitId())return;if(t(i,r)===!1)throw new Error("Command is stopped by the hook onBeforeDeleteDataValidation")}}))}onBeforeDeleteAllDataValidation(t){return a.toDisposable(this._commandService.beforeCommandExecuted((e,r)=>{const i=e.params;if(e.id===n.RemoveSheetAllDataValidationCommand.id){if(i.unitId!==this._workbook.getUnitId())return;if(t(i,r)===!1)throw new Error("Command is stopped by the hook onBeforeDeleteAllDataValidation")}}))}}f.FWorkbook.extend(A);class R extends f.FWorksheet{getDataValidations(){return this._injector.get(v.DataValidationModel).getRules(this._workbook.getUnitId(),this._worksheet.getSheetId()).map(e=>new S(e,this._worksheet,this._injector))}getValidatorStatus(){return this._injector.get(n.SheetsDataValidationValidatorService).validatorWorksheet(this._workbook.getUnitId(),this._worksheet.getSheetId())}getValidatorStatusAsync(){return this.getValidatorStatus()}getDataValidation(t){const r=this._injector.get(v.DataValidationModel).getRuleById(this._workbook.getUnitId(),this._worksheet.getSheetId(),t);return r?new S(r,this._worksheet,this._injector):null}async getAllDataValidationErrorAsync(){const t=this._workbook.getUnitId(),e=this._worksheet.getSheetId();return this._collectValidationErrorsForSheet(t,e)}async _collectValidationErrorsForSheet(t,e){const i=this._injector.get(v.DataValidationModel).getRules(t,e);if(!i.length)return[];const o=i.flatMap(h=>h.ranges);return this._collectValidationErrorsForRange(t,e,o)}async _collectValidationErrorsForRange(t,e,r){if(!r.length)return[];const i=this._injector.get(n.SheetsDataValidationValidatorService),o=this._worksheet,h=o.getName(),l=[];for(const s of r){const u=[];for(let c=s.startRow;c<=s.endRow;c++)for(let d=s.startColumn;d<=s.endColumn;d++)u.push((async()=>{var m;try{if(await i.validatorCell(t,e,c,d)!==a.DataValidationStatus.VALID){const _=this._injector.get(n.SheetDataValidationModel).getRuleByLocation(t,e,c,d);if(_){const w=((m=o.getCell(c,d))==null?void 0:m.v)||null,I=this._createDataValidationError(h,c,d,_,w);l.push(I)}}}catch(p){console.warn(`Failed to validate cell [${c}, ${d}]:`,p)}})());await Promise.all(u)}return l}_createDataValidationError(t,e,r,i,o){return{sheetName:t,row:e,column:r,ruleId:i.uid,inputValue:o,rule:i}}}f.FWorksheet.extend(R);class M{get SheetDataValidationChanged(){return"SheetDataValidationChanged"}get SheetDataValidatorStatusChanged(){return"SheetDataValidatorStatusChanged"}get BeforeSheetDataValidationAdd(){return"BeforeSheetDataValidationAdd"}get BeforeSheetDataValidationDelete(){return"BeforeSheetDataValidationDelete"}get BeforeSheetDataValidationDeleteAll(){return"BeforeSheetDataValidationDeleteAll"}get BeforeSheetDataValidationCriteriaUpdate(){return"BeforeSheetDataValidationCriteriaUpdate"}get BeforeSheetDataValidationRangeUpdate(){return"BeforeSheetDataValidationRangeUpdate"}get BeforeSheetDataValidationOptionsUpdate(){return"BeforeSheetDataValidationOptionsUpdate"}}y.FEventName.extend(M),g.FDataValidation=S,g.FDataValidationBuilder=V,Object.defineProperty(g,Symbol.toStringTag,{value:"Module"})}));
1
+ (function(e,t){typeof exports==`object`&&typeof module<`u`?t(exports,require(`@univerjs/core`),require(`@univerjs/sheets-data-validation`),require(`@univerjs/sheets/facade`),require(`@univerjs/data-validation`),require(`@univerjs/engine-formula`),require(`@univerjs/core/facade`),require(`rxjs`)):typeof define==`function`&&define.amd?define([`exports`,`@univerjs/core`,`@univerjs/sheets-data-validation`,`@univerjs/sheets/facade`,`@univerjs/data-validation`,`@univerjs/engine-formula`,`@univerjs/core/facade`,`rxjs`],t):(e=typeof globalThis<`u`?globalThis:e||self,t(e.UniverSheetsDataValidationFacade={},e.UniverCore,e.UniverSheetsDataValidation,e.UniverSheetsFacade,e.UniverDataValidation,e.UniverEngineFormula,e.UniverCoreFacade,e.rxjs))})(this,function(e,t,n,r,i,a,o,s){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});function c(e){"@babel/helpers - typeof";return c=typeof Symbol==`function`&&typeof Symbol.iterator==`symbol`?function(e){return typeof e}:function(e){return e&&typeof Symbol==`function`&&e.constructor===Symbol&&e!==Symbol.prototype?`symbol`:typeof e},c(e)}function l(e,t){if(c(e)!=`object`||!e)return e;var n=e[Symbol.toPrimitive];if(n!==void 0){var r=n.call(e,t||`default`);if(c(r)!=`object`)return r;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(t===`string`?String:Number)(e)}function u(e){var t=l(e,`string`);return c(t)==`symbol`?t:t+``}function d(e,t,n){return(t=u(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}var f=class e{constructor(e){d(this,`_rule`,void 0),this._rule=e==null?{uid:(0,t.generateRandomId)(),ranges:void 0,type:t.DataValidationType.CUSTOM}:e}build(){return new p(this._rule)}copy(){return new e({...this._rule,uid:(0,t.generateRandomId)()})}getAllowInvalid(){return this._rule.errorStyle!==t.DataValidationErrorStyle.STOP}getCriteriaType(){return this._rule.type}getCriteriaValues(){return[this._rule.operator,this._rule.formula1,this._rule.formula2]}getHelpText(){return this._rule.error}requireCheckbox(e,n){return this._rule.type=t.DataValidationType.CHECKBOX,this._rule.formula1=e,this._rule.formula2=n,this}requireDateAfter(e){return this._rule.type=t.DataValidationType.DATE,this._rule.formula1=e.toLocaleDateString(),this._rule.operator=t.DataValidationOperator.GREATER_THAN,this}requireDateBefore(e){return this._rule.type=t.DataValidationType.DATE,this._rule.formula1=e.toLocaleDateString(),this._rule.formula2=void 0,this._rule.operator=t.DataValidationOperator.LESS_THAN,this}requireDateBetween(e,n){return this._rule.type=t.DataValidationType.DATE,this._rule.formula1=e.toLocaleDateString(),this._rule.formula2=n.toLocaleDateString(),this._rule.operator=t.DataValidationOperator.BETWEEN,this}requireDateEqualTo(e){return this._rule.type=t.DataValidationType.DATE,this._rule.formula1=e.toLocaleDateString(),this._rule.formula2=void 0,this._rule.operator=t.DataValidationOperator.EQUAL,this}requireDateNotBetween(e,n){return this._rule.type=t.DataValidationType.DATE,this._rule.formula1=e.toLocaleDateString(),this._rule.formula2=n.toLocaleDateString(),this._rule.operator=t.DataValidationOperator.NOT_BETWEEN,this}requireDateOnOrAfter(e){return this._rule.type=t.DataValidationType.DATE,this._rule.formula1=e.toLocaleDateString(),this._rule.formula2=void 0,this._rule.operator=t.DataValidationOperator.GREATER_THAN_OR_EQUAL,this}requireDateOnOrBefore(e){return this._rule.type=t.DataValidationType.DATE,this._rule.formula1=e.toLocaleDateString(),this._rule.formula2=void 0,this._rule.operator=t.DataValidationOperator.LESS_THAN_OR_EQUAL,this}requireFormulaSatisfied(e){return this._rule.type=t.DataValidationType.CUSTOM,this._rule.formula1=e,this._rule.formula2=void 0,this}requireNumberBetween(e,n,r){return this._rule.formula1=`${e}`,this._rule.formula2=`${n}`,this._rule.operator=t.DataValidationOperator.BETWEEN,this._rule.type=r?t.DataValidationType.WHOLE:t.DataValidationType.DECIMAL,this}requireNumberEqualTo(e,n){return this._rule.formula1=`${e}`,this._rule.formula2=void 0,this._rule.operator=t.DataValidationOperator.EQUAL,this._rule.type=n?t.DataValidationType.WHOLE:t.DataValidationType.DECIMAL,this}requireNumberGreaterThan(e,n){return this._rule.formula1=`${e}`,this._rule.formula2=void 0,this._rule.operator=t.DataValidationOperator.GREATER_THAN,this._rule.type=n?t.DataValidationType.WHOLE:t.DataValidationType.DECIMAL,this}requireNumberGreaterThanOrEqualTo(e,n){return this._rule.formula1=`${e}`,this._rule.formula2=void 0,this._rule.operator=t.DataValidationOperator.GREATER_THAN_OR_EQUAL,this._rule.type=n?t.DataValidationType.WHOLE:t.DataValidationType.DECIMAL,this}requireNumberLessThan(e,n){return this._rule.formula1=`${e}`,this._rule.formula2=void 0,this._rule.operator=t.DataValidationOperator.LESS_THAN,this._rule.type=n?t.DataValidationType.WHOLE:t.DataValidationType.DECIMAL,this}requireNumberLessThanOrEqualTo(e,n){return this._rule.formula1=`${e}`,this._rule.formula2=void 0,this._rule.operator=t.DataValidationOperator.LESS_THAN_OR_EQUAL,this._rule.type=n?t.DataValidationType.WHOLE:t.DataValidationType.DECIMAL,this}requireNumberNotBetween(e,n,r){return this._rule.formula1=`${e}`,this._rule.formula2=`${n}`,this._rule.operator=t.DataValidationOperator.NOT_BETWEEN,this._rule.type=r?t.DataValidationType.WHOLE:t.DataValidationType.DECIMAL,this}requireNumberNotEqualTo(e,n){return this._rule.formula1=`${e}`,this._rule.formula2=void 0,this._rule.operator=t.DataValidationOperator.NOT_EQUAL,this._rule.type=n?t.DataValidationType.WHOLE:t.DataValidationType.DECIMAL,this}requireValueInList(e,n,r){return this._rule.type=n?t.DataValidationType.LIST_MULTIPLE:t.DataValidationType.LIST,this._rule.formula1=e.join(`,`),this._rule.formula2=void 0,this._rule.showDropDown=r==null?!0:r,this}requireValueInRange(e,n,r){return this._rule.type=n?t.DataValidationType.LIST_MULTIPLE:t.DataValidationType.LIST,this._rule.formula1=`=${(0,a.serializeRangeToRefString)({unitId:e.getUnitId(),sheetName:e.getSheetName(),range:e.getRange()})}`,this._rule.formula2=void 0,this._rule.showDropDown=r==null?!0:r,this}setAllowInvalid(e){return this._rule.errorStyle=e?t.DataValidationErrorStyle.WARNING:t.DataValidationErrorStyle.STOP,this}setAllowBlank(e){return this._rule.allowBlank=e,this}setOptions(e){return Object.assign(this._rule,e),this}},p=class{constructor(e,t,n){d(this,`rule`,void 0),d(this,`_worksheet`,void 0),d(this,`_injector`,void 0),this._injector=n,this.rule=e,this._worksheet=t}getAllowInvalid(){return this.rule.errorStyle!==t.DataValidationErrorStyle.STOP}getCriteriaType(){return this.rule.type}getCriteriaValues(){return[this.rule.operator,this.rule.formula1,this.rule.formula2]}getHelpText(){return this.rule.error}copy(){return new f(this.rule)}getApplied(){if(!this._worksheet)return!1;let e=this._injector.get(i.DataValidationModel).getRuleById(this._worksheet.getUnitId(),this._worksheet.getSheetId(),this.rule.uid);return!!(e&&e.ranges.length)}getRanges(){if(!this.getApplied())return[];let e=this._injector.get(t.IUniverInstanceService).getUnit(this._worksheet.getUnitId());return this.rule.ranges.map(t=>this._injector.createInstance(r.FRange,e,this._worksheet,t))}getUnitId(){var e;return(e=this._worksheet)==null?void 0:e.getUnitId()}getSheetId(){var e;return(e=this._worksheet)==null?void 0:e.getSheetId()}setCriteria(e,r,i=!0){if(this.getApplied()&&!this._injector.get(t.ICommandService).syncExecuteCommand(n.UpdateSheetDataValidationSettingCommand.id,{unitId:this.getUnitId(),subUnitId:this.getSheetId(),ruleId:this.rule.uid,setting:{operator:r[0],formula1:r[1],formula2:r[2],type:this.rule.type,allowBlank:i}}))throw Error(`setCriteria failed`);return this.rule.operator=r[0],this.rule.formula1=r[1],this.rule.formula2=r[2],this.rule.type=e,this.rule.allowBlank=i,this}setOptions(e){if(this.getApplied()&&!this._injector.get(t.ICommandService).syncExecuteCommand(n.UpdateSheetDataValidationOptionsCommand.id,{unitId:this.getUnitId(),subUnitId:this.getSheetId(),ruleId:this.rule.uid,options:{...(0,i.getRuleOptions)(this.rule),...e}}))throw Error(`setOptions failed`);return Object.assign(this.rule,e),this}setRanges(e){if(this.getApplied()&&!this._injector.get(t.ICommandService).syncExecuteCommand(n.UpdateSheetDataValidationRangeCommand.id,{unitId:this.getUnitId(),subUnitId:this.getSheetId(),ruleId:this.rule.uid,ranges:e.map(e=>e.getRange())}))throw Error(`setRanges failed`);return this.rule.ranges=e.map(e=>e.getRange()),this}delete(){return this.getApplied()?this._injector.get(t.ICommandService).syncExecuteCommand(n.RemoveSheetDataValidationCommand.id,{unitId:this.getUnitId(),subUnitId:this.getSheetId(),ruleId:this.rule.uid}):!1}},m=class extends r.FRange{setDataValidation(e){if(!e)return this._commandService.syncExecuteCommand(n.ClearRangeDataValidationCommand.id,{unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),ranges:[this._range]}),this;let t={unitId:this._workbook.getUnitId(),subUnitId:this._worksheet.getSheetId(),rule:{...e.rule,ranges:[this._range]}};return this._commandService.syncExecuteCommand(n.AddSheetDataValidationCommand.id,t),this}getDataValidation(){let e=this._injector.get(n.SheetsDataValidationValidatorService).getDataValidation(this._workbook.getUnitId(),this._worksheet.getSheetId(),[this._range]);return e&&new p(e,this._worksheet,this._injector)}getDataValidations(){return this._injector.get(n.SheetsDataValidationValidatorService).getDataValidations(this._workbook.getUnitId(),this._worksheet.getSheetId(),[this._range]).map(e=>new p(e,this._worksheet,this._injector))}async getValidatorStatus(){return this._injector.get(n.SheetsDataValidationValidatorService).validatorRanges(this._workbook.getUnitId(),this._worksheet.getSheetId(),[this._range])}async getDataValidationErrorAsync(){let e=this._workbook.getUnitId(),t=this._worksheet.getSheetId();return this._collectValidationErrorsForRange(e,t,[this._range])}async _collectValidationErrorsForRange(e,r,i){if(!i.length)return[];let a=this._injector.get(n.SheetsDataValidationValidatorService),o=this._worksheet,s=o.getName(),c=[];for(let l of i){let i=[];for(let u=l.startRow;u<=l.endRow;u++)for(let d=l.startColumn;d<=l.endColumn;d++)i.push((async()=>{try{if(await a.validatorCell(e,r,u,d)!==t.DataValidationStatus.VALID){let t=this._injector.get(n.SheetDataValidationModel).getRuleByLocation(e,r,u,d);if(t){var i;let e=((i=o.getCell(u,d))==null?void 0:i.v)||null,n=this._createDataValidationError(s,u,d,t,e);c.push(n)}}}catch(e){console.warn(`Failed to validate cell [${u}, ${d}]:`,e)}})());await Promise.all(i)}return c}_createDataValidationError(e,t,n,r,i){return{sheetName:e,row:t,column:n,ruleId:r.uid,inputValue:i,rule:r}}};r.FRange.extend(m);var h=class extends o.FUniver{static newDataValidation(){return new f}newDataValidation(){return new f}_initialize(e){let r=e.get(t.ICommandService);this.disposeWithMe(this.registerEventHandler(this.Event.SheetDataValidationChanged,()=>e.has(n.SheetDataValidationModel)?e.get(n.SheetDataValidationModel).ruleChange$.subscribe(e=>{let{unitId:t,subUnitId:n,rule:r,oldRule:i,type:a}=e,o=this.getSheetTarget(t,n);if(!o)return;let{workbook:s,worksheet:c}=o,l=new p(r,c.getSheet(),this._injector);this.fireEvent(this.Event.SheetDataValidationChanged,{origin:e,worksheet:c,workbook:s,changeType:a,oldRule:i,rule:l})}):{dispose:()=>{}})),this.disposeWithMe(this.registerEventHandler(this.Event.SheetDataValidatorStatusChanged,()=>e.has(n.SheetDataValidationModel)?e.get(n.SheetDataValidationModel).validStatusChange$.subscribe(e=>{let{unitId:t,subUnitId:n,ruleId:r,status:i,row:a,col:o}=e,s=this.getSheetTarget(t,n);if(!s)return;let{workbook:c,worksheet:l}=s,u=l.getDataValidation(r);u&&this.fireEvent(this.Event.SheetDataValidatorStatusChanged,{workbook:c,worksheet:l,row:a,column:o,rule:u,status:i})}):{dispose:()=>{}})),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDataValidationAdd,()=>r.beforeCommandExecuted(e=>{if(e.id===n.AddSheetDataValidationCommand.id){let n=e.params,r=this.getSheetTarget(n.unitId,n.subUnitId);if(!r)return;let{workbook:i,worksheet:a}=r,o={worksheet:a,workbook:i,rule:n.rule};if(this.fireEvent(this.Event.BeforeSheetDataValidationAdd,o),o.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDataValidationCriteriaUpdate,()=>r.beforeCommandExecuted(e=>{if(e.id===n.UpdateSheetDataValidationSettingCommand.id){let n=e.params,r=this.getSheetTarget(n.unitId,n.subUnitId);if(!r)return;let{workbook:i,worksheet:a}=r,o=a.getDataValidation(n.ruleId);if(!o)return;let s={worksheet:a,workbook:i,rule:o,ruleId:n.ruleId,newCriteria:n.setting};if(this.fireEvent(this.Event.BeforeSheetDataValidationCriteriaUpdate,s),s.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDataValidationRangeUpdate,()=>r.beforeCommandExecuted(e=>{if(e.id===n.UpdateSheetDataValidationRangeCommand.id){let n=e.params,r=this.getSheetTarget(n.unitId,n.subUnitId);if(!r)return;let{workbook:i,worksheet:a}=r,o=a.getDataValidation(n.ruleId);if(!o)return;let s={worksheet:a,workbook:i,rule:o,ruleId:n.ruleId,newRanges:n.ranges};if(this.fireEvent(this.Event.BeforeSheetDataValidationRangeUpdate,s),s.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDataValidationOptionsUpdate,()=>r.beforeCommandExecuted(e=>{if(e.id===n.UpdateSheetDataValidationOptionsCommand.id){let n=e.params,r=this.getSheetTarget(n.unitId,n.subUnitId);if(!r)return;let{workbook:i,worksheet:a}=r,o=a.getDataValidation(n.ruleId);if(!o)return;let s={worksheet:a,workbook:i,rule:o,ruleId:n.ruleId,newOptions:n.options};if(this.fireEvent(this.Event.BeforeSheetDataValidationOptionsUpdate,s),s.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDataValidationDelete,()=>r.beforeCommandExecuted(e=>{if(e.id===n.RemoveSheetDataValidationCommand.id){let n=e.params,r=this.getSheetTarget(n.unitId,n.subUnitId);if(!r)return;let{workbook:i,worksheet:a}=r,o=a.getDataValidation(n.ruleId);if(!o)return;let s={worksheet:a,workbook:i,rule:o,ruleId:n.ruleId};if(this.fireEvent(this.Event.BeforeSheetDataValidationDelete,s),s.cancel)throw new t.CanceledError}}))),this.disposeWithMe(this.registerEventHandler(this.Event.BeforeSheetDataValidationDeleteAll,()=>r.beforeCommandExecuted(e=>{if(e.id===n.RemoveSheetAllDataValidationCommand.id){let n=e.params,r=this.getSheetTarget(n.unitId,n.subUnitId);if(!r)return;let{workbook:i,worksheet:a}=r,o={worksheet:a,workbook:i,rules:a.getDataValidations()};if(this.fireEvent(this.Event.BeforeSheetDataValidationDeleteAll,o),o.cancel)throw new t.CanceledError}})))}};o.FUniver.extend(h);var g=class extends r.FWorkbook{_initialize(){Object.defineProperty(this,`_dataValidationModel`,{get(){return this._injector.get(n.SheetDataValidationModel)}})}getValidatorStatus(){return this._injector.get(n.SheetsDataValidationValidatorService).validatorWorkbook(this._workbook.getUnitId())}async getAllDataValidationErrorAsync(){let e=this._workbook.getUnitId(),t=this._dataValidationModel.getSubUnitIds(e),n=[];for(let r of t){let t=await this._collectValidationErrorsForSheet(e,r);n.push(...t)}return n}async _collectValidationErrorsForSheet(e,t){let n=this._dataValidationModel.getRules(e,t);if(!n.length)return[];let r=n.flatMap(e=>e.ranges);return this._collectValidationErrorsForRange(e,t,r)}async _collectValidationErrorsForRange(e,r,i){if(!i.length)return[];let a=this._injector.get(n.SheetsDataValidationValidatorService),o=this._workbook.getSheetBySheetId(r);if(!o)throw Error(`Cannot find worksheet with sheetId: ${r}`);let s=o.getName(),c=[];for(let n of i){let i=[];for(let l=n.startRow;l<=n.endRow;l++)for(let u=n.startColumn;u<=n.endColumn;u++)i.push((async()=>{try{if(await a.validatorCell(e,r,l,u)!==t.DataValidationStatus.VALID){let t=this._dataValidationModel.getRuleByLocation(e,r,l,u);if(t){var n;let e=((n=o.getCell(l,u))==null?void 0:n.v)||null,r=this._createDataValidationError(s,l,u,t,e);c.push(r)}}}catch(e){console.warn(`Failed to validate cell [${l}, ${u}]:`,e)}})());await Promise.all(i)}return c}_createDataValidationError(e,t,n,r,i){return{sheetName:e,row:t,column:n,ruleId:r.uid,inputValue:i,rule:r}}onDataValidationChange(e){return(0,t.toDisposable)(this._dataValidationModel.ruleChange$.pipe((0,s.filter)(e=>e.unitId===this._workbook.getUnitId())).subscribe(e))}onDataValidationStatusChange(e){return(0,t.toDisposable)(this._dataValidationModel.validStatusChange$.pipe((0,s.filter)(e=>e.unitId===this._workbook.getUnitId())).subscribe(e))}onBeforeAddDataValidation(e){return(0,t.toDisposable)(this._commandService.beforeCommandExecuted((t,r)=>{let i=t.params;if(t.id===n.AddSheetDataValidationCommand.id){if(i.unitId!==this._workbook.getUnitId())return;if(e(i,r)===!1)throw Error(`Command is stopped by the hook onBeforeAddDataValidation`)}}))}onBeforeUpdateDataValidationCriteria(e){return(0,t.toDisposable)(this._commandService.beforeCommandExecuted((t,r)=>{let i=t.params;if(t.id===n.UpdateSheetDataValidationSettingCommand.id){if(i.unitId!==this._workbook.getUnitId())return;if(e(i,r)===!1)throw Error(`Command is stopped by the hook onBeforeUpdateDataValidationCriteria`)}}))}onBeforeUpdateDataValidationRange(e){return(0,t.toDisposable)(this._commandService.beforeCommandExecuted((t,r)=>{let i=t.params;if(t.id===n.UpdateSheetDataValidationRangeCommand.id){if(i.unitId!==this._workbook.getUnitId())return;if(e(i,r)===!1)throw Error(`Command is stopped by the hook onBeforeUpdateDataValidationRange`)}}))}onBeforeUpdateDataValidationOptions(e){return(0,t.toDisposable)(this._commandService.beforeCommandExecuted((t,r)=>{let i=t.params;if(t.id===n.UpdateSheetDataValidationOptionsCommand.id){if(i.unitId!==this._workbook.getUnitId())return;if(e(i,r)===!1)throw Error(`Command is stopped by the hook onBeforeUpdateDataValidationOptions`)}}))}onBeforeDeleteDataValidation(e){return(0,t.toDisposable)(this._commandService.beforeCommandExecuted((t,r)=>{let i=t.params;if(t.id===n.RemoveSheetDataValidationCommand.id){if(i.unitId!==this._workbook.getUnitId())return;if(e(i,r)===!1)throw Error(`Command is stopped by the hook onBeforeDeleteDataValidation`)}}))}onBeforeDeleteAllDataValidation(e){return(0,t.toDisposable)(this._commandService.beforeCommandExecuted((t,r)=>{let i=t.params;if(t.id===n.RemoveSheetAllDataValidationCommand.id){if(i.unitId!==this._workbook.getUnitId())return;if(e(i,r)===!1)throw Error(`Command is stopped by the hook onBeforeDeleteAllDataValidation`)}}))}};r.FWorkbook.extend(g);var _=class extends r.FWorksheet{getDataValidations(){return this._injector.get(i.DataValidationModel).getRules(this._workbook.getUnitId(),this._worksheet.getSheetId()).map(e=>new p(e,this._worksheet,this._injector))}getValidatorStatus(){return this._injector.get(n.SheetsDataValidationValidatorService).validatorWorksheet(this._workbook.getUnitId(),this._worksheet.getSheetId())}getValidatorStatusAsync(){return this.getValidatorStatus()}getDataValidation(e){let t=this._injector.get(i.DataValidationModel).getRuleById(this._workbook.getUnitId(),this._worksheet.getSheetId(),e);return t?new p(t,this._worksheet,this._injector):null}async getAllDataValidationErrorAsync(){let e=this._workbook.getUnitId(),t=this._worksheet.getSheetId();return this._collectValidationErrorsForSheet(e,t)}async _collectValidationErrorsForSheet(e,t){let n=this._injector.get(i.DataValidationModel).getRules(e,t);if(!n.length)return[];let r=n.flatMap(e=>e.ranges);return this._collectValidationErrorsForRange(e,t,r)}async _collectValidationErrorsForRange(e,r,i){if(!i.length)return[];let a=this._injector.get(n.SheetsDataValidationValidatorService),o=this._worksheet,s=o.getName(),c=[];for(let l of i){let i=[];for(let u=l.startRow;u<=l.endRow;u++)for(let d=l.startColumn;d<=l.endColumn;d++)i.push((async()=>{try{if(await a.validatorCell(e,r,u,d)!==t.DataValidationStatus.VALID){let t=this._injector.get(n.SheetDataValidationModel).getRuleByLocation(e,r,u,d);if(t){var i;let e=((i=o.getCell(u,d))==null?void 0:i.v)||null,n=this._createDataValidationError(s,u,d,t,e);c.push(n)}}}catch(e){console.warn(`Failed to validate cell [${u}, ${d}]:`,e)}})());await Promise.all(i)}return c}_createDataValidationError(e,t,n,r,i){return{sheetName:e,row:t,column:n,ruleId:r.uid,inputValue:i,rule:r}}};r.FWorksheet.extend(_);var v=class{get SheetDataValidationChanged(){return`SheetDataValidationChanged`}get SheetDataValidatorStatusChanged(){return`SheetDataValidatorStatusChanged`}get BeforeSheetDataValidationAdd(){return`BeforeSheetDataValidationAdd`}get BeforeSheetDataValidationDelete(){return`BeforeSheetDataValidationDelete`}get BeforeSheetDataValidationDeleteAll(){return`BeforeSheetDataValidationDeleteAll`}get BeforeSheetDataValidationCriteriaUpdate(){return`BeforeSheetDataValidationCriteriaUpdate`}get BeforeSheetDataValidationRangeUpdate(){return`BeforeSheetDataValidationRangeUpdate`}get BeforeSheetDataValidationOptionsUpdate(){return`BeforeSheetDataValidationOptionsUpdate`}};o.FEventName.extend(v),e.FDataValidation=p,e.FDataValidationBuilder=f});