zmdms-webui 2.0.3 → 2.0.5

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.
@@ -39,6 +39,8 @@ interface IUploadListProps extends Omit<UploadProps, "onChange"> {
39
39
  /** 是否显示下载按钮 */
40
40
  isDownload?: boolean;
41
41
  isDelete?: boolean;
42
+ /** 是否支持文件预览 */
43
+ filePreview?: boolean;
42
44
  /** 批量下载的zip包名 */
43
45
  zipName?: string;
44
46
  /** 是否只上传图片 */
@@ -31,7 +31,7 @@ var MAXSIZE = 104857600; // 100 * 1024 * 1024
31
31
  */
32
32
  var UploadList = function (props, ref) {
33
33
  var _a;
34
- 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.zipName, zipName = _e === void 0 ? "\u6279\u91CF\u4E0B\u8F7D-".concat(Date.now(), ".zip") : _e, isImage = props.isImage, imgCropProps = props.imgCropProps, _f = props.imgWidth, imgWidth = _f === void 0 ? 110 : _f, _g = props.imgHeight, imgHeight = _g === void 0 ? 110 : _g, customRenderBtn = props.customRenderBtn, disAllowDuplicateFile = props.disAllowDuplicateFile, fieldNames = props.fieldNames, tableColumns = props.tableColumns, onBeforeDownloadValidate = props.onBeforeDownloadValidate, onBeforePreviewValidate = props.onBeforePreviewValidate, onBeforeDeleteValidate = props.onBeforeDeleteValidate, 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", "zipName", "isImage", "imgCropProps", "imgWidth", "imgHeight", "customRenderBtn", "disAllowDuplicateFile", "fieldNames", "tableColumns", "onBeforeDownloadValidate", "onBeforePreviewValidate", "onBeforeDeleteValidate"]);
34
+ 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, 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, 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", "imgCropProps", "imgWidth", "imgHeight", "customRenderBtn", "disAllowDuplicateFile", "fieldNames", "tableColumns", "onBeforeDownloadValidate", "onBeforePreviewValidate", "onBeforeDeleteValidate"]);
35
35
  var maxCount = resetProps.maxCount, listType = resetProps.listType, method = resetProps.method;
36
36
  var imgSizeClassName = "temporary-className-".concat(imgWidth, "-").concat(imgHeight);
37
37
  var classes = classNames("ztxk-upload", className, (_a = {},
@@ -41,7 +41,7 @@ var UploadList = function (props, ref) {
41
41
  var tableRef = useRef({});
42
42
  var modalRef = useRef({});
43
43
  var imgCropModalRef = useRef();
44
- var _h = useState(), imgSrc = _h[0], setImgSrc = _h[1];
44
+ var _j = useState(), imgSrc = _j[0], setImgSrc = _j[1];
45
45
  useEffect(function () {
46
46
  if (!isImage) {
47
47
  return;
@@ -59,7 +59,7 @@ var UploadList = function (props, ref) {
59
59
  };
60
60
  }, [imgHeight, imgSizeClassName, imgWidth, isImage]);
61
61
  var newFieldNames = getField(fieldNames);
62
- var _j = useBaseContext(), apiBaseUrl = _j.apiBaseUrl, fileBaseUrl = _j.fileBaseUrl;
62
+ var _k = useBaseContext(), apiBaseUrl = _k.apiBaseUrl, fileBaseUrl = _k.fileBaseUrl;
63
63
  var API_BASEURL = PROPS_API_BASEURL ? PROPS_API_BASEURL : apiBaseUrl;
64
64
  var FILE_API_BASEURL = PROPS_FILE_API_BASEURL
65
65
  ? PROPS_FILE_API_BASEURL
@@ -75,7 +75,7 @@ var UploadList = function (props, ref) {
75
75
  fileList: fileList,
76
76
  });
77
77
  // 文件改变逻辑
78
- var _k = useOnChange({
78
+ var _l = useOnChange({
79
79
  onChange: onChange,
80
80
  userName: userName,
81
81
  fileList: fileList,
@@ -84,15 +84,15 @@ var UploadList = function (props, ref) {
84
84
  API_BASEURL: API_BASEURL,
85
85
  newFieldNames: newFieldNames,
86
86
  listType: listType,
87
- }), onChangeHandle = _k.onChangeHandle, innerFileList = _k.innerFileList, setInnerFileList = _k.setInnerFileList;
87
+ }), onChangeHandle = _l.onChangeHandle, innerFileList = _l.innerFileList, setInnerFileList = _l.setInnerFileList;
88
88
  // 基础参数
89
- var _l = useBasicInfo({
89
+ var _m = useBasicInfo({
90
90
  action: action,
91
91
  API_BASEURL: API_BASEURL,
92
92
  headers: headers,
93
93
  data: data,
94
94
  isPublic: isPublic,
95
- }), fileAction = _l.fileAction, fileHeaders = _l.fileHeaders, fileData = _l.fileData;
95
+ }), fileAction = _m.fileAction, fileHeaders = _m.fileHeaders, fileData = _m.fileData;
96
96
  // 表格需要的附件列表数据
97
97
  var uploadTableData = useUploadTableData({
98
98
  fileList: innerFileList,
@@ -208,6 +208,9 @@ var UploadList = function (props, ref) {
208
208
  }); };
209
209
  // 图片预览
210
210
  var onPreview = function (file) {
211
+ if (!filePreview) {
212
+ return;
213
+ }
211
214
  if (isImage) {
212
215
  var url = createDownloadLink(file.attachId, {
213
216
  API_BASEURL: API_BASEURL,
@@ -385,7 +388,7 @@ var UploadList = function (props, ref) {
385
388
  onClick: function (e) {
386
389
  onBatchDownloadHandle(e.key);
387
390
  },
388
- }, 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, isDelete: isDelete, isDownload: isDownload, ref: tableRef, listType: listType, tableColumns: tableColumns, onBeforeDeleteValidate: onBeforeDeleteValidate, onBeforeDownloadValidate: onBeforeDownloadValidate, onBeforePreviewValidate: onBeforePreviewValidate })) : 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 })) : null, isImage && (jsx(ModalComponent, __assign({ ref: modalRef, footer: null, width: "520px" }, { children: jsx("div", __assign({ style: {
391
+ }, 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 })) : 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 })) : null, isImage && (jsx(ModalComponent, __assign({ ref: modalRef, footer: null, width: "520px" }, { children: jsx("div", __assign({ style: {
389
392
  textAlign: "center",
390
393
  } }, { children: jsx("img", { src: imgSrc, alt: "\u9884\u89C8", style: {
391
394
  maxWidth: "400px",
@@ -13,7 +13,7 @@ import myMessage from '../message/index.js';
13
13
  import { Progress } from 'antd';
14
14
 
15
15
  var UploadTable = function (_a, ref) {
16
- 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, isDelete = _a.isDelete, isDownload = _a.isDownload; _a.listType; var tableColumns = _a.tableColumns, onBeforeDownloadValidate = _a.onBeforeDownloadValidate, onBeforePreviewValidate = _a.onBeforePreviewValidate, onBeforeDeleteValidate = _a.onBeforeDeleteValidate;
16
+ 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;
17
17
  var _d = useState(false), loading = _d[0], setLoading = _d[1];
18
18
  var _e = useState(), checked = _e[0], setChecked = _e[1];
19
19
  var isDownloadSingleBoolean = isDownload;
@@ -182,7 +182,7 @@ var UploadTable = function (_a, ref) {
182
182
  key: "attachName",
183
183
  align: "left",
184
184
  render: function (text, record, index) {
185
- return (jsx(ButtonCom, __assign({ type: "link", onClick: function () { return operationCallback("preview", record, index); }, style: { textAlign: "left" } }, { children: text })));
185
+ return !filePreview ? (text) : (jsx(ButtonCom, __assign({ type: "link", onClick: function () { return operationCallback("preview", record, index); }, style: { textAlign: "left" } }, { children: text })));
186
186
  },
187
187
  };
188
188
  var fileSizeColumn = {
@@ -311,11 +311,13 @@ var UploadTable = function (_a, ref) {
311
311
  loading: loading,
312
312
  });
313
313
  }
314
- statusBtnConfig.push({
315
- name: "预览",
316
- type: "preview",
317
- loading: onBeforePreviewValidate ? loading : undefined,
318
- });
314
+ if (filePreview) {
315
+ statusBtnConfig.push({
316
+ name: "预览",
317
+ type: "preview",
318
+ loading: onBeforePreviewValidate ? loading : undefined,
319
+ });
320
+ }
319
321
  if (isDeleteSingleBoolean) {
320
322
  statusBtnConfig.push({
321
323
  name: "删除",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "2.0.3",
3
+ "version": "2.0.5",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",