ztxkui 3.2.8 → 3.2.9
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.
package/dist/UploadDemo.js
CHANGED
|
@@ -143,24 +143,27 @@ function UploadDemo() {
|
|
|
143
143
|
}, []);
|
|
144
144
|
var checkHandle = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
145
145
|
var err_1, errorFields;
|
|
146
|
-
var _a, _b;
|
|
147
|
-
return __generator(this, function (
|
|
148
|
-
switch (
|
|
146
|
+
var _a, _b, _c, _d;
|
|
147
|
+
return __generator(this, function (_e) {
|
|
148
|
+
switch (_e.label) {
|
|
149
149
|
case 0:
|
|
150
|
-
|
|
150
|
+
_e.trys.push([0, 3, , 4]);
|
|
151
151
|
return [4 /*yield*/, ((_b = (_a = upload.current) === null || _a === void 0 ? void 0 : _a.validate) === null || _b === void 0 ? void 0 : _b.call(_a, { title: '测试下面的', isError: true }))];
|
|
152
152
|
case 1:
|
|
153
|
-
|
|
154
|
-
return [
|
|
153
|
+
_e.sent();
|
|
154
|
+
return [4 /*yield*/, ((_d = (_c = tableHandleRef.current) === null || _c === void 0 ? void 0 : _c.validate) === null || _d === void 0 ? void 0 : _d.call(_c))];
|
|
155
155
|
case 2:
|
|
156
|
-
|
|
156
|
+
_e.sent();
|
|
157
|
+
return [3 /*break*/, 4];
|
|
158
|
+
case 3:
|
|
159
|
+
err_1 = _e.sent();
|
|
157
160
|
console.log(err_1);
|
|
158
161
|
errorFields = err_1.errorFields;
|
|
159
162
|
if (errorFields) {
|
|
160
163
|
console.log(errorFields[0].errors + '');
|
|
161
164
|
}
|
|
162
165
|
return [2 /*return*/];
|
|
163
|
-
case
|
|
166
|
+
case 4: return [2 /*return*/];
|
|
164
167
|
}
|
|
165
168
|
});
|
|
166
169
|
}); };
|
|
@@ -171,6 +174,7 @@ function UploadDemo() {
|
|
|
171
174
|
console.log('请传入特殊值');
|
|
172
175
|
return UploadSingle.LIST_IGNORE;
|
|
173
176
|
};
|
|
177
|
+
var tableHandleRef = useRef();
|
|
174
178
|
return (React.createElement("div", null,
|
|
175
179
|
React.createElement(UploadSingle, { action: "http://192.168.0.83:8888/api/zmdms-resource/oss/endpoint/put-file-attach", data: {
|
|
176
180
|
system: '2',
|
|
@@ -193,7 +197,9 @@ function UploadDemo() {
|
|
|
193
197
|
system: '2',
|
|
194
198
|
}, apiBaseUrl: "http://192.168.0.83:8888", fileBaseUrl: "http://192.168.0.83:88", originFileList: fileList, callback: uploadCallbackFn, onDeleteCallback: function (index, file) {
|
|
195
199
|
console.log(index, file);
|
|
196
|
-
}, upload: upload, rowSelection: "checkbox", uploadTableRef: uploadTableRef
|
|
200
|
+
}, upload: upload, rowSelection: "checkbox", uploadTableRef: uploadTableRef, tableRestProps: {
|
|
201
|
+
tableHandleRef: tableHandleRef,
|
|
202
|
+
} }),
|
|
197
203
|
React.createElement(Upload, { maxSize: 200 * 1024, ztAccept: ['.jpg', '.jpeg', '.png', '.bmp', '.gif'], listType: "picture-card", method: "post", headers: {
|
|
198
204
|
'Zmdms-Auth': token,
|
|
199
205
|
}, showUploadList: {
|
|
@@ -69,7 +69,7 @@ import { divide, round, times } from 'number-precision';
|
|
|
69
69
|
import { downloadFileCallBack, downloadPublicFile, previewFile, } from 'ztxkutils/dist/fileOperation';
|
|
70
70
|
import { transformFileSize } from 'ztxkutils/dist/tools';
|
|
71
71
|
var UploadTable = function (_a) {
|
|
72
|
-
var fileList = _a.fileList, action = _a.action, headers = _a.headers, authToken = _a.authToken, method = _a.method, apiBaseUrl = _a.apiBaseUrl, uploadUser = _a.uploadUser, _b = _a.fileBaseUrl, fileBaseUrl = _b === void 0 ? '' : _b, onDelete = _a.onDelete, onUpload = _a.onUpload, showDeleteBtn = _a.showDeleteBtn, isAutoDelete = _a.isAutoDelete, onDownLoadCallbackBefore = _a.onDownLoadCallbackBefore, showDownloadBtn = _a.showDownloadBtn, onDownLoadCallbackAfter = _a.onDownLoadCallbackAfter, onPreviewCallbackBefore = _a.onPreviewCallbackBefore, showPreviewBtn = _a.showPreviewBtn, isPublic = _a.isPublic, data = _a.data, _c = _a.startColumns, startColumns = _c === void 0 ? [] : _c, _d = _a.otherColumns, otherColumns = _d === void 0 ? [] : _d, showUploadBtn = _a.showUploadBtn, rowSelection = _a.rowSelection, uploadTableRef = _a.uploadTableRef;
|
|
72
|
+
var fileList = _a.fileList, action = _a.action, headers = _a.headers, authToken = _a.authToken, method = _a.method, apiBaseUrl = _a.apiBaseUrl, uploadUser = _a.uploadUser, _b = _a.fileBaseUrl, fileBaseUrl = _b === void 0 ? '' : _b, onDelete = _a.onDelete, onUpload = _a.onUpload, showDeleteBtn = _a.showDeleteBtn, isAutoDelete = _a.isAutoDelete, onDownLoadCallbackBefore = _a.onDownLoadCallbackBefore, showDownloadBtn = _a.showDownloadBtn, onDownLoadCallbackAfter = _a.onDownLoadCallbackAfter, onPreviewCallbackBefore = _a.onPreviewCallbackBefore, showPreviewBtn = _a.showPreviewBtn, isPublic = _a.isPublic, data = _a.data, _c = _a.startColumns, startColumns = _c === void 0 ? [] : _c, _d = _a.otherColumns, otherColumns = _d === void 0 ? [] : _d, showUploadBtn = _a.showUploadBtn, rowSelection = _a.rowSelection, uploadTableRef = _a.uploadTableRef, tableRestProps = _a.tableRestProps;
|
|
73
73
|
var _e = useState([]), dataSource = _e[0], setDataSource = _e[1];
|
|
74
74
|
var _f = useState(false), loading = _f[0], setLoading = _f[1];
|
|
75
75
|
var _g = useState(), selectedRows = _g[0], setSelectedRows = _g[1];
|
|
@@ -415,6 +415,6 @@ var UploadTable = function (_a) {
|
|
|
415
415
|
}
|
|
416
416
|
: rowSelection;
|
|
417
417
|
}, [rowSelection]);
|
|
418
|
-
return (React.createElement(Table, { columns: columns, dataSource: dataSource, rowKey: "id", loading: loading, rowSelection: myRowSelection }));
|
|
418
|
+
return (React.createElement(Table, __assign({ columns: columns, dataSource: dataSource, rowKey: "id", loading: loading, rowSelection: myRowSelection }, tableRestProps)));
|
|
419
419
|
};
|
|
420
420
|
export default memo(UploadTable);
|
|
@@ -67,6 +67,8 @@ export interface IProps extends UploadProps {
|
|
|
67
67
|
rowSelection?: TableRowSelection<any> | 'checkbox' | 'radio';
|
|
68
68
|
/**组件提供给外部调用的一些方法 */
|
|
69
69
|
uploadTableRef?: any;
|
|
70
|
+
/**表格方法 */
|
|
71
|
+
tableRestProps?: any;
|
|
70
72
|
}
|
|
71
73
|
declare const Upload: React.FC<IProps>;
|
|
72
74
|
export default Upload;
|
|
@@ -81,7 +81,7 @@ var _accept = [
|
|
|
81
81
|
];
|
|
82
82
|
var statusArr = ['error', 'success', 'done', 'uploading', 'removed'];
|
|
83
83
|
var Upload = function (props) {
|
|
84
|
-
var children = props.children, className = props.className, _a = props.showTip, showTip = _a === void 0 ? true : _a, _b = props.showUploadBtn, showUploadBtn = _b === void 0 ? true : _b, _c = props.showDeleteBtn, showDeleteBtn = _c === void 0 ? true : _c, onDownLoadCallbackBefore = props.onDownLoadCallbackBefore, _d = props.showDownloadBtn, showDownloadBtn = _d === void 0 ? true : _d, onDownLoadCallbackAfter = props.onDownLoadCallbackAfter, _e = props.showPreviewBtn, showPreviewBtn = _e === void 0 ? true : _e, onPreviewCallbackBefore = props.onPreviewCallbackBefore, _f = props.showTable, showTable = _f === void 0 ? true : _f, showUploadList = props.showUploadList, onChange = props.onChange, beforeUpload = props.beforeUpload, multiple = props.multiple, ztAccept = props.ztAccept, ztShowTipText = props.ztShowTipText, maxCount = props.maxCount, maxSize = props.maxSize, maxSizeStr = props.maxSizeStr, action = props.action, headers = props.headers, method = props.method, uploadUser = props.uploadUser, originFileList = props.originFileList, callback = props.callback, onDeleteCallback = props.onDeleteCallback, isAutoDelete = props.isAutoDelete, apiBaseUrl = props.apiBaseUrl, _g = props.fileBaseUrl, fileBaseUrl = _g === void 0 ? '' : _g, fileBtnText = props.fileBtnText, data = props.data, authToken = props.authToken, listType = props.listType, isPublic = props.isPublic, startColumns = props.startColumns, otherColumns = props.otherColumns, _h = props.isDirect, isDirect = _h === void 0 ? false : _h, upload = props.upload, rowSelection = props.rowSelection, uploadTableRef = props.uploadTableRef, restProps = __rest(props, ["children", "className", "showTip", "showUploadBtn", "showDeleteBtn", "onDownLoadCallbackBefore", "showDownloadBtn", "onDownLoadCallbackAfter", "showPreviewBtn", "onPreviewCallbackBefore", "showTable", "showUploadList", "onChange", "beforeUpload", "multiple", "ztAccept", "ztShowTipText", "maxCount", "maxSize", "maxSizeStr", "action", "headers", "method", "uploadUser", "originFileList", "callback", "onDeleteCallback", "isAutoDelete", "apiBaseUrl", "fileBaseUrl", "fileBtnText", "data", "authToken", "listType", "isPublic", "startColumns", "otherColumns", "isDirect", "upload", "rowSelection", "uploadTableRef"]);
|
|
84
|
+
var children = props.children, className = props.className, _a = props.showTip, showTip = _a === void 0 ? true : _a, _b = props.showUploadBtn, showUploadBtn = _b === void 0 ? true : _b, _c = props.showDeleteBtn, showDeleteBtn = _c === void 0 ? true : _c, onDownLoadCallbackBefore = props.onDownLoadCallbackBefore, _d = props.showDownloadBtn, showDownloadBtn = _d === void 0 ? true : _d, onDownLoadCallbackAfter = props.onDownLoadCallbackAfter, _e = props.showPreviewBtn, showPreviewBtn = _e === void 0 ? true : _e, onPreviewCallbackBefore = props.onPreviewCallbackBefore, _f = props.showTable, showTable = _f === void 0 ? true : _f, showUploadList = props.showUploadList, onChange = props.onChange, beforeUpload = props.beforeUpload, multiple = props.multiple, ztAccept = props.ztAccept, ztShowTipText = props.ztShowTipText, maxCount = props.maxCount, maxSize = props.maxSize, maxSizeStr = props.maxSizeStr, action = props.action, headers = props.headers, method = props.method, uploadUser = props.uploadUser, originFileList = props.originFileList, callback = props.callback, onDeleteCallback = props.onDeleteCallback, isAutoDelete = props.isAutoDelete, apiBaseUrl = props.apiBaseUrl, _g = props.fileBaseUrl, fileBaseUrl = _g === void 0 ? '' : _g, fileBtnText = props.fileBtnText, data = props.data, authToken = props.authToken, listType = props.listType, isPublic = props.isPublic, startColumns = props.startColumns, otherColumns = props.otherColumns, _h = props.isDirect, isDirect = _h === void 0 ? false : _h, upload = props.upload, rowSelection = props.rowSelection, uploadTableRef = props.uploadTableRef, tableRestProps = props.tableRestProps, restProps = __rest(props, ["children", "className", "showTip", "showUploadBtn", "showDeleteBtn", "onDownLoadCallbackBefore", "showDownloadBtn", "onDownLoadCallbackAfter", "showPreviewBtn", "onPreviewCallbackBefore", "showTable", "showUploadList", "onChange", "beforeUpload", "multiple", "ztAccept", "ztShowTipText", "maxCount", "maxSize", "maxSizeStr", "action", "headers", "method", "uploadUser", "originFileList", "callback", "onDeleteCallback", "isAutoDelete", "apiBaseUrl", "fileBaseUrl", "fileBtnText", "data", "authToken", "listType", "isPublic", "startColumns", "otherColumns", "isDirect", "upload", "rowSelection", "uploadTableRef", "tableRestProps"]);
|
|
85
85
|
var _j = useState(originFileList || []), fileList = _j[0], setFileList = _j[1];
|
|
86
86
|
var _k = useState('20M'), maxSizeTransStr = _k[0], setMaxSizeTransStr = _k[1];
|
|
87
87
|
useEffect(function () {
|
|
@@ -307,6 +307,6 @@ var Upload = function (props) {
|
|
|
307
307
|
? ztShowTipText
|
|
308
308
|
: 'PDF、Word、Excel、Txt、JPG、PNG、BMP、GIF、RAR、ZIP',
|
|
309
309
|
")")))),
|
|
310
|
-
showTable && (React.createElement(UploadTable, { fileList: fileList, action: fileAction, apiBaseUrl: apiBaseUrl, fileBaseUrl: fileBaseUrl, headers: headers, method: method, uploadUser: uploadUser, onDelete: onDeleteHandle, onUpload: onUploadHandle, showDeleteBtn: showDeleteBtn, onDownLoadCallbackBefore: onDownLoadCallbackBefore, showDownloadBtn: showDownloadBtn, onDownLoadCallbackAfter: onDownLoadCallbackAfter, showPreviewBtn: showPreviewBtn, onPreviewCallbackBefore: onPreviewCallbackBefore, isAutoDelete: isAutoDelete, authToken: authToken, isPublic: isPublic, data: data, startColumns: startColumns, otherColumns: otherColumns, showUploadBtn: showUploadBtn, rowSelection: rowSelection, uploadTableRef: uploadTableRef }))));
|
|
310
|
+
showTable && (React.createElement(UploadTable, { fileList: fileList, action: fileAction, apiBaseUrl: apiBaseUrl, fileBaseUrl: fileBaseUrl, headers: headers, method: method, uploadUser: uploadUser, onDelete: onDeleteHandle, onUpload: onUploadHandle, showDeleteBtn: showDeleteBtn, onDownLoadCallbackBefore: onDownLoadCallbackBefore, showDownloadBtn: showDownloadBtn, onDownLoadCallbackAfter: onDownLoadCallbackAfter, showPreviewBtn: showPreviewBtn, onPreviewCallbackBefore: onPreviewCallbackBefore, isAutoDelete: isAutoDelete, authToken: authToken, isPublic: isPublic, data: data, startColumns: startColumns, otherColumns: otherColumns, showUploadBtn: showUploadBtn, rowSelection: rowSelection, uploadTableRef: uploadTableRef, tableRestProps: tableRestProps }))));
|
|
311
311
|
};
|
|
312
312
|
export default Upload;
|