@univerjs/sheets-data-validation 0.24.0 → 0.25.0-insiders.20260608-e4336f7
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 +114 -128
- package/lib/cjs/index.js +185 -160
- package/lib/cjs/locale/ar-SA.js +139 -0
- package/lib/cjs/locale/ca-ES.js +139 -0
- package/lib/cjs/locale/de-DE.js +139 -0
- package/lib/cjs/locale/en-US.js +154 -0
- package/lib/cjs/locale/es-ES.js +139 -0
- package/lib/cjs/locale/fa-IR.js +139 -0
- package/lib/cjs/locale/fr-FR.js +139 -0
- package/lib/cjs/locale/id-ID.js +139 -0
- package/lib/cjs/locale/it-IT.js +139 -0
- package/lib/cjs/locale/ja-JP.js +139 -0
- package/lib/cjs/locale/ko-KR.js +139 -0
- package/lib/cjs/locale/pl-PL.js +139 -0
- package/lib/cjs/locale/pt-BR.js +139 -0
- package/lib/cjs/locale/ru-RU.js +139 -0
- package/lib/cjs/locale/sk-SK.js +139 -0
- package/lib/cjs/locale/vi-VN.js +139 -0
- package/lib/cjs/locale/zh-CN.js +139 -0
- package/lib/cjs/locale/zh-HK.js +139 -0
- package/lib/cjs/locale/zh-TW.js +139 -0
- package/lib/es/facade.js +115 -129
- package/lib/es/index.js +183 -156
- package/lib/es/locale/ar-SA.js +138 -0
- package/lib/es/locale/ca-ES.js +138 -0
- package/lib/es/locale/de-DE.js +138 -0
- package/lib/es/locale/en-US.js +153 -0
- package/lib/es/locale/es-ES.js +138 -0
- package/lib/es/locale/fa-IR.js +138 -0
- package/lib/es/locale/fr-FR.js +138 -0
- package/lib/es/locale/id-ID.js +138 -0
- package/lib/es/locale/it-IT.js +138 -0
- package/lib/es/locale/ja-JP.js +138 -0
- package/lib/es/locale/ko-KR.js +138 -0
- package/lib/es/locale/pl-PL.js +138 -0
- package/lib/es/locale/pt-BR.js +138 -0
- package/lib/es/locale/ru-RU.js +138 -0
- package/lib/es/locale/sk-SK.js +138 -0
- package/lib/es/locale/vi-VN.js +138 -0
- package/lib/es/locale/zh-CN.js +138 -0
- package/lib/es/locale/zh-HK.js +138 -0
- package/lib/es/locale/zh-TW.js +138 -0
- package/lib/facade.js +115 -129
- package/lib/index.js +183 -156
- package/lib/locale/ar-SA.js +138 -0
- package/lib/locale/ca-ES.js +138 -0
- package/lib/locale/de-DE.js +138 -0
- package/lib/locale/en-US.js +153 -0
- package/lib/locale/es-ES.js +138 -0
- package/lib/locale/fa-IR.js +138 -0
- package/lib/locale/fr-FR.js +138 -0
- package/lib/locale/id-ID.js +138 -0
- package/lib/locale/it-IT.js +138 -0
- package/lib/locale/ja-JP.js +138 -0
- package/lib/locale/ko-KR.js +138 -0
- package/lib/locale/pl-PL.js +138 -0
- package/lib/locale/pt-BR.js +138 -0
- package/lib/locale/ru-RU.js +138 -0
- package/lib/locale/sk-SK.js +138 -0
- package/lib/locale/vi-VN.js +138 -0
- package/lib/locale/zh-CN.js +138 -0
- package/lib/locale/zh-HK.js +138 -0
- package/lib/locale/zh-TW.js +138 -0
- package/lib/types/facade/f-data-validation-builder.d.ts +50 -25
- package/lib/types/facade/f-data-validation.d.ts +26 -13
- package/lib/types/facade/f-range.d.ts +10 -5
- package/lib/types/facade/f-univer.d.ts +2 -1
- package/lib/types/facade/f-workbook.d.ts +1 -43
- package/lib/types/facade/f-worksheet.d.ts +8 -9
- package/lib/types/index.d.ts +5 -5
- package/lib/types/locale/ar-SA.d.ts +18 -0
- package/lib/types/locale/ca-ES.d.ts +18 -0
- package/lib/types/locale/de-DE.d.ts +18 -0
- package/lib/types/locale/en-US.d.ts +156 -0
- package/lib/types/locale/es-ES.d.ts +18 -0
- package/lib/types/locale/fa-IR.d.ts +18 -0
- package/lib/types/locale/fr-FR.d.ts +18 -0
- package/lib/types/locale/id-ID.d.ts +18 -0
- package/lib/types/locale/it-IT.d.ts +18 -0
- package/lib/types/locale/ja-JP.d.ts +18 -0
- package/lib/types/locale/ko-KR.d.ts +18 -0
- package/lib/types/locale/pl-PL.d.ts +18 -0
- package/lib/types/locale/pt-BR.d.ts +18 -0
- package/lib/types/locale/ru-RU.d.ts +18 -0
- package/lib/types/locale/sk-SK.d.ts +18 -0
- package/lib/types/locale/vi-VN.d.ts +18 -0
- package/lib/types/locale/zh-CN.d.ts +18 -0
- package/lib/types/locale/zh-HK.d.ts +18 -0
- package/lib/types/locale/zh-TW.d.ts +18 -0
- package/lib/types/types/const/operator-text-map.d.ts +2 -1
- package/lib/types/validators/any-validator.d.ts +2 -2
- package/lib/types/validators/base-sheet-validator.d.ts +26 -0
- package/lib/types/validators/checkbox-validator.d.ts +2 -2
- package/lib/types/validators/custom-validator.d.ts +2 -2
- package/lib/types/validators/date-validator.d.ts +2 -2
- package/lib/types/validators/decimal-validator.d.ts +2 -2
- package/lib/types/validators/list-validator.d.ts +2 -2
- package/lib/types/validators/text-length-validator.d.ts +2 -2
- package/lib/types/validators/util.d.ts +0 -2
- package/lib/types/validators/whole-validator.d.ts +2 -2
- package/lib/umd/facade.js +1 -1
- package/lib/umd/index.js +1 -1
- package/lib/umd/locale/ar-SA.js +1 -0
- package/lib/umd/locale/ca-ES.js +1 -0
- package/lib/umd/locale/de-DE.js +1 -0
- package/lib/umd/locale/en-US.js +1 -0
- package/lib/umd/locale/es-ES.js +1 -0
- package/lib/umd/locale/fa-IR.js +1 -0
- package/lib/umd/locale/fr-FR.js +1 -0
- package/lib/umd/locale/id-ID.js +1 -0
- package/lib/umd/locale/it-IT.js +1 -0
- package/lib/umd/locale/ja-JP.js +1 -0
- package/lib/umd/locale/ko-KR.js +1 -0
- package/lib/umd/locale/pl-PL.js +1 -0
- package/lib/umd/locale/pt-BR.js +1 -0
- package/lib/umd/locale/ru-RU.js +1 -0
- package/lib/umd/locale/sk-SK.js +1 -0
- package/lib/umd/locale/vi-VN.js +1 -0
- package/lib/umd/locale/zh-CN.js +1 -0
- package/lib/umd/locale/zh-HK.js +1 -0
- package/lib/umd/locale/zh-TW.js +1 -0
- package/package.json +14 -9
- package/LICENSE +0 -176
package/lib/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { CellValueType, CommandType, DataValidationOperator, DataValidationRenderMode, DataValidationStatus, DataValidationType, DependentOn, Disposable, ICommandService, IConfigService, IPermissionService, IUndoRedoService, IUniverInstanceService, Inject, Injector, LifecycleService, LifecycleStages, ObjectMatrix, Plugin, RBush, Range, Rectangle, RxDisposable, Tools, UniverInstanceType, WrapStrategy, bufferDebounceTime, dateKit, debounce, generateRandomId, getIntersectRange, getOriginCellValue, isFormulaString, isRangesEqual, merge, numfmt, sequenceExecute, toDisposable } from "@univerjs/core";
|
|
2
|
-
import { AddDataValidationMutation, BaseDataValidator, DataValidationModel, DataValidatorRegistryService, RemoveDataValidationMutation,
|
|
2
|
+
import { AddDataValidationMutation, BaseDataValidator, DataValidationModel, DataValidatorRegistryService, RemoveDataValidationMutation, UniverDataValidationPlugin, UpdateDataValidationMutation, UpdateRuleType, getRuleOptions, getRuleSetting } from "@univerjs/data-validation";
|
|
3
3
|
import { ERROR_TYPE_SET, LexerTreeBuilder, OtherFormulaBizType, RegisterOtherFormulaService, deserializeRangeWithSheet, deserializeRangeWithSheetWithCache, isReferenceString, operatorToken, sequenceNodeType } from "@univerjs/engine-formula";
|
|
4
|
-
import { ClearSelectionAllCommand, CopySheetCommand, RefRangeService, RemoveSheetCommand, RemoveSheetMutation, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SheetInterceptorService, SheetsSelectionsService, WorksheetViewPermission, getSheetCommandTarget, handleCommonDefaultRangeChangeWithEffectRefCommands } from "@univerjs/sheets";
|
|
4
|
+
import { ClearSelectionAllCommand, CopySheetCommand, RefRangeService, RemoveSheetCommand, RemoveSheetMutation, SetRangeValuesMutation, SetRangeValuesUndoMutationFactory, SheetInterceptorService, SheetsSelectionsService, WorksheetViewPermission, deserializeListOptions, getSheetCommandTarget, handleCommonDefaultRangeChangeWithEffectRefCommands } from "@univerjs/sheets";
|
|
5
5
|
import { Subject, bufferWhen, filter, skip } from "rxjs";
|
|
6
6
|
import { UnitAction } from "@univerjs/protocol";
|
|
7
7
|
import { FormulaRefRangeService, UniverSheetsFormulaPlugin } from "@univerjs/sheets-formula";
|
|
8
8
|
|
|
9
|
-
//#region \0@oxc-project+runtime@0.
|
|
9
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/typeof.js
|
|
10
10
|
function _typeof(o) {
|
|
11
11
|
"@babel/helpers - typeof";
|
|
12
12
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -17,7 +17,7 @@ function _typeof(o) {
|
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
//#endregion
|
|
20
|
-
//#region \0@oxc-project+runtime@0.
|
|
20
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPrimitive.js
|
|
21
21
|
function toPrimitive(t, r) {
|
|
22
22
|
if ("object" != _typeof(t) || !t) return t;
|
|
23
23
|
var e = t[Symbol.toPrimitive];
|
|
@@ -30,14 +30,14 @@ function toPrimitive(t, r) {
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
//#endregion
|
|
33
|
-
//#region \0@oxc-project+runtime@0.
|
|
33
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/toPropertyKey.js
|
|
34
34
|
function toPropertyKey(t) {
|
|
35
35
|
var i = toPrimitive(t, "string");
|
|
36
36
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
//#endregion
|
|
40
|
-
//#region \0@oxc-project+runtime@0.
|
|
40
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/defineProperty.js
|
|
41
41
|
function _defineProperty(e, r, t) {
|
|
42
42
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
43
43
|
value: t,
|
|
@@ -48,7 +48,7 @@ function _defineProperty(e, r, t) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
//#endregion
|
|
51
|
-
//#region \0@oxc-project+runtime@0.
|
|
51
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/decorateParam.js
|
|
52
52
|
function __decorateParam(paramIndex, decorator) {
|
|
53
53
|
return function(target, key) {
|
|
54
54
|
decorator(target, key, paramIndex);
|
|
@@ -56,7 +56,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
//#endregion
|
|
59
|
-
//#region \0@oxc-project+runtime@0.
|
|
59
|
+
//#region \0@oxc-project+runtime@0.134.0/helpers/esm/decorate.js
|
|
60
60
|
function __decorate(decorators, target, key, desc) {
|
|
61
61
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
62
62
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -388,31 +388,6 @@ function getStringCellValue(cell) {
|
|
|
388
388
|
return String((_getCellValueOrigin = getCellValueOrigin(cell)) !== null && _getCellValueOrigin !== void 0 ? _getCellValueOrigin : "");
|
|
389
389
|
}
|
|
390
390
|
|
|
391
|
-
//#endregion
|
|
392
|
-
//#region src/validators/util.ts
|
|
393
|
-
function serializeListOptions(options) {
|
|
394
|
-
return options.filter(Boolean).join(",");
|
|
395
|
-
}
|
|
396
|
-
function deserializeListOptions(optionsStr) {
|
|
397
|
-
return optionsStr.split(",").filter(Boolean);
|
|
398
|
-
}
|
|
399
|
-
function getDataValidationCellValue(cellData) {
|
|
400
|
-
const cellValue = getCellValueOrigin(cellData);
|
|
401
|
-
if (cellValue === void 0 || cellValue === null) return "";
|
|
402
|
-
return cellValue.toString();
|
|
403
|
-
}
|
|
404
|
-
function getTransformedFormula(lexerTreeBuilder, rule, position) {
|
|
405
|
-
const { formula1, formula2 } = rule;
|
|
406
|
-
const originStartRow = rule.ranges[0].startRow;
|
|
407
|
-
const originStartColumn = rule.ranges[0].startColumn;
|
|
408
|
-
const offsetRow = position.row - originStartRow;
|
|
409
|
-
const offsetColumn = position.col - originStartColumn;
|
|
410
|
-
return {
|
|
411
|
-
transformedFormula1: isFormulaString(formula1) ? lexerTreeBuilder.moveFormulaRefOffset(formula1, offsetColumn, offsetRow, true) : formula1,
|
|
412
|
-
transformedFormula2: isFormulaString(formula2) ? lexerTreeBuilder.moveFormulaRefOffset(formula2, offsetColumn, offsetRow, true) : formula2
|
|
413
|
-
};
|
|
414
|
-
}
|
|
415
|
-
|
|
416
391
|
//#endregion
|
|
417
392
|
//#region src/services/dv-list-cache.service.ts
|
|
418
393
|
let DataValidationListCacheService = class DataValidationListCacheService extends Disposable {
|
|
@@ -1011,21 +986,103 @@ SheetDataValidationModel = __decorate([
|
|
|
1011
986
|
__decorateParam(6, ICommandService)
|
|
1012
987
|
], SheetDataValidationModel);
|
|
1013
988
|
|
|
989
|
+
//#endregion
|
|
990
|
+
//#region src/types/const/operator-text-map.ts
|
|
991
|
+
/**
|
|
992
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
993
|
+
*
|
|
994
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
995
|
+
* you may not use this file except in compliance with the License.
|
|
996
|
+
* You may obtain a copy of the License at
|
|
997
|
+
*
|
|
998
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
999
|
+
*
|
|
1000
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
1001
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1002
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1003
|
+
* See the License for the specific language governing permissions and
|
|
1004
|
+
* limitations under the License.
|
|
1005
|
+
*/
|
|
1006
|
+
const OperatorTextMap = {
|
|
1007
|
+
[DataValidationOperator.BETWEEN]: "sheets-data-validation.operators.between",
|
|
1008
|
+
[DataValidationOperator.EQUAL]: "sheets-data-validation.operators.equal",
|
|
1009
|
+
[DataValidationOperator.GREATER_THAN]: "sheets-data-validation.operators.greaterThan",
|
|
1010
|
+
[DataValidationOperator.GREATER_THAN_OR_EQUAL]: "sheets-data-validation.operators.greaterThanOrEqual",
|
|
1011
|
+
[DataValidationOperator.LESS_THAN]: "sheets-data-validation.operators.lessThan",
|
|
1012
|
+
[DataValidationOperator.LESS_THAN_OR_EQUAL]: "sheets-data-validation.operators.lessThanOrEqual",
|
|
1013
|
+
[DataValidationOperator.NOT_BETWEEN]: "sheets-data-validation.operators.notBetween",
|
|
1014
|
+
[DataValidationOperator.NOT_EQUAL]: "sheets-data-validation.operators.notEqual"
|
|
1015
|
+
};
|
|
1016
|
+
const OperatorTitleMap = {
|
|
1017
|
+
[DataValidationOperator.BETWEEN]: "sheets-data-validation.ruleName.between",
|
|
1018
|
+
[DataValidationOperator.EQUAL]: "sheets-data-validation.ruleName.equal",
|
|
1019
|
+
[DataValidationOperator.GREATER_THAN]: "sheets-data-validation.ruleName.greaterThan",
|
|
1020
|
+
[DataValidationOperator.GREATER_THAN_OR_EQUAL]: "sheets-data-validation.ruleName.greaterThanOrEqual",
|
|
1021
|
+
[DataValidationOperator.LESS_THAN]: "sheets-data-validation.ruleName.lessThan",
|
|
1022
|
+
[DataValidationOperator.LESS_THAN_OR_EQUAL]: "sheets-data-validation.ruleName.lessThanOrEqual",
|
|
1023
|
+
[DataValidationOperator.NOT_BETWEEN]: "sheets-data-validation.ruleName.notBetween",
|
|
1024
|
+
[DataValidationOperator.NOT_EQUAL]: "sheets-data-validation.ruleName.notEqual",
|
|
1025
|
+
NONE: "sheets-data-validation.ruleName.legal"
|
|
1026
|
+
};
|
|
1027
|
+
const OperatorErrorTitleMap = {
|
|
1028
|
+
[DataValidationOperator.BETWEEN]: "sheets-data-validation.errorMsg.between",
|
|
1029
|
+
[DataValidationOperator.EQUAL]: "sheets-data-validation.errorMsg.equal",
|
|
1030
|
+
[DataValidationOperator.GREATER_THAN]: "sheets-data-validation.errorMsg.greaterThan",
|
|
1031
|
+
[DataValidationOperator.GREATER_THAN_OR_EQUAL]: "sheets-data-validation.errorMsg.greaterThanOrEqual",
|
|
1032
|
+
[DataValidationOperator.LESS_THAN]: "sheets-data-validation.errorMsg.lessThan",
|
|
1033
|
+
[DataValidationOperator.LESS_THAN_OR_EQUAL]: "sheets-data-validation.errorMsg.lessThanOrEqual",
|
|
1034
|
+
[DataValidationOperator.NOT_BETWEEN]: "sheets-data-validation.errorMsg.notBetween",
|
|
1035
|
+
[DataValidationOperator.NOT_EQUAL]: "sheets-data-validation.errorMsg.notEqual",
|
|
1036
|
+
NONE: "sheets-data-validation.errorMsg.legal"
|
|
1037
|
+
};
|
|
1038
|
+
const TextLengthErrorTitleMap = {
|
|
1039
|
+
[DataValidationOperator.BETWEEN]: "sheets-data-validation.textLength.errorMsg.between",
|
|
1040
|
+
[DataValidationOperator.EQUAL]: "sheets-data-validation.textLength.errorMsg.equal",
|
|
1041
|
+
[DataValidationOperator.GREATER_THAN]: "sheets-data-validation.textLength.errorMsg.greaterThan",
|
|
1042
|
+
[DataValidationOperator.GREATER_THAN_OR_EQUAL]: "sheets-data-validation.textLength.errorMsg.greaterThanOrEqual",
|
|
1043
|
+
[DataValidationOperator.LESS_THAN]: "sheets-data-validation.textLength.errorMsg.lessThan",
|
|
1044
|
+
[DataValidationOperator.LESS_THAN_OR_EQUAL]: "sheets-data-validation.textLength.errorMsg.lessThanOrEqual",
|
|
1045
|
+
[DataValidationOperator.NOT_BETWEEN]: "sheets-data-validation.textLength.errorMsg.notBetween",
|
|
1046
|
+
[DataValidationOperator.NOT_EQUAL]: "sheets-data-validation.textLength.errorMsg.notEqual"
|
|
1047
|
+
};
|
|
1048
|
+
|
|
1049
|
+
//#endregion
|
|
1050
|
+
//#region src/validators/base-sheet-validator.ts
|
|
1051
|
+
const FORMULA1$1 = "{FORMULA1}";
|
|
1052
|
+
const FORMULA2$1 = "{FORMULA2}";
|
|
1053
|
+
const TYPE = "{TYPE}";
|
|
1054
|
+
var BaseSheetValidator = class extends BaseDataValidator {
|
|
1055
|
+
get operatorNames() {
|
|
1056
|
+
return this.operators.map((operator) => this.localeService.t(OperatorTextMap[operator]));
|
|
1057
|
+
}
|
|
1058
|
+
generateRuleName(rule) {
|
|
1059
|
+
var _rule$formula, _rule$formula2;
|
|
1060
|
+
if (!rule.operator) return this.localeService.t(OperatorTitleMap.NONE).replace(TYPE, this.titleStr);
|
|
1061
|
+
const ruleName = this.localeService.t(OperatorTitleMap[rule.operator]).replace(FORMULA1$1, (_rule$formula = rule.formula1) !== null && _rule$formula !== void 0 ? _rule$formula : "").replace(FORMULA2$1, (_rule$formula2 = rule.formula2) !== null && _rule$formula2 !== void 0 ? _rule$formula2 : "");
|
|
1062
|
+
return `${this.titleStr} ${ruleName}`;
|
|
1063
|
+
}
|
|
1064
|
+
generateRuleErrorMessage(rule, _position) {
|
|
1065
|
+
var _rule$formula3, _rule$formula4;
|
|
1066
|
+
if (!rule.operator) return this.localeService.t(OperatorErrorTitleMap.NONE).replace(TYPE, this.titleStr);
|
|
1067
|
+
return `${this.localeService.t(OperatorErrorTitleMap[rule.operator]).replace(FORMULA1$1, (_rule$formula3 = rule.formula1) !== null && _rule$formula3 !== void 0 ? _rule$formula3 : "").replace(FORMULA2$1, (_rule$formula4 = rule.formula2) !== null && _rule$formula4 !== void 0 ? _rule$formula4 : "")}`;
|
|
1068
|
+
}
|
|
1069
|
+
};
|
|
1070
|
+
|
|
1014
1071
|
//#endregion
|
|
1015
1072
|
//#region src/validators/checkbox-validator.ts
|
|
1016
1073
|
const CHECKBOX_FORMULA_1 = 1;
|
|
1017
1074
|
const CHECKBOX_FORMULA_2 = 0;
|
|
1018
1075
|
function getFailMessage(formula, localeService) {
|
|
1019
|
-
if (Tools.isBlank(formula)) return localeService.t("
|
|
1020
|
-
if (isFormulaString(formula)) return localeService.t("
|
|
1076
|
+
if (Tools.isBlank(formula)) return localeService.t("sheets-data-validation.validFail.value");
|
|
1077
|
+
if (isFormulaString(formula)) return localeService.t("sheets-data-validation.validFail.primitive");
|
|
1021
1078
|
return "";
|
|
1022
1079
|
}
|
|
1023
1080
|
const transformCheckboxValue = (value) => Tools.isDefine(value) && String(value).toLowerCase() === "true" ? "1" : String(value).toLowerCase() === "false" ? "0" : value;
|
|
1024
|
-
var CheckboxValidator = class extends
|
|
1081
|
+
var CheckboxValidator = class extends BaseSheetValidator {
|
|
1025
1082
|
constructor(..._args) {
|
|
1026
1083
|
super(..._args);
|
|
1027
1084
|
_defineProperty(this, "id", DataValidationType.CHECKBOX);
|
|
1028
|
-
_defineProperty(this, "title", "
|
|
1085
|
+
_defineProperty(this, "title", "sheets-data-validation.checkbox.title");
|
|
1029
1086
|
_defineProperty(this, "operators", []);
|
|
1030
1087
|
_defineProperty(this, "scopes", ["sheet"]);
|
|
1031
1088
|
_defineProperty(this, "order", 41);
|
|
@@ -1044,8 +1101,8 @@ var CheckboxValidator = class extends BaseDataValidator {
|
|
|
1044
1101
|
if (Tools.isBlank(formula1) && Tools.isBlank(formula2)) return { success: true };
|
|
1045
1102
|
if (isEqual) return {
|
|
1046
1103
|
success: false,
|
|
1047
|
-
formula1: this.localeService.t("
|
|
1048
|
-
formula2: this.localeService.t("
|
|
1104
|
+
formula1: this.localeService.t("sheets-data-validation.validFail.checkboxEqual"),
|
|
1105
|
+
formula2: this.localeService.t("sheets-data-validation.validFail.checkboxEqual")
|
|
1049
1106
|
};
|
|
1050
1107
|
const error1 = getFailMessage(formula1, this.localeService);
|
|
1051
1108
|
const error2 = getFailMessage(formula2, this.localeService);
|
|
@@ -1095,7 +1152,7 @@ var CheckboxValidator = class extends BaseDataValidator {
|
|
|
1095
1152
|
return Tools.isDefine(value) && (String(value) === String(formula1) || String(value) === String(formula2) || String(value) === String(originFormula1 !== null && originFormula1 !== void 0 ? originFormula1 : "") || String(value) === String(originFormula2 !== null && originFormula2 !== void 0 ? originFormula2 : ""));
|
|
1096
1153
|
}
|
|
1097
1154
|
generateRuleErrorMessage(rule) {
|
|
1098
|
-
return this.localeService.t("
|
|
1155
|
+
return this.localeService.t("sheets-data-validation.checkbox.error");
|
|
1099
1156
|
}
|
|
1100
1157
|
generateRuleName(rule) {
|
|
1101
1158
|
return this.titleStr;
|
|
@@ -1120,46 +1177,46 @@ var CheckboxValidator = class extends BaseDataValidator {
|
|
|
1120
1177
|
* limitations under the License.
|
|
1121
1178
|
*/
|
|
1122
1179
|
const DateOperatorNameMap = {
|
|
1123
|
-
[DataValidationOperator.BETWEEN]: "
|
|
1124
|
-
[DataValidationOperator.EQUAL]: "
|
|
1125
|
-
[DataValidationOperator.GREATER_THAN]: "
|
|
1126
|
-
[DataValidationOperator.GREATER_THAN_OR_EQUAL]: "
|
|
1127
|
-
[DataValidationOperator.LESS_THAN]: "
|
|
1128
|
-
[DataValidationOperator.LESS_THAN_OR_EQUAL]: "
|
|
1129
|
-
[DataValidationOperator.NOT_BETWEEN]: "
|
|
1130
|
-
[DataValidationOperator.NOT_EQUAL]: "
|
|
1180
|
+
[DataValidationOperator.BETWEEN]: "sheets-data-validation.date.operators.between",
|
|
1181
|
+
[DataValidationOperator.EQUAL]: "sheets-data-validation.date.operators.equal",
|
|
1182
|
+
[DataValidationOperator.GREATER_THAN]: "sheets-data-validation.date.operators.greaterThan",
|
|
1183
|
+
[DataValidationOperator.GREATER_THAN_OR_EQUAL]: "sheets-data-validation.date.operators.greaterThanOrEqual",
|
|
1184
|
+
[DataValidationOperator.LESS_THAN]: "sheets-data-validation.date.operators.lessThan",
|
|
1185
|
+
[DataValidationOperator.LESS_THAN_OR_EQUAL]: "sheets-data-validation.date.operators.lessThanOrEqual",
|
|
1186
|
+
[DataValidationOperator.NOT_BETWEEN]: "sheets-data-validation.date.operators.notBetween",
|
|
1187
|
+
[DataValidationOperator.NOT_EQUAL]: "sheets-data-validation.date.operators.notEqual"
|
|
1131
1188
|
};
|
|
1132
1189
|
const DateOperatorTextMap = {
|
|
1133
|
-
[DataValidationOperator.BETWEEN]: "
|
|
1134
|
-
[DataValidationOperator.EQUAL]: "
|
|
1135
|
-
[DataValidationOperator.GREATER_THAN]: "
|
|
1136
|
-
[DataValidationOperator.GREATER_THAN_OR_EQUAL]: "
|
|
1137
|
-
[DataValidationOperator.LESS_THAN]: "
|
|
1138
|
-
[DataValidationOperator.LESS_THAN_OR_EQUAL]: "
|
|
1139
|
-
[DataValidationOperator.NOT_BETWEEN]: "
|
|
1140
|
-
[DataValidationOperator.NOT_EQUAL]: "
|
|
1190
|
+
[DataValidationOperator.BETWEEN]: "sheets-data-validation.date.operators.between",
|
|
1191
|
+
[DataValidationOperator.EQUAL]: "sheets-data-validation.date.operators.equal",
|
|
1192
|
+
[DataValidationOperator.GREATER_THAN]: "sheets-data-validation.date.operators.greaterThan",
|
|
1193
|
+
[DataValidationOperator.GREATER_THAN_OR_EQUAL]: "sheets-data-validation.date.operators.greaterThanOrEqual",
|
|
1194
|
+
[DataValidationOperator.LESS_THAN]: "sheets-data-validation.date.operators.lessThan",
|
|
1195
|
+
[DataValidationOperator.LESS_THAN_OR_EQUAL]: "sheets-data-validation.date.operators.lessThanOrEqual",
|
|
1196
|
+
[DataValidationOperator.NOT_BETWEEN]: "sheets-data-validation.date.operators.notBetween",
|
|
1197
|
+
[DataValidationOperator.NOT_EQUAL]: "sheets-data-validation.date.operators.notEqual"
|
|
1141
1198
|
};
|
|
1142
1199
|
const DateOperatorTitleMap = {
|
|
1143
|
-
[DataValidationOperator.BETWEEN]: "
|
|
1144
|
-
[DataValidationOperator.EQUAL]: "
|
|
1145
|
-
[DataValidationOperator.GREATER_THAN]: "
|
|
1146
|
-
[DataValidationOperator.GREATER_THAN_OR_EQUAL]: "
|
|
1147
|
-
[DataValidationOperator.LESS_THAN]: "
|
|
1148
|
-
[DataValidationOperator.LESS_THAN_OR_EQUAL]: "
|
|
1149
|
-
[DataValidationOperator.NOT_BETWEEN]: "
|
|
1150
|
-
[DataValidationOperator.NOT_EQUAL]: "
|
|
1151
|
-
NONE: "
|
|
1200
|
+
[DataValidationOperator.BETWEEN]: "sheets-data-validation.date.ruleName.between",
|
|
1201
|
+
[DataValidationOperator.EQUAL]: "sheets-data-validation.date.ruleName.equal",
|
|
1202
|
+
[DataValidationOperator.GREATER_THAN]: "sheets-data-validation.date.ruleName.greaterThan",
|
|
1203
|
+
[DataValidationOperator.GREATER_THAN_OR_EQUAL]: "sheets-data-validation.date.ruleName.greaterThanOrEqual",
|
|
1204
|
+
[DataValidationOperator.LESS_THAN]: "sheets-data-validation.date.ruleName.lessThan",
|
|
1205
|
+
[DataValidationOperator.LESS_THAN_OR_EQUAL]: "sheets-data-validation.date.ruleName.lessThanOrEqual",
|
|
1206
|
+
[DataValidationOperator.NOT_BETWEEN]: "sheets-data-validation.date.ruleName.notBetween",
|
|
1207
|
+
[DataValidationOperator.NOT_EQUAL]: "sheets-data-validation.date.ruleName.notEqual",
|
|
1208
|
+
NONE: "sheets-data-validation.date.ruleName.legal"
|
|
1152
1209
|
};
|
|
1153
1210
|
const DateOperatorErrorTitleMap = {
|
|
1154
|
-
[DataValidationOperator.BETWEEN]: "
|
|
1155
|
-
[DataValidationOperator.EQUAL]: "
|
|
1156
|
-
[DataValidationOperator.GREATER_THAN]: "
|
|
1157
|
-
[DataValidationOperator.GREATER_THAN_OR_EQUAL]: "
|
|
1158
|
-
[DataValidationOperator.LESS_THAN]: "
|
|
1159
|
-
[DataValidationOperator.LESS_THAN_OR_EQUAL]: "
|
|
1160
|
-
[DataValidationOperator.NOT_BETWEEN]: "
|
|
1161
|
-
[DataValidationOperator.NOT_EQUAL]: "
|
|
1162
|
-
NONE: "
|
|
1211
|
+
[DataValidationOperator.BETWEEN]: "sheets-data-validation.date.errorMsg.between",
|
|
1212
|
+
[DataValidationOperator.EQUAL]: "sheets-data-validation.date.errorMsg.equal",
|
|
1213
|
+
[DataValidationOperator.GREATER_THAN]: "sheets-data-validation.date.errorMsg.greaterThan",
|
|
1214
|
+
[DataValidationOperator.GREATER_THAN_OR_EQUAL]: "sheets-data-validation.date.errorMsg.greaterThanOrEqual",
|
|
1215
|
+
[DataValidationOperator.LESS_THAN]: "sheets-data-validation.date.errorMsg.lessThan",
|
|
1216
|
+
[DataValidationOperator.LESS_THAN_OR_EQUAL]: "sheets-data-validation.date.errorMsg.lessThanOrEqual",
|
|
1217
|
+
[DataValidationOperator.NOT_BETWEEN]: "sheets-data-validation.date.errorMsg.notBetween",
|
|
1218
|
+
[DataValidationOperator.NOT_EQUAL]: "sheets-data-validation.date.errorMsg.notEqual",
|
|
1219
|
+
NONE: "sheets-data-validation.date.errorMsg.legal"
|
|
1163
1220
|
};
|
|
1164
1221
|
|
|
1165
1222
|
//#endregion
|
|
@@ -1201,6 +1258,25 @@ const TWO_FORMULA_OPERATOR_COUNT = [DataValidationOperator.BETWEEN, DataValidati
|
|
|
1201
1258
|
const FORMULA1 = "{FORMULA1}";
|
|
1202
1259
|
const FORMULA2 = "{FORMULA2}";
|
|
1203
1260
|
|
|
1261
|
+
//#endregion
|
|
1262
|
+
//#region src/validators/util.ts
|
|
1263
|
+
function getDataValidationCellValue(cellData) {
|
|
1264
|
+
const cellValue = getCellValueOrigin(cellData);
|
|
1265
|
+
if (cellValue === void 0 || cellValue === null) return "";
|
|
1266
|
+
return cellValue.toString();
|
|
1267
|
+
}
|
|
1268
|
+
function getTransformedFormula(lexerTreeBuilder, rule, position) {
|
|
1269
|
+
const { formula1, formula2 } = rule;
|
|
1270
|
+
const originStartRow = rule.ranges[0].startRow;
|
|
1271
|
+
const originStartColumn = rule.ranges[0].startColumn;
|
|
1272
|
+
const offsetRow = position.row - originStartRow;
|
|
1273
|
+
const offsetColumn = position.col - originStartColumn;
|
|
1274
|
+
return {
|
|
1275
|
+
transformedFormula1: isFormulaString(formula1) ? lexerTreeBuilder.moveFormulaRefOffset(formula1, offsetColumn, offsetRow, true) : formula1,
|
|
1276
|
+
transformedFormula2: isFormulaString(formula2) ? lexerTreeBuilder.moveFormulaRefOffset(formula2, offsetColumn, offsetRow, true) : formula2
|
|
1277
|
+
};
|
|
1278
|
+
}
|
|
1279
|
+
|
|
1204
1280
|
//#endregion
|
|
1205
1281
|
//#region src/validators/date-validator.ts
|
|
1206
1282
|
const transformDate2SerialNumber = (value) => {
|
|
@@ -1211,11 +1287,11 @@ const transformDate2SerialNumber = (value) => {
|
|
|
1211
1287
|
if (Tools.isDefine(v)) return v;
|
|
1212
1288
|
return (_numfmt$parseDate2 = numfmt.parseDate(dateKit(value).format("YYYY-MM-DD HH:mm:ss"))) === null || _numfmt$parseDate2 === void 0 ? void 0 : _numfmt$parseDate2.v;
|
|
1213
1289
|
};
|
|
1214
|
-
var DateValidator = class extends
|
|
1290
|
+
var DateValidator = class extends BaseSheetValidator {
|
|
1215
1291
|
constructor(..._args) {
|
|
1216
1292
|
super(..._args);
|
|
1217
1293
|
_defineProperty(this, "id", DataValidationType.DATE);
|
|
1218
|
-
_defineProperty(this, "title", "
|
|
1294
|
+
_defineProperty(this, "title", "sheets-data-validation.date.title");
|
|
1219
1295
|
_defineProperty(this, "order", 40);
|
|
1220
1296
|
_defineProperty(this, "operators", [
|
|
1221
1297
|
DataValidationOperator.BETWEEN,
|
|
@@ -1255,7 +1331,7 @@ var DateValidator = class extends BaseDataValidator {
|
|
|
1255
1331
|
const operator = rule.operator;
|
|
1256
1332
|
if (!operator) return { success: true };
|
|
1257
1333
|
const formula1Success = this._validatorSingleFormula(rule.formula1);
|
|
1258
|
-
const errorMsg = this.localeService.t("
|
|
1334
|
+
const errorMsg = this.localeService.t("sheets-data-validation.validFail.date");
|
|
1259
1335
|
if (TWO_FORMULA_OPERATOR_COUNT.includes(operator)) {
|
|
1260
1336
|
const formula2Success = this._validatorSingleFormula(rule.formula2);
|
|
1261
1337
|
return {
|
|
@@ -1311,67 +1387,18 @@ var DateValidator = class extends BaseDataValidator {
|
|
|
1311
1387
|
}
|
|
1312
1388
|
};
|
|
1313
1389
|
|
|
1314
|
-
//#endregion
|
|
1315
|
-
//#region src/types/const/operator-text-map.ts
|
|
1316
|
-
/**
|
|
1317
|
-
* Copyright 2023-present DreamNum Co., Ltd.
|
|
1318
|
-
*
|
|
1319
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1320
|
-
* you may not use this file except in compliance with the License.
|
|
1321
|
-
* You may obtain a copy of the License at
|
|
1322
|
-
*
|
|
1323
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1324
|
-
*
|
|
1325
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1326
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1327
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1328
|
-
* See the License for the specific language governing permissions and
|
|
1329
|
-
* limitations under the License.
|
|
1330
|
-
*/
|
|
1331
|
-
const OperatorTextMap = {
|
|
1332
|
-
[DataValidationOperator.BETWEEN]: "dataValidation.operators.between",
|
|
1333
|
-
[DataValidationOperator.EQUAL]: "dataValidation.operators.equal",
|
|
1334
|
-
[DataValidationOperator.GREATER_THAN]: "dataValidation.operators.greaterThan",
|
|
1335
|
-
[DataValidationOperator.GREATER_THAN_OR_EQUAL]: "dataValidation.operators.greaterThanOrEqual",
|
|
1336
|
-
[DataValidationOperator.LESS_THAN]: "dataValidation.operators.lessThan",
|
|
1337
|
-
[DataValidationOperator.LESS_THAN_OR_EQUAL]: "dataValidation.operators.lessThanOrEqual",
|
|
1338
|
-
[DataValidationOperator.NOT_BETWEEN]: "dataValidation.operators.notBetween",
|
|
1339
|
-
[DataValidationOperator.NOT_EQUAL]: "dataValidation.operators.notEqual"
|
|
1340
|
-
};
|
|
1341
|
-
const OperatorTitleMap = {
|
|
1342
|
-
[DataValidationOperator.BETWEEN]: "dataValidation.ruleName.between",
|
|
1343
|
-
[DataValidationOperator.EQUAL]: "dataValidation.ruleName.equal",
|
|
1344
|
-
[DataValidationOperator.GREATER_THAN]: "dataValidation.ruleName.greaterThan",
|
|
1345
|
-
[DataValidationOperator.GREATER_THAN_OR_EQUAL]: "dataValidation.ruleName.greaterThanOrEqual",
|
|
1346
|
-
[DataValidationOperator.LESS_THAN]: "dataValidation.ruleName.lessThan",
|
|
1347
|
-
[DataValidationOperator.LESS_THAN_OR_EQUAL]: "dataValidation.ruleName.lessThanOrEqual",
|
|
1348
|
-
[DataValidationOperator.NOT_BETWEEN]: "dataValidation.ruleName.notBetween",
|
|
1349
|
-
[DataValidationOperator.NOT_EQUAL]: "dataValidation.ruleName.notEqual"
|
|
1350
|
-
};
|
|
1351
|
-
const OperatorErrorTitleMap = {
|
|
1352
|
-
[DataValidationOperator.BETWEEN]: "dataValidation.errorMsg.between",
|
|
1353
|
-
[DataValidationOperator.EQUAL]: "dataValidation.errorMsg.equal",
|
|
1354
|
-
[DataValidationOperator.GREATER_THAN]: "dataValidation.errorMsg.greaterThan",
|
|
1355
|
-
[DataValidationOperator.GREATER_THAN_OR_EQUAL]: "dataValidation.errorMsg.greaterThanOrEqual",
|
|
1356
|
-
[DataValidationOperator.LESS_THAN]: "dataValidation.errorMsg.lessThan",
|
|
1357
|
-
[DataValidationOperator.LESS_THAN_OR_EQUAL]: "dataValidation.errorMsg.lessThanOrEqual",
|
|
1358
|
-
[DataValidationOperator.NOT_BETWEEN]: "dataValidation.errorMsg.notBetween",
|
|
1359
|
-
[DataValidationOperator.NOT_EQUAL]: "dataValidation.errorMsg.notEqual",
|
|
1360
|
-
NONE: "dataValidation.errorMsg.legal"
|
|
1361
|
-
};
|
|
1362
|
-
|
|
1363
1390
|
//#endregion
|
|
1364
1391
|
//#region src/validators/decimal-validator.ts
|
|
1365
1392
|
function getCellValueNumber(cellValue) {
|
|
1366
1393
|
return +cellValue;
|
|
1367
1394
|
}
|
|
1368
|
-
var DecimalValidator = class extends
|
|
1395
|
+
var DecimalValidator = class extends BaseSheetValidator {
|
|
1369
1396
|
constructor(..._args) {
|
|
1370
1397
|
super(..._args);
|
|
1371
1398
|
_defineProperty(this, "_customFormulaService", this.injector.get(DataValidationCustomFormulaService));
|
|
1372
1399
|
_defineProperty(this, "id", DataValidationType.DECIMAL);
|
|
1373
1400
|
_defineProperty(this, "_lexerTreeBuilder", this.injector.get(LexerTreeBuilder));
|
|
1374
|
-
_defineProperty(this, "title", "
|
|
1401
|
+
_defineProperty(this, "title", "sheets-data-validation.decimal.title");
|
|
1375
1402
|
_defineProperty(this, "order", 20);
|
|
1376
1403
|
_defineProperty(this, "operators", [
|
|
1377
1404
|
DataValidationOperator.BETWEEN,
|
|
@@ -1420,7 +1447,7 @@ var DecimalValidator = class extends BaseDataValidator {
|
|
|
1420
1447
|
const formula1Success = Tools.isDefine(rule.formula1) && this._isFormulaOrNumber(rule.formula1);
|
|
1421
1448
|
const formula2Success = Tools.isDefine(rule.formula2) && this._isFormulaOrNumber(rule.formula2);
|
|
1422
1449
|
const isTwoFormula = TWO_FORMULA_OPERATOR_COUNT.includes(operator);
|
|
1423
|
-
const errorMsg = this.localeService.t("
|
|
1450
|
+
const errorMsg = this.localeService.t("sheets-data-validation.validFail.number");
|
|
1424
1451
|
if (isTwoFormula) return {
|
|
1425
1452
|
success: formula1Success && formula2Success,
|
|
1426
1453
|
formula1: formula1Success ? void 0 : errorMsg,
|
|
@@ -1482,7 +1509,7 @@ function isRuleIntersects(rule, sheetName) {
|
|
|
1482
1509
|
}
|
|
1483
1510
|
return false;
|
|
1484
1511
|
}
|
|
1485
|
-
var ListValidator = class extends
|
|
1512
|
+
var ListValidator = class extends BaseSheetValidator {
|
|
1486
1513
|
constructor(..._args) {
|
|
1487
1514
|
super(..._args);
|
|
1488
1515
|
_defineProperty(this, "formulaService", this.injector.get(DataValidationFormulaService));
|
|
@@ -1492,7 +1519,7 @@ var ListValidator = class extends BaseDataValidator {
|
|
|
1492
1519
|
_defineProperty(this, "order", 50);
|
|
1493
1520
|
_defineProperty(this, "offsetFormulaByRange", false);
|
|
1494
1521
|
_defineProperty(this, "id", DataValidationType.LIST);
|
|
1495
|
-
_defineProperty(this, "title", "
|
|
1522
|
+
_defineProperty(this, "title", "sheets-data-validation.list.title");
|
|
1496
1523
|
_defineProperty(this, "operators", []);
|
|
1497
1524
|
_defineProperty(this, "scopes", ["sheet"]);
|
|
1498
1525
|
_defineProperty(this, "skipDefaultFontRender", (rule) => {
|
|
@@ -1507,7 +1534,7 @@ var ListValidator = class extends BaseDataValidator {
|
|
|
1507
1534
|
const isIntersects = isRuleIntersects(rule, sheetName !== null && sheetName !== void 0 ? sheetName : "");
|
|
1508
1535
|
return {
|
|
1509
1536
|
success: Boolean(success && valid && !isIntersects),
|
|
1510
|
-
formula1: success ? valid ? !isIntersects ? void 0 : this.localeService.t("
|
|
1537
|
+
formula1: success ? valid ? !isIntersects ? void 0 : this.localeService.t("sheets-data-validation.validFail.listIntersects") : this.localeService.t("sheets-data-validation.validFail.listInvalid") : this.localeService.t("sheets-data-validation.validFail.list")
|
|
1511
1538
|
};
|
|
1512
1539
|
}
|
|
1513
1540
|
getExtraStyle(rule, value, { style: defaultStyle }) {
|
|
@@ -1539,13 +1566,13 @@ var ListValidator = class extends BaseDataValidator {
|
|
|
1539
1566
|
const { value, unitId, subUnitId } = cellInfo;
|
|
1540
1567
|
const { formula1 = "" } = rule;
|
|
1541
1568
|
const formula1Result = isFormulaString(formula1) ? this._listCacheService.getOrCompute(unitId, subUnitId, rule).list : deserializeListOptions(formula1);
|
|
1542
|
-
return this.parseCellValue(value).every((i) => formula1Result.includes(i));
|
|
1569
|
+
return (rule.type === DataValidationType.LIST ? value === void 0 || value === null || value === "" ? [] : [`${value}`] : this.parseCellValue(value)).every((i) => formula1Result.includes(i));
|
|
1543
1570
|
}
|
|
1544
1571
|
generateRuleName() {
|
|
1545
|
-
return this.localeService.t("
|
|
1572
|
+
return this.localeService.t("sheets-data-validation.list.name");
|
|
1546
1573
|
}
|
|
1547
1574
|
generateRuleErrorMessage() {
|
|
1548
|
-
return this.localeService.t("
|
|
1575
|
+
return this.localeService.t("sheets-data-validation.list.error");
|
|
1549
1576
|
}
|
|
1550
1577
|
_getUnitAndSubUnit(currentUnitId, currentSubUnitId) {
|
|
1551
1578
|
var _ref2, _ref3;
|
|
@@ -1589,11 +1616,11 @@ var ListValidator = class extends BaseDataValidator {
|
|
|
1589
1616
|
|
|
1590
1617
|
//#endregion
|
|
1591
1618
|
//#region src/validators/text-length-validator.ts
|
|
1592
|
-
var TextLengthValidator = class extends
|
|
1619
|
+
var TextLengthValidator = class extends BaseSheetValidator {
|
|
1593
1620
|
constructor(..._args) {
|
|
1594
1621
|
super(..._args);
|
|
1595
1622
|
_defineProperty(this, "id", DataValidationType.TEXT_LENGTH);
|
|
1596
|
-
_defineProperty(this, "title", "
|
|
1623
|
+
_defineProperty(this, "title", "sheets-data-validation.textLength.title");
|
|
1597
1624
|
_defineProperty(this, "_lexerTreeBuilder", this.injector.get(LexerTreeBuilder));
|
|
1598
1625
|
_defineProperty(this, "order", 30);
|
|
1599
1626
|
_defineProperty(this, "operators", [
|
|
@@ -1618,7 +1645,7 @@ var TextLengthValidator = class extends BaseDataValidator {
|
|
|
1618
1645
|
const formula1Success = Tools.isDefine(rule.formula1) && this._isFormulaOrInt(rule.formula1);
|
|
1619
1646
|
const formula2Success = Tools.isDefine(rule.formula2) && this._isFormulaOrInt(rule.formula2);
|
|
1620
1647
|
const isTwoFormula = TWO_FORMULA_OPERATOR_COUNT.includes(operator);
|
|
1621
|
-
const errorMsg = this.localeService.t("
|
|
1648
|
+
const errorMsg = this.localeService.t("sheets-data-validation.validFail.number");
|
|
1622
1649
|
if (isTwoFormula) return {
|
|
1623
1650
|
success: formula1Success && formula2Success,
|
|
1624
1651
|
formula1: formula1Success ? void 0 : errorMsg,
|
|
@@ -2281,7 +2308,7 @@ DataValidationFormulaController = __decorate([
|
|
|
2281
2308
|
//#endregion
|
|
2282
2309
|
//#region package.json
|
|
2283
2310
|
var name = "@univerjs/sheets-data-validation";
|
|
2284
|
-
var version = "0.
|
|
2311
|
+
var version = "0.25.0-insiders.20260608-e4336f7";
|
|
2285
2312
|
|
|
2286
2313
|
//#endregion
|
|
2287
2314
|
//#region src/config/config.ts
|
|
@@ -2764,11 +2791,11 @@ SheetDataValidationSheetController = __decorate([
|
|
|
2764
2791
|
|
|
2765
2792
|
//#endregion
|
|
2766
2793
|
//#region src/validators/any-validator.ts
|
|
2767
|
-
var AnyValidator = class extends
|
|
2794
|
+
var AnyValidator = class extends BaseSheetValidator {
|
|
2768
2795
|
constructor(..._args) {
|
|
2769
2796
|
super(..._args);
|
|
2770
2797
|
_defineProperty(this, "id", DataValidationType.ANY);
|
|
2771
|
-
_defineProperty(this, "title", "
|
|
2798
|
+
_defineProperty(this, "title", "sheets-data-validation.any.title");
|
|
2772
2799
|
_defineProperty(this, "operators", []);
|
|
2773
2800
|
_defineProperty(this, "scopes", ["sheet"]);
|
|
2774
2801
|
_defineProperty(this, "order", 0);
|
|
@@ -2788,17 +2815,17 @@ var AnyValidator = class extends BaseDataValidator {
|
|
|
2788
2815
|
return true;
|
|
2789
2816
|
}
|
|
2790
2817
|
generateRuleErrorMessage(rule) {
|
|
2791
|
-
return this.localeService.t("
|
|
2818
|
+
return this.localeService.t("sheets-data-validation.any.error");
|
|
2792
2819
|
}
|
|
2793
2820
|
};
|
|
2794
2821
|
|
|
2795
2822
|
//#endregion
|
|
2796
2823
|
//#region src/validators/custom-validator.ts
|
|
2797
|
-
var CustomFormulaValidator = class extends
|
|
2824
|
+
var CustomFormulaValidator = class extends BaseSheetValidator {
|
|
2798
2825
|
constructor(..._args) {
|
|
2799
2826
|
super(..._args);
|
|
2800
2827
|
_defineProperty(this, "id", DataValidationType.CUSTOM);
|
|
2801
|
-
_defineProperty(this, "title", "
|
|
2828
|
+
_defineProperty(this, "title", "sheets-data-validation.custom.title");
|
|
2802
2829
|
_defineProperty(this, "operators", []);
|
|
2803
2830
|
_defineProperty(this, "scopes", ["sheet"]);
|
|
2804
2831
|
_defineProperty(this, "order", 60);
|
|
@@ -2812,7 +2839,7 @@ var CustomFormulaValidator = class extends BaseDataValidator {
|
|
|
2812
2839
|
const valid = this._lexerTreeBuilder.checkIfAddBracket(formulaText) === 0 && formulaText.startsWith(operatorToken.EQUALS);
|
|
2813
2840
|
return {
|
|
2814
2841
|
success: success && valid,
|
|
2815
|
-
formula1: success && valid ? "" : this.localeService.t("
|
|
2842
|
+
formula1: success && valid ? "" : this.localeService.t("sheets-data-validation.validFail.formula")
|
|
2816
2843
|
};
|
|
2817
2844
|
}
|
|
2818
2845
|
async parseFormula(_rule, _unitId, _subUnitId) {
|
|
@@ -2837,11 +2864,11 @@ var CustomFormulaValidator = class extends BaseDataValidator {
|
|
|
2837
2864
|
return false;
|
|
2838
2865
|
}
|
|
2839
2866
|
generateRuleErrorMessage(rule) {
|
|
2840
|
-
return this.localeService.t("
|
|
2867
|
+
return this.localeService.t("sheets-data-validation.custom.error");
|
|
2841
2868
|
}
|
|
2842
2869
|
generateRuleName(rule) {
|
|
2843
2870
|
var _rule$formula2;
|
|
2844
|
-
return this.localeService.t("
|
|
2871
|
+
return this.localeService.t("sheets-data-validation.custom.ruleName").replace("{FORMULA1}", (_rule$formula2 = rule.formula1) !== null && _rule$formula2 !== void 0 ? _rule$formula2 : "");
|
|
2845
2872
|
}
|
|
2846
2873
|
};
|
|
2847
2874
|
|
|
@@ -2866,7 +2893,7 @@ var ListMultipleValidator = class extends ListValidator {
|
|
|
2866
2893
|
constructor(..._args) {
|
|
2867
2894
|
super(..._args);
|
|
2868
2895
|
_defineProperty(this, "id", DataValidationType.LIST_MULTIPLE);
|
|
2869
|
-
_defineProperty(this, "title", "
|
|
2896
|
+
_defineProperty(this, "title", "sheets-data-validation.listMultiple.title");
|
|
2870
2897
|
_defineProperty(this, "offsetFormulaByRange", false);
|
|
2871
2898
|
_defineProperty(this, "skipDefaultFontRender", () => {
|
|
2872
2899
|
return true;
|
|
@@ -2876,13 +2903,13 @@ var ListMultipleValidator = class extends ListValidator {
|
|
|
2876
2903
|
|
|
2877
2904
|
//#endregion
|
|
2878
2905
|
//#region src/validators/whole-validator.ts
|
|
2879
|
-
var WholeValidator = class extends
|
|
2906
|
+
var WholeValidator = class extends BaseSheetValidator {
|
|
2880
2907
|
constructor(..._args) {
|
|
2881
2908
|
super(..._args);
|
|
2882
2909
|
_defineProperty(this, "_customFormulaService", this.injector.get(DataValidationCustomFormulaService));
|
|
2883
2910
|
_defineProperty(this, "_lexerTreeBuilder", this.injector.get(LexerTreeBuilder));
|
|
2884
2911
|
_defineProperty(this, "id", DataValidationType.WHOLE);
|
|
2885
|
-
_defineProperty(this, "title", "
|
|
2912
|
+
_defineProperty(this, "title", "sheets-data-validation.whole.title");
|
|
2886
2913
|
_defineProperty(this, "order", 10);
|
|
2887
2914
|
_defineProperty(this, "operators", [
|
|
2888
2915
|
DataValidationOperator.BETWEEN,
|
|
@@ -2934,7 +2961,7 @@ var WholeValidator = class extends BaseDataValidator {
|
|
|
2934
2961
|
const formula1Success = Tools.isDefine(rule.formula1) && this._isFormulaOrInt(rule.formula1);
|
|
2935
2962
|
const formula2Success = Tools.isDefine(rule.formula2) && this._isFormulaOrInt(rule.formula2);
|
|
2936
2963
|
const isTwoFormula = TWO_FORMULA_OPERATOR_COUNT.includes(operator);
|
|
2937
|
-
const errorMsg = this.localeService.t("
|
|
2964
|
+
const errorMsg = this.localeService.t("sheets-data-validation.validFail.number");
|
|
2938
2965
|
if (isTwoFormula) return {
|
|
2939
2966
|
success: formula1Success && formula2Success,
|
|
2940
2967
|
formula1: formula1Success ? void 0 : errorMsg,
|
|
@@ -3267,10 +3294,10 @@ function createDefaultNewRule(accessor) {
|
|
|
3267
3294
|
|
|
3268
3295
|
//#endregion
|
|
3269
3296
|
//#region src/index.ts
|
|
3270
|
-
const CUSTOM_FORMULA_INPUT_NAME = "data-validation.custom-formula-input";
|
|
3271
|
-
const BASE_FORMULA_INPUT_NAME = "data-validation.formula-input";
|
|
3272
|
-
const LIST_FORMULA_INPUT_NAME = "data-validation.list-formula-input";
|
|
3273
|
-
const CHECKBOX_FORMULA_INPUT_NAME = "data-validation.checkbox-formula-input";
|
|
3297
|
+
const CUSTOM_FORMULA_INPUT_NAME = "sheets-data-validation.custom-formula-input";
|
|
3298
|
+
const BASE_FORMULA_INPUT_NAME = "sheets-data-validation.formula-input";
|
|
3299
|
+
const LIST_FORMULA_INPUT_NAME = "sheets-data-validation.list-formula-input";
|
|
3300
|
+
const CHECKBOX_FORMULA_INPUT_NAME = "sheets-data-validation.checkbox-formula-input";
|
|
3274
3301
|
|
|
3275
3302
|
//#endregion
|
|
3276
|
-
export { AddSheetDataValidationCommand, BASE_FORMULA_INPUT_NAME, CHECKBOX_FORMULA_1, CHECKBOX_FORMULA_2, CHECKBOX_FORMULA_INPUT_NAME, CUSTOM_FORMULA_INPUT_NAME, CheckboxValidator, ClearRangeDataValidationCommand, DATA_VALIDATION_PLUGIN_NAME, DataValidationCacheService, DataValidationCustomFormulaService, DataValidationFormulaController, DataValidationFormulaService, DataValidationListCacheService, DateValidator, LIST_FORMULA_INPUT_NAME, ListMultipleValidator, ListValidator, RemoveSheetAllDataValidationCommand, RemoveSheetDataValidationCommand, SheetDataValidationModel, SheetsDataValidationValidatorService, UniverSheetsDataValidationPlugin, UpdateSheetDataValidationOptionsCommand, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand, createDefaultNewRule,
|
|
3303
|
+
export { AddSheetDataValidationCommand, BASE_FORMULA_INPUT_NAME, CHECKBOX_FORMULA_1, CHECKBOX_FORMULA_2, CHECKBOX_FORMULA_INPUT_NAME, CUSTOM_FORMULA_INPUT_NAME, CheckboxValidator, ClearRangeDataValidationCommand, DATA_VALIDATION_PLUGIN_NAME, DataValidationCacheService, DataValidationCustomFormulaService, DataValidationFormulaController, DataValidationFormulaService, DataValidationListCacheService, DateValidator, LIST_FORMULA_INPUT_NAME, ListMultipleValidator, ListValidator, RemoveSheetAllDataValidationCommand, RemoveSheetDataValidationCommand, SheetDataValidationModel, SheetsDataValidationValidatorService, UniverSheetsDataValidationPlugin, UpdateSheetDataValidationOptionsCommand, UpdateSheetDataValidationRangeCommand, UpdateSheetDataValidationSettingCommand, createDefaultNewRule, getCellValueNumber, getCellValueOrigin, getDataValidationCellValue, getDataValidationDiffMutations, getFormulaCellData, getFormulaResult, getTransformedFormula, isLegalFormulaResult, transformCheckboxValue };
|