zmdms-utils 0.0.73 → 0.0.75

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 (67) hide show
  1. package/package.json +4 -2
  2. package/publish.py +12 -0
  3. package/src/index.ts +3 -0
  4. package/src/locales/i18n.ts +18 -0
  5. package/src/locales/index.ts +8 -0
  6. package/src/locales/t-in-non-react.ts +65 -0
  7. package/src/locales/t-options.ts +24 -0
  8. package/src/locales/use-translation.ts +76 -0
  9. package/src/locales//345/244/232/350/257/255/350/250/200.md +1 -0
  10. package/src/math.ts +6 -1
  11. package/src/microAppCreator.ts +47 -8
  12. package/dist/es/_virtual/_commonjsHelpers.js +0 -3
  13. package/dist/es/_virtual/_tslib.js +0 -87
  14. package/dist/es/_virtual/decimal.js +0 -7
  15. package/dist/es/_virtual/parseTimeTest.js +0 -3
  16. package/dist/es/_virtual/test.js +0 -3
  17. package/dist/es/auth.d.ts +0 -9
  18. package/dist/es/auth.js +0 -49
  19. package/dist/es/baseUrl.d.ts +0 -23
  20. package/dist/es/baseUrl.js +0 -50
  21. package/dist/es/canvas.d.ts +0 -6
  22. package/dist/es/canvas.js +0 -14
  23. package/dist/es/common.d.ts +0 -81
  24. package/dist/es/common.js +0 -304
  25. package/dist/es/constants.d.ts +0 -20
  26. package/dist/es/constants.js +0 -33
  27. package/dist/es/crypto.d.ts +0 -51
  28. package/dist/es/crypto.js +0 -97
  29. package/dist/es/file.d.ts +0 -127
  30. package/dist/es/file.js +0 -373
  31. package/dist/es/htmlToPdf.d.ts +0 -44
  32. package/dist/es/htmlToPdf.js +0 -84
  33. package/dist/es/mainApp.d.ts +0 -36
  34. package/dist/es/mainApp.js +0 -44
  35. package/dist/es/math.d.ts +0 -29
  36. package/dist/es/math.js +0 -142
  37. package/dist/es/microAppCreator.d.ts +0 -23
  38. package/dist/es/microAppCreator.js +0 -67
  39. package/dist/es/node_modules/decimal.js/decimal.js +0 -4896
  40. package/dist/es/node_modules/decimal.js/decimal2.js +0 -4930
  41. package/dist/es/node_modules/js-base64/base64.js +0 -273
  42. package/dist/es/node_modules/jwt-decode/build/jwt-decode.esm.js +0 -3
  43. package/dist/es/node_modules/mitt/dist/mitt.js +0 -3
  44. package/dist/es/node_modules/pinyin-pro/dist/index.js +0 -12627
  45. package/dist/es/parseTime.d.ts +0 -29
  46. package/dist/es/parseTime.js +0 -189
  47. package/dist/es/parseTimeTest.js +0 -2
  48. package/dist/es/passwordValidate.d.ts +0 -9
  49. package/dist/es/passwordValidate.js +0 -169
  50. package/dist/es/pdf.d.ts +0 -49
  51. package/dist/es/pdf.js +0 -176
  52. package/dist/es/pinyin.js +0 -1
  53. package/dist/es/print.d.ts +0 -23
  54. package/dist/es/print.js +0 -43
  55. package/dist/es/qiankunUtils.d.ts +0 -13
  56. package/dist/es/qiankunUtils.js +0 -32
  57. package/dist/es/request.d.ts +0 -87
  58. package/dist/es/request.js +0 -308
  59. package/dist/es/src/parseTimeTest.js +0 -288
  60. package/dist/es/src/test.js +0 -245
  61. package/dist/es/test.js +0 -2
  62. package/dist/es/validate.d.ts +0 -26
  63. package/dist/es/validate.js +0 -47
  64. package/dist/es/water.d.ts +0 -53
  65. package/dist/es/water.js +0 -88
  66. package/dist/index.d.ts +0 -21
  67. package/dist/index.js +0 -21
package/dist/es/water.js DELETED
@@ -1,88 +0,0 @@
1
- import dayjs from 'dayjs';
2
- import { parseToken } from './auth.js';
3
-
4
- /**
5
- * 创建水印
6
- */
7
- function createWater(config) {
8
- var _a = mergeWaterConfig(config), width = _a.width, height = _a.height, rotate = _a.rotate, content = _a.content, font = _a.font, lineSpacing = _a.lineSpacing;
9
- // 创建canvas元素
10
- var canvas = document.createElement("canvas");
11
- canvas.width = width * 2;
12
- canvas.height = height * 2;
13
- var ctx = canvas.getContext("2d");
14
- if (ctx) {
15
- // 设置字体样式
16
- ctx.font = "".concat(font.fontStyle, " ").concat(font.fontWeight, " ").concat(font.fontSize, "px ").concat(font.fontFamily);
17
- ctx.fillStyle = font.color;
18
- ctx.textAlign = font.textAlign;
19
- // 绘制水印文本的函数
20
- var drawText = function (textLines, x, y) {
21
- ctx.save();
22
- ctx.translate(x, y);
23
- ctx.rotate((Math.PI / 180) * rotate);
24
- if (Array.isArray(textLines)) {
25
- // 多行文本
26
- textLines.forEach(function (line, index) {
27
- ctx.fillText(line, 0, index * (font.fontSize + lineSpacing));
28
- });
29
- }
30
- else {
31
- // 单行文本
32
- ctx.fillText(textLines, 0, 0);
33
- }
34
- ctx.restore();
35
- };
36
- // 绘制两个重叠的水印文本
37
- drawText(content, width / 2, height / 2); // 中心对齐第一个文本
38
- drawText(content, (width * 3) / 2, (height * 3) / 2); // 中心对齐第二个文本
39
- }
40
- return {
41
- imgBase64: canvas.toDataURL("image/png"),
42
- canvasWidth: canvas.width,
43
- canvasHeight: canvas.height,
44
- };
45
- }
46
- /**
47
- * 默认配置
48
- */
49
- function mergeWaterConfig(waterConfig) {
50
- var _a, _b, _c, _d, _e, _f;
51
- var defaultContent = getDefaultContent();
52
- return {
53
- width: (waterConfig === null || waterConfig === void 0 ? void 0 : waterConfig.width) || 200,
54
- height: (waterConfig === null || waterConfig === void 0 ? void 0 : waterConfig.height) || 200,
55
- rotate: (waterConfig === null || waterConfig === void 0 ? void 0 : waterConfig.rotate) || -20,
56
- zIndex: (waterConfig === null || waterConfig === void 0 ? void 0 : waterConfig.zIndex) || 10,
57
- content: (waterConfig === null || waterConfig === void 0 ? void 0 : waterConfig.content) || defaultContent,
58
- lineSpacing: 4,
59
- font: {
60
- color: ((_a = waterConfig === null || waterConfig === void 0 ? void 0 : waterConfig.font) === null || _a === void 0 ? void 0 : _a.color) || "rgba(0, 0, 0, 0.2)",
61
- fontSize: ((_b = waterConfig === null || waterConfig === void 0 ? void 0 : waterConfig.font) === null || _b === void 0 ? void 0 : _b.fontSize) || 14,
62
- fontWeight: ((_c = waterConfig === null || waterConfig === void 0 ? void 0 : waterConfig.font) === null || _c === void 0 ? void 0 : _c.fontWeight) || "normal",
63
- fontStyle: ((_d = waterConfig === null || waterConfig === void 0 ? void 0 : waterConfig.font) === null || _d === void 0 ? void 0 : _d.fontStyle) || "normal",
64
- fontFamily: ((_e = waterConfig === null || waterConfig === void 0 ? void 0 : waterConfig.font) === null || _e === void 0 ? void 0 : _e.fontFamily) || "微软雅黑",
65
- textAlign: ((_f = waterConfig === null || waterConfig === void 0 ? void 0 : waterConfig.font) === null || _f === void 0 ? void 0 : _f.textAlign) || "center",
66
- },
67
- image: waterConfig === null || waterConfig === void 0 ? void 0 : waterConfig.image,
68
- };
69
- }
70
- function getDefaultContent() {
71
- var jwtInfo = parseToken();
72
- if (typeof jwtInfo === "object" && jwtInfo != null) {
73
- var username = jwtInfo.real_name || jwtInfo.realName || "";
74
- var phone = jwtInfo.phone || "";
75
- var phoneLen = phone.length;
76
- if (phoneLen <= 4) {
77
- phone = phone;
78
- }
79
- else {
80
- phone = phone.slice(phoneLen - 4);
81
- }
82
- var time = dayjs().format("YYMMDD");
83
- return ["".concat(username, " ").concat(phone), time];
84
- }
85
- return "浙江交通集团";
86
- }
87
-
88
- export { createWater, getDefaultContent, mergeWaterConfig };
package/dist/index.d.ts DELETED
@@ -1,21 +0,0 @@
1
- export { initMicroApp } from './es/microAppCreator.js';
2
- export { getMicroUrl, isQiankun } from './es/qiankunUtils.js';
3
- export { initGlobalError, initMainApp } from './es/mainApp.js';
4
- export { getToken, parseToken, removeToken, setToken } from './es/auth.js';
5
- export { AxiosRequest, IOptions, IOtherOptions } from './es/request.js';
6
- export { getBaseUrl } from './es/baseUrl.js';
7
- export { Crypto, md5 } from './es/crypto.js';
8
- export { addThousedSeparator, appendQueryParamsToUrl, copyToClipboard, dangerouslyXss, delay, emitter, getFileExtension, isChinese, isImageExtension, isNonEmpty, parseJoin, parseQueryParams, specialString, unescapeString } from './es/common.js';
9
- export { divide, exactRound, formatUnit, minus, plus, times } from './es/math.js';
10
- export { validatePassword } from './es/passwordValidate.js';
11
- export { emailValidate, idCardValidate, isChineseValidate, morePhoneValidate, phoneValidate, strLenValidate } from './es/validate.js';
12
- export { batchDownloadFiles, createDeleteFileLink, createDownloadLink, createOriginalLink, createThumbnailLink, createUploadFileLink, downloadFile, exportBolb, previewFile } from './es/file.js';
13
- export { calculateAge, parseTime } from './es/parseTime.js';
14
- export { BASIC_KEY, EMITTER_CCP_KEY, EMITTER_PCC_KEY, EMITTER_TYPE, TOKEN_KEY } from './es/constants.js';
15
- export { convert, html, match, pinyin } from 'pinyin-pro';
16
- export { domToCanvas } from './es/canvas.js';
17
- export { imgToPdf } from './es/pdf.js';
18
- export { htmlToPdf } from './es/htmlToPdf.js';
19
- export { htmlPrint, imgPrint, pdfPrint, windowPrint } from './es/print.js';
20
- export { createWater, getDefaultContent, mergeWaterConfig } from './es/water.js';
21
- export { Base64 } from 'js-base64';
package/dist/index.js DELETED
@@ -1,21 +0,0 @@
1
- export { initMicroApp } from './es/microAppCreator.js';
2
- export { getMicroUrl, isQiankun } from './es/qiankunUtils.js';
3
- export { initGlobalError, initMainApp } from './es/mainApp.js';
4
- export { getToken, parseToken, removeToken, setToken } from './es/auth.js';
5
- export { AxiosRequest } from './es/request.js';
6
- export { getBaseUrl } from './es/baseUrl.js';
7
- export { Crypto, md5 } from './es/crypto.js';
8
- export { addThousedSeparator, appendQueryParamsToUrl, copyToClipboard, dangerouslyXss, delay, emitter, getFileExtension, isChinese, isImageExtension, isNonEmpty, parseJoin, parseQueryParams, specialString, unescapeString } from './es/common.js';
9
- export { divide, exactRound, formatUnit, minus, plus, times } from './es/math.js';
10
- export { validatePassword } from './es/passwordValidate.js';
11
- export { emailValidate, idCardValidate, isChineseValidate, morePhoneValidate, phoneValidate, strLenValidate } from './es/validate.js';
12
- export { batchDownloadFiles, createDeleteFileLink, createDownloadLink, createOriginalLink, createThumbnailLink, createUploadFileLink, downloadFile, exportBolb, previewFile } from './es/file.js';
13
- export { calculateAge, parseTime } from './es/parseTime.js';
14
- export { BASIC_KEY, EMITTER_CCP_KEY, EMITTER_PCC_KEY, EMITTER_TYPE, TOKEN_KEY } from './es/constants.js';
15
- export { convert, html, match, pinyin } from './es/node_modules/pinyin-pro/dist/index.js';
16
- export { domToCanvas } from './es/canvas.js';
17
- export { imgToPdf } from './es/pdf.js';
18
- export { htmlToPdf } from './es/htmlToPdf.js';
19
- export { htmlPrint, imgPrint, pdfPrint, windowPrint } from './es/print.js';
20
- export { createWater, getDefaultContent, mergeWaterConfig } from './es/water.js';
21
- export { Base64 } from './es/node_modules/js-base64/base64.js';