ztxkui 4.2.23-341-beta → 4.2.23-342-beta
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,7 +39,7 @@ var FileOperation = function (props) {
|
|
|
39
39
|
onWatermarkChange && onWatermarkChange(e.target.checked);
|
|
40
40
|
} }, "\u6DFB\u52A0\u6C34\u5370"))),
|
|
41
41
|
React.createElement("div", { className: "file-operation--list" },
|
|
42
|
-
isReplaceFile && (React.createElement(FileUpload, { fileList: fileList, apiBaseUrl: apiBaseUrl, onFileChange: onFileChange }, "\u66FF\u6362")),
|
|
42
|
+
isReplaceFile && (React.createElement(FileUpload, { fileList: fileList, apiBaseUrl: apiBaseUrl, onFileChange: onFileChange, type: "link" }, "\u66FF\u6362")),
|
|
43
43
|
isDownload && fileId ? (React.createElement(Button, { type: "link", onClick: function () {
|
|
44
44
|
downloadFileCallBack(apiBaseUrl, fileId, dangerouslySetXss(fileName) || '附件', {
|
|
45
45
|
addWaterMark: false,
|
|
@@ -20,16 +20,16 @@ import useLastest from '../../utils/useLastest';
|
|
|
20
20
|
import { getToken } from 'ztxkutils/dist/authority';
|
|
21
21
|
import { formatUnit, getFileExtension } from '../utils';
|
|
22
22
|
var FileUpload = function (props) {
|
|
23
|
-
var apiBaseUrl = props.apiBaseUrl, headers = props.headers, data = props.data, isPublic = props.isPublic, acceptList = props.acceptList, maxSize = props.maxSize, beforeUpload = props.beforeUpload, disAllowDuplicateFile = props.disAllowDuplicateFile, fileList = props.fileList, onFileChange = props.onFileChange, children = props.children, _a = props.multiple, multiple = _a === void 0 ? true : _a;
|
|
24
|
-
var
|
|
23
|
+
var apiBaseUrl = props.apiBaseUrl, headers = props.headers, data = props.data, isPublic = props.isPublic, acceptList = props.acceptList, maxSize = props.maxSize, beforeUpload = props.beforeUpload, disAllowDuplicateFile = props.disAllowDuplicateFile, fileList = props.fileList, onFileChange = props.onFileChange, children = props.children, _a = props.multiple, multiple = _a === void 0 ? true : _a, _b = props.type, type = _b === void 0 ? 'primary' : _b;
|
|
24
|
+
var _c = useState(false), loading = _c[0], setLoading = _c[1];
|
|
25
25
|
// 取接口地址
|
|
26
26
|
var defaultApiBaseUrl = useBaseContext().apiBaseUrl;
|
|
27
|
-
var
|
|
27
|
+
var _d = useBasicInfo({
|
|
28
28
|
apiBaseUrl: apiBaseUrl || defaultApiBaseUrl,
|
|
29
29
|
headers: headers,
|
|
30
30
|
data: data,
|
|
31
31
|
isPublic: isPublic,
|
|
32
|
-
}), fileAction =
|
|
32
|
+
}), fileAction = _d.fileAction, fileHeaders = _d.fileHeaders, fileData = _d.fileData;
|
|
33
33
|
// 文件上传前的判断处理
|
|
34
34
|
var beforeUploadHandle = useBeforeUpload({
|
|
35
35
|
acceptList: acceptList,
|
|
@@ -50,7 +50,7 @@ var FileUpload = function (props) {
|
|
|
50
50
|
onFileChange && onFileChange(info);
|
|
51
51
|
}, [onFileChange]);
|
|
52
52
|
return (React.createElement(Upload, { action: fileAction, headers: fileHeaders, data: fileData, showUploadList: false, beforeUpload: beforeUploadHandle, onChange: onChange, disabled: loading, multiple: multiple, className: "electron-file-upload" },
|
|
53
|
-
React.createElement(Button, { type:
|
|
53
|
+
React.createElement(Button, { type: type, loading: loading }, children)));
|
|
54
54
|
};
|
|
55
55
|
export default memo(FileUpload);
|
|
56
56
|
function useBasicInfo(props) {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
+
import { ButtonProps } from 'antd';
|
|
2
3
|
/** 附件的字段说明 */
|
|
3
4
|
export interface IFileFieldsName {
|
|
4
5
|
/** 附件id */
|
|
@@ -644,6 +645,7 @@ export interface IFileUploadProps {
|
|
|
644
645
|
onFileChange?: any;
|
|
645
646
|
children?: React.ReactNode;
|
|
646
647
|
multiple?: boolean;
|
|
648
|
+
type?: ButtonProps['type'];
|
|
647
649
|
}
|
|
648
650
|
export interface IFileOperationProps {
|
|
649
651
|
/**附件名称 */
|