@univerjs/sheets-data-validation 1.0.0-insiders.20260809-70eefdd → 1.0.0-rc.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 (85) hide show
  1. package/LICENSE +176 -0
  2. package/README.md +10 -2
  3. package/lib/cjs/index.js +35 -25
  4. package/lib/cjs/locale/ar-SA.js +5 -25
  5. package/lib/cjs/locale/ca-ES.js +5 -25
  6. package/lib/cjs/locale/de-DE.js +5 -25
  7. package/lib/cjs/locale/en-US.js +5 -25
  8. package/lib/cjs/locale/es-ES.js +5 -25
  9. package/lib/cjs/locale/fa-IR.js +5 -25
  10. package/lib/cjs/locale/fr-FR.js +5 -25
  11. package/lib/cjs/locale/id-ID.js +5 -25
  12. package/lib/cjs/locale/it-IT.js +5 -25
  13. package/lib/cjs/locale/ja-JP.js +5 -25
  14. package/lib/cjs/locale/ko-KR.js +5 -25
  15. package/lib/cjs/locale/pl-PL.js +5 -25
  16. package/lib/cjs/locale/pt-BR.js +5 -25
  17. package/lib/cjs/locale/ru-RU.js +5 -25
  18. package/lib/cjs/locale/sk-SK.js +5 -25
  19. package/lib/cjs/locale/vi-VN.js +5 -25
  20. package/lib/cjs/locale/zh-CN.js +5 -25
  21. package/lib/cjs/locale/zh-HK.js +5 -25
  22. package/lib/cjs/locale/zh-TW.js +5 -25
  23. package/lib/es/index.js +36 -26
  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/index.js +36 -26
  44. package/lib/locale/ar-SA.js +5 -25
  45. package/lib/locale/ca-ES.js +5 -25
  46. package/lib/locale/de-DE.js +5 -25
  47. package/lib/locale/en-US.js +5 -25
  48. package/lib/locale/es-ES.js +5 -25
  49. package/lib/locale/fa-IR.js +5 -25
  50. package/lib/locale/fr-FR.js +5 -25
  51. package/lib/locale/id-ID.js +5 -25
  52. package/lib/locale/it-IT.js +5 -25
  53. package/lib/locale/ja-JP.js +5 -25
  54. package/lib/locale/ko-KR.js +5 -25
  55. package/lib/locale/pl-PL.js +5 -25
  56. package/lib/locale/pt-BR.js +5 -25
  57. package/lib/locale/ru-RU.js +5 -25
  58. package/lib/locale/sk-SK.js +5 -25
  59. package/lib/locale/vi-VN.js +5 -25
  60. package/lib/locale/zh-CN.js +5 -25
  61. package/lib/locale/zh-HK.js +5 -25
  62. package/lib/locale/zh-TW.js +5 -25
  63. package/lib/types/locale/en-US.d.ts +0 -18
  64. package/lib/types/validators/date-validator.d.ts +3 -1
  65. package/lib/umd/index.js +1 -1
  66. package/lib/umd/locale/ar-SA.js +1 -1
  67. package/lib/umd/locale/ca-ES.js +1 -1
  68. package/lib/umd/locale/de-DE.js +1 -1
  69. package/lib/umd/locale/en-US.js +1 -1
  70. package/lib/umd/locale/es-ES.js +1 -1
  71. package/lib/umd/locale/fa-IR.js +1 -1
  72. package/lib/umd/locale/fr-FR.js +1 -1
  73. package/lib/umd/locale/id-ID.js +1 -1
  74. package/lib/umd/locale/it-IT.js +1 -1
  75. package/lib/umd/locale/ja-JP.js +1 -1
  76. package/lib/umd/locale/ko-KR.js +1 -1
  77. package/lib/umd/locale/pl-PL.js +1 -1
  78. package/lib/umd/locale/pt-BR.js +1 -1
  79. package/lib/umd/locale/ru-RU.js +1 -1
  80. package/lib/umd/locale/sk-SK.js +1 -1
  81. package/lib/umd/locale/vi-VN.js +1 -1
  82. package/lib/umd/locale/zh-CN.js +1 -1
  83. package/lib/umd/locale/zh-HK.js +1 -1
  84. package/lib/umd/locale/zh-TW.js +1 -1
  85. package/package.json +9 -9
package/LICENSE ADDED
@@ -0,0 +1,176 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
package/README.md CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  | Package | UMD global | CSS | Locales | Facade entry |
12
12
  | --- | --- | :---: | :---: | :---: |
13
- | `@univerjs/sheets-data-validation` | `UniverSheetsDataValidation` | No | No | Yes |
13
+ | `@univerjs/sheets-data-validation` | `UniverSheetsDataValidation` | No | Yes | Yes |
14
14
 
15
15
  ## Installation
16
16
 
@@ -25,7 +25,16 @@ Keep all `@univerjs/*` packages on the same version.
25
25
  ## Usage
26
26
 
27
27
  ```ts
28
+ import { LocaleType, mergeLocales, Univer } from '@univerjs/core';
28
29
  import { UniverSheetsDataValidationPlugin } from '@univerjs/sheets-data-validation';
30
+ import EnUS from '@univerjs/sheets-data-validation/locale/en-US';
31
+
32
+ const univer = new Univer({
33
+ locale: LocaleType.EN_US,
34
+ locales: {
35
+ [LocaleType.EN_US]: mergeLocales(EnUS),
36
+ },
37
+ });
29
38
 
30
39
  univer.registerPlugin(UniverSheetsDataValidationPlugin);
31
40
  ```
@@ -39,4 +48,3 @@ Use this package with `@univerjs/sheets-data-validation-ui` when users need vali
39
48
  - [Documentation](https://docs.univer.ai)
40
49
  - [NPM package](https://npmjs.com/package/@univerjs/sheets-data-validation)
41
50
  - [GitHub repository](https://github.com/dream-num/univer)
42
-
package/lib/cjs/index.js CHANGED
@@ -1274,14 +1274,15 @@ function getTransformedFormula(lexerTreeBuilder, rule, position) {
1274
1274
 
1275
1275
  //#endregion
1276
1276
  //#region src/validators/date-validator.ts
1277
- const transformDate2SerialNumber = (value) => {
1278
- var _numfmt$parseDate, _numfmt$parseDate2;
1277
+ const transformDate2SerialNumber = (value, options = {}) => {
1278
+ var _numfmt$parseDate;
1279
1279
  if (value === void 0 || value === null || typeof value === "boolean") return;
1280
1280
  if (typeof value === "number" || !Number.isNaN(+value)) return +value;
1281
- const v = (_numfmt$parseDate = _univerjs_core.numfmt.parseDate(value)) === null || _numfmt$parseDate === void 0 ? void 0 : _numfmt$parseDate.v;
1282
- if (_univerjs_core.Tools.isDefine(v)) return v;
1283
- return (_numfmt$parseDate2 = _univerjs_core.numfmt.parseDate((0, _univerjs_core.dateKit)(value).format("YYYY-MM-DD HH:mm:ss"))) === null || _numfmt$parseDate2 === void 0 ? void 0 : _numfmt$parseDate2.v;
1281
+ return (_numfmt$parseDate = _univerjs_core.numfmt.parseDate(value, options)) === null || _numfmt$parseDate === void 0 ? void 0 : _numfmt$parseDate.v;
1284
1282
  };
1283
+ function pad(value) {
1284
+ return String(value).padStart(2, "0");
1285
+ }
1285
1286
  var DateValidator = class extends BaseSheetValidator {
1286
1287
  constructor(..._args) {
1287
1288
  super(..._args);
@@ -1301,6 +1302,14 @@ var DateValidator = class extends BaseSheetValidator {
1301
1302
  _defineProperty(this, "scopes", ["sheet"]);
1302
1303
  _defineProperty(this, "_customFormulaService", this.injector.get(DataValidationCustomFormulaService));
1303
1304
  _defineProperty(this, "_lexerTreeBuilder", this.injector.get(_univerjs_engine_formula.LexerTreeBuilder));
1305
+ _defineProperty(this, "_univerInstanceService", this.injector.get(_univerjs_core.IUniverInstanceService));
1306
+ }
1307
+ _getParseOptions(unitId, workbook) {
1308
+ const targetWorkbook = workbook ?? (unitId ? this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_SHEET) : void 0);
1309
+ return targetWorkbook ? {
1310
+ locale: (0, _univerjs_core.getNumfmtLocaleTag)(targetWorkbook.getSnapshot().locale),
1311
+ dateSystem: targetWorkbook.getDateSystem()
1312
+ } : { dateSystem: _univerjs_core.DateSystem.Date1900 };
1304
1313
  }
1305
1314
  async parseFormula(rule, unitId, subUnitId, row, column) {
1306
1315
  const formulaResult1 = await this._customFormulaService.getCellFormulaValue(unitId, subUnitId, rule.uid, row, column);
@@ -1308,27 +1317,29 @@ var DateValidator = class extends BaseSheetValidator {
1308
1317
  const { formula1, formula2 } = rule;
1309
1318
  const isFormulaValid = isLegalFormulaResult(String(formulaResult1 === null || formulaResult1 === void 0 ? void 0 : formulaResult1.v)) && isLegalFormulaResult(String(formulaResult2 === null || formulaResult2 === void 0 ? void 0 : formulaResult2.v));
1310
1319
  return {
1311
- formula1: transformDate2SerialNumber((0, _univerjs_core.isFormulaString)(formula1) ? formulaResult1 === null || formulaResult1 === void 0 ? void 0 : formulaResult1.v : formula1),
1312
- formula2: transformDate2SerialNumber((0, _univerjs_core.isFormulaString)(formula2) ? formulaResult2 === null || formulaResult2 === void 0 ? void 0 : formulaResult2.v : formula2),
1320
+ formula1: transformDate2SerialNumber((0, _univerjs_core.isFormulaString)(formula1) ? formulaResult1 === null || formulaResult1 === void 0 ? void 0 : formulaResult1.v : formula1, this._getParseOptions(unitId)),
1321
+ formula2: transformDate2SerialNumber((0, _univerjs_core.isFormulaString)(formula2) ? formulaResult2 === null || formulaResult2 === void 0 ? void 0 : formulaResult2.v : formula2, this._getParseOptions(unitId)),
1313
1322
  isFormulaValid
1314
1323
  };
1315
1324
  }
1316
1325
  async isValidType(info) {
1317
1326
  const { interceptValue, value } = info;
1318
- if (typeof value === "number" && typeof interceptValue === "string") return Boolean(_univerjs_core.numfmt.parseDate(interceptValue));
1319
- if (typeof interceptValue === "string") return Boolean(_univerjs_core.numfmt.parseDate(interceptValue));
1327
+ const options = this._getParseOptions(info.unitId, info.workbook);
1328
+ if (typeof value === "number" && typeof interceptValue === "string") return Boolean(_univerjs_core.numfmt.parseDate(interceptValue, options));
1329
+ if (typeof interceptValue === "string") return Boolean(_univerjs_core.numfmt.parseDate(interceptValue, options));
1320
1330
  return false;
1321
1331
  }
1322
- _validatorSingleFormula(formula) {
1323
- return !_univerjs_core.Tools.isBlank(formula) && ((0, _univerjs_core.isFormulaString)(formula) || !Number.isNaN(+formula) || Boolean(formula && _univerjs_core.numfmt.parseDate(formula)));
1332
+ _validatorSingleFormula(formula, options) {
1333
+ return !_univerjs_core.Tools.isBlank(formula) && ((0, _univerjs_core.isFormulaString)(formula) || !Number.isNaN(+formula) || Boolean(formula && _univerjs_core.numfmt.parseDate(formula, options)));
1324
1334
  }
1325
1335
  validatorFormula(rule, unitId, subUnitId) {
1326
1336
  const operator = rule.operator;
1327
1337
  if (!operator) return { success: true };
1328
- const formula1Success = this._validatorSingleFormula(rule.formula1);
1338
+ const options = this._getParseOptions(unitId);
1339
+ const formula1Success = this._validatorSingleFormula(rule.formula1, options);
1329
1340
  const errorMsg = this.localeService.t("sheets-data-validation.validFail.date");
1330
1341
  if (TWO_FORMULA_OPERATOR_COUNT.includes(operator)) {
1331
- const formula2Success = this._validatorSingleFormula(rule.formula2);
1342
+ const formula2Success = this._validatorSingleFormula(rule.formula2, options);
1332
1343
  return {
1333
1344
  success: formula1Success && formula2Success,
1334
1345
  formula1: formula1Success ? void 0 : errorMsg,
@@ -1340,19 +1351,18 @@ var DateValidator = class extends BaseSheetValidator {
1340
1351
  formula1: formula1Success ? void 0 : errorMsg
1341
1352
  };
1342
1353
  }
1343
- normalizeFormula(rule, _unitId, _subUnitId) {
1354
+ normalizeFormula(rule, unitId, _subUnitId) {
1344
1355
  const { formula1, formula2, bizInfo } = rule;
1356
+ const options = this._getParseOptions(unitId);
1345
1357
  const normlizeSingleFormula = (formula) => {
1358
+ var _numfmt$parseDate2;
1346
1359
  if (!formula) return formula;
1347
- let date;
1348
- if (!Number.isNaN(+formula)) date = _univerjs_core.numfmt.dateFromSerial(+formula);
1349
- else {
1350
- var _numfmt$parseDate3;
1351
- const res = (_numfmt$parseDate3 = _univerjs_core.numfmt.parseDate(formula)) === null || _numfmt$parseDate3 === void 0 ? void 0 : _numfmt$parseDate3.v;
1352
- if (res === void 0 || res === null) return "";
1353
- date = _univerjs_core.numfmt.dateFromSerial(res);
1354
- }
1355
- return (0, _univerjs_core.dateKit)(`${date[0]}/${date[1]}/${date[2]} ${date[3]}:${date[4]}:${date[5]}`).format((bizInfo === null || bizInfo === void 0 ? void 0 : bizInfo.showTime) ? "YYYY-MM-DD HH:mm:ss" : "YYYY-MM-DD");
1360
+ const serial = !Number.isNaN(+formula) ? +formula : (_numfmt$parseDate2 = _univerjs_core.numfmt.parseDate(formula, options)) === null || _numfmt$parseDate2 === void 0 ? void 0 : _numfmt$parseDate2.v;
1361
+ if (typeof serial !== "number") return "";
1362
+ const date = (0, _univerjs_core.excelSerialToDateTimeParts)(serial, { dateSystem: options.dateSystem ?? _univerjs_core.DateSystem.Date1900 });
1363
+ if (!date) return "";
1364
+ const dateText = `${String(date.year).padStart(4, "0")}-${pad(date.month)}-${pad(date.day)}`;
1365
+ return (bizInfo === null || bizInfo === void 0 ? void 0 : bizInfo.showTime) ? `${dateText} ${pad(date.hours)}:${pad(date.minutes)}:${pad(date.seconds)}` : dateText;
1356
1366
  };
1357
1367
  return {
1358
1368
  formula1: (0, _univerjs_core.isFormulaString)(formula1) ? formula1 : normlizeSingleFormula(`${formula1}`),
@@ -1363,7 +1373,7 @@ var DateValidator = class extends BaseSheetValidator {
1363
1373
  const { value } = cellInfo;
1364
1374
  return {
1365
1375
  ...cellInfo,
1366
- value: transformDate2SerialNumber(value)
1376
+ value: transformDate2SerialNumber(value, this._getParseOptions(cellInfo.unitId, cellInfo.workbook))
1367
1377
  };
1368
1378
  }
1369
1379
  get operatorNames() {
@@ -2300,7 +2310,7 @@ DataValidationFormulaController = __decorate([
2300
2310
  //#endregion
2301
2311
  //#region package.json
2302
2312
  var name = "@univerjs/sheets-data-validation";
2303
- var version = "1.0.0-insiders.20260809-70eefdd";
2313
+ var version = "1.0.0-rc.0";
2304
2314
 
2305
2315
  //#endregion
2306
2316
  //#region src/config/config.ts
@@ -9,8 +9,7 @@ const locale = { "sheets-data-validation": {
9
9
  lessThanOrEqual: "أقل من أو يساوي",
10
10
  equal: "يساوي",
11
11
  notEqual: "لا يساوي",
12
- notBetween: "ليس بين",
13
- legal: "نوع قانوني"
12
+ notBetween: "ليس بين"
14
13
  },
15
14
  ruleName: {
16
15
  between: "بين {FORMULA1} و{FORMULA2}",
@@ -43,8 +42,7 @@ const locale = { "sheets-data-validation": {
43
42
  lessThanOrEqual: "في أو قبل",
44
43
  equal: "يساوي",
45
44
  notEqual: "لا يساوي",
46
- notBetween: "ليس بين",
47
- legal: "تاريخ قانوني"
45
+ notBetween: "ليس بين"
48
46
  },
49
47
  ruleName: {
50
48
  between: "بين {FORMULA1} و{FORMULA2}",
@@ -86,20 +84,16 @@ const locale = { "sheets-data-validation": {
86
84
  custom: {
87
85
  ruleName: "الصيغة المخصصة هي {FORMULA1}",
88
86
  title: "صيغة مخصصة",
89
- validFail: "يرجى إدخال صيغة صالحة",
90
87
  error: "محتويات هذه الخلية تنتهك قاعدة التحقق"
91
88
  },
92
89
  validFail: {
93
90
  value: "يرجى إدخال قيمة",
94
- common: "يرجى إدخال قيمة أو صيغة",
95
91
  number: "يرجى إدخال رقم أو صيغة",
96
92
  formula: "يرجى إدخال صيغة",
97
- integer: "يرجى إدخال عدد صحيح أو صيغة",
98
93
  date: "يرجى إدخال تاريخ أو صيغة",
99
94
  list: "يرجى إدخال خيارات",
100
95
  listInvalid: "يجب أن يكون مصدر القائمة قائمة محددة بفواصل أو مرجعًا لصف أو عمود واحد",
101
96
  checkboxEqual: "أدخل قيمًا مختلفة لمحتويات الخلية المحددة وغير المحددة.",
102
- formulaError: "يحتوي نطاق المرجع على بيانات غير مرئية، يرجى إعادة ضبط النطاق",
103
97
  listIntersects: "لا يمكن أن يتقاطع النطاق المحدد مع نطاق القواعد",
104
98
  primitive: "غير مسموح بالصيغ لقيم المحدد وغير المحدد المخصصة."
105
99
  },
@@ -110,28 +104,14 @@ const locale = { "sheets-data-validation": {
110
104
  list: {
111
105
  title: "قائمة منسدلة",
112
106
  name: "القيمة تحتوي على واحدة من النطاق",
113
- error: "يجب أن يكون الإدخال ضمن النطاق المحدد",
114
- emptyError: "يرجى إدخال قيمة",
115
- add: "إضافة",
116
- dropdown: "تحديد",
117
- options: "خيارات",
118
- customOptions: "مخصص",
119
- refOptions: "من نطاق",
120
- formulaError: "يجب أن يكون مصدر القائمة قائمة بيانات محددة بفواصل، أو مرجعًا لصف أو عمود واحد.",
121
- edit: "تحرير"
122
- },
123
- listMultiple: {
124
- title: "قائمة منسدلة - متعددة",
125
- dropdown: "تحديد متعدد"
107
+ error: "يجب أن يكون الإدخال ضمن النطاق المحدد"
126
108
  },
109
+ listMultiple: { title: "قائمة منسدلة - متعددة" },
127
110
  decimal: { title: "رقم" },
128
111
  whole: { title: "عدد صحيح" },
129
112
  checkbox: {
130
113
  title: "خانة اختيار",
131
- error: "محتويات هذه الخلية تنتهك قاعدة التحقق",
132
- tips: "استخدم قيمًا مخصصة داخل الخلايا",
133
- checked: "القيمة المحددة",
134
- unchecked: "القيمة غير المحددة"
114
+ error: "محتويات هذه الخلية تنتهك قاعدة التحقق"
135
115
  }
136
116
  } };
137
117
 
@@ -9,8 +9,7 @@ const locale = { "sheets-data-validation": {
9
9
  lessThanOrEqual: "menys o igual que",
10
10
  equal: "igual",
11
11
  notEqual: "no igual",
12
- notBetween: "no entre",
13
- legal: "és tipus legal"
12
+ notBetween: "no entre"
14
13
  },
15
14
  ruleName: {
16
15
  between: "Està entre {FORMULA1} i {FORMULA2}",
@@ -43,8 +42,7 @@ const locale = { "sheets-data-validation": {
43
42
  lessThanOrEqual: "en o abans de",
44
43
  equal: "igual",
45
44
  notEqual: "no igual",
46
- notBetween: "no entre",
47
- legal: "és una data legal"
45
+ notBetween: "no entre"
48
46
  },
49
47
  ruleName: {
50
48
  between: "està entre {FORMULA1} i {FORMULA2}",
@@ -86,20 +84,16 @@ const locale = { "sheets-data-validation": {
86
84
  custom: {
87
85
  ruleName: "La fórmula personalitzada és {FORMULA1}",
88
86
  title: "Fórmula personalitzada",
89
- validFail: "Si us plau, introdueix una fórmula vàlida",
90
87
  error: "El contingut d’aquesta cel·la incompleix la seva regla de validació"
91
88
  },
92
89
  validFail: {
93
90
  value: "Si us plau, introdueix un valor",
94
- common: "Si us plau, introdueix un valor o una fórmula",
95
91
  number: "Si us plau, introdueix un número o una fórmula",
96
92
  formula: "Si us plau, introdueix una fórmula",
97
- integer: "Si us plau, introdueix un enter o una fórmula",
98
93
  date: "Si us plau, introdueix una data o una fórmula",
99
94
  list: "Si us plau, introdueix opcions",
100
95
  listInvalid: "La font de la llista ha de ser una llista delimitada o una referència a una sola fila o columna",
101
96
  checkboxEqual: "Introdueix valors diferents per als continguts de cel·la marcats i desmarcats.",
102
- formulaError: "L’interval de referència conté dades invisibles, ajusta l’interval",
103
97
  listIntersects: "L’interval seleccionat no pot creuar-se amb l’àmbit de les regles",
104
98
  primitive: "No es permeten fórmules per a valors personalitzats marcats i desmarcats."
105
99
  },
@@ -110,28 +104,14 @@ const locale = { "sheets-data-validation": {
110
104
  list: {
111
105
  title: "Desplegable",
112
106
  name: "El valor conté un del rang",
113
- error: "L’entrada ha d’estar dins del rang especificat",
114
- emptyError: "Si us plau, introdueix un valor",
115
- add: "Afegeix",
116
- dropdown: "Selecciona",
117
- options: "Opcions",
118
- customOptions: "Personalitzat",
119
- refOptions: "D’un interval",
120
- formulaError: "La font de la llista ha de ser una llista delimitada de dades o una referència a una sola fila o columna.",
121
- edit: "Edita"
122
- },
123
- listMultiple: {
124
- title: "Desplegable-múltiple",
125
- dropdown: "Selecció múltiple"
107
+ error: "L’entrada ha d’estar dins del rang especificat"
126
108
  },
109
+ listMultiple: { title: "Desplegable-múltiple" },
127
110
  decimal: { title: "Número" },
128
111
  whole: { title: "Enter" },
129
112
  checkbox: {
130
113
  title: "Casella de selecció",
131
- error: "El contingut d’aquesta cel·la incompleix la seva regla de validació",
132
- tips: "Utilitza valors personalitzats dins de les cel·les",
133
- checked: "Valor seleccionat",
134
- unchecked: "Valor no seleccionat"
114
+ error: "El contingut d’aquesta cel·la incompleix la seva regla de validació"
135
115
  }
136
116
  } };
137
117
 
@@ -9,8 +9,7 @@ const locale = { "sheets-data-validation": {
9
9
  lessThanOrEqual: "kleiner als oder gleich",
10
10
  equal: "gleich",
11
11
  notEqual: "ungleich",
12
- notBetween: "nicht zwischen",
13
- legal: "ist gültiger Typ"
12
+ notBetween: "nicht zwischen"
14
13
  },
15
14
  ruleName: {
16
15
  between: "Ist zwischen {FORMULA1} und {FORMULA2}",
@@ -43,8 +42,7 @@ const locale = { "sheets-data-validation": {
43
42
  lessThanOrEqual: "am oder vor",
44
43
  equal: "gleich",
45
44
  notEqual: "ungleich",
46
- notBetween: "nicht zwischen",
47
- legal: "ist ein gültiges Datum"
45
+ notBetween: "nicht zwischen"
48
46
  },
49
47
  ruleName: {
50
48
  between: "ist zwischen {FORMULA1} und {FORMULA2}",
@@ -86,20 +84,16 @@ const locale = { "sheets-data-validation": {
86
84
  custom: {
87
85
  ruleName: "Benutzerdefinierte Formel ist {FORMULA1}",
88
86
  title: "Benutzerdefinierte Formel",
89
- validFail: "Bitte geben Sie eine gültige Formel ein",
90
87
  error: "Der Inhalt dieser Zelle verstößt gegen die Überprüfungsregel"
91
88
  },
92
89
  validFail: {
93
90
  value: "Bitte geben Sie einen Wert ein",
94
- common: "Bitte geben Sie einen Wert oder eine Formel ein",
95
91
  number: "Bitte geben Sie eine Zahl oder eine Formel ein",
96
92
  formula: "Bitte geben Sie eine Formel ein",
97
- integer: "Bitte geben Sie eine ganze Zahl oder eine Formel ein",
98
93
  date: "Bitte geben Sie ein Datum oder eine Formel ein",
99
94
  list: "Bitte geben Sie Optionen ein",
100
95
  listInvalid: "Die Listenquelle muss eine durch Trennzeichen getrennte Liste oder ein Bezug auf eine einzelne Zeile oder Spalte sein",
101
96
  checkboxEqual: "Geben Sie unterschiedliche Werte für angekreuzte und nicht angekreuzte Zelleninhalte ein.",
102
- formulaError: "Der Bezugsbereich enthält unsichtbare Daten, bitte passen Sie den Bereich an",
103
97
  listIntersects: "Der ausgewählte Bereich darf sich nicht mit dem Geltungsbereich der Regeln überschneiden",
104
98
  primitive: "Formeln sind für benutzerdefinierte angekreuzte und nicht angekreuzte Werte nicht zulässig."
105
99
  },
@@ -110,28 +104,14 @@ const locale = { "sheets-data-validation": {
110
104
  list: {
111
105
  title: "Dropdown",
112
106
  name: "Wert enthält einen aus dem Bereich",
113
- error: "Eingabe muss im angegebenen Bereich liegen",
114
- emptyError: "Bitte geben Sie einen Wert ein",
115
- add: "Hinzufügen",
116
- dropdown: "Auswählen",
117
- options: "Optionen",
118
- customOptions: "Benutzerdefiniert",
119
- refOptions: "Aus einem Bereich",
120
- formulaError: "Die Listenquelle muss eine durch Trennzeichen getrennte Datenliste oder ein Bezug auf eine einzelne Zeile oder Spalte sein.",
121
- edit: "Bearbeiten"
122
- },
123
- listMultiple: {
124
- title: "Dropdown-Mehrfachauswahl",
125
- dropdown: "Mehrfachauswahl"
107
+ error: "Eingabe muss im angegebenen Bereich liegen"
126
108
  },
109
+ listMultiple: { title: "Dropdown-Mehrfachauswahl" },
127
110
  decimal: { title: "Zahl" },
128
111
  whole: { title: "Ganze Zahl" },
129
112
  checkbox: {
130
113
  title: "Kontrollkästchen",
131
- error: "Der Inhalt dieser Zelle verstößt gegen die Überprüfungsregel",
132
- tips: "Benutzerdefinierte Werte in Zellen verwenden",
133
- checked: "Ausgewählter Wert",
134
- unchecked: "Nicht ausgewählter Wert"
114
+ error: "Der Inhalt dieser Zelle verstößt gegen die Überprüfungsregel"
135
115
  }
136
116
  } };
137
117
 
@@ -24,8 +24,7 @@ const locale = { "sheets-data-validation": {
24
24
  lessThanOrEqual: "less than or equal",
25
25
  equal: "equal",
26
26
  notEqual: "not equal",
27
- notBetween: "not between",
28
- legal: "is legal type"
27
+ notBetween: "not between"
29
28
  },
30
29
  ruleName: {
31
30
  between: "Is between {FORMULA1} and {FORMULA2}",
@@ -58,8 +57,7 @@ const locale = { "sheets-data-validation": {
58
57
  lessThanOrEqual: "on or before",
59
58
  equal: "equal",
60
59
  notEqual: "not equal",
61
- notBetween: "not between",
62
- legal: "is a legal date"
60
+ notBetween: "not between"
63
61
  },
64
62
  ruleName: {
65
63
  between: "is between {FORMULA1} and {FORMULA2}",
@@ -101,20 +99,16 @@ const locale = { "sheets-data-validation": {
101
99
  custom: {
102
100
  ruleName: "Custom formula is {FORMULA1}",
103
101
  title: "Custom formula",
104
- validFail: "Please input a valid formula",
105
102
  error: "This cell's contents violate its validation rule"
106
103
  },
107
104
  validFail: {
108
105
  value: "Please input a value",
109
- common: "Please input value or formula",
110
106
  number: "Please input number or formula",
111
107
  formula: "Please input formula",
112
- integer: "Please input integer or formula",
113
108
  date: "Please input date or formula",
114
109
  list: "Please input options",
115
110
  listInvalid: "The list source must be a delimited list or a reference to a single row or column",
116
111
  checkboxEqual: "Enter different values for ticked and unticked cell contents.",
117
- formulaError: "The reference range contains invisible data, please readjust the range",
118
112
  listIntersects: "The selected range cannot intersect with the scope of the rules",
119
113
  primitive: "Formulas are not permitted for custom ticked and unticked values."
120
114
  },
@@ -125,28 +119,14 @@ const locale = { "sheets-data-validation": {
125
119
  list: {
126
120
  title: "Dropdown",
127
121
  name: "Value contains one from range",
128
- error: "Input must fall within specified range",
129
- emptyError: "Please enter a value",
130
- add: "Add",
131
- dropdown: "Select",
132
- options: "Options",
133
- customOptions: "Custom",
134
- refOptions: "From a range",
135
- formulaError: "The list source must be a delimited list of data, or a reference to a single row or column.",
136
- edit: "Edit"
137
- },
138
- listMultiple: {
139
- title: "Dropdown-Multiple",
140
- dropdown: "Multiple select"
122
+ error: "Input must fall within specified range"
141
123
  },
124
+ listMultiple: { title: "Dropdown-Multiple" },
142
125
  decimal: { title: "Number" },
143
126
  whole: { title: "Integer" },
144
127
  checkbox: {
145
128
  title: "Checkbox",
146
- error: "This cell's contents violate its validation rule",
147
- tips: "Use custom values within cells",
148
- checked: "Selected value",
149
- unchecked: "Unselected value"
129
+ error: "This cell's contents violate its validation rule"
150
130
  }
151
131
  } };
152
132