zmdms-webui 3.5.2 → 3.5.4

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 (153) hide show
  1. package/dist/es/applayout/index.css +1 -1
  2. package/dist/es/applayoutheader/setting/fullCom.js +5 -1
  3. package/dist/es/applayoutheader/setting/userInfo.js +9 -5
  4. package/dist/es/applayoutheader/setting/userInfoModal.js +18 -12
  5. package/dist/es/applayoutheader/setting/userPwdModal.js +19 -13
  6. package/dist/es/applayoutheader/tabs/index.js +10 -6
  7. package/dist/es/applayoutsider/menu/Logo.js +5 -1
  8. package/dist/es/applayoutsider/menu/SearchInput.js +6 -2
  9. package/dist/es/applayoutsider/menu/SubMenu.js +6 -2
  10. package/dist/es/asyncdynamicsetting/asyncDynamicDrawer.js +2 -0
  11. package/dist/es/asyncdynamicsetting/useAsyncDrawer.js +2 -0
  12. package/dist/es/button/button.js +4 -2
  13. package/dist/es/button/buttonDownload.js +6 -4
  14. package/dist/es/button/buttonExport.js +8 -4
  15. package/dist/es/button/buttonPreview.js +6 -3
  16. package/dist/es/canvastable/canvasTable.js +46 -29
  17. package/dist/es/canvastable/components/CanvasTableMenu.js +5 -1
  18. package/dist/es/canvastable/components/FilterPopover.js +15 -11
  19. package/dist/es/canvastable/hooks/useProcessedColumns.js +7 -2
  20. package/dist/es/canvastable/hooks/useSelectionSnapshot.js +115 -0
  21. package/dist/es/canvastable/hooks/useSummaryRow.js +6 -2
  22. package/dist/es/canvastable/hooks/useTableRender.js +5 -1
  23. package/dist/es/canvastable/interface.d.ts +29 -1
  24. package/dist/es/chatroom/chat-room.js +8 -3
  25. package/dist/es/config/i18n/en/appLayoutHeader.js +70 -0
  26. package/dist/es/config/i18n/en/appLayoutSider.js +14 -0
  27. package/dist/es/config/i18n/en/asyncDynamicSetting.js +42 -0
  28. package/dist/es/config/i18n/en/authLoading.js +6 -0
  29. package/dist/es/config/i18n/en/button.js +14 -0
  30. package/dist/es/config/i18n/en/canvasTable.js +50 -0
  31. package/dist/es/config/i18n/en/chatRoom.js +14 -0
  32. package/dist/es/config/i18n/en/datePicker.js +22 -0
  33. package/dist/es/config/i18n/en/detailList.js +6 -0
  34. package/dist/es/config/i18n/en/differences.js +6 -0
  35. package/dist/es/config/i18n/en/dynamicSetting.js +72 -0
  36. package/dist/es/config/i18n/en/electronSignatures.js +173 -0
  37. package/dist/es/config/i18n/en/enhanceSelect.js +8 -0
  38. package/dist/es/config/i18n/en/footer.js +8 -0
  39. package/dist/es/config/i18n/en/form.js +26 -0
  40. package/dist/es/config/i18n/en/formItem.js +8 -0
  41. package/dist/es/config/i18n/en/inputNumber.js +7 -0
  42. package/dist/es/config/i18n/en/login.js +76 -0
  43. package/dist/es/config/i18n/en/modal.js +8 -0
  44. package/dist/es/config/i18n/en/notAuthPage.js +8 -0
  45. package/dist/es/config/i18n/en/notRoutePage.js +8 -0
  46. package/dist/es/config/i18n/en/operationBtn.js +10 -0
  47. package/dist/es/config/i18n/en/print.js +16 -0
  48. package/dist/es/config/i18n/en/select.js +6 -0
  49. package/dist/es/config/i18n/en/table.js +65 -0
  50. package/dist/es/config/i18n/en/tabs.js +10 -0
  51. package/dist/es/config/i18n/en/translationButton.js +26 -0
  52. package/dist/es/config/i18n/en/tree.js +6 -0
  53. package/dist/es/config/i18n/en/uploadList.js +82 -0
  54. package/dist/es/config/i18n/en/ztTransfer.js +14 -0
  55. package/dist/es/config/i18n/en.js +65 -1
  56. package/dist/es/config/i18n/i18nInstance.js +33 -0
  57. package/dist/es/config/i18n/zh_cn/appLayoutHeader.js +70 -0
  58. package/dist/es/config/i18n/zh_cn/appLayoutSider.js +14 -0
  59. package/dist/es/config/i18n/zh_cn/asyncDynamicSetting.js +42 -0
  60. package/dist/es/config/i18n/zh_cn/authLoading.js +6 -0
  61. package/dist/es/config/i18n/zh_cn/button.js +14 -0
  62. package/dist/es/config/i18n/zh_cn/canvasTable.js +50 -0
  63. package/dist/es/config/i18n/zh_cn/chatRoom.js +14 -0
  64. package/dist/es/config/i18n/zh_cn/datePicker.js +22 -0
  65. package/dist/es/config/i18n/zh_cn/detailList.js +6 -0
  66. package/dist/es/config/i18n/zh_cn/differences.js +6 -0
  67. package/dist/es/config/i18n/zh_cn/dynamicSetting.js +72 -0
  68. package/dist/es/config/i18n/zh_cn/electronSignatures.js +342 -0
  69. package/dist/es/config/i18n/zh_cn/enhanceSelect.js +8 -0
  70. package/dist/es/config/i18n/zh_cn/footer.js +8 -0
  71. package/dist/es/config/i18n/zh_cn/form.js +26 -0
  72. package/dist/es/config/i18n/zh_cn/formItem.js +8 -0
  73. package/dist/es/config/i18n/zh_cn/inputNumber.js +7 -0
  74. package/dist/es/config/i18n/zh_cn/login.js +76 -0
  75. package/dist/es/config/i18n/zh_cn/modal.js +8 -0
  76. package/dist/es/config/i18n/zh_cn/notAuthPage.js +8 -0
  77. package/dist/es/config/i18n/zh_cn/notRoutePage.js +8 -0
  78. package/dist/es/config/i18n/zh_cn/operationBtn.js +10 -0
  79. package/dist/es/config/i18n/zh_cn/print.js +16 -0
  80. package/dist/es/config/i18n/zh_cn/select.js +6 -0
  81. package/dist/es/config/i18n/zh_cn/table.js +65 -0
  82. package/dist/es/config/i18n/zh_cn/tabs.js +10 -0
  83. package/dist/es/config/i18n/zh_cn/translationButton.js +26 -0
  84. package/dist/es/config/i18n/zh_cn/tree.js +6 -0
  85. package/dist/es/config/i18n/zh_cn/uploadList.js +82 -0
  86. package/dist/es/config/i18n/zh_cn/ztTransfer.js +14 -0
  87. package/dist/es/config/i18n/zh_cn.d.ts +538 -0
  88. package/dist/es/config/i18n/zh_cn.js +65 -1
  89. package/dist/es/config/index.js +1 -1
  90. package/dist/es/config/useLocale.d.ts +560 -0
  91. package/dist/es/config/useLocale.js +41 -8
  92. package/dist/es/datepicker/index.js +9 -3
  93. package/dist/es/datepicker/utils.js +32 -26
  94. package/dist/es/detaillist/item.js +7 -2
  95. package/dist/es/detaillist/list.js +2 -0
  96. package/dist/es/differences/differences.js +8 -1
  97. package/dist/es/dynamicsetting/dynamicDrawer.js +41 -24
  98. package/dist/es/dynamicsetting/hooks.js +2 -0
  99. package/dist/es/dynamicsetting/moreConfig.js +6 -2
  100. package/dist/es/dynamicsetting/useSearch.js +5 -1
  101. package/dist/es/dynamicsetting/useTemplate.js +19 -15
  102. package/dist/es/electronsignatures/content.js +52 -31
  103. package/dist/es/electronsignatures/filecomponents/file-upload.js +2 -0
  104. package/dist/es/electronsignatures/filecomponents/useFetchFileTypeData.js +2 -0
  105. package/dist/es/enhanceselect/enhance-select.js +7 -3
  106. package/dist/es/enhanceselect/list-query.js +2 -0
  107. package/dist/es/enhanceselect/page-query.js +2 -0
  108. package/dist/es/form/common-search-list.js +7 -2
  109. package/dist/es/form/form.js +9 -5
  110. package/dist/es/form/resetButton.js +16 -11
  111. package/dist/es/form/useCommonSearch.js +12 -9
  112. package/dist/es/formitem/formItem.js +4 -2
  113. package/dist/es/inputnumber/inputNumber.js +11 -2
  114. package/dist/es/inputnumber/utils.js +41 -8
  115. package/dist/es/login/forget-password.js +9 -5
  116. package/dist/es/login/index.js +12 -8
  117. package/dist/es/modal/modal.js +6 -2
  118. package/dist/es/operationbtn/operationBtn.js +5 -3
  119. package/dist/es/select/hooks.js +5 -1
  120. package/dist/es/table/components/ColumnAddDel.js +11 -5
  121. package/dist/es/table/components/EnhanceBodyCell.js +7 -5
  122. package/dist/es/table/components/FilterDropdown.js +7 -3
  123. package/dist/es/table/components/SortTitle.js +8 -4
  124. package/dist/es/table/components/TableMenu.js +5 -1
  125. package/dist/es/table/components/TitleOperation.js +5 -1
  126. package/dist/es/table/components/table-header-operation/FillDown.js +7 -3
  127. package/dist/es/table/excel.js +8 -4
  128. package/dist/es/table/hooks/useSelectSubtotal.js +8 -1
  129. package/dist/es/table/table.js +6 -4
  130. package/dist/es/table/useColumns.js +8 -4
  131. package/dist/es/table/useSummary.js +6 -2
  132. package/dist/es/table/useTableValidate.js +39 -7
  133. package/dist/es/table/utils.js +10 -5
  134. package/dist/es/tabs/tab-type.js +10 -1
  135. package/dist/es/title/title.js +2 -0
  136. package/dist/es/translationbutton/DownFile.js +8 -4
  137. package/dist/es/translationbutton/PreviewFile.js +5 -3
  138. package/dist/es/translationbutton/hooks.js +5 -1
  139. package/dist/es/translationbutton/translationButton.js +15 -12
  140. package/dist/es/tree/tree.js +8 -2
  141. package/dist/es/uploadlist/hooks.js +17 -11
  142. package/dist/es/uploadlist/uploadList.js +39 -26
  143. package/dist/es/uploadlist/uploadListDetail.js +15 -11
  144. package/dist/es/uploadlist/uploadTable.js +23 -19
  145. package/dist/es/uploadlist/utils.js +8 -1
  146. package/dist/es/zttransfer/Container.js +5 -1
  147. package/dist/es/zttransfer/SelectContainer.js +5 -1
  148. package/dist/es/zttransfer/zt-transfer.js +5 -1
  149. package/dist/index.build.d.ts +2 -1
  150. package/dist/index.dark.css +2 -2
  151. package/dist/index.default.css +2 -2
  152. package/dist/index.es.js +1 -0
  153. package/package.json +6 -3
@@ -4,6 +4,9 @@ import { flushSync } from 'react-dom';
4
4
  import { getFileExtension, isImageExtension, createDownloadLink, createUploadFileLink, TOKEN_KEY, getPreToken, exactRound, times, divide } from 'zmdms-utils';
5
5
  import MemoUploadList from './uploadList.js';
6
6
  import { useLatest } from 'ahooks';
7
+ import useLocale, { formatLocaleText, getLocale } from '../config/useLocale.js';
8
+ import '../config/ZtxkContext.js';
9
+ import '../config/MyStorage.js';
7
10
  import myMessage from '../message/index.js';
8
11
 
9
12
  // 默认限制的文件类型
@@ -14,6 +17,7 @@ var NO_ACCEPT = ["exe"];
14
17
  function useBeforeUpload(props) {
15
18
  var acceptList = props.acceptList, maxSize = props.maxSize, maxSizeStr = props.maxSizeStr, beforeUpload = props.beforeUpload, isImage = props.isImage, disAllowDuplicateFile = props.disAllowDuplicateFile, fileList = props.fileList;
16
19
  var fileListRef = useLatest(fileList);
20
+ var locale = useLocale().UploadList;
17
21
  return useCallback(function (file, fileList) {
18
22
  var _a, _b;
19
23
  var fileName = file.name, fileSize = file.size;
@@ -27,16 +31,16 @@ function useBeforeUpload(props) {
27
31
  }
28
32
  if (disAllowDuplicateFile &&
29
33
  ((_b = (_a = fileListRef.current) === null || _a === void 0 ? void 0 : _a.find) === null || _b === void 0 ? void 0 : _b.call(_a, function (item) { return item.name === fileName || item.attachName === fileName; }))) {
30
- myMessage.warning("不能上传同名附件!");
34
+ myMessage.warning(locale.duplicateFileWarning);
31
35
  return MemoUploadList.LIST_IGNORE;
32
36
  }
33
37
  // 文件大小
34
38
  if (fileSize === 0) {
35
- myMessage.warning("不能上传空文件!");
39
+ myMessage.warning(locale.emptyFileWarning);
36
40
  return MemoUploadList.LIST_IGNORE;
37
41
  }
38
42
  if (isImage && !isImageExtension(fileExtension)) {
39
- myMessage.warning("不能上传非图片格式的文件!");
43
+ myMessage.warning(locale.nonImageFileWarning);
40
44
  return MemoUploadList.LIST_IGNORE;
41
45
  }
42
46
  // 获取支持的附件类型
@@ -44,16 +48,16 @@ function useBeforeUpload(props) {
44
48
  ACCEPT = ACCEPT.map(function (a) { return a.toLowerCase(); });
45
49
  // 默认支持任何格式的文件,但是不支持exe
46
50
  if (ACCEPT.length > 0 && !ACCEPT.includes(fileExtension)) {
47
- myMessage.warning("\u4E0D\u652F\u6301 ".concat(fileExtension, " \u6587\u4EF6\u683C\u5F0F"));
51
+ myMessage.warning(formatLocaleText(locale.unsupportedFormat, { ext: fileExtension }));
48
52
  return MemoUploadList.LIST_IGNORE;
49
53
  }
50
54
  if (ACCEPT.length === 0 && NO_ACCEPT.includes(fileExtension)) {
51
- myMessage.warning("\u4E0D\u652F\u6301 ".concat(fileExtension, " \u6587\u4EF6\u683C\u5F0F"));
55
+ myMessage.warning(formatLocaleText(locale.unsupportedFormat, { ext: fileExtension }));
52
56
  return MemoUploadList.LIST_IGNORE;
53
57
  }
54
58
  // 文件大小限制
55
59
  if (maxSize && fileSize > maxSize) {
56
- myMessage.warning("\u6587\u4EF6\u8D85\u51FA ".concat(maxSizeStr, "\uFF01"));
60
+ myMessage.warning(formatLocaleText(locale.fileSizeExceeded, { size: maxSizeStr }));
57
61
  return MemoUploadList.LIST_IGNORE;
58
62
  }
59
63
  return Promise.resolve(file);
@@ -65,6 +69,7 @@ function useBeforeUpload(props) {
65
69
  isImage,
66
70
  fileListRef,
67
71
  disAllowDuplicateFile,
72
+ locale,
68
73
  ]);
69
74
  }
70
75
  // 上传成功的状态
@@ -306,10 +311,11 @@ function useUploadTableData(props) {
306
311
  */
307
312
  function uploadFile(props) {
308
313
  return __awaiter(this, void 0, void 0, function () {
309
- var action, data, headers, file, _a, method, onProgress;
314
+ var action, data, headers, file, _a, method, onProgress, locale;
310
315
  var _this = this;
311
316
  return __generator(this, function (_b) {
312
317
  action = props.action, data = props.data, headers = props.headers, file = props.file, _a = props.method, method = _a === void 0 ? "POST" : _a, onProgress = props.onProgress;
318
+ locale = getLocale().UploadList;
313
319
  if (!action) {
314
320
  return [2 /*return*/, null];
315
321
  }
@@ -343,7 +349,7 @@ function uploadFile(props) {
343
349
  if (xhr.status === 200) {
344
350
  var response = JSON.parse(xhr.responseText);
345
351
  if (!response) {
346
- myMessage.warning("文件上传失败!");
352
+ myMessage.warning(locale.uploadFailed);
347
353
  }
348
354
  var code = response.code, data_1 = response.data, msg = response.msg;
349
355
  if (code === 200) {
@@ -351,16 +357,16 @@ function uploadFile(props) {
351
357
  }
352
358
  else {
353
359
  reject();
354
- myMessage.warning(msg || "文件上传失败!");
360
+ myMessage.warning(msg || locale.uploadFailed);
355
361
  }
356
362
  }
357
363
  else {
358
364
  try {
359
365
  var result = xhr.response
360
366
  ? JSON.parse(xhr.response)
361
- : { msg: "文件上传失败,请检查网络!" };
367
+ : { msg: locale.uploadFailedNetwork };
362
368
  reject();
363
- myMessage.warning(result.msg || "文件上传失败!");
369
+ myMessage.warning(result.msg || locale.uploadFailed);
364
370
  }
365
371
  catch (err) {
366
372
  reject();
@@ -11,8 +11,9 @@ import ImgCrop from '../node_modules/antd-img-crop/dist/antd-img-crop.esm.js';
11
11
  import { getField, useBeforeUpload, useOnChange, useBasicInfo, useUploadTableData } from './hooks.js';
12
12
  import { MAX_PREVIEW_SIZE } from '../config/constant.js';
13
13
  import { toPreviewFile } from './utils.js';
14
- import '../config/ZtxkContext.js';
14
+ import useLocale, { formatLocaleText } from '../config/useLocale.js';
15
15
  import useBaseContext from '../config/useBaseContext.js';
16
+ import '../config/ZtxkContext.js';
16
17
  import '../config/MyStorage.js';
17
18
  import { getFinalValue } from '../config/utils.js';
18
19
  import LoadingOutlined from '../node_modules/@ant-design/icons/es/icons/LoadingOutlined.js';
@@ -34,8 +35,11 @@ var MAXSIZE = 104857600; // 100 * 1024 * 1024
34
35
  */
35
36
  var UploadList = function (props, ref) {
36
37
  var _a;
37
- var children = props.children, btnText = props.btnText, className = props.className, _b = props.showTip, showTip = _b === void 0 ? true : _b, _c = props.maxSize, maxSize = _c === void 0 ? MAXSIZE : _c, showTable = props.showTable, acceptList = props.acceptList, beforeUpload = props.beforeUpload, onChange = props.onChange, PROPS_API_BASEURL = props.API_BASEURL, PROPS_FILE_API_BASEURL = props.FILE_API_BASEURL, action = props.action, headers = props.headers, data = props.data, userName = props.userName, fileList = props.fileList, isPublic = props.isPublic, _d = props.maxPreviewSize, maxPreviewSize = _d === void 0 ? MAX_PREVIEW_SIZE : _d, isPreview = props.isPreview, isDownload = props.isDownload, isDelete = props.isDelete, _e = props.filePreview, filePreview = _e === void 0 ? true : _e, _f = props.zipName, zipName = _f === void 0 ? "\u6279\u91CF\u4E0B\u8F7D-".concat(Date.now(), ".zip") : _f, isImage = props.isImage, _g = props.isImageCrop, isImageCrop = _g === void 0 ? true : _g, imgCropProps = props.imgCropProps, _h = props.imgWidth, imgWidth = _h === void 0 ? 110 : _h, _j = props.imgHeight, imgHeight = _j === void 0 ? 110 : _j, customRenderBtn = props.customRenderBtn, disAllowDuplicateFile = props.disAllowDuplicateFile, fieldNames = props.fieldNames, tableColumns = props.tableColumns, onBeforeDownloadValidate = props.onBeforeDownloadValidate, onBeforePreviewValidate = props.onBeforePreviewValidate, onBeforeDeleteValidate = props.onBeforeDeleteValidate, isImgPreview = props.isImgPreview, isTranslation = props.isTranslation, renderTableOperationColumn = props.renderTableOperationColumn, renderDetailPrepend = props.renderDetailPrepend, textItemRender = props.textItemRender, showFileSize = props.showFileSize, customItemRender = props.itemRender, resetProps = __rest(props, ["children", "btnText", "className", "showTip", "maxSize", "showTable", "acceptList", "beforeUpload", "onChange", "API_BASEURL", "FILE_API_BASEURL", "action", "headers", "data", "userName", "fileList", "isPublic", "maxPreviewSize", "isPreview", "isDownload", "isDelete", "filePreview", "zipName", "isImage", "isImageCrop", "imgCropProps", "imgWidth", "imgHeight", "customRenderBtn", "disAllowDuplicateFile", "fieldNames", "tableColumns", "onBeforeDownloadValidate", "onBeforePreviewValidate", "onBeforeDeleteValidate", "isImgPreview", "isTranslation", "renderTableOperationColumn", "renderDetailPrepend", "textItemRender", "showFileSize", "itemRender"]);
38
- var _k = useBaseContext(), apiBaseUrl = _k.apiBaseUrl, fileBaseUrl = _k.fileBaseUrl, enableTranslationButton = _k.enableTranslationButton, fileListRequestHeaders = _k.fileListRequestHeaders, isUIWeeklyReview = _k.isUIWeeklyReview, enableUploadListTextItemRender = _k.enableUploadListTextItemRender, enableUploadListFileSize = _k.enableUploadListFileSize;
38
+ var children = props.children, btnText = props.btnText, className = props.className, _b = props.showTip, showTip = _b === void 0 ? true : _b, _c = props.maxSize, maxSize = _c === void 0 ? MAXSIZE : _c, showTable = props.showTable, acceptList = props.acceptList, beforeUpload = props.beforeUpload, onChange = props.onChange, PROPS_API_BASEURL = props.API_BASEURL, PROPS_FILE_API_BASEURL = props.FILE_API_BASEURL, action = props.action, headers = props.headers, data = props.data, userName = props.userName, fileList = props.fileList, isPublic = props.isPublic, _d = props.maxPreviewSize, maxPreviewSize = _d === void 0 ? MAX_PREVIEW_SIZE : _d, isPreview = props.isPreview, isDownload = props.isDownload, isDelete = props.isDelete, _e = props.filePreview, filePreview = _e === void 0 ? true : _e, zipName = props.zipName, isImage = props.isImage, _f = props.isImageCrop, isImageCrop = _f === void 0 ? true : _f, imgCropProps = props.imgCropProps, _g = props.imgWidth, imgWidth = _g === void 0 ? 110 : _g, _h = props.imgHeight, imgHeight = _h === void 0 ? 110 : _h, customRenderBtn = props.customRenderBtn, disAllowDuplicateFile = props.disAllowDuplicateFile, fieldNames = props.fieldNames, tableColumns = props.tableColumns, onBeforeDownloadValidate = props.onBeforeDownloadValidate, onBeforePreviewValidate = props.onBeforePreviewValidate, onBeforeDeleteValidate = props.onBeforeDeleteValidate, isImgPreview = props.isImgPreview, isTranslation = props.isTranslation, renderTableOperationColumn = props.renderTableOperationColumn, renderDetailPrepend = props.renderDetailPrepend, textItemRender = props.textItemRender, showFileSize = props.showFileSize, customItemRender = props.itemRender, resetProps = __rest(props, ["children", "btnText", "className", "showTip", "maxSize", "showTable", "acceptList", "beforeUpload", "onChange", "API_BASEURL", "FILE_API_BASEURL", "action", "headers", "data", "userName", "fileList", "isPublic", "maxPreviewSize", "isPreview", "isDownload", "isDelete", "filePreview", "zipName", "isImage", "isImageCrop", "imgCropProps", "imgWidth", "imgHeight", "customRenderBtn", "disAllowDuplicateFile", "fieldNames", "tableColumns", "onBeforeDownloadValidate", "onBeforePreviewValidate", "onBeforeDeleteValidate", "isImgPreview", "isTranslation", "renderTableOperationColumn", "renderDetailPrepend", "textItemRender", "showFileSize", "itemRender"]);
39
+ var _j = useBaseContext(), apiBaseUrl = _j.apiBaseUrl, fileBaseUrl = _j.fileBaseUrl, enableTranslationButton = _j.enableTranslationButton, fileListRequestHeaders = _j.fileListRequestHeaders, isUIWeeklyReview = _j.isUIWeeklyReview, enableUploadListTextItemRender = _j.enableUploadListTextItemRender, enableUploadListFileSize = _j.enableUploadListFileSize;
40
+ var locale = useLocale().UploadList;
41
+ // 批量下载的zip包名 未传时用语言包兜底
42
+ var finalZipName = zipName || "".concat(locale.batchDownload, "-").concat(Date.now(), ".zip");
39
43
  // 翻译按钮是否显示
40
44
  var isTranslationButton = getFinalValue(enableTranslationButton, isTranslation);
41
45
  // 列表项渲染:组件级 props 优先,否则取全局值
@@ -50,7 +54,7 @@ var UploadList = function (props, ref) {
50
54
  var tableRef = useRef({});
51
55
  var modalRef = useRef({});
52
56
  var imgCropModalRef = useRef();
53
- var _l = useState(), imgSrc = _l[0], setImgSrc = _l[1];
57
+ var _k = useState(), imgSrc = _k[0], setImgSrc = _k[1];
54
58
  useEffect(function () {
55
59
  if (!isImage) {
56
60
  return;
@@ -83,7 +87,7 @@ var UploadList = function (props, ref) {
83
87
  fileList: fileList,
84
88
  });
85
89
  // 文件改变逻辑
86
- var _m = useOnChange({
90
+ var _l = useOnChange({
87
91
  onChange: onChange,
88
92
  userName: userName,
89
93
  fileList: fileList,
@@ -92,16 +96,16 @@ var UploadList = function (props, ref) {
92
96
  API_BASEURL: API_BASEURL,
93
97
  newFieldNames: newFieldNames,
94
98
  listType: listType,
95
- }), onChangeHandle = _m.onChangeHandle, innerFileList = _m.innerFileList, setInnerFileList = _m.setInnerFileList;
99
+ }), onChangeHandle = _l.onChangeHandle, innerFileList = _l.innerFileList, setInnerFileList = _l.setInnerFileList;
96
100
  // 基础参数
97
- var _o = useBasicInfo({
101
+ var _m = useBasicInfo({
98
102
  action: action,
99
103
  API_BASEURL: API_BASEURL,
100
104
  headers: headers,
101
105
  data: data,
102
106
  isPublic: isPublic,
103
107
  fileListRequestHeaders: fileListRequestHeaders,
104
- }), fileAction = _o.fileAction, fileHeaders = _o.fileHeaders, fileData = _o.fileData;
108
+ }), fileAction = _m.fileAction, fileHeaders = _m.fileHeaders, fileData = _m.fileData;
105
109
  // 表格需要的附件列表数据
106
110
  var uploadTableData = useUploadTableData({
107
111
  fileList: innerFileList,
@@ -117,7 +121,7 @@ var UploadList = function (props, ref) {
117
121
  case 0:
118
122
  checked = (_b = (_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.getChecked) === null || _b === void 0 ? void 0 : _b.call(_a);
119
123
  if (!checked || checked.length === 0) {
120
- myMessage.info("请选择需要操作的数据!");
124
+ myMessage.info(locale.selectDataFirst);
121
125
  return [2 /*return*/];
122
126
  }
123
127
  if (!onBeforeDeleteValidate) return [3 /*break*/, 4];
@@ -157,7 +161,7 @@ var UploadList = function (props, ref) {
157
161
  case 0:
158
162
  checked = (_b = (_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.getChecked) === null || _b === void 0 ? void 0 : _b.call(_a);
159
163
  if (!checked || checked.length === 0) {
160
- myMessage.info("请选择需要操作的数据!");
164
+ myMessage.info(locale.selectDataFirst);
161
165
  return [2 /*return*/];
162
166
  }
163
167
  (_c = tableRef.current) === null || _c === void 0 ? void 0 : _c.setLoading(true);
@@ -184,7 +188,7 @@ var UploadList = function (props, ref) {
184
188
  _h.trys.push([5, 7, , 8]);
185
189
  return [4 /*yield*/, batchDownloadFiles(checked, {
186
190
  API_BASEURL: API_BASEURL,
187
- zipName: zipName,
191
+ zipName: finalZipName,
188
192
  parseErrorBlob: true,
189
193
  })];
190
194
  case 6:
@@ -193,7 +197,7 @@ var UploadList = function (props, ref) {
193
197
  return [3 /*break*/, 8];
194
198
  case 7:
195
199
  err_3 = _h.sent();
196
- myMessage.error((err_3 === null || err_3 === void 0 ? void 0 : err_3.msg) || "批量下载失败!");
200
+ myMessage.error((err_3 === null || err_3 === void 0 ? void 0 : err_3.msg) || locale.batchDownloadFailed);
197
201
  (_g = tableRef.current) === null || _g === void 0 ? void 0 : _g.setLoading(false);
198
202
  return [3 /*break*/, 8];
199
203
  case 8: return [3 /*break*/, 10];
@@ -211,7 +215,7 @@ var UploadList = function (props, ref) {
211
215
  .catch(function (err) {
212
216
  var _a;
213
217
  console.log(err);
214
- myMessage.error((err === null || err === void 0 ? void 0 : err.msg) || "下载失败!");
218
+ myMessage.error((err === null || err === void 0 ? void 0 : err.msg) || locale.downloadFailed);
215
219
  (_a = tableRef.current) === null || _a === void 0 ? void 0 : _a.setLoading(false);
216
220
  });
217
221
  });
@@ -283,7 +287,7 @@ var UploadList = function (props, ref) {
283
287
  case 3:
284
288
  err_4 = _a.sent();
285
289
  console.log(err_4);
286
- myMessage.error((err_4 === null || err_4 === void 0 ? void 0 : err_4.msg) || "下载失败!");
290
+ myMessage.error((err_4 === null || err_4 === void 0 ? void 0 : err_4.msg) || locale.downloadFailed);
287
291
  endCallback();
288
292
  return [3 /*break*/, 4];
289
293
  case 4: return [2 /*return*/];
@@ -329,28 +333,31 @@ var UploadList = function (props, ref) {
329
333
  }, title: isError ? undefined : fileName }, { children: [jsx("span", __assign({ className: "ztxk-upload--text-item__name-body" }, { children: nameBody })), nameExt ? (jsx("span", __assign({ className: "ztxk-upload--text-item__name-ext" }, { children: nameExt }))) : null] })));
330
334
  return (jsxs("span", __assign({ className: classNames("ztxk-upload--text-item", {
331
335
  "is-error": isError,
332
- }) }, { children: [jsx("span", __assign({ className: "ztxk-upload--text-item__icon" }, { children: jsx(PaperClipOutlined, {}) })), isError ? (jsx(Tooltip, __assign({ title: "\u4E0A\u4F20\u5931\u8D25" }, { children: nameEl }))) : (nameEl), finalShowFileSize !== false && fileSize != null ? (jsx("span", __assign({ className: "ztxk-upload--text-item__size" }, { children: formatUnit(fileSize) }))) : null, jsxs("span", __assign({ className: "ztxk-upload--text-item__actions" }, { children: [renderDetailPrepend
336
+ }) }, { children: [jsx("span", __assign({ className: "ztxk-upload--text-item__icon" }, { children: jsx(PaperClipOutlined, {}) })), isError ? (jsx(Tooltip, __assign({ title: locale.uploadFailedTip }, { children: nameEl }))) : (nameEl), finalShowFileSize !== false && fileSize != null ? (jsx("span", __assign({ className: "ztxk-upload--text-item__size" }, { children: formatUnit(fileSize) }))) : null, jsxs("span", __assign({ className: "ztxk-upload--text-item__actions" }, { children: [renderDetailPrepend
333
337
  ? renderDetailPrepend(file, fileList.indexOf(file))
334
- : null, isDownload && !isError ? (jsx(ButtonCom, __assign({ type: "link", size: "small", className: "ztxk-upload--text-item__download", onClick: function () { return actions.download(); } }, { children: "\u4E0B\u8F7D" }))) : null, isDelete ? (jsx(ButtonCom, __assign({ type: "link", size: "small", danger: true, className: "ztxk-upload--text-item__delete", onClick: function () { return actions.remove(); } }, { children: "\u5220\u9664" }))) : null] }))] })));
338
+ : null, isDownload && !isError ? (jsx(ButtonCom, __assign({ type: "link", size: "small", className: "ztxk-upload--text-item__download", onClick: function () { return actions.download(); } }, { children: locale.download }))) : null, isDelete ? (jsx(ButtonCom, __assign({ type: "link", size: "small", danger: true, className: "ztxk-upload--text-item__delete", onClick: function () { return actions.remove(); } }, { children: locale.delete }))) : null] }))] })));
335
339
  }, [
336
340
  filePreview,
337
341
  isDownload,
338
342
  isDelete,
339
343
  finalShowFileSize,
340
344
  renderDetailPrepend,
345
+ locale,
341
346
  ]);
342
347
  // 上传子元素
343
348
  var uploadBtn = (jsx(Upload, __assign({ showUploadList: showUploadListMemo, multiple: maxCount === 1 ? false : true, beforeUpload: beforeUploadHandle, onChange: onChangeHandle, action: fileAction, headers: fileHeaders, data: fileData, fileList: innerFileList, onPreview: onPreview, onDownload: onDownload }, resetProps, { itemRender: !showTable &&
344
349
  (!listType || listType === "text") &&
345
350
  finalTextItemRender !== false
346
351
  ? customItemRender || itemRenderText
347
- : customItemRender }, { children: children ? (children) : !listType || listType === "text" ? (jsxs(ButtonCom, __assign({ type: "primary", icon: jsx(UploadOutlined, {}) }, { children: [btnText || "添加附件", maxCount ? "(\u6700\u591A\u4E0A\u4F20".concat(maxCount, "\u4E2A\u6587\u4EF6)") : ""] }))) : isImage &&
352
+ : customItemRender }, { children: children ? (children) : !listType || listType === "text" ? (jsxs(ButtonCom, __assign({ type: "primary", icon: jsx(UploadOutlined, {}) }, { children: [btnText || locale.addFile, maxCount
353
+ ? formatLocaleText(locale.maxCountTip, { count: maxCount })
354
+ : ""] }))) : isImage &&
348
355
  maxCount &&
349
356
  innerFileList &&
350
357
  innerFileList.length >= maxCount &&
351
- !isImgPreview ? null : (jsxs("div", __assign({ className: "ztxk-upload--picture" }, { children: [jsx(UploadOutlined, { style: { fontSize: 18 } }), jsx("div", __assign({ style: { marginTop: 8 } }, { children: btnText || "添加图片" }))] }))) })));
358
+ !isImgPreview ? null : (jsxs("div", __assign({ className: "ztxk-upload--picture" }, { children: [jsx(UploadOutlined, { style: { fontSize: 18 } }), jsx("div", __assign({ style: { marginTop: 8 } }, { children: btnText || locale.addImage }))] }))) })));
352
359
  // UI周查样式下,showTip 以 Tooltip 形式展示在上传按钮上
353
- var renderChildren = isUIWeeklyReview && showTip ? (jsx(Tooltip, __assign({ title: "\u5355\u4E2A\u9644\u4EF6\u6700\u5927\u652F\u6301".concat(maxSizeStr) }, { children: uploadBtn }))) : (uploadBtn);
360
+ var renderChildren = isUIWeeklyReview && showTip ? (jsx(Tooltip, __assign({ title: formatLocaleText(locale.maxSizeTip, { size: maxSizeStr }) }, { children: uploadBtn }))) : (uploadBtn);
354
361
  // 暴露给外部的一些方法
355
362
  useImperativeHandle(ref, function () {
356
363
  return {
@@ -403,7 +410,10 @@ var UploadList = function (props, ref) {
403
410
  return [4 /*yield*/, Promise.reject({
404
411
  errorFields: [
405
412
  {
406
- errors: "".concat(title || "", " \u7B2C").concat(i + 1, "\u4E2A\u9644\u4EF6\u8FD8\u5728\u4E0A\u4F20\u4E2D\uFF0C\u8BF7\u7A0D\u7B49..."),
413
+ errors: formatLocaleText(locale.uploadingError, {
414
+ title: title || "",
415
+ index: i + 1,
416
+ }),
407
417
  },
408
418
  ],
409
419
  })];
@@ -415,7 +425,10 @@ var UploadList = function (props, ref) {
415
425
  return [4 /*yield*/, Promise.reject({
416
426
  errorFields: [
417
427
  {
418
- errors: "".concat(title || "", " \u7B2C").concat(i + 1, "\u4E2A\u9644\u4EF6\u4E0A\u4F20\u5931\u8D25\uFF0C\u8BF7\u68C0\u67E5"),
428
+ errors: formatLocaleText(locale.uploadError, {
429
+ title: title || "",
430
+ index: i + 1,
431
+ }),
419
432
  },
420
433
  ],
421
434
  })];
@@ -431,23 +444,23 @@ var UploadList = function (props, ref) {
431
444
  }); },
432
445
  };
433
446
  });
434
- return (jsxs("div", __assign({ className: classes, ref: imgCropModalRef }, { children: [isPreview ? null : (jsxs(Fragment, { children: [isImage && isImageCrop ? (jsx(ImgCrop, __assign({ rotationSlider: true, showReset: true, quality: 0.8, modalClassName: "ztxk-upload-imgcrop", modalProps: { getContainer: function () { return imgCropModalRef.current; } }, aspect: imgWidth / imgHeight }, imgCropProps, { children: renderChildren }))) : (renderChildren), showTip && !isUIWeeklyReview ? (jsxs("span", __assign({ className: "ztxk-upload--tips" }, { children: ["(\u5355\u4E2A\u9644\u4EF6\u6700\u5927\u652F\u6301", maxSizeStr, ")"] }))) : ("")] })), isDelete && !isPreview && showTable ? (jsx(Popconfirm, __assign({ title: "\u662F\u5426\u5220\u9664\u9009\u4E2D\u9644\u4EF6\uFF1F", cancelText: "\u5426", okText: "\u662F", onConfirm: function () { return onBatchDeleteHandle(); } }, { children: jsx(ButtonCom, __assign({ type: "primary" }, { children: "\u6279\u91CF\u5220\u9664" })) }))) : null, isDownload && showTable ? (jsx(Dropdown, __assign({ menu: {
447
+ return (jsxs("div", __assign({ className: classes, ref: imgCropModalRef }, { children: [isPreview ? null : (jsxs(Fragment, { children: [isImage && isImageCrop ? (jsx(ImgCrop, __assign({ rotationSlider: true, showReset: true, quality: 0.8, modalClassName: "ztxk-upload-imgcrop", modalProps: { getContainer: function () { return imgCropModalRef.current; } }, aspect: imgWidth / imgHeight }, imgCropProps, { children: renderChildren }))) : (renderChildren), showTip && !isUIWeeklyReview ? (jsxs("span", __assign({ className: "ztxk-upload--tips" }, { children: ["(", formatLocaleText(locale.maxSizeTip, { size: maxSizeStr }), ")"] }))) : ("")] })), isDelete && !isPreview && showTable ? (jsx(Popconfirm, __assign({ title: locale.confirmBatchDelete, cancelText: locale.no, okText: locale.yes, onConfirm: function () { return onBatchDeleteHandle(); } }, { children: jsx(ButtonCom, __assign({ type: "primary" }, { children: locale.batchDelete })) }))) : null, isDownload && showTable ? (jsx(Dropdown, __assign({ menu: {
435
448
  items: [
436
449
  {
437
- label: "压缩",
450
+ label: locale.compress,
438
451
  key: "compress",
439
452
  },
440
453
  {
441
- label: "不压缩",
454
+ label: locale.noCompress,
442
455
  key: "noCompress",
443
456
  },
444
457
  ],
445
458
  onClick: function (e) {
446
459
  onBatchDownloadHandle(e.key);
447
460
  },
448
- }, placement: "bottomLeft" }, { children: jsx(ButtonCom, __assign({ type: "primary" }, { children: "\u6279\u91CF\u4E0B\u8F7D" })) }))) : null, customRenderBtn, showTable ? (jsx(UploadTable, { dataSource: uploadTableData, action: fileAction, headers: fileHeaders, data: fileData, method: method, setInnerFileList: setInnerFileList, isPublic: isPublic, API_BASEURL: API_BASEURL, FILE_API_BASEURL: FILE_API_BASEURL, maxPreviewSize: maxPreviewSize, isPreview: isPreview, filePreview: filePreview, isDelete: isDelete, isDownload: isDownload, ref: tableRef, listType: listType, tableColumns: tableColumns, onBeforeDeleteValidate: onBeforeDeleteValidate, onBeforeDownloadValidate: onBeforeDownloadValidate, onBeforePreviewValidate: onBeforePreviewValidate, isTranslation: isTranslationButton, renderTableOperationColumn: renderTableOperationColumn })) : null, isPreview && !showTable && !isImage ? (jsx(UploadListDetail, { dataSource: uploadTableData, action: fileAction, headers: fileHeaders, data: fileData, method: method, setInnerFileList: setInnerFileList, isPublic: isPublic, API_BASEURL: API_BASEURL, FILE_API_BASEURL: FILE_API_BASEURL, maxPreviewSize: maxPreviewSize, isPreview: isPreview, isDelete: isDelete, isDownload: isDownload, ref: tableRef, listType: listType, tableColumns: tableColumns, onBeforeDeleteValidate: onBeforeDeleteValidate, onBeforeDownloadValidate: onBeforeDownloadValidate, onBeforePreviewValidate: onBeforePreviewValidate, isTranslation: isTranslationButton, renderDetailPrepend: renderDetailPrepend, textItemRender: finalTextItemRender, showFileSize: finalShowFileSize })) : null, isImage && (jsx(ModalComponent, __assign({ ref: modalRef, footer: null, width: "520px" }, { children: jsx("div", __assign({ style: {
461
+ }, placement: "bottomLeft" }, { children: jsx(ButtonCom, __assign({ type: "primary" }, { children: locale.batchDownload })) }))) : null, customRenderBtn, showTable ? (jsx(UploadTable, { dataSource: uploadTableData, action: fileAction, headers: fileHeaders, data: fileData, method: method, setInnerFileList: setInnerFileList, isPublic: isPublic, API_BASEURL: API_BASEURL, FILE_API_BASEURL: FILE_API_BASEURL, maxPreviewSize: maxPreviewSize, isPreview: isPreview, filePreview: filePreview, isDelete: isDelete, isDownload: isDownload, ref: tableRef, listType: listType, tableColumns: tableColumns, onBeforeDeleteValidate: onBeforeDeleteValidate, onBeforeDownloadValidate: onBeforeDownloadValidate, onBeforePreviewValidate: onBeforePreviewValidate, isTranslation: isTranslationButton, renderTableOperationColumn: renderTableOperationColumn })) : null, isPreview && !showTable && !isImage ? (jsx(UploadListDetail, { dataSource: uploadTableData, action: fileAction, headers: fileHeaders, data: fileData, method: method, setInnerFileList: setInnerFileList, isPublic: isPublic, API_BASEURL: API_BASEURL, FILE_API_BASEURL: FILE_API_BASEURL, maxPreviewSize: maxPreviewSize, isPreview: isPreview, isDelete: isDelete, isDownload: isDownload, ref: tableRef, listType: listType, tableColumns: tableColumns, onBeforeDeleteValidate: onBeforeDeleteValidate, onBeforeDownloadValidate: onBeforeDownloadValidate, onBeforePreviewValidate: onBeforePreviewValidate, isTranslation: isTranslationButton, renderDetailPrepend: renderDetailPrepend, textItemRender: finalTextItemRender, showFileSize: finalShowFileSize })) : null, isImage && (jsx(ModalComponent, __assign({ ref: modalRef, footer: null, width: "520px" }, { children: jsx("div", __assign({ style: {
449
462
  textAlign: "center",
450
- } }, { children: jsx("img", { src: imgSrc, alt: "\u9884\u89C8", style: {
463
+ } }, { children: jsx("img", { src: imgSrc, alt: locale.preview, style: {
451
464
  maxWidth: "400px",
452
465
  maxHeight: "400px",
453
466
  } }) })) })))] })));
@@ -3,6 +3,9 @@ import { jsx, jsxs } from 'react/jsx-runtime';
3
3
  import { forwardRef, useState, useImperativeHandle } from 'react';
4
4
  import { formatUnit, downloadFile } from 'zmdms-utils';
5
5
  import { toPreviewFile } from './utils.js';
6
+ import useLocale from '../config/useLocale.js';
7
+ import '../config/ZtxkContext.js';
8
+ import '../config/MyStorage.js';
6
9
  import PaperClipOutlined from '../node_modules/@ant-design/icons/es/icons/PaperClipOutlined.js';
7
10
  import ButtonCom from '../button/button.js';
8
11
  import TranslationButton from '../translationbutton/translationButton.js';
@@ -16,6 +19,7 @@ var UploadTable = function (_a, ref) {
16
19
  var dataSource = _a.dataSource; _a.action; _a.headers; _a.data; _a.method; var setInnerFileList = _a.setInnerFileList, isPublic = _a.isPublic, _c = _a.API_BASEURL, API_BASEURL = _c === void 0 ? "" : _c, _d = _a.FILE_API_BASEURL, FILE_API_BASEURL = _d === void 0 ? "" : _d, maxPreviewSize = _a.maxPreviewSize, isPreview = _a.isPreview, isDelete = _a.isDelete, isDownload = _a.isDownload; _a.listType; _a.tableColumns; var onBeforeDownloadValidate = _a.onBeforeDownloadValidate, onBeforePreviewValidate = _a.onBeforePreviewValidate; _a.onBeforeDeleteValidate; var isTranslation = _a.isTranslation, renderDetailPrepend = _a.renderDetailPrepend, textItemRender = _a.textItemRender, showFileSize = _a.showFileSize;
17
20
  var _e = useState(false), loading = _e[0], setLoading = _e[1];
18
21
  var _f = useState(), checked = _f[0], setChecked = _f[1];
22
+ var locale = useLocale().UploadList;
19
23
  var isDownloadSingleBoolean = isDownload;
20
24
  var isDeleteSingleBoolean = isDelete && !isPreview;
21
25
  // 操作按钮组
@@ -27,22 +31,22 @@ var UploadTable = function (_a, ref) {
27
31
  if (operationAuth) {
28
32
  if (operationAuth.indexOf("2") !== -1 && isDownloadSingleBoolean) {
29
33
  statusBtnConfig.push({
30
- name: "下载",
34
+ name: locale.download,
31
35
  type: "download",
32
36
  loading: loading,
33
37
  });
34
38
  }
35
39
  if (operationAuth.indexOf("1") !== -1) {
36
40
  statusBtnConfig.push({
37
- name: "预览",
41
+ name: locale.preview,
38
42
  type: "preview",
39
43
  });
40
44
  }
41
45
  if (operationAuth.indexOf("3") !== -1 && isDeleteSingleBoolean) {
42
46
  statusBtnConfig.push({
43
- name: "删除",
47
+ name: locale.delete,
44
48
  type: "delete",
45
- confirmMsg: "确认删除该附件吗?",
49
+ confirmMsg: locale.confirmDelete,
46
50
  loading: loading,
47
51
  });
48
52
  }
@@ -50,20 +54,20 @@ var UploadTable = function (_a, ref) {
50
54
  else {
51
55
  if (isDownloadSingleBoolean) {
52
56
  statusBtnConfig.push({
53
- name: "下载",
57
+ name: locale.download,
54
58
  type: "download",
55
59
  loading: loading,
56
60
  });
57
61
  }
58
62
  statusBtnConfig.push({
59
- name: "预览",
63
+ name: locale.preview,
60
64
  type: "preview",
61
65
  });
62
66
  if (isDeleteSingleBoolean) {
63
67
  statusBtnConfig.push({
64
- name: "删除",
68
+ name: locale.delete,
65
69
  type: "delete",
66
- confirmMsg: "确认删除该附件吗?",
70
+ confirmMsg: locale.confirmDelete,
67
71
  loading: loading,
68
72
  });
69
73
  }
@@ -206,7 +210,7 @@ var UploadTable = function (_a, ref) {
206
210
  if (isPreviewAuth) {
207
211
  return operationCallback("preview", record, index);
208
212
  }
209
- myMessage.info("暂无预览权限!");
213
+ myMessage.info(locale.noPreviewPermission);
210
214
  return Promise.resolve();
211
215
  };
212
216
  var itemKey = record.attachId || record.fileId || index;
@@ -220,9 +224,9 @@ var UploadTable = function (_a, ref) {
220
224
  return (jsxs("div", __assign({ className: "ztxk-upload--text-item" }, { children: [jsx("span", __assign({ className: "ztxk-upload--text-item__icon" }, { children: jsx(PaperClipOutlined, {}) })), jsxs("span", __assign({ className: "ztxk-upload--text-item__name", onClick: handlePreview, title: fileName }, { children: [jsx("span", __assign({ className: "ztxk-upload--text-item__name-body" }, { children: nameBody })), nameExt ? (jsx("span", __assign({ className: "ztxk-upload--text-item__name-ext" }, { children: nameExt }))) : null] })), showFileSize !== false &&
221
225
  record.attachSize != null ? (jsx("span", __assign({ className: "ztxk-upload--text-item__size" }, { children: formatUnit(record.attachSize) }))) : null, jsxs("span", __assign({ className: "ztxk-upload--text-item__actions" }, { children: [renderDetailPrepend && renderDetailPrepend(record, index), isDownloadAuth ? (jsx(ButtonCom, __assign({ type: "link", size: "small", className: "ztxk-upload--text-item__download", onClick: function () {
222
226
  return operationCallback("download", record, index);
223
- } }, { children: "\u4E0B\u8F7D" }))) : null, isTranslation ? (jsx(TranslationButton, { attachId: record.attachId, attachName: record.attachName })) : null] }))] }), itemKey));
227
+ } }, { children: locale.download }))) : null, isTranslation ? (jsx(TranslationButton, { attachId: record.attachId, attachName: record.attachName })) : null] }))] }), itemKey));
224
228
  }
225
- return (jsxs("div", __assign({ className: "ztxk-upload--preview-list__item" }, { children: [jsx("div", __assign({ className: "preview-list__item--left" }, { children: jsxs(ButtonCom, __assign({ type: "link", onClick: handlePreview, style: { textAlign: "left" }, title: record.attachName }, { children: [jsx(LinkOutlined, {}), record.attachName] })) })), jsxs("div", __assign({ className: "preview-list__item--right" }, { children: [renderDetailPrepend && renderDetailPrepend(record, index), isDownloadAuth ? (jsx(ButtonCom, __assign({ type: "link", onClick: function () { return operationCallback("download", record, index); }, style: { textAlign: "left" }, title: "\u4E0B\u8F7D" }, { children: jsx(DownloadOutlined, {}) }))) : null, isTranslation && (jsx(TranslationButton, { attachId: record.attachId, attachName: record.attachName }))] }))] }), itemKey));
229
+ return (jsxs("div", __assign({ className: "ztxk-upload--preview-list__item" }, { children: [jsx("div", __assign({ className: "preview-list__item--left" }, { children: jsxs(ButtonCom, __assign({ type: "link", onClick: handlePreview, style: { textAlign: "left" }, title: record.attachName }, { children: [jsx(LinkOutlined, {}), record.attachName] })) })), jsxs("div", __assign({ className: "preview-list__item--right" }, { children: [renderDetailPrepend && renderDetailPrepend(record, index), isDownloadAuth ? (jsx(ButtonCom, __assign({ type: "link", onClick: function () { return operationCallback("download", record, index); }, style: { textAlign: "left" }, title: locale.download }, { children: jsx(DownloadOutlined, {}) }))) : null, isTranslation && (jsx(TranslationButton, { attachId: record.attachId, attachName: record.attachName }))] }))] }), itemKey));
226
230
  }) })) })));
227
231
  };
228
232
  var UploadListDetail = forwardRef(UploadTable);
@@ -1,4 +1,4 @@
1
- import { __spreadArray, __assign, __awaiter, __generator } from '../_virtual/_tslib.js';
1
+ import { __assign, __spreadArray, __awaiter, __generator } from '../_virtual/_tslib.js';
2
2
  import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
3
3
  import { forwardRef, useState, useMemo, useImperativeHandle } from 'react';
4
4
  import MemoTable from '../table/table.js';
@@ -7,6 +7,9 @@ import { formatUnit, downloadFile } from 'zmdms-utils';
7
7
  import { uploadFile } from './hooks.js';
8
8
  import dayjs from 'dayjs';
9
9
  import { toPreviewFile } from './utils.js';
10
+ import useLocale from '../config/useLocale.js';
11
+ import '../config/ZtxkContext.js';
12
+ import '../config/MyStorage.js';
10
13
  import ButtonCom from '../button/button.js';
11
14
  import OperationBtn from '../operationbtn/operationBtn.js';
12
15
  import TranslationButton from '../translationbutton/translationButton.js';
@@ -17,6 +20,7 @@ var UploadTable = function (_a, ref) {
17
20
  var dataSource = _a.dataSource, action = _a.action, headers = _a.headers, data = _a.data, method = _a.method, setInnerFileList = _a.setInnerFileList, isPublic = _a.isPublic, _b = _a.API_BASEURL, API_BASEURL = _b === void 0 ? "" : _b, _c = _a.FILE_API_BASEURL, FILE_API_BASEURL = _c === void 0 ? "" : _c, maxPreviewSize = _a.maxPreviewSize, isPreview = _a.isPreview, filePreview = _a.filePreview, isDelete = _a.isDelete, isDownload = _a.isDownload; _a.listType; var tableColumns = _a.tableColumns, onBeforeDownloadValidate = _a.onBeforeDownloadValidate, onBeforePreviewValidate = _a.onBeforePreviewValidate, onBeforeDeleteValidate = _a.onBeforeDeleteValidate, isTranslation = _a.isTranslation, renderTableOperationColumn = _a.renderTableOperationColumn;
18
21
  var _d = useState(false), loading = _d[0], setLoading = _d[1];
19
22
  var _e = useState(), checked = _e[0], setChecked = _e[1];
23
+ var locale = useLocale().UploadList;
20
24
  var isDownloadSingleBoolean = isDownload;
21
25
  // const isDownloadBoolean = isDownload && listType !== "text";
22
26
  var isDownloadBoolean = isDownload;
@@ -80,7 +84,7 @@ var UploadTable = function (_a, ref) {
80
84
  case 8:
81
85
  err_2 = _b.sent();
82
86
  console.log(err_2);
83
- myMessage.error((err_2 === null || err_2 === void 0 ? void 0 : err_2.msg) || "下载失败!");
87
+ myMessage.error((err_2 === null || err_2 === void 0 ? void 0 : err_2.msg) || locale.downloadFailed);
84
88
  endCallback();
85
89
  return [3 /*break*/, 9];
86
90
  case 9:
@@ -171,7 +175,7 @@ var UploadTable = function (_a, ref) {
171
175
  });
172
176
  }); };
173
177
  var indexColumn = {
174
- title: "序号",
178
+ title: locale.serialNumber,
175
179
  width: 60,
176
180
  key: "index",
177
181
  fixed: "left",
@@ -179,7 +183,7 @@ var UploadTable = function (_a, ref) {
179
183
  render: function (value, record, index) { return "".concat(index + 1); },
180
184
  };
181
185
  var fileNameColumn = {
182
- title: "文件名称",
186
+ title: locale.fileName,
183
187
  width: 140,
184
188
  dataIndex: "attachName",
185
189
  key: "attachName",
@@ -189,7 +193,7 @@ var UploadTable = function (_a, ref) {
189
193
  },
190
194
  };
191
195
  var fileSizeColumn = {
192
- title: "文件大小",
196
+ title: locale.fileSize,
193
197
  width: 100,
194
198
  dataIndex: "attachSize",
195
199
  key: "attachSize",
@@ -200,7 +204,7 @@ var UploadTable = function (_a, ref) {
200
204
  },
201
205
  };
202
206
  var createTimeColumn = {
203
- title: "上传时间",
207
+ title: locale.uploadTime,
204
208
  width: 100,
205
209
  dataIndex: "uploadTime",
206
210
  key: "uploadTime",
@@ -211,14 +215,14 @@ var UploadTable = function (_a, ref) {
211
215
  },
212
216
  };
213
217
  var createUserColumn = {
214
- title: "上传人",
218
+ title: locale.uploadUser,
215
219
  width: 100,
216
220
  align: "left",
217
221
  dataIndex: "uploadUser",
218
222
  key: "uploadUser",
219
223
  };
220
224
  var percentColumn = {
221
- title: "上传进度",
225
+ title: locale.uploadProgress,
222
226
  width: 160,
223
227
  align: "left",
224
228
  isDisplay: !isPreview,
@@ -226,7 +230,7 @@ var UploadTable = function (_a, ref) {
226
230
  var _a, _b;
227
231
  var status = record.status === "error" ? "exception" : undefined;
228
232
  if (record.status === "error") {
229
- return (jsx(ButtonCom, __assign({ type: "link", style: { color: "#ff4d4f" }, onClick: function () { return onReloadUploadHandle(record, index); } }, { children: "\u6587\u4EF6\u4E0A\u4F20\u5931\u8D25\uFF0C\u91CD\u65B0\u4E0A\u4F20" })));
233
+ return (jsx(ButtonCom, __assign({ type: "link", style: { color: "#ff4d4f" }, onClick: function () { return onReloadUploadHandle(record, index); } }, { children: locale.retryUpload })));
230
234
  }
231
235
  var percent = (_b = (_a = record === null || record === void 0 ? void 0 : record.percent) === null || _a === void 0 ? void 0 : _a.toFixed) === null || _b === void 0 ? void 0 : _b.call(_a, 0);
232
236
  // 要状态 和 进度都是完成时,才能把进度设置成100%
@@ -238,7 +242,7 @@ var UploadTable = function (_a, ref) {
238
242
  },
239
243
  };
240
244
  var optionsColumns = {
241
- title: "操作",
245
+ title: locale.operation,
242
246
  width: 140,
243
247
  ellipsis: false,
244
248
  fixed: "right",
@@ -286,22 +290,22 @@ var UploadTable = function (_a, ref) {
286
290
  if (operationAuth) {
287
291
  if (operationAuth.indexOf("2") !== -1 && isDownloadSingleBoolean) {
288
292
  statusBtnConfig.push({
289
- name: "下载",
293
+ name: locale.download,
290
294
  type: "download",
291
295
  loading: loading,
292
296
  });
293
297
  }
294
298
  if (operationAuth.indexOf("1") !== -1) {
295
299
  statusBtnConfig.push({
296
- name: "预览",
300
+ name: locale.preview,
297
301
  type: "preview",
298
302
  });
299
303
  }
300
304
  if (operationAuth.indexOf("3") !== -1 && isDeleteSingleBoolean) {
301
305
  statusBtnConfig.push({
302
- name: "删除",
306
+ name: locale.delete,
303
307
  type: "delete",
304
- confirmMsg: "确认删除该附件吗?",
308
+ confirmMsg: locale.confirmDelete,
305
309
  loading: loading,
306
310
  });
307
311
  }
@@ -309,23 +313,23 @@ var UploadTable = function (_a, ref) {
309
313
  else {
310
314
  if (isDownloadSingleBoolean) {
311
315
  statusBtnConfig.push({
312
- name: "下载",
316
+ name: locale.download,
313
317
  type: "download",
314
318
  loading: loading,
315
319
  });
316
320
  }
317
321
  if (filePreview) {
318
322
  statusBtnConfig.push({
319
- name: "预览",
323
+ name: locale.preview,
320
324
  type: "preview",
321
325
  loading: onBeforePreviewValidate ? loading : undefined,
322
326
  });
323
327
  }
324
328
  if (isDeleteSingleBoolean) {
325
329
  statusBtnConfig.push({
326
- name: "删除",
330
+ name: locale.delete,
327
331
  type: "delete",
328
- confirmMsg: "确认删除该附件吗?",
332
+ confirmMsg: locale.confirmDelete,
329
333
  loading: loading,
330
334
  });
331
335
  }
@@ -343,7 +347,7 @@ var UploadTable = function (_a, ref) {
343
347
  // 重新上传
344
348
  var onReloadUploadHandle = function (record, index) {
345
349
  if (!record.originFileObj) {
346
- myMessage.error("当前失败项,没有找到附件原件信息,无法重新上传!");
350
+ myMessage.error(locale.noOriginFileError);
347
351
  return;
348
352
  }
349
353
  setLoading(true);
@@ -1,4 +1,8 @@
1
1
  import { formatUnit, previewFile } from 'zmdms-utils';
2
+ import { getLocale, formatLocaleText } from '../config/useLocale.js';
3
+ import 'react';
4
+ import '../config/ZtxkContext.js';
5
+ import '../config/MyStorage.js';
2
6
  import myMessage from '../message/index.js';
3
7
 
4
8
  /**
@@ -8,8 +12,11 @@ import myMessage from '../message/index.js';
8
12
  */
9
13
  function toPreviewFile(fileInfo, info) {
10
14
  var maxPreviewSize = info.maxPreviewSize, FILE_API_BASEURL = info.FILE_API_BASEURL, uploadTableData = info.uploadTableData;
15
+ var locale = getLocale().UploadList;
11
16
  if (fileInfo.attachSize > maxPreviewSize) {
12
- myMessage.info("\u6587\u4EF6\u5927\u4E8E".concat(formatUnit(maxPreviewSize), ",\u6682\u4E0D\u652F\u6301\u5728\u7EBF\u9884\u89C8\uFF0C\u8BF7\u5148\u4E0B\u8F7D\u540E\u67E5\u770B"));
17
+ myMessage.info(formatLocaleText(locale.previewSizeExceeded, {
18
+ size: formatUnit(maxPreviewSize),
19
+ }));
13
20
  }
14
21
  else {
15
22
  previewFile(fileInfo.attachId, fileInfo.attachName, {