zmdms-webui 1.7.3 → 1.7.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.
@@ -384,7 +384,7 @@ var UploadList = function (props, ref) {
384
384
  onClick: function (e) {
385
385
  onBatchDownloadHandle(e.key);
386
386
  },
387
- }, 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 })) : null, isImage && (jsx(ModalComponent, __assign({ ref: modalRef, footer: null, width: "520px" }, { children: jsx("div", __assign({ style: {
387
+ }, 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: {
388
388
  textAlign: "center",
389
389
  } }, { children: jsx("img", { src: imgSrc, alt: "\u9884\u89C8", style: {
390
390
  maxWidth: "400px",
@@ -10,7 +10,7 @@ import { Spin, message } from 'antd';
10
10
 
11
11
  var UploadTable = function (_a, ref) {
12
12
  var _b;
13
- 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;
13
+ 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;
14
14
  var _e = useState(false), loading = _e[0], setLoading = _e[1];
15
15
  var _f = useState(), checked = _f[0], setChecked = _f[1];
16
16
  var isDownloadSingleBoolean = isDownload;
@@ -68,7 +68,7 @@ var UploadTable = function (_a, ref) {
68
68
  return statusBtnConfig;
69
69
  };
70
70
  var operationCallback = function (type, record, index) { return __awaiter(void 0, void 0, void 0, function () {
71
- var attachId, attachName, _a, endCallback, err_1;
71
+ var attachId, attachName, _a, endCallback, canDownload, err_2, endCallback_1, canDownload;
72
72
  return __generator(this, function (_b) {
73
73
  switch (_b.label) {
74
74
  case 0:
@@ -76,10 +76,10 @@ var UploadTable = function (_a, ref) {
76
76
  _a = type;
77
77
  switch (_a) {
78
78
  case "download": return [3 /*break*/, 1];
79
- case "preview": return [3 /*break*/, 6];
80
- case "delete": return [3 /*break*/, 7];
79
+ case "preview": return [3 /*break*/, 10];
80
+ case "delete": return [3 /*break*/, 15];
81
81
  }
82
- return [3 /*break*/, 8];
82
+ return [3 /*break*/, 16];
83
83
  case 1:
84
84
  setInnerFileList(function (innerFileList) {
85
85
  var newInnerFileList = innerFileList.slice();
@@ -95,31 +95,76 @@ var UploadTable = function (_a, ref) {
95
95
  };
96
96
  _b.label = 2;
97
97
  case 2:
98
- _b.trys.push([2, 4, , 5]);
99
- return [4 /*yield*/, downloadFile(attachId, attachName, {
100
- API_BASEURL: API_BASEURL,
101
- open: isPublic,
102
- })];
98
+ _b.trys.push([2, 8, , 9]);
99
+ if (!onBeforeDownloadValidate) return [3 /*break*/, 6];
100
+ _b.label = 3;
103
101
  case 3:
102
+ _b.trys.push([3, 5, , 6]);
103
+ return [4 /*yield*/, onBeforeDownloadValidate([record])];
104
+ case 4:
105
+ canDownload = _b.sent();
106
+ if (!canDownload) {
107
+ endCallback();
108
+ return [2 /*return*/];
109
+ }
110
+ return [3 /*break*/, 6];
111
+ case 5:
104
112
  _b.sent();
105
113
  endCallback();
106
- return [3 /*break*/, 5];
107
- case 4:
108
- err_1 = _b.sent();
109
- console.log(err_1);
114
+ return [2 /*return*/];
115
+ case 6: return [4 /*yield*/, downloadFile(attachId, attachName, {
116
+ API_BASEURL: API_BASEURL,
117
+ open: isPublic,
118
+ })];
119
+ case 7:
120
+ _b.sent();
110
121
  endCallback();
111
- return [3 /*break*/, 5];
112
- case 5:
122
+ return [3 /*break*/, 9];
123
+ case 8:
124
+ err_2 = _b.sent();
125
+ console.log(err_2);
126
+ endCallback();
127
+ return [3 /*break*/, 9];
128
+ case 9:
113
129
  // finally 可能再某些浏览器下不兼容
114
- return [3 /*break*/, 8];
115
- case 6:
130
+ return [3 /*break*/, 16];
131
+ case 10:
132
+ if (!onBeforePreviewValidate) return [3 /*break*/, 14];
133
+ setInnerFileList(function (innerFileList) {
134
+ var newInnerFileList = innerFileList.slice();
135
+ newInnerFileList.splice(index, 1, __assign(__assign({}, record), { loading: true }));
136
+ return newInnerFileList;
137
+ });
138
+ endCallback_1 = function () {
139
+ setInnerFileList(function (innerFileList) {
140
+ var newInnerFileList = innerFileList.slice();
141
+ newInnerFileList.splice(index, 1, __assign(__assign({}, record), { loading: false }));
142
+ return newInnerFileList;
143
+ });
144
+ };
145
+ _b.label = 11;
146
+ case 11:
147
+ _b.trys.push([11, 13, , 14]);
148
+ return [4 /*yield*/, onBeforePreviewValidate([record])];
149
+ case 12:
150
+ canDownload = _b.sent();
151
+ endCallback_1();
152
+ if (!canDownload) {
153
+ return [2 /*return*/];
154
+ }
155
+ return [3 /*break*/, 14];
156
+ case 13:
157
+ _b.sent();
158
+ endCallback_1();
159
+ return [2 /*return*/];
160
+ case 14:
116
161
  toPreviewFile(record, {
117
162
  maxPreviewSize: maxPreviewSize,
118
163
  FILE_API_BASEURL: FILE_API_BASEURL,
119
164
  uploadTableData: dataSource,
120
165
  });
121
- return [3 /*break*/, 8];
122
- case 7:
166
+ return [3 /*break*/, 16];
167
+ case 15:
123
168
  setChecked(function (c) {
124
169
  if (Array.isArray(c)) {
125
170
  var copyC = c.slice();
@@ -133,8 +178,8 @@ var UploadTable = function (_a, ref) {
133
178
  newInnerFileList.splice(index, 1);
134
179
  return newInnerFileList;
135
180
  });
136
- return [3 /*break*/, 8];
137
- case 8: return [2 /*return*/];
181
+ return [3 /*break*/, 16];
182
+ case 16: return [2 /*return*/];
138
183
  }
139
184
  });
140
185
  }); };
@@ -160,7 +205,7 @@ var UploadTable = function (_a, ref) {
160
205
  }
161
206
  message.info("暂无预览权限!");
162
207
  return Promise.resolve();
163
- }, style: { textAlign: "left" }, title: record.attachName }, { children: [jsx(LinkOutlined, {}), record.attachName] })) })), jsx("div", __assign({ className: "preview-list__item--right" }, { children: isDownloadAuth ? (jsx(ButtonCom, __assign({ type: "link", onClick: function () { return operationCallback("download", record, index); }, style: { textAlign: "left" }, title: "\u4E0B\u8F7D" }, { children: jsx(DownloadOutlined, {}) }))) : null }))] })));
208
+ }, style: { textAlign: "left" }, title: record.attachName }, { children: [jsx(LinkOutlined, {}), record.attachName] })) })), jsx("div", __assign({ className: "preview-list__item--right" }, { children: isDownloadAuth ? (jsx(ButtonCom, __assign({ type: "link", onClick: function () { return operationCallback("download", record, index); }, style: { textAlign: "left" }, title: "\u4E0B\u8F7D" }, { children: jsx(DownloadOutlined, {}) }))) : null }))] }), record.attachId || record.fileId || index));
164
209
  }) })) })));
165
210
  };
166
211
  var UploadListDetail = forwardRef(UploadTable);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "zmdms-webui",
3
- "version": "1.7.3",
3
+ "version": "1.7.4",
4
4
  "private": false,
5
5
  "main": "dist/index.es.js",
6
6
  "module": "dist/index.es.js",