@univerjs/sheets-data-validation 1.0.0-alpha.8 → 1.0.0-beta.1

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 (86) hide show
  1. package/lib/cjs/facade.js +3 -3
  2. package/lib/cjs/index.js +33 -51
  3. package/lib/cjs/locale/ar-SA.js +5 -25
  4. package/lib/cjs/locale/ca-ES.js +5 -25
  5. package/lib/cjs/locale/de-DE.js +5 -25
  6. package/lib/cjs/locale/en-US.js +5 -25
  7. package/lib/cjs/locale/es-ES.js +5 -25
  8. package/lib/cjs/locale/fa-IR.js +5 -25
  9. package/lib/cjs/locale/fr-FR.js +5 -25
  10. package/lib/cjs/locale/id-ID.js +5 -25
  11. package/lib/cjs/locale/it-IT.js +5 -25
  12. package/lib/cjs/locale/ja-JP.js +5 -25
  13. package/lib/cjs/locale/ko-KR.js +5 -25
  14. package/lib/cjs/locale/pl-PL.js +5 -25
  15. package/lib/cjs/locale/pt-BR.js +5 -25
  16. package/lib/cjs/locale/ru-RU.js +5 -25
  17. package/lib/cjs/locale/sk-SK.js +5 -25
  18. package/lib/cjs/locale/vi-VN.js +5 -25
  19. package/lib/cjs/locale/zh-CN.js +5 -25
  20. package/lib/cjs/locale/zh-HK.js +5 -25
  21. package/lib/cjs/locale/zh-TW.js +5 -25
  22. package/lib/es/facade.js +3 -3
  23. package/lib/es/index.js +33 -51
  24. package/lib/es/locale/ar-SA.js +5 -25
  25. package/lib/es/locale/ca-ES.js +5 -25
  26. package/lib/es/locale/de-DE.js +5 -25
  27. package/lib/es/locale/en-US.js +5 -25
  28. package/lib/es/locale/es-ES.js +5 -25
  29. package/lib/es/locale/fa-IR.js +5 -25
  30. package/lib/es/locale/fr-FR.js +5 -25
  31. package/lib/es/locale/id-ID.js +5 -25
  32. package/lib/es/locale/it-IT.js +5 -25
  33. package/lib/es/locale/ja-JP.js +5 -25
  34. package/lib/es/locale/ko-KR.js +5 -25
  35. package/lib/es/locale/pl-PL.js +5 -25
  36. package/lib/es/locale/pt-BR.js +5 -25
  37. package/lib/es/locale/ru-RU.js +5 -25
  38. package/lib/es/locale/sk-SK.js +5 -25
  39. package/lib/es/locale/vi-VN.js +5 -25
  40. package/lib/es/locale/zh-CN.js +5 -25
  41. package/lib/es/locale/zh-HK.js +5 -25
  42. package/lib/es/locale/zh-TW.js +5 -25
  43. package/lib/facade.js +3 -3
  44. package/lib/index.js +33 -51
  45. package/lib/locale/ar-SA.js +5 -25
  46. package/lib/locale/ca-ES.js +5 -25
  47. package/lib/locale/de-DE.js +5 -25
  48. package/lib/locale/en-US.js +5 -25
  49. package/lib/locale/es-ES.js +5 -25
  50. package/lib/locale/fa-IR.js +5 -25
  51. package/lib/locale/fr-FR.js +5 -25
  52. package/lib/locale/id-ID.js +5 -25
  53. package/lib/locale/it-IT.js +5 -25
  54. package/lib/locale/ja-JP.js +5 -25
  55. package/lib/locale/ko-KR.js +5 -25
  56. package/lib/locale/pl-PL.js +5 -25
  57. package/lib/locale/pt-BR.js +5 -25
  58. package/lib/locale/ru-RU.js +5 -25
  59. package/lib/locale/sk-SK.js +5 -25
  60. package/lib/locale/vi-VN.js +5 -25
  61. package/lib/locale/zh-CN.js +5 -25
  62. package/lib/locale/zh-HK.js +5 -25
  63. package/lib/locale/zh-TW.js +5 -25
  64. package/lib/types/locale/en-US.d.ts +0 -18
  65. package/lib/umd/facade.js +1 -1
  66. package/lib/umd/index.js +1 -1
  67. package/lib/umd/locale/ar-SA.js +1 -1
  68. package/lib/umd/locale/ca-ES.js +1 -1
  69. package/lib/umd/locale/de-DE.js +1 -1
  70. package/lib/umd/locale/en-US.js +1 -1
  71. package/lib/umd/locale/es-ES.js +1 -1
  72. package/lib/umd/locale/fa-IR.js +1 -1
  73. package/lib/umd/locale/fr-FR.js +1 -1
  74. package/lib/umd/locale/id-ID.js +1 -1
  75. package/lib/umd/locale/it-IT.js +1 -1
  76. package/lib/umd/locale/ja-JP.js +1 -1
  77. package/lib/umd/locale/ko-KR.js +1 -1
  78. package/lib/umd/locale/pl-PL.js +1 -1
  79. package/lib/umd/locale/pt-BR.js +1 -1
  80. package/lib/umd/locale/ru-RU.js +1 -1
  81. package/lib/umd/locale/sk-SK.js +1 -1
  82. package/lib/umd/locale/vi-VN.js +1 -1
  83. package/lib/umd/locale/zh-CN.js +1 -1
  84. package/lib/umd/locale/zh-HK.js +1 -1
  85. package/lib/umd/locale/zh-TW.js +1 -1
  86. package/package.json +8 -8
package/lib/index.js CHANGED
@@ -186,9 +186,8 @@ function isLegalFormulaResult(res) {
186
186
  * Judge if the data-validation's formula need to be offseted by ranges
187
187
  */
188
188
  function shouldOffsetFormulaByRange(type, validatorRegistryService) {
189
- var _validator$offsetForm;
190
189
  const validator = validatorRegistryService.getValidatorItem(type);
191
- return (_validator$offsetForm = validator === null || validator === void 0 ? void 0 : validator.offsetFormulaByRange) !== null && _validator$offsetForm !== void 0 ? _validator$offsetForm : false;
190
+ return (validator === null || validator === void 0 ? void 0 : validator.offsetFormulaByRange) ?? false;
192
191
  }
193
192
 
194
193
  //#endregion
@@ -384,8 +383,7 @@ function getCellValueOrigin(cell) {
384
383
  return getOriginCellValue(cell);
385
384
  }
386
385
  function getStringCellValue(cell) {
387
- var _getCellValueOrigin;
388
- return String((_getCellValueOrigin = getCellValueOrigin(cell)) !== null && _getCellValueOrigin !== void 0 ? _getCellValueOrigin : "");
386
+ return String(getCellValueOrigin(cell) ?? "");
389
387
  }
390
388
 
391
389
  //#endregion
@@ -714,8 +712,7 @@ var RuleMatrix = class RuleMatrix {
714
712
  const mutations = [];
715
713
  let deleteIndex = 0;
716
714
  rules.forEach((rule, index) => {
717
- var _this$_map$get;
718
- const newRanges = (_this$_map$get = this._map.get(rule.uid)) !== null && _this$_map$get !== void 0 ? _this$_map$get : [];
715
+ const newRanges = this._map.get(rule.uid) ?? [];
719
716
  const oldRanges = rule.ranges;
720
717
  if (newRanges.length !== 0 && (newRanges.length !== oldRanges.length || newRanges.some((range, i) => !Rectangle.equals(range, oldRanges[i])))) mutations.push({
721
718
  type: "update",
@@ -739,8 +736,7 @@ var RuleMatrix = class RuleMatrix {
739
736
  const mutations = [];
740
737
  let deleteIndex = 0;
741
738
  rules.forEach((rule, index) => {
742
- var _this$_map$get2;
743
- const newRanges = (_this$_map$get2 = this._map.get(rule.uid)) !== null && _this$_map$get2 !== void 0 ? _this$_map$get2 : [];
739
+ const newRanges = this._map.get(rule.uid) ?? [];
744
740
  const oldRanges = rule.ranges;
745
741
  if (newRanges.length !== 0 && (newRanges.length !== oldRanges.length || newRanges.some((range, i) => !Rectangle.equals(range, oldRanges[i])))) mutations.push({
746
742
  type: "update",
@@ -759,8 +755,7 @@ var RuleMatrix = class RuleMatrix {
759
755
  }
760
756
  });
761
757
  Array.from(additionRules).forEach((rule) => {
762
- var _this$_map$get3;
763
- const newRanges = (_this$_map$get3 = this._map.get(rule.uid)) !== null && _this$_map$get3 !== void 0 ? _this$_map$get3 : [];
758
+ const newRanges = this._map.get(rule.uid) ?? [];
764
759
  mutations.push({
765
760
  type: "add",
766
761
  rule: {
@@ -945,8 +940,8 @@ let SheetDataValidationModel = class SheetDataValidationModel extends Disposable
945
940
  });
946
941
  return DataValidationStatus.VALIDATING;
947
942
  }
948
- onCompete(current !== null && current !== void 0 ? current : DataValidationStatus.VALID, false);
949
- return current !== null && current !== void 0 ? current : DataValidationStatus.VALID;
943
+ onCompete(current ?? DataValidationStatus.VALID, false);
944
+ return current ?? DataValidationStatus.VALID;
950
945
  } else {
951
946
  onCompete(DataValidationStatus.VALID, false);
952
947
  return DataValidationStatus.VALID;
@@ -1057,15 +1052,13 @@ var BaseSheetValidator = class extends BaseDataValidator {
1057
1052
  return this.operators.map((operator) => this.localeService.t(OperatorTextMap[operator]));
1058
1053
  }
1059
1054
  generateRuleName(rule) {
1060
- var _rule$formula, _rule$formula2;
1061
1055
  if (!rule.operator) return this.localeService.t(OperatorTitleMap.NONE).replace(TYPE, this.titleStr);
1062
- 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 : "");
1056
+ const ruleName = this.localeService.t(OperatorTitleMap[rule.operator]).replace(FORMULA1$1, rule.formula1 ?? "").replace(FORMULA2$1, rule.formula2 ?? "");
1063
1057
  return `${this.titleStr} ${ruleName}`;
1064
1058
  }
1065
1059
  generateRuleErrorMessage(rule, _position) {
1066
- var _rule$formula3, _rule$formula4;
1067
1060
  if (!rule.operator) return this.localeService.t(OperatorErrorTitleMap.NONE).replace(TYPE, this.titleStr);
1068
- 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 : "")}`;
1061
+ return `${this.localeService.t(OperatorErrorTitleMap[rule.operator]).replace(FORMULA1$1, rule.formula1 ?? "").replace(FORMULA2$1, rule.formula2 ?? "")}`;
1069
1062
  }
1070
1063
  };
1071
1064
 
@@ -1092,7 +1085,7 @@ var CheckboxValidator = class extends BaseSheetValidator {
1092
1085
  _defineProperty(this, "skipDefaultFontRender", (rule, cellValue, pos) => {
1093
1086
  const { unitId, subUnitId } = pos;
1094
1087
  const { formula1, formula2 } = this.parseFormulaSync(rule, unitId, subUnitId);
1095
- const valueStr = `${cellValue !== null && cellValue !== void 0 ? cellValue : ""}`;
1088
+ const valueStr = `${cellValue ?? ""}`;
1096
1089
  return !valueStr || valueStr === `${formula1}` || valueStr === `${formula2}`;
1097
1090
  });
1098
1091
  }
@@ -1150,7 +1143,7 @@ var CheckboxValidator = class extends BaseSheetValidator {
1150
1143
  const { value, unitId, subUnitId } = cellInfo;
1151
1144
  const { formula1, formula2, originFormula1, originFormula2 } = await this.parseFormula(rule, unitId, subUnitId);
1152
1145
  if (!Tools.isDefine(formula1) || !Tools.isDefine(formula2)) return true;
1153
- 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 : ""));
1146
+ return Tools.isDefine(value) && (String(value) === String(formula1) || String(value) === String(formula2) || String(value) === String(originFormula1 ?? "") || String(value) === String(originFormula2 ?? ""));
1154
1147
  }
1155
1148
  generateRuleErrorMessage(rule) {
1156
1149
  return this.localeService.t("sheets-data-validation.checkbox.error");
@@ -1376,15 +1369,14 @@ var DateValidator = class extends BaseSheetValidator {
1376
1369
  return this.operators.map((operator) => this.localeService.t(DateOperatorNameMap[operator]));
1377
1370
  }
1378
1371
  generateRuleName(rule) {
1379
- var _rule$formula, _rule$formula2;
1380
1372
  if (!rule.operator) return this.localeService.t(DateOperatorTitleMap.NONE);
1381
- const ruleName = this.localeService.t(DateOperatorTitleMap[rule.operator]).replace(FORMULA1, (_rule$formula = rule.formula1) !== null && _rule$formula !== void 0 ? _rule$formula : "").replace(FORMULA2, (_rule$formula2 = rule.formula2) !== null && _rule$formula2 !== void 0 ? _rule$formula2 : "");
1373
+ const ruleName = this.localeService.t(DateOperatorTitleMap[rule.operator]).replace(FORMULA1, rule.formula1 ?? "").replace(FORMULA2, rule.formula2 ?? "");
1382
1374
  return `${this.titleStr} ${ruleName}`;
1383
1375
  }
1384
1376
  generateRuleErrorMessage(rule, pos) {
1385
1377
  if (!rule.operator) return this.titleStr;
1386
1378
  const { transformedFormula1, transformedFormula2 } = getTransformedFormula(this._lexerTreeBuilder, rule, pos);
1387
- return `${this.localeService.t(DateOperatorErrorTitleMap[rule.operator]).replace(FORMULA1, transformedFormula1 !== null && transformedFormula1 !== void 0 ? transformedFormula1 : "").replace(FORMULA2, transformedFormula2 !== null && transformedFormula2 !== void 0 ? transformedFormula2 : "")}`;
1379
+ return `${this.localeService.t(DateOperatorErrorTitleMap[rule.operator]).replace(FORMULA1, transformedFormula1 ?? "").replace(FORMULA2, transformedFormula2 ?? "")}`;
1388
1380
  }
1389
1381
  };
1390
1382
 
@@ -1462,7 +1454,7 @@ var DecimalValidator = class extends BaseSheetValidator {
1462
1454
  generateRuleErrorMessage(rule, position) {
1463
1455
  if (!rule.operator) return this.localeService.t(OperatorErrorTitleMap.NONE).replace("{TYPE}", this.titleStr);
1464
1456
  const { transformedFormula1, transformedFormula2 } = getTransformedFormula(this._lexerTreeBuilder, rule, position);
1465
- return `${this.localeService.t(OperatorErrorTitleMap[rule.operator]).replace(FORMULA1, transformedFormula1 !== null && transformedFormula1 !== void 0 ? transformedFormula1 : "").replace(FORMULA2, transformedFormula2 !== null && transformedFormula2 !== void 0 ? transformedFormula2 : "")}`;
1457
+ return `${this.localeService.t(OperatorErrorTitleMap[rule.operator]).replace(FORMULA1, transformedFormula1 ?? "").replace(FORMULA2, transformedFormula2 ?? "")}`;
1466
1458
  }
1467
1459
  };
1468
1460
 
@@ -1528,21 +1520,19 @@ var ListValidator = class extends BaseSheetValidator {
1528
1520
  });
1529
1521
  }
1530
1522
  validatorFormula(rule, unitId, subUnitId) {
1531
- var _rule$formula, _this$_univerInstance;
1523
+ var _this$_univerInstance;
1532
1524
  const success = !Tools.isBlank(rule.formula1);
1533
- const valid = isValidListFormula((_rule$formula = rule.formula1) !== null && _rule$formula !== void 0 ? _rule$formula : "", this._lexer);
1534
- const sheetName = (_this$_univerInstance = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 || (_this$_univerInstance = _this$_univerInstance.getSheetBySheetId(subUnitId)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getName();
1535
- const isIntersects = isRuleIntersects(rule, sheetName !== null && sheetName !== void 0 ? sheetName : "");
1525
+ const valid = isValidListFormula(rule.formula1 ?? "", this._lexer);
1526
+ const isIntersects = isRuleIntersects(rule, ((_this$_univerInstance = this._univerInstanceService.getUnit(unitId, UniverInstanceType.UNIVER_SHEET)) === null || _this$_univerInstance === void 0 || (_this$_univerInstance = _this$_univerInstance.getSheetBySheetId(subUnitId)) === null || _this$_univerInstance === void 0 ? void 0 : _this$_univerInstance.getName()) ?? "");
1536
1527
  return {
1537
1528
  success: Boolean(success && valid && !isIntersects),
1538
1529
  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")
1539
1530
  };
1540
1531
  }
1541
1532
  getExtraStyle(rule, value, { style: defaultStyle }) {
1542
- var _ref;
1543
- const tb = (_ref = defaultStyle.tb !== WrapStrategy.OVERFLOW ? defaultStyle.tb : WrapStrategy.CLIP) !== null && _ref !== void 0 ? _ref : WrapStrategy.WRAP;
1533
+ const tb = (defaultStyle.tb !== WrapStrategy.OVERFLOW ? defaultStyle.tb : WrapStrategy.CLIP) ?? WrapStrategy.WRAP;
1544
1534
  if (rule.type === DataValidationType.LIST && (rule.renderMode === DataValidationRenderMode.ARROW || rule.renderMode === DataValidationRenderMode.TEXT)) {
1545
- const color = this.getListWithColorMap(rule)[`${value !== null && value !== void 0 ? value : ""}`];
1535
+ const color = this.getListWithColorMap(rule)[`${value ?? ""}`];
1546
1536
  if (color) return {
1547
1537
  bg: { rgb: color },
1548
1538
  tb
@@ -1576,10 +1566,9 @@ var ListValidator = class extends BaseSheetValidator {
1576
1566
  return this.localeService.t("sheets-data-validation.list.error");
1577
1567
  }
1578
1568
  _getUnitAndSubUnit(currentUnitId, currentSubUnitId) {
1579
- var _ref2, _ref3;
1580
- const workbook = (_ref2 = currentUnitId ? this._univerInstanceService.getUnit(currentUnitId, UniverInstanceType.UNIVER_SHEET) : void 0) !== null && _ref2 !== void 0 ? _ref2 : this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
1569
+ const workbook = (currentUnitId ? this._univerInstanceService.getUnit(currentUnitId, UniverInstanceType.UNIVER_SHEET) : void 0) ?? this._univerInstanceService.getCurrentUnitOfType(UniverInstanceType.UNIVER_SHEET);
1581
1570
  if (!workbook) return null;
1582
- const worksheet = (_ref3 = currentSubUnitId ? workbook.getSheetBySheetId(currentSubUnitId) : void 0) !== null && _ref3 !== void 0 ? _ref3 : workbook.getActiveSheet();
1571
+ const worksheet = (currentSubUnitId ? workbook.getSheetBySheetId(currentSubUnitId) : void 0) ?? workbook.getActiveSheet();
1583
1572
  if (!worksheet) return null;
1584
1573
  return {
1585
1574
  unitId: workbook.getUnitId(),
@@ -1685,17 +1674,17 @@ var TextLengthValidator = class extends BaseSheetValidator {
1685
1674
  generateRuleErrorMessage(rule, pos) {
1686
1675
  if (!rule.operator) return this.titleStr;
1687
1676
  const { transformedFormula1, transformedFormula2 } = getTransformedFormula(this._lexerTreeBuilder, rule, pos);
1688
- return `${this.localeService.t(TextLengthErrorTitleMap[rule.operator]).replace(FORMULA1, transformedFormula1 !== null && transformedFormula1 !== void 0 ? transformedFormula1 : "").replace(FORMULA2, transformedFormula2 !== null && transformedFormula2 !== void 0 ? transformedFormula2 : "")}`;
1677
+ return `${this.localeService.t(TextLengthErrorTitleMap[rule.operator]).replace(FORMULA1, transformedFormula1 ?? "").replace(FORMULA2, transformedFormula2 ?? "")}`;
1689
1678
  }
1690
1679
  };
1691
1680
 
1692
1681
  //#endregion
1693
1682
  //#region src/commands/commands/data-validation.command.ts
1694
1683
  function isBlankCell(cellData) {
1695
- var _cellData$p$body$data, _cellData$p$body;
1684
+ var _cellData$p$body;
1696
1685
  if (!cellData) return true;
1697
1686
  if (!cellData.p) return Tools.isBlank(cellData.v);
1698
- return !((_cellData$p$body$data = (_cellData$p$body = cellData.p.body) === null || _cellData$p$body === void 0 ? void 0 : _cellData$p$body.dataStream) !== null && _cellData$p$body$data !== void 0 ? _cellData$p$body$data : "").slice(0, -2).trim();
1687
+ return !(((_cellData$p$body = cellData.p.body) === null || _cellData$p$body === void 0 ? void 0 : _cellData$p$body.dataStream) ?? "").slice(0, -2).trim();
1699
1688
  }
1700
1689
  function getDataValidationDiffMutations(unitId, subUnitId, diffs, accessor, source = "command", fillDefaultValue = true) {
1701
1690
  const lexerTreeBuilder = accessor.get(LexerTreeBuilder);
@@ -2310,7 +2299,7 @@ DataValidationFormulaController = __decorate([
2310
2299
  //#endregion
2311
2300
  //#region package.json
2312
2301
  var name = "@univerjs/sheets-data-validation";
2313
- var version = "1.0.0-alpha.8";
2302
+ var version = "1.0.0-beta.1";
2314
2303
 
2315
2304
  //#endregion
2316
2305
  //#region src/config/config.ts
@@ -2355,7 +2344,7 @@ let DataValidationFormulaRefRangeController = class DataValidationFormulaRefRang
2355
2344
  const oldRanges = rule.ranges;
2356
2345
  const oldFormula1 = rule.formula1;
2357
2346
  const oldFormula2 = rule.formula2;
2358
- const disposable = this._formulaRefRangeService.registerRangeFormula(unitId, subUnitId, oldRanges, [oldFormula1 !== null && oldFormula1 !== void 0 ? oldFormula1 : "", oldFormula2 !== null && oldFormula2 !== void 0 ? oldFormula2 : ""], (res) => {
2347
+ const disposable = this._formulaRefRangeService.registerRangeFormula(unitId, subUnitId, oldRanges, [oldFormula1 ?? "", oldFormula2 ?? ""], (res) => {
2359
2348
  if (res.length === 0) return {
2360
2349
  undos: [{
2361
2350
  id: AddDataValidationMutation.id,
@@ -2511,10 +2500,9 @@ let DataValidationRefRangeController = class DataValidationRefRangeController ex
2511
2500
  return `${unitID}_${subUnitId}_${ruleId}`;
2512
2501
  }
2513
2502
  registerFormula(unitId, subUnitId, rule) {
2514
- var _this$_disposableMap$;
2515
2503
  const ruleId = rule.uid;
2516
2504
  const id = this._getIdWithUnitId(unitId, subUnitId, ruleId);
2517
- const disposeSet = (_this$_disposableMap$ = this._disposableMap.get(id)) !== null && _this$_disposableMap$ !== void 0 ? _this$_disposableMap$ : /* @__PURE__ */ new Set();
2505
+ const disposeSet = this._disposableMap.get(id) ?? /* @__PURE__ */ new Set();
2518
2506
  const handleFormulaChange = (type, formulaString) => {
2519
2507
  const oldRule = this._dataValidationModel.getRuleById(unitId, subUnitId, ruleId);
2520
2508
  if (!oldRule) return {
@@ -2580,7 +2568,6 @@ let DataValidationRefRangeController = class DataValidationRefRangeController ex
2580
2568
  }
2581
2569
  }
2582
2570
  register(unitId, subUnitId, rule) {
2583
- var _this$_disposableMap$2;
2584
2571
  const handleRangeChange = (commandInfo) => {
2585
2572
  const oldRanges = [...rule.ranges];
2586
2573
  const resultRanges = oldRanges.map((range) => {
@@ -2641,7 +2628,7 @@ let DataValidationRefRangeController = class DataValidationRefRangeController ex
2641
2628
  disposeList.push(() => disposable.dispose());
2642
2629
  });
2643
2630
  const id = this._getIdWithUnitId(unitId, subUnitId, rule.uid);
2644
- const current = (_this$_disposableMap$2 = this._disposableMap.get(id)) !== null && _this$_disposableMap$2 !== void 0 ? _this$_disposableMap$2 : /* @__PURE__ */ new Set();
2631
+ const current = this._disposableMap.get(id) ?? /* @__PURE__ */ new Set();
2645
2632
  current.add(() => disposeList.forEach((dispose) => dispose()));
2646
2633
  this._disposableMap.set(id, current);
2647
2634
  }
@@ -2835,9 +2822,8 @@ var CustomFormulaValidator = class extends BaseSheetValidator {
2835
2822
  _defineProperty(this, "_lexerTreeBuilder", this.injector.get(LexerTreeBuilder));
2836
2823
  }
2837
2824
  validatorFormula(rule, unitId, subUnitId) {
2838
- var _rule$formula;
2839
2825
  const success = isFormulaString(rule.formula1);
2840
- const formulaText = (_rule$formula = rule.formula1) !== null && _rule$formula !== void 0 ? _rule$formula : "";
2826
+ const formulaText = rule.formula1 ?? "";
2841
2827
  const valid = this._lexerTreeBuilder.checkIfAddBracket(formulaText) === 0 && formulaText.startsWith(operatorToken.EQUALS);
2842
2828
  return {
2843
2829
  success: success && valid,
@@ -2869,8 +2855,7 @@ var CustomFormulaValidator = class extends BaseSheetValidator {
2869
2855
  return this.localeService.t("sheets-data-validation.custom.error");
2870
2856
  }
2871
2857
  generateRuleName(rule) {
2872
- var _rule$formula2;
2873
- return this.localeService.t("sheets-data-validation.custom.ruleName").replace("{FORMULA1}", (_rule$formula2 = rule.formula1) !== null && _rule$formula2 !== void 0 ? _rule$formula2 : "");
2858
+ return this.localeService.t("sheets-data-validation.custom.ruleName").replace("{FORMULA1}", rule.formula1 ?? "");
2874
2859
  }
2875
2860
  };
2876
2861
 
@@ -2977,7 +2962,7 @@ var WholeValidator = class extends BaseSheetValidator {
2977
2962
  generateRuleErrorMessage(rule, position) {
2978
2963
  if (!rule.operator) return this.localeService.t(OperatorErrorTitleMap.NONE).replace("{TYPE}", this.titleStr);
2979
2964
  const { transformedFormula1, transformedFormula2 } = getTransformedFormula(this._lexerTreeBuilder, rule, position);
2980
- return `${this.localeService.t(OperatorErrorTitleMap[rule.operator]).replace(FORMULA1, transformedFormula1 !== null && transformedFormula1 !== void 0 ? transformedFormula1 : "").replace(FORMULA2, transformedFormula2 !== null && transformedFormula2 !== void 0 ? transformedFormula2 : "")}`;
2965
+ return `${this.localeService.t(OperatorErrorTitleMap[rule.operator]).replace(FORMULA1, transformedFormula1 ?? "").replace(FORMULA2, transformedFormula2 ?? "")}`;
2981
2966
  }
2982
2967
  };
2983
2968
 
@@ -3153,10 +3138,7 @@ let SheetsDataValidationValidatorService = class SheetsDataValidationValidatorSe
3153
3138
  * Because during the validation process, merged cells are all marked as VALIDATING status in cache.
3154
3139
  */
3155
3140
  if (mergeCells.length) mergeCells.forEach(({ resultRowIndex, resultColIndex, row, col }) => {
3156
- if (result[resultRowIndex][resultColIndex] === DataValidationStatus.VALIDATING) {
3157
- var _this$_dataValidation;
3158
- result[resultRowIndex][resultColIndex] = (_this$_dataValidation = this._dataValidationCacheService.getValue(unitId, subUnitId, row, col)) !== null && _this$_dataValidation !== void 0 ? _this$_dataValidation : DataValidationStatus.VALID;
3159
- }
3141
+ if (result[resultRowIndex][resultColIndex] === DataValidationStatus.VALIDATING) result[resultRowIndex][resultColIndex] = this._dataValidationCacheService.getValue(unitId, subUnitId, row, col) ?? DataValidationStatus.VALID;
3160
3142
  });
3161
3143
  return result;
3162
3144
  }
@@ -3285,7 +3267,7 @@ function createDefaultNewRule(accessor) {
3285
3267
  type: DataValidationType.DECIMAL,
3286
3268
  operator: DataValidationOperator.EQUAL,
3287
3269
  formula1: "100",
3288
- ranges: currentRanges !== null && currentRanges !== void 0 ? currentRanges : [{
3270
+ ranges: currentRanges ?? [{
3289
3271
  startColumn: 0,
3290
3272
  endColumn: 0,
3291
3273
  startRow: 0,
@@ -8,8 +8,7 @@ const locale = { "sheets-data-validation": {
8
8
  lessThanOrEqual: "أقل من أو يساوي",
9
9
  equal: "يساوي",
10
10
  notEqual: "لا يساوي",
11
- notBetween: "ليس بين",
12
- legal: "نوع قانوني"
11
+ notBetween: "ليس بين"
13
12
  },
14
13
  ruleName: {
15
14
  between: "بين {FORMULA1} و{FORMULA2}",
@@ -42,8 +41,7 @@ const locale = { "sheets-data-validation": {
42
41
  lessThanOrEqual: "في أو قبل",
43
42
  equal: "يساوي",
44
43
  notEqual: "لا يساوي",
45
- notBetween: "ليس بين",
46
- legal: "تاريخ قانوني"
44
+ notBetween: "ليس بين"
47
45
  },
48
46
  ruleName: {
49
47
  between: "بين {FORMULA1} و{FORMULA2}",
@@ -85,20 +83,16 @@ const locale = { "sheets-data-validation": {
85
83
  custom: {
86
84
  ruleName: "الصيغة المخصصة هي {FORMULA1}",
87
85
  title: "صيغة مخصصة",
88
- validFail: "يرجى إدخال صيغة صالحة",
89
86
  error: "محتويات هذه الخلية تنتهك قاعدة التحقق"
90
87
  },
91
88
  validFail: {
92
89
  value: "يرجى إدخال قيمة",
93
- common: "يرجى إدخال قيمة أو صيغة",
94
90
  number: "يرجى إدخال رقم أو صيغة",
95
91
  formula: "يرجى إدخال صيغة",
96
- integer: "يرجى إدخال عدد صحيح أو صيغة",
97
92
  date: "يرجى إدخال تاريخ أو صيغة",
98
93
  list: "يرجى إدخال خيارات",
99
94
  listInvalid: "يجب أن يكون مصدر القائمة قائمة محددة بفواصل أو مرجعًا لصف أو عمود واحد",
100
95
  checkboxEqual: "أدخل قيمًا مختلفة لمحتويات الخلية المحددة وغير المحددة.",
101
- formulaError: "يحتوي نطاق المرجع على بيانات غير مرئية، يرجى إعادة ضبط النطاق",
102
96
  listIntersects: "لا يمكن أن يتقاطع النطاق المحدد مع نطاق القواعد",
103
97
  primitive: "غير مسموح بالصيغ لقيم المحدد وغير المحدد المخصصة."
104
98
  },
@@ -109,28 +103,14 @@ const locale = { "sheets-data-validation": {
109
103
  list: {
110
104
  title: "قائمة منسدلة",
111
105
  name: "القيمة تحتوي على واحدة من النطاق",
112
- error: "يجب أن يكون الإدخال ضمن النطاق المحدد",
113
- emptyError: "يرجى إدخال قيمة",
114
- add: "إضافة",
115
- dropdown: "تحديد",
116
- options: "خيارات",
117
- customOptions: "مخصص",
118
- refOptions: "من نطاق",
119
- formulaError: "يجب أن يكون مصدر القائمة قائمة بيانات محددة بفواصل، أو مرجعًا لصف أو عمود واحد.",
120
- edit: "تحرير"
121
- },
122
- listMultiple: {
123
- title: "قائمة منسدلة - متعددة",
124
- dropdown: "تحديد متعدد"
106
+ error: "يجب أن يكون الإدخال ضمن النطاق المحدد"
125
107
  },
108
+ listMultiple: { title: "قائمة منسدلة - متعددة" },
126
109
  decimal: { title: "رقم" },
127
110
  whole: { title: "عدد صحيح" },
128
111
  checkbox: {
129
112
  title: "خانة اختيار",
130
- error: "محتويات هذه الخلية تنتهك قاعدة التحقق",
131
- tips: "استخدم قيمًا مخصصة داخل الخلايا",
132
- checked: "القيمة المحددة",
133
- unchecked: "القيمة غير المحددة"
113
+ error: "محتويات هذه الخلية تنتهك قاعدة التحقق"
134
114
  }
135
115
  } };
136
116
 
@@ -8,8 +8,7 @@ const locale = { "sheets-data-validation": {
8
8
  lessThanOrEqual: "menys o igual que",
9
9
  equal: "igual",
10
10
  notEqual: "no igual",
11
- notBetween: "no entre",
12
- legal: "és tipus legal"
11
+ notBetween: "no entre"
13
12
  },
14
13
  ruleName: {
15
14
  between: "Està entre {FORMULA1} i {FORMULA2}",
@@ -42,8 +41,7 @@ const locale = { "sheets-data-validation": {
42
41
  lessThanOrEqual: "en o abans de",
43
42
  equal: "igual",
44
43
  notEqual: "no igual",
45
- notBetween: "no entre",
46
- legal: "és una data legal"
44
+ notBetween: "no entre"
47
45
  },
48
46
  ruleName: {
49
47
  between: "està entre {FORMULA1} i {FORMULA2}",
@@ -85,20 +83,16 @@ const locale = { "sheets-data-validation": {
85
83
  custom: {
86
84
  ruleName: "La fórmula personalitzada és {FORMULA1}",
87
85
  title: "Fórmula personalitzada",
88
- validFail: "Si us plau, introdueix una fórmula vàlida",
89
86
  error: "El contingut d’aquesta cel·la incompleix la seva regla de validació"
90
87
  },
91
88
  validFail: {
92
89
  value: "Si us plau, introdueix un valor",
93
- common: "Si us plau, introdueix un valor o una fórmula",
94
90
  number: "Si us plau, introdueix un número o una fórmula",
95
91
  formula: "Si us plau, introdueix una fórmula",
96
- integer: "Si us plau, introdueix un enter o una fórmula",
97
92
  date: "Si us plau, introdueix una data o una fórmula",
98
93
  list: "Si us plau, introdueix opcions",
99
94
  listInvalid: "La font de la llista ha de ser una llista delimitada o una referència a una sola fila o columna",
100
95
  checkboxEqual: "Introdueix valors diferents per als continguts de cel·la marcats i desmarcats.",
101
- formulaError: "L’interval de referència conté dades invisibles, ajusta l’interval",
102
96
  listIntersects: "L’interval seleccionat no pot creuar-se amb l’àmbit de les regles",
103
97
  primitive: "No es permeten fórmules per a valors personalitzats marcats i desmarcats."
104
98
  },
@@ -109,28 +103,14 @@ const locale = { "sheets-data-validation": {
109
103
  list: {
110
104
  title: "Desplegable",
111
105
  name: "El valor conté un del rang",
112
- error: "L’entrada ha d’estar dins del rang especificat",
113
- emptyError: "Si us plau, introdueix un valor",
114
- add: "Afegeix",
115
- dropdown: "Selecciona",
116
- options: "Opcions",
117
- customOptions: "Personalitzat",
118
- refOptions: "D’un interval",
119
- formulaError: "La font de la llista ha de ser una llista delimitada de dades o una referència a una sola fila o columna.",
120
- edit: "Edita"
121
- },
122
- listMultiple: {
123
- title: "Desplegable-múltiple",
124
- dropdown: "Selecció múltiple"
106
+ error: "L’entrada ha d’estar dins del rang especificat"
125
107
  },
108
+ listMultiple: { title: "Desplegable-múltiple" },
126
109
  decimal: { title: "Número" },
127
110
  whole: { title: "Enter" },
128
111
  checkbox: {
129
112
  title: "Casella de selecció",
130
- error: "El contingut d’aquesta cel·la incompleix la seva regla de validació",
131
- tips: "Utilitza valors personalitzats dins de les cel·les",
132
- checked: "Valor seleccionat",
133
- unchecked: "Valor no seleccionat"
113
+ error: "El contingut d’aquesta cel·la incompleix la seva regla de validació"
134
114
  }
135
115
  } };
136
116
 
@@ -8,8 +8,7 @@ const locale = { "sheets-data-validation": {
8
8
  lessThanOrEqual: "kleiner als oder gleich",
9
9
  equal: "gleich",
10
10
  notEqual: "ungleich",
11
- notBetween: "nicht zwischen",
12
- legal: "ist gültiger Typ"
11
+ notBetween: "nicht zwischen"
13
12
  },
14
13
  ruleName: {
15
14
  between: "Ist zwischen {FORMULA1} und {FORMULA2}",
@@ -42,8 +41,7 @@ const locale = { "sheets-data-validation": {
42
41
  lessThanOrEqual: "am oder vor",
43
42
  equal: "gleich",
44
43
  notEqual: "ungleich",
45
- notBetween: "nicht zwischen",
46
- legal: "ist ein gültiges Datum"
44
+ notBetween: "nicht zwischen"
47
45
  },
48
46
  ruleName: {
49
47
  between: "ist zwischen {FORMULA1} und {FORMULA2}",
@@ -85,20 +83,16 @@ const locale = { "sheets-data-validation": {
85
83
  custom: {
86
84
  ruleName: "Benutzerdefinierte Formel ist {FORMULA1}",
87
85
  title: "Benutzerdefinierte Formel",
88
- validFail: "Bitte geben Sie eine gültige Formel ein",
89
86
  error: "Der Inhalt dieser Zelle verstößt gegen die Überprüfungsregel"
90
87
  },
91
88
  validFail: {
92
89
  value: "Bitte geben Sie einen Wert ein",
93
- common: "Bitte geben Sie einen Wert oder eine Formel ein",
94
90
  number: "Bitte geben Sie eine Zahl oder eine Formel ein",
95
91
  formula: "Bitte geben Sie eine Formel ein",
96
- integer: "Bitte geben Sie eine ganze Zahl oder eine Formel ein",
97
92
  date: "Bitte geben Sie ein Datum oder eine Formel ein",
98
93
  list: "Bitte geben Sie Optionen ein",
99
94
  listInvalid: "Die Listenquelle muss eine durch Trennzeichen getrennte Liste oder ein Bezug auf eine einzelne Zeile oder Spalte sein",
100
95
  checkboxEqual: "Geben Sie unterschiedliche Werte für angekreuzte und nicht angekreuzte Zelleninhalte ein.",
101
- formulaError: "Der Bezugsbereich enthält unsichtbare Daten, bitte passen Sie den Bereich an",
102
96
  listIntersects: "Der ausgewählte Bereich darf sich nicht mit dem Geltungsbereich der Regeln überschneiden",
103
97
  primitive: "Formeln sind für benutzerdefinierte angekreuzte und nicht angekreuzte Werte nicht zulässig."
104
98
  },
@@ -109,28 +103,14 @@ const locale = { "sheets-data-validation": {
109
103
  list: {
110
104
  title: "Dropdown",
111
105
  name: "Wert enthält einen aus dem Bereich",
112
- error: "Eingabe muss im angegebenen Bereich liegen",
113
- emptyError: "Bitte geben Sie einen Wert ein",
114
- add: "Hinzufügen",
115
- dropdown: "Auswählen",
116
- options: "Optionen",
117
- customOptions: "Benutzerdefiniert",
118
- refOptions: "Aus einem Bereich",
119
- formulaError: "Die Listenquelle muss eine durch Trennzeichen getrennte Datenliste oder ein Bezug auf eine einzelne Zeile oder Spalte sein.",
120
- edit: "Bearbeiten"
121
- },
122
- listMultiple: {
123
- title: "Dropdown-Mehrfachauswahl",
124
- dropdown: "Mehrfachauswahl"
106
+ error: "Eingabe muss im angegebenen Bereich liegen"
125
107
  },
108
+ listMultiple: { title: "Dropdown-Mehrfachauswahl" },
126
109
  decimal: { title: "Zahl" },
127
110
  whole: { title: "Ganze Zahl" },
128
111
  checkbox: {
129
112
  title: "Kontrollkästchen",
130
- error: "Der Inhalt dieser Zelle verstößt gegen die Überprüfungsregel",
131
- tips: "Benutzerdefinierte Werte in Zellen verwenden",
132
- checked: "Ausgewählter Wert",
133
- unchecked: "Nicht ausgewählter Wert"
113
+ error: "Der Inhalt dieser Zelle verstößt gegen die Überprüfungsregel"
134
114
  }
135
115
  } };
136
116
 
@@ -23,8 +23,7 @@ const locale = { "sheets-data-validation": {
23
23
  lessThanOrEqual: "less than or equal",
24
24
  equal: "equal",
25
25
  notEqual: "not equal",
26
- notBetween: "not between",
27
- legal: "is legal type"
26
+ notBetween: "not between"
28
27
  },
29
28
  ruleName: {
30
29
  between: "Is between {FORMULA1} and {FORMULA2}",
@@ -57,8 +56,7 @@ const locale = { "sheets-data-validation": {
57
56
  lessThanOrEqual: "on or before",
58
57
  equal: "equal",
59
58
  notEqual: "not equal",
60
- notBetween: "not between",
61
- legal: "is a legal date"
59
+ notBetween: "not between"
62
60
  },
63
61
  ruleName: {
64
62
  between: "is between {FORMULA1} and {FORMULA2}",
@@ -100,20 +98,16 @@ const locale = { "sheets-data-validation": {
100
98
  custom: {
101
99
  ruleName: "Custom formula is {FORMULA1}",
102
100
  title: "Custom formula",
103
- validFail: "Please input a valid formula",
104
101
  error: "This cell's contents violate its validation rule"
105
102
  },
106
103
  validFail: {
107
104
  value: "Please input a value",
108
- common: "Please input value or formula",
109
105
  number: "Please input number or formula",
110
106
  formula: "Please input formula",
111
- integer: "Please input integer or formula",
112
107
  date: "Please input date or formula",
113
108
  list: "Please input options",
114
109
  listInvalid: "The list source must be a delimited list or a reference to a single row or column",
115
110
  checkboxEqual: "Enter different values for ticked and unticked cell contents.",
116
- formulaError: "The reference range contains invisible data, please readjust the range",
117
111
  listIntersects: "The selected range cannot intersect with the scope of the rules",
118
112
  primitive: "Formulas are not permitted for custom ticked and unticked values."
119
113
  },
@@ -124,28 +118,14 @@ const locale = { "sheets-data-validation": {
124
118
  list: {
125
119
  title: "Dropdown",
126
120
  name: "Value contains one from range",
127
- error: "Input must fall within specified range",
128
- emptyError: "Please enter a value",
129
- add: "Add",
130
- dropdown: "Select",
131
- options: "Options",
132
- customOptions: "Custom",
133
- refOptions: "From a range",
134
- formulaError: "The list source must be a delimited list of data, or a reference to a single row or column.",
135
- edit: "Edit"
136
- },
137
- listMultiple: {
138
- title: "Dropdown-Multiple",
139
- dropdown: "Multiple select"
121
+ error: "Input must fall within specified range"
140
122
  },
123
+ listMultiple: { title: "Dropdown-Multiple" },
141
124
  decimal: { title: "Number" },
142
125
  whole: { title: "Integer" },
143
126
  checkbox: {
144
127
  title: "Checkbox",
145
- error: "This cell's contents violate its validation rule",
146
- tips: "Use custom values within cells",
147
- checked: "Selected value",
148
- unchecked: "Unselected value"
128
+ error: "This cell's contents violate its validation rule"
149
129
  }
150
130
  } };
151
131
 
@@ -8,8 +8,7 @@ const locale = { "sheets-data-validation": {
8
8
  lessThanOrEqual: "menor o igual que",
9
9
  equal: "igual",
10
10
  notEqual: "no igual",
11
- notBetween: "no entre",
12
- legal: "es tipo legal"
11
+ notBetween: "no entre"
13
12
  },
14
13
  ruleName: {
15
14
  between: "Está entre {FORMULA1} y {FORMULA2}",
@@ -42,8 +41,7 @@ const locale = { "sheets-data-validation": {
42
41
  lessThanOrEqual: "en o antes de",
43
42
  equal: "igual",
44
43
  notEqual: "no igual",
45
- notBetween: "no entre",
46
- legal: "es una fecha legal"
44
+ notBetween: "no entre"
47
45
  },
48
46
  ruleName: {
49
47
  between: "está entre {FORMULA1} y {FORMULA2}",
@@ -85,20 +83,16 @@ const locale = { "sheets-data-validation": {
85
83
  custom: {
86
84
  ruleName: "La fórmula personalizada es {FORMULA1}",
87
85
  title: "Fórmula personalizada",
88
- validFail: "Por favor, introduce una fórmula válida",
89
86
  error: "El contenido de esta celda viola su regla de validación"
90
87
  },
91
88
  validFail: {
92
89
  value: "Por favor, introduce un valor",
93
- common: "Por favor, introduce un valor o fórmula",
94
90
  number: "Por favor, introduce un número o fórmula",
95
91
  formula: "Por favor, introduce una fórmula",
96
- integer: "Por favor, introduce un entero o fórmula",
97
92
  date: "Por favor, introduce una fecha o fórmula",
98
93
  list: "Por favor, introduce opciones",
99
94
  listInvalid: "La fuente de la lista debe ser una lista delimitada o una referencia a una sola fila o columna",
100
95
  checkboxEqual: "Introduce valores diferentes para los contenidos de celda marcados y desmarcados.",
101
- formulaError: "El rango de referencia contiene datos invisibles, ajusta el rango",
102
96
  listIntersects: "El rango seleccionado no puede cruzarse con el ámbito de las reglas",
103
97
  primitive: "No se permiten fórmulas para valores personalizados marcados y desmarcados."
104
98
  },
@@ -109,28 +103,14 @@ const locale = { "sheets-data-validation": {
109
103
  list: {
110
104
  title: "Desplegable",
111
105
  name: "El valor contiene uno del rango",
112
- error: "La entrada debe estar dentro del rango especificado",
113
- emptyError: "Por favor, introduce un valor",
114
- add: "Añadir",
115
- dropdown: "Seleccionar",
116
- options: "Opciones",
117
- customOptions: "Personalizado",
118
- refOptions: "De un rango",
119
- formulaError: "La fuente de la lista debe ser una lista delimitada de datos o una referencia a una sola fila o columna.",
120
- edit: "Editar"
121
- },
122
- listMultiple: {
123
- title: "Desplegable-múltiple",
124
- dropdown: "Selección múltiple"
106
+ error: "La entrada debe estar dentro del rango especificado"
125
107
  },
108
+ listMultiple: { title: "Desplegable-múltiple" },
126
109
  decimal: { title: "Número" },
127
110
  whole: { title: "Entero" },
128
111
  checkbox: {
129
112
  title: "Casilla de verificación",
130
- error: "El contenido de esta celda viola su regla de validación",
131
- tips: "Usa valores personalizados dentro de las celdas",
132
- checked: "Valor seleccionado",
133
- unchecked: "Valor no seleccionado"
113
+ error: "El contenido de esta celda viola su regla de validación"
134
114
  }
135
115
  } };
136
116