ztxkutils 2.10.66-4 → 2.10.66-41

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/dist/businessTools.js +4 -3
  2. package/dist/{dataModel-1fbaff40.js → dataModel-f1ef06bc.js} +4 -2
  3. package/dist/dataModel.js +2 -1
  4. package/dist/fileOperation.d.ts +19 -0
  5. package/dist/fileOperation.js +55 -17
  6. package/dist/hooks.js +35 -23
  7. package/dist/i18next.d.ts +2 -0
  8. package/dist/i18next.js +2401 -0
  9. package/dist/index.js +6 -5
  10. package/dist/myIndexDb.d.ts +1 -1
  11. package/dist/print.d.ts +2 -4
  12. package/dist/print.js +60 -12
  13. package/dist/{reqUrl-22b880a4.js → reqUrl-ea7ef876.js} +3 -2
  14. package/dist/reqUrl.js +1 -1
  15. package/dist/request-3b358860.js +2988 -0
  16. package/dist/{request-87d93572.js → request-40e9ca7b.js} +16 -8
  17. package/dist/{request-dc69f021.js → request-7bcf02f4.js} +34 -20
  18. package/dist/{request-3c906c2d.js → request-e147d640.js} +98 -23
  19. package/dist/request.d.ts +4 -0
  20. package/dist/request.js +2 -1
  21. package/dist/stompClient.js +21 -8
  22. package/dist/{tools-16a7fb45.js → tools-47b9bee7.js} +53 -1
  23. package/dist/tools.js +1 -1
  24. package/dist/useFileIdToBase64.js +1 -1
  25. package/dist/useHistory.js +7 -0
  26. package/dist/{validate-18e52490.js → validate-2138d94a.js} +29 -15
  27. package/dist/validate.d.ts +1 -0
  28. package/dist/validate.js +2 -1
  29. package/dist/workflow.js +4 -6
  30. package/locales/en-US.json +64 -0
  31. package/locales/zh-CN.json +64 -0
  32. package/package.json +41 -4
  33. package/zti18n-cli/bin/index.js +3 -0
  34. package/zti18n-cli/index.js +23 -0
  35. package/zti18n-cli/src/command/collect.js +353 -0
  36. package/zti18n-cli/src/command/convert.js +17 -0
  37. package/zti18n-cli/src/command/convert2.js +35 -0
  38. package/zti18n-cli/src/command/initFileConf.js +133 -0
  39. package/zti18n-cli/src/command/publish.js +24 -0
  40. package/zti18n-cli/src/conf/BaseConf.js +21 -0
  41. package/zti18n-cli/src/conf/FileConf.js +116 -0
  42. package/zti18n-cli/src/index.js +75 -0
  43. package/zti18n-cli/src/translate/google.js +87 -0
  44. package/zti18n-cli/src/utils/isChinese.js +3 -0
  45. package/zti18n-cli/src/utils/log.js +8 -0
  46. package/zti18n-cli/src/utils/mergeOptions.js +45 -0
  47. package/zti18n-cli/src/utils/reactOptions.js +73 -0
  48. package/zti18n-cli/src/utils/vueOptions.js +69 -0
  49. package/zti18n-core/index.js +1 -0
  50. package/zti18n-core/src/index.js +5 -0
  51. package/zti18n-core/src/plugin/reactIntlToReactIntlUniversal.js +224 -0
  52. package/zti18n-core/src/plugin/reactIntlUniversalToDi18n.js +64 -0
  53. package/zti18n-core/src/transform/defaultPkMap.js +79 -0
  54. package/zti18n-core/src/transform/transformHtml.js +271 -0
  55. package/zti18n-core/src/transform/transformJs.js +489 -0
  56. package/zti18n-core/src/transform/transformPug.js +272 -0
  57. package/zti18n-core/src/transform/transformReactIntlToReactIntlUniversal.js +96 -0
  58. package/zti18n-core/src/transform/transformReactIntlUniveralToDi18n.js +90 -0
  59. package/zti18n-core/src/transform/transformToDi18n.js +22 -0
  60. package/zti18n-core/src/transform/transformTs.js +41 -0
  61. package/zti18n-core/src/transform/transformVue.js +126 -0
  62. package/zti18n-core/src/transform/transformZeroToDi18n.js +105 -0
  63. package/zti18n-core/src/translate/google.js +6 -0
  64. package/zti18n-core/src/utils/constants.js +3 -0
  65. package/zti18n-core/src/utils/getIgnoreLines.js +14 -0
  66. package/zti18n-core/src/utils/isChinese.js +3 -0
  67. package/zti18n-core/src/utils/log.js +8 -0
package/dist/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  export { d as authority } from './authority-7a91cb9f.js';
2
- export { d as dataModel } from './dataModel-1fbaff40.js';
3
- export { t as tools } from './tools-390e3466.js';
4
- export { v as validate } from './validate-18e52490.js';
5
- export { r as request } from './request-87d93572.js';
6
- export { r as reqUrl } from './reqUrl-22b880a4.js';
2
+ export { d as dataModel } from './dataModel-f1ef06bc.js';
3
+ export { t as tools } from './tools-47b9bee7.js';
4
+ export { v as validate } from './validate-2138d94a.js';
5
+ export { r as request } from './request-3b358860.js';
6
+ export { r as reqUrl } from './reqUrl-ea7ef876.js';
7
+ import './i18next.js';
7
8
  import './tslib.es6-35653116.js';
8
9
  import 'dayjs';
9
10
  import 'axios';
@@ -1 +1 @@
1
- declare function openDB(dbName: string, version?: number): Promise<unknown>;
1
+ export {};
package/dist/print.d.ts CHANGED
@@ -66,10 +66,8 @@ export declare function htmlToPdfNoCanvas({ pageClassName, dom, isShowPage, file
66
66
  pdfName?: string;
67
67
  isDownload?: boolean;
68
68
  pdfOption?: IPdfOption;
69
- /** 是否添加水印 */
70
- isAddWater?: boolean;
71
- /** 水印base 64字符串 */
72
- waterBase64?: string;
69
+ /** 是否添加水印 */ isAddWater?: boolean;
70
+ /** 水印base 64字符串 */ waterBase64?: string;
73
71
  imgWidth?: number;
74
72
  imgHeight?: number;
75
73
  isCompress?: boolean;
package/dist/print.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { d as __spreadArray, _ as __assign, b as __awaiter, c as __generator } from './tslib.es6-35653116.js';
2
+ import instance from './i18next.js';
2
3
  import { jsPDF } from 'jspdf';
3
4
  import html2canvas from 'html2canvas';
4
5
 
@@ -57,6 +58,40 @@ function printCurrentDom(_a) {
57
58
  document.head.appendChild(styleDom);
58
59
  window.print();
59
60
  }
61
+ function getTextDimensions(text, fontSize) {
62
+ var width, height;
63
+ try {
64
+ // 创建一个临时元素
65
+ var tempElement = document.createElement('div');
66
+ // 设置元素内容为传入的文本
67
+ tempElement.textContent = text;
68
+ // 设置样式使其不可见且不影响页面布局
69
+ tempElement.style.position = 'absolute';
70
+ tempElement.style.visibility = 'hidden'; // 元素不可见但仍占据空间
71
+ tempElement.style.opacity = '0'; // 完全透明
72
+ tempElement.style.pointerEvents = 'none'; // 不响应鼠标事件
73
+ tempElement.style.whiteSpace = 'nowrap'; // 防止文本换行影响宽度测量
74
+ tempElement.style.fontSize = fontSize;
75
+ tempElement.style.fontFamily = '微软雅黑';
76
+ tempElement.style.padding = '50px 10px';
77
+ // 插入到body中
78
+ document.body.appendChild(tempElement);
79
+ // 获取元素的宽高
80
+ width = tempElement.offsetWidth;
81
+ height = tempElement.offsetHeight;
82
+ // 从DOM中移除元素
83
+ document.body.removeChild(tempElement);
84
+ }
85
+ catch (err) {
86
+ width = text.length * 22;
87
+ height = text.length * 9;
88
+ }
89
+ // 返回测量结果
90
+ return {
91
+ width: width > 520 ? 520 : width < 240 ? 240 : width,
92
+ height: height > 200 ? 200 : height < 100 ? 100 : height,
93
+ };
94
+ }
60
95
  /**
61
96
  * 创建文本水印图片
62
97
  * @param waterText 水印文本
@@ -74,17 +109,21 @@ function createWaterHandle(obj) {
74
109
  // console.log(err);
75
110
  // }
76
111
  // }
77
- var defaultWaterText = '浙商中拓';
112
+ var defaultWaterText = instance.t('浙商中拓');
78
113
  var _a = obj || {}, waterText = _a.waterText, opacity = _a.opacity, fontSize = _a.fontSize, cavansWidth = _a.cavansWidth, cavansHeight = _a.cavansHeight;
79
114
  var canvas = document.createElement('canvas');
115
+ // 如何计算水印的大小。创建一个元素插入到body中,获取到宽高后移除
116
+ var _b = getTextDimensions(waterText, fontSize || '18px'), textWidth = _b.width, textHeight = _b.height;
117
+ // 之前的宽度是文本长度 * 22
80
118
  var defaultCanvasWidth = waterText
81
119
  ? waterText.length > 10
82
- ? waterText.length * 22
120
+ ? textWidth
83
121
  : 240
84
122
  : 240;
123
+ // 之前的高度是文本长度 * 9
85
124
  var defaultCanvasHeight = waterText
86
125
  ? waterText.length > 10
87
- ? waterText.length * 9
126
+ ? textHeight
88
127
  : 100
89
128
  : 100;
90
129
  canvas.width = cavansWidth || defaultCanvasWidth;
@@ -92,7 +131,7 @@ function createWaterHandle(obj) {
92
131
  var ctx = canvas.getContext('2d');
93
132
  if (ctx) {
94
133
  ctx.rotate((-10 * Math.PI) / 180); // 水印旋转角度
95
- ctx.font = (fontSize || '18px') + " \u5FAE\u8F6F\u96C5\u9ED1";
134
+ ctx.font = instance.t('{{slot0}} 微软雅黑', { slot0: fontSize || '18px' });
96
135
  ctx.fillStyle = "rgba(0,0,0," + (opacity ? opacity : '0.07') + ")";
97
136
  ctx.textAlign = 'center';
98
137
  ctx.textBaseline = 'middle';
@@ -395,11 +434,16 @@ function htmlToPdfNoCanvas(_a) {
395
434
  windowWidth: pageWidth,
396
435
  callback: function (res) {
397
436
  // 添加呈现的HTML所需的页面(从第2页开始)
398
- for (var i_1 = 2, j = res.internal.getNumberOfPages(); i_1 <= j; i_1++) {
399
- pdf.addPage(pageFormat, pageOrient);
400
- }
401
- for (var i_2 = 1, j = res.internal.getNumberOfPages(); i_2 <= j; i_2++) {
402
- pdf.setPage(i_2);
437
+ // 注释掉这里导致多出一页空白页
438
+ // for (
439
+ // let i = 2, j = (res as any).internal.getNumberOfPages();
440
+ // i <= j;
441
+ // i++
442
+ // ) {
443
+ // pdf.addPage(pageFormat, pageOrient);
444
+ // }
445
+ for (var i_1 = 1, j = res.internal.getNumberOfPages(); i_1 <= j; i_1++) {
446
+ pdf.setPage(i_1);
403
447
  // 添加水印
404
448
  if (isAddWater) {
405
449
  setPdfWater(pdf, waterBase64, imgWidth, imgHeight);
@@ -497,9 +541,13 @@ function htmlToPdfNoCanvas(_a) {
497
541
  windowWidth: pageWidth_1,
498
542
  callback: function (res) {
499
543
  // 添加呈现的HTML所需的页面(从第2页开始)
500
- for (var i = 2, j = res.internal.getNumberOfPages(); i <= j; i++) {
501
- pdf_3.addPage(pageFormat, pageOrient);
502
- }
544
+ // for (
545
+ // let i = 2, j = (res as any).internal.getNumberOfPages();
546
+ // i <= j;
547
+ // i++
548
+ // ) {
549
+ // pdf.addPage(pageFormat, pageOrient);
550
+ // }
503
551
  for (var i = 1, j = res.internal.getNumberOfPages(); i <= j; i++) {
504
552
  pdf_3.setPage(i);
505
553
  // 添加水印
@@ -14,9 +14,10 @@ function getReqUrl(processObj) {
14
14
  'https://nportal.zmd.com.cn:18998'; // 生产环境外网api地址 https://m-portal.zmd.com.cn:18998 http://dz.zmd.com.cn:48000
15
15
  // 文件服务器
16
16
  var ZT_FILE_PREVIEW_DEV = processObj.REACT_APP_ZT_FILE_PREVIEW_DEV || 'http://192.168.0.83:88'; // 开发环境
17
- var ZT_FILE_PREVIEW_TEST = processObj.REACT_APP_ZT_FILE_PREVIEW_TEST || 'http://172.55.5.101:33013'; // 测试环境 https://192.168.0.135:18012
17
+ var ZT_FILE_PREVIEW_TEST = processObj.REACT_APP_ZT_FILE_PREVIEW_TEST ||
18
+ 'http://preview-test.zmdms.com.cn:30079'; // 测试环境 http://172.55.5.101:33013
18
19
  var ZT_FILE_PREVIEW_STAGE = processObj.REACT_APP_ZT_FILE_PREVIEW_STAGE ||
19
- 'https://dzfile-prod.zmd.com.cn/'; // 阶段性环境 http://192.168.0.134:8012
20
+ 'http://preview-stage.zmdms.com.cn:30079'; // 阶段性环境 https://dzfile-prod.zmd.com.cn/
20
21
  var ZT_FILE_PREVIEW_SIM = processObj.REACT_APP_ZT_FILE_PREVIEW_SIM ||
21
22
  'https://dzfile-data.zmd.com.cn/'; // 阶段性环境 http://192.168.0.134:8012
22
23
  var ZT_FILE_PREVIEW_PRODUCT = processObj.REACT_APP_ZT_FILE_PREVIEW_PRODUCT ||
package/dist/reqUrl.js CHANGED
@@ -1 +1 @@
1
- export { g as getReqUrl } from './reqUrl-22b880a4.js';
1
+ export { g as getReqUrl } from './reqUrl-ea7ef876.js';