zmdms-utils 0.0.74 → 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 (84) hide show
  1. package/package.json +1 -1
  2. package/publish.py +12 -0
  3. package/src/locales/i18n.ts +18 -18
  4. package/src/locales/index.ts +8 -8
  5. package/src/locales/t-in-non-react.ts +65 -65
  6. package/src/locales/t-options.ts +24 -24
  7. package/src/locales/use-translation.ts +76 -76
  8. package/src/math.ts +6 -1
  9. package/dist/es/_virtual/_commonjsHelpers.js +0 -3
  10. package/dist/es/_virtual/_tslib.js +0 -87
  11. package/dist/es/_virtual/decimal.js +0 -7
  12. package/dist/es/_virtual/parseTimeTest.js +0 -3
  13. package/dist/es/_virtual/test.js +0 -3
  14. package/dist/es/auth.d.ts +0 -9
  15. package/dist/es/auth.js +0 -49
  16. package/dist/es/baseUrl.d.ts +0 -23
  17. package/dist/es/baseUrl.js +0 -50
  18. package/dist/es/canvas.d.ts +0 -6
  19. package/dist/es/canvas.js +0 -14
  20. package/dist/es/common.d.ts +0 -81
  21. package/dist/es/common.js +0 -304
  22. package/dist/es/constants.d.ts +0 -20
  23. package/dist/es/constants.js +0 -33
  24. package/dist/es/crypto.d.ts +0 -51
  25. package/dist/es/crypto.js +0 -97
  26. package/dist/es/file.d.ts +0 -127
  27. package/dist/es/file.js +0 -373
  28. package/dist/es/htmlToPdf.d.ts +0 -44
  29. package/dist/es/htmlToPdf.js +0 -84
  30. package/dist/es/locales/i18n.d.ts +0 -15
  31. package/dist/es/locales/t-in-non-react.d.ts +0 -17
  32. package/dist/es/locales/t-options.d.ts +0 -7
  33. package/dist/es/locales/use-translation.d.ts +0 -42
  34. package/dist/es/mainApp.d.ts +0 -36
  35. package/dist/es/mainApp.js +0 -44
  36. package/dist/es/math.d.ts +0 -29
  37. package/dist/es/math.js +0 -142
  38. package/dist/es/microAppCreator.d.ts +0 -46
  39. package/dist/es/microAppCreator.js +0 -89
  40. package/dist/es/node_modules/decimal.js/decimal.js +0 -4896
  41. package/dist/es/node_modules/decimal.js/decimal2.js +0 -4930
  42. package/dist/es/node_modules/html-parse-stringify/dist/html-parse-stringify.module.js +0 -5
  43. package/dist/es/node_modules/i18next/dist/esm/i18next.js +0 -2242
  44. package/dist/es/node_modules/js-base64/base64.js +0 -273
  45. package/dist/es/node_modules/jwt-decode/build/jwt-decode.esm.js +0 -3
  46. package/dist/es/node_modules/mitt/dist/mitt.js +0 -3
  47. package/dist/es/node_modules/pinyin-pro/dist/index.js +0 -12627
  48. package/dist/es/node_modules/react-i18next/dist/es/Trans.js +0 -47
  49. package/dist/es/node_modules/react-i18next/dist/es/TransWithoutContext.js +0 -312
  50. package/dist/es/node_modules/react-i18next/dist/es/context.js +0 -18
  51. package/dist/es/node_modules/react-i18next/dist/es/defaults.js +0 -21
  52. package/dist/es/node_modules/react-i18next/dist/es/i18nInstance.js +0 -7
  53. package/dist/es/node_modules/react-i18next/dist/es/initReactI18next.js +0 -12
  54. package/dist/es/node_modules/react-i18next/dist/es/unescape.js +0 -27
  55. package/dist/es/node_modules/react-i18next/dist/es/useTranslation.js +0 -112
  56. package/dist/es/node_modules/react-i18next/dist/es/utils.js +0 -63
  57. package/dist/es/node_modules/void-elements/index.js +0 -23
  58. package/dist/es/parseTime.d.ts +0 -29
  59. package/dist/es/parseTime.js +0 -189
  60. package/dist/es/parseTimeTest.js +0 -2
  61. package/dist/es/passwordValidate.d.ts +0 -9
  62. package/dist/es/passwordValidate.js +0 -169
  63. package/dist/es/pdf.d.ts +0 -49
  64. package/dist/es/pdf.js +0 -176
  65. package/dist/es/pinyin.js +0 -1
  66. package/dist/es/print.d.ts +0 -23
  67. package/dist/es/print.js +0 -43
  68. package/dist/es/qiankunUtils.d.ts +0 -13
  69. package/dist/es/qiankunUtils.js +0 -32
  70. package/dist/es/request.d.ts +0 -87
  71. package/dist/es/request.js +0 -308
  72. package/dist/es/src/locales/i18n.js +0 -16
  73. package/dist/es/src/locales/t-in-non-react.js +0 -54
  74. package/dist/es/src/locales/t-options.js +0 -20
  75. package/dist/es/src/locales/use-translation.js +0 -60
  76. package/dist/es/src/parseTimeTest.js +0 -288
  77. package/dist/es/src/test.js +0 -245
  78. package/dist/es/test.js +0 -2
  79. package/dist/es/validate.d.ts +0 -26
  80. package/dist/es/validate.js +0 -47
  81. package/dist/es/water.d.ts +0 -53
  82. package/dist/es/water.js +0 -88
  83. package/dist/index.d.ts +0 -26
  84. package/dist/index.js +0 -26
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,26 +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 { initLocale } from './es/locales/i18n.js';
22
- export { useTranslation } from './es/locales/use-translation.js';
23
- export { safeT } from './es/locales/t-in-non-react.js';
24
- export { Base64 } from 'js-base64';
25
- export { default as i18n } from 'i18next';
26
- export { Trans } from 'react-i18next';
package/dist/index.js DELETED
@@ -1,26 +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 { initLocale } from './es/src/locales/i18n.js';
22
- export { useTranslation } from './es/src/locales/use-translation.js';
23
- export { safeT } from './es/src/locales/t-in-non-react.js';
24
- export { Base64 } from './es/node_modules/js-base64/base64.js';
25
- export { default as i18n } from './es/node_modules/i18next/dist/esm/i18next.js';
26
- export { Trans } from './es/node_modules/react-i18next/dist/es/Trans.js';