zmdms-webui 2.0.8 → 2.1.0

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.
@@ -20,30 +20,29 @@ function getConfig(content, duration, onClose) {
20
20
  };
21
21
  return config;
22
22
  }
23
- var defaultDuration = 10;
24
23
  var myMessage = {
25
24
  info: function (content, duration, onClose) {
26
- var config = getConfig(content, duration ? duration : defaultDuration, onClose);
25
+ var config = getConfig(content, duration, onClose);
27
26
  message.info(config, duration, onClose);
28
27
  return Promise.resolve();
29
28
  },
30
29
  success: function (content, duration, onClose) {
31
- var config = getConfig(content, duration ? duration : defaultDuration, onClose);
30
+ var config = getConfig(content, duration, onClose);
32
31
  message.success(config, duration, onClose);
33
32
  return Promise.resolve();
34
33
  },
35
34
  error: function (content, duration, onClose) {
36
- var config = getConfig(content, duration ? duration : defaultDuration, onClose);
35
+ var config = getConfig(content, duration, onClose);
37
36
  message.error(config, duration, onClose);
38
37
  return Promise.resolve();
39
38
  },
40
39
  warning: function (content, duration, onClose) {
41
- var config = getConfig(content, duration ? duration : defaultDuration, onClose);
40
+ var config = getConfig(content, duration, onClose);
42
41
  message.warning(config, duration, onClose);
43
42
  return Promise.resolve();
44
43
  },
45
44
  loading: function (content, duration, onClose) {
46
- var config = getConfig(content, duration ? duration : defaultDuration, onClose);
45
+ var config = getConfig(content, duration, onClose);
47
46
  message.loading(config, duration, onClose);
48
47
  return Promise.resolve();
49
48
  },
@@ -52,7 +51,7 @@ var myMessage = {
52
51
  return Promise.resolve();
53
52
  },
54
53
  warn: function (content, duration, onClose) {
55
- var config = getConfig(content, duration ? duration : defaultDuration, onClose);
54
+ var config = getConfig(content, duration, onClose);
56
55
  message.warn(config, duration, onClose);
57
56
  return Promise.resolve();
58
57
  },
@@ -45,6 +45,8 @@ interface IUploadListProps extends Omit<UploadProps, "onChange"> {
45
45
  zipName?: string;
46
46
  /** 是否只上传图片 */
47
47
  isImage?: boolean;
48
+ /** 是否开启图片裁剪 */
49
+ isImageCrop?: boolean;
48
50
  /** 图片预览 */
49
51
  isImgPreview?: boolean;
50
52
  /** 裁剪组件的一些配置 link: https://github.com/nanxiaobei/antd-img-crop/blob/main/README.zh-CN.md */
@@ -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.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, isImgPreview = props.isImgPreview, 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", "isImgPreview"]);
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, _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, 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"]);
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 _j = useState(), imgSrc = _j[0], setImgSrc = _j[1];
44
+ var _k = useState(), imgSrc = _k[0], setImgSrc = _k[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 _k = useBaseContext(), apiBaseUrl = _k.apiBaseUrl, fileBaseUrl = _k.fileBaseUrl;
62
+ var _l = useBaseContext(), apiBaseUrl = _l.apiBaseUrl, fileBaseUrl = _l.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 _l = useOnChange({
78
+ var _m = 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 = _l.onChangeHandle, innerFileList = _l.innerFileList, setInnerFileList = _l.setInnerFileList;
87
+ }), onChangeHandle = _m.onChangeHandle, innerFileList = _m.innerFileList, setInnerFileList = _m.setInnerFileList;
88
88
  // 基础参数
89
- var _m = useBasicInfo({
89
+ var _o = 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 = _m.fileAction, fileHeaders = _m.fileHeaders, fileData = _m.fileData;
95
+ }), fileAction = _o.fileAction, fileHeaders = _o.fileHeaders, fileData = _o.fileData;
96
96
  // 表格需要的附件列表数据
97
97
  var uploadTableData = useUploadTableData({
98
98
  fileList: innerFileList,
@@ -375,7 +375,7 @@ var UploadList = function (props, ref) {
375
375
  }); },
376
376
  };
377
377
  });
378
- return (jsxs("div", __assign({ className: classes, ref: imgCropModalRef }, { children: [isPreview ? null : (jsxs(Fragment, { children: [isImage ? (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 ? (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: {
378
+ 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 ? (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: {
379
379
  items: [
380
380
  {
381
381
  label: "压缩",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "2.0.8",
3
+ "version": "2.1.0",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",