zmdms-utils 0.0.28 → 0.0.30
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/dist/es/baseUrl.js +1 -1
- package/dist/es/common.d.ts +7 -1
- package/dist/es/common.js +13 -1
- package/dist/es/node_modules/pinyin-pro/dist/index.js +12627 -0
- package/dist/es/pinyin.js +1 -0
- package/dist/es/validate.d.ts +5 -1
- package/dist/es/validate.js +5 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/package.json +5 -4
- package/src/baseUrl.ts +1 -1
- package/src/common.ts +13 -0
- package/src/index.ts +7 -0
- package/src/pinyin.ts +3 -0
- package/src/validate.ts +5 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { convert, html, match, pinyin } from './node_modules/pinyin-pro/dist/index.js';
|
package/dist/es/validate.d.ts
CHANGED
|
@@ -18,5 +18,9 @@ declare const emailValidate: {
|
|
|
18
18
|
regex: RegExp;
|
|
19
19
|
message: string;
|
|
20
20
|
};
|
|
21
|
+
declare const isChineseValidate: {
|
|
22
|
+
regex: RegExp;
|
|
23
|
+
message: string;
|
|
24
|
+
};
|
|
21
25
|
|
|
22
|
-
export { emailValidate, idCardValidate, morePhoneValidate, phoneValidate, strLenValidate };
|
|
26
|
+
export { emailValidate, idCardValidate, isChineseValidate, morePhoneValidate, phoneValidate, strLenValidate };
|
package/dist/es/validate.js
CHANGED
|
@@ -39,5 +39,9 @@ var emailValidate = {
|
|
|
39
39
|
regex: /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/,
|
|
40
40
|
message: "请输入正确的邮箱!",
|
|
41
41
|
};
|
|
42
|
+
var isChineseValidate = {
|
|
43
|
+
regex: /[\u4e00-\u9fa5]/,
|
|
44
|
+
message: "请输入中文!",
|
|
45
|
+
};
|
|
42
46
|
|
|
43
|
-
export { emailValidate, idCardValidate, morePhoneValidate, phoneValidate, strLenValidate };
|
|
47
|
+
export { emailValidate, idCardValidate, isChineseValidate, morePhoneValidate, phoneValidate, strLenValidate };
|
package/dist/index.d.ts
CHANGED
|
@@ -5,10 +5,11 @@ export { getToken, removeToken, setToken } from './es/auth.js';
|
|
|
5
5
|
export { AxiosRequest, IOptions, IOtherOptions } from './es/request.js';
|
|
6
6
|
export { getBaseUrl } from './es/baseUrl.js';
|
|
7
7
|
export { Crypto, md5 } from './es/crypto.js';
|
|
8
|
-
export { addThousedSeparator, copyToClipboard, dangerouslyXss, delay, emitter, getFileExtension, isImageExtension, isNonEmpty, parseJoin, parseQueryParams, specialString, unescapeString } from './es/common.js';
|
|
8
|
+
export { addThousedSeparator, copyToClipboard, dangerouslyXss, delay, emitter, getFileExtension, isChinese, isImageExtension, isNonEmpty, parseJoin, parseQueryParams, specialString, unescapeString } from './es/common.js';
|
|
9
9
|
export { divide, exactRound, formatUnit, minus, plus, times } from './es/math.js';
|
|
10
10
|
export { validatePassword } from './es/passwordValidate.js';
|
|
11
|
-
export { emailValidate, idCardValidate, morePhoneValidate, phoneValidate, strLenValidate } from './es/validate.js';
|
|
11
|
+
export { emailValidate, idCardValidate, isChineseValidate, morePhoneValidate, phoneValidate, strLenValidate } from './es/validate.js';
|
|
12
12
|
export { batchDownloadFiles, createDeleteFileLink, createDownloadLink, createOriginalLink, createThumbnailLink, createUploadFileLink, downloadFile, exportBolb, previewFile } from './es/file.js';
|
|
13
13
|
export { calculateAge, parseTime } from './es/parseTime.js';
|
|
14
14
|
export { EMITTER_CCP_KEY, EMITTER_PCC_KEY, EMITTER_TYPE } from './es/constants.js';
|
|
15
|
+
export { convert, html, match, pinyin } from 'pinyin-pro';
|
package/dist/index.js
CHANGED
|
@@ -5,10 +5,11 @@ export { getToken, removeToken, setToken } from './es/auth.js';
|
|
|
5
5
|
export { AxiosRequest } from './es/request.js';
|
|
6
6
|
export { getBaseUrl } from './es/baseUrl.js';
|
|
7
7
|
export { Crypto, md5 } from './es/crypto.js';
|
|
8
|
-
export { addThousedSeparator, copyToClipboard, dangerouslyXss, delay, emitter, getFileExtension, isImageExtension, isNonEmpty, parseJoin, parseQueryParams, specialString, unescapeString } from './es/common.js';
|
|
8
|
+
export { addThousedSeparator, copyToClipboard, dangerouslyXss, delay, emitter, getFileExtension, isChinese, isImageExtension, isNonEmpty, parseJoin, parseQueryParams, specialString, unescapeString } from './es/common.js';
|
|
9
9
|
export { divide, exactRound, formatUnit, minus, plus, times } from './es/math.js';
|
|
10
10
|
export { validatePassword } from './es/passwordValidate.js';
|
|
11
|
-
export { emailValidate, idCardValidate, morePhoneValidate, phoneValidate, strLenValidate } from './es/validate.js';
|
|
11
|
+
export { emailValidate, idCardValidate, isChineseValidate, morePhoneValidate, phoneValidate, strLenValidate } from './es/validate.js';
|
|
12
12
|
export { batchDownloadFiles, createDeleteFileLink, createDownloadLink, createOriginalLink, createThumbnailLink, createUploadFileLink, downloadFile, exportBolb, previewFile } from './es/file.js';
|
|
13
13
|
export { calculateAge, parseTime } from './es/parseTime.js';
|
|
14
14
|
export { EMITTER_CCP_KEY, EMITTER_PCC_KEY, EMITTER_TYPE } from './es/constants.js';
|
|
15
|
+
export { convert, html, match, pinyin } from './es/node_modules/pinyin-pro/dist/index.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "zmdms-utils",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.30",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -15,12 +15,13 @@
|
|
|
15
15
|
"peerDependencies": {
|
|
16
16
|
"axios": "^1.4.0",
|
|
17
17
|
"crypto-js": "^4.1.1",
|
|
18
|
-
"
|
|
19
|
-
"
|
|
18
|
+
"dayjs": "^1.11.7",
|
|
19
|
+
"qiankun": "^2.10.8"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
22
|
"decimal.js": "^10.4.3",
|
|
23
|
-
"mitt": "^3.0.0"
|
|
23
|
+
"mitt": "^3.0.0",
|
|
24
|
+
"pinyin-pro": "^3.18.2"
|
|
24
25
|
},
|
|
25
26
|
"devDependencies": {
|
|
26
27
|
"@rollup/plugin-commonjs": "^24.0.1",
|
package/src/baseUrl.ts
CHANGED
|
@@ -13,7 +13,7 @@ export function getBaseUrl(processObj: any) {
|
|
|
13
13
|
// file 服务器
|
|
14
14
|
const fileBaseUrlObj: any = {
|
|
15
15
|
dev: processObj.REACT_APP_FILE_DEV || "http://192.168.0.134:89",
|
|
16
|
-
test: processObj.REACT_APP_FILE_TEST || "http://
|
|
16
|
+
test: processObj.REACT_APP_FILE_TEST || "http://file.cico.com.cn:30601",
|
|
17
17
|
stage: processObj.REACT_APP_FILE_STAGE || "https://dzfile-prod.zmd.com.cn",
|
|
18
18
|
product:
|
|
19
19
|
processObj.REACT_APP_FILE_PRODUCT || "https://dzfile.zmd.com.cn:8012",
|
package/src/common.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// 基础函数
|
|
2
2
|
import mitt from "mitt";
|
|
3
|
+
import { isChineseValidate } from "./validate";
|
|
3
4
|
/**
|
|
4
5
|
* 同步阻断
|
|
5
6
|
* @param time 秒
|
|
@@ -236,3 +237,15 @@ export function parseJoin(params?: any) {
|
|
|
236
237
|
}
|
|
237
238
|
return params;
|
|
238
239
|
}
|
|
240
|
+
|
|
241
|
+
/**
|
|
242
|
+
* 判断字符串是否是中文文本
|
|
243
|
+
* @param char 字符
|
|
244
|
+
* @returns
|
|
245
|
+
*/
|
|
246
|
+
export function isChinese(char?: string) {
|
|
247
|
+
if (!char) {
|
|
248
|
+
return false;
|
|
249
|
+
}
|
|
250
|
+
return isChineseValidate.regex.test(char);
|
|
251
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -18,6 +18,7 @@ export {
|
|
|
18
18
|
specialString,
|
|
19
19
|
isNonEmpty,
|
|
20
20
|
parseJoin,
|
|
21
|
+
isChinese,
|
|
21
22
|
} from "./common";
|
|
22
23
|
export { plus, minus, times, divide, exactRound, formatUnit } from "./math";
|
|
23
24
|
export { validatePassword } from "./passwordValidate";
|
|
@@ -27,6 +28,7 @@ export {
|
|
|
27
28
|
morePhoneValidate,
|
|
28
29
|
idCardValidate,
|
|
29
30
|
emailValidate,
|
|
31
|
+
isChineseValidate,
|
|
30
32
|
} from "./validate";
|
|
31
33
|
/** 附件预览相关 */
|
|
32
34
|
export {
|
|
@@ -49,3 +51,8 @@ export { parseTime, calculateAge } from "./parseTime";
|
|
|
49
51
|
* 常量相关
|
|
50
52
|
*/
|
|
51
53
|
export { EMITTER_CCP_KEY, EMITTER_PCC_KEY, EMITTER_TYPE } from "./constants";
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 中文处理
|
|
57
|
+
*/
|
|
58
|
+
export { pinyin, match, convert, html } from "./pinyin";
|
package/src/pinyin.ts
ADDED