fix(components): [input] unify async-validator string length calc (#16757)

fix(components): [input] unify `async-validator` character length calc
This commit is contained in:
btea 2024-05-20 12:22:56 +08:00 committed by GitHub
parent ad0cd51796
commit b1bfb9fd1b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 41 additions and 4 deletions

View File

@ -135,6 +135,9 @@
"react", "react",
"react-dom" "react-dom"
] ]
},
"patchedDependencies": {
"async-validator@4.2.5": "patches/async-validator@4.2.5.patch"
} }
}, },
"lint-staged": { "lint-staged": {

View File

@ -0,0 +1,28 @@
diff --git a/dist-node/index.js b/dist-node/index.js
index 563b966fe2b4dce9583c6d90ceb996215c1104bc..f81c89359f4566b7a1e7b6228227fc858e026670 100644
--- a/dist-node/index.js
+++ b/dist-node/index.js
@@ -564,7 +564,8 @@ var range = function range(rule, value, source, errors, options) {
if (str) {
// 处理码点大于U+010000的文字length属性不准确的bug如"𠮷𠮷𠮷".lenght !== 3
- val = value.replace(spRegexp, '_').length;
+ // val = value.replace(spRegexp, '_').length;
+ val = value.length;
}
if (len) {
diff --git a/dist-web/index.js b/dist-web/index.js
index 3bdcb3926b75854c4a9203281400376aa7ea246b..4c4e10a409d007280e6991a0021c6874e9e2a1c3 100644
--- a/dist-web/index.js
+++ b/dist-web/index.js
@@ -560,7 +560,8 @@ var range = function range(rule, value, source, errors, options) {
if (str) {
// 处理码点大于U+010000的文字length属性不准确的bug如"𠮷𠮷𠮷".lenght !== 3
- val = value.replace(spRegexp, '_').length;
+ // val = value.replace(spRegexp, '_').length;
+ val = value.length;
}
if (len) {

View File

@ -4,6 +4,11 @@ settings:
autoInstallPeers: true autoInstallPeers: true
excludeLinksFromLockfile: false excludeLinksFromLockfile: false
patchedDependencies:
async-validator@4.2.5:
hash: wdmp4xlpil2odxo3rasjmxbdfm
path: patches/async-validator@4.2.5.patch
importers: importers:
.: .:
@ -52,7 +57,7 @@ importers:
version: 9.1.0(vue@3.2.37) version: 9.1.0(vue@3.2.37)
async-validator: async-validator:
specifier: ^4.2.5 specifier: ^4.2.5
version: 4.2.5 version: 4.2.5(patch_hash=wdmp4xlpil2odxo3rasjmxbdfm)
dayjs: dayjs:
specifier: ^1.11.3 specifier: ^1.11.3
version: 1.11.3 version: 1.11.3
@ -569,7 +574,7 @@ importers:
version: 9.1.0(vue@3.2.37) version: 9.1.0(vue@3.2.37)
async-validator: async-validator:
specifier: ^4.2.5 specifier: ^4.2.5
version: 4.2.5 version: 4.2.5(patch_hash=wdmp4xlpil2odxo3rasjmxbdfm)
dayjs: dayjs:
specifier: ^1.11.3 specifier: ^1.11.3
version: 1.11.3 version: 1.11.3
@ -5820,9 +5825,10 @@ packages:
async-done: 1.3.2 async-done: 1.3.2
dev: false dev: false
/async-validator@4.2.5: /async-validator@4.2.5(patch_hash=wdmp4xlpil2odxo3rasjmxbdfm):
resolution: {integrity: sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==} resolution: {integrity: sha512-7HhHjtERjqlNbZtqNqy2rckN/SpOOlmDliet+lP7k+eKZEjPk3DgyeU9lIXLdeLz0uBbbVp+9Qdow9wJWgwwfg==}
dev: false dev: false
patched: true
/async@3.2.5: /async@3.2.5:
resolution: {integrity: sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==} resolution: {integrity: sha512-baNZyqaaLhyLVKm/DlvdW051MSgO6b8eVfIezl9E5PqWxFgzLm/wQntEW4zOytVburDEr0JlALEpdOFwvErLsg==}
@ -7279,7 +7285,7 @@ packages:
'@types/lodash': 4.14.184 '@types/lodash': 4.14.184
'@types/lodash-es': 4.17.6 '@types/lodash-es': 4.17.6
'@vueuse/core': 9.1.0(vue@3.2.37) '@vueuse/core': 9.1.0(vue@3.2.37)
async-validator: 4.2.5 async-validator: 4.2.5(patch_hash=wdmp4xlpil2odxo3rasjmxbdfm)
dayjs: 1.11.5 dayjs: 1.11.5
escape-html: 1.0.3 escape-html: 1.0.3
lodash: 4.17.21 lodash: 4.17.21