@hzab/form-render 1.7.3 → 1.7.5-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.
- package/CHANGELOG.md +8 -0
- package/package.json +1 -1
- package/src/components/RichEditor/index.tsx +3 -2
- package/src/components/Upload/common/handleIOFileList.ts +7 -2
- package/src/components/Upload/common/ossUpload.js +2 -1
- package/src/components/Upload/uploader.jsx +4 -2
- package/src/globalConfig.ts +15 -0
package/CHANGELOG.md
CHANGED
package/package.json
CHANGED
|
@@ -8,6 +8,7 @@ import "./index.less";
|
|
|
8
8
|
import { Spin, message } from "antd";
|
|
9
9
|
import { connect, mapProps, observer, useField } from "@formily/react";
|
|
10
10
|
import { merge } from "lodash";
|
|
11
|
+
import { getFormRenderPCGlobalServeConfig } from "../../globalConfig";
|
|
11
12
|
interface AnyObject {
|
|
12
13
|
[key: string]: any;
|
|
13
14
|
}
|
|
@@ -42,8 +43,8 @@ export const RichEditor = observer(function (props: PropsType, parentRef) {
|
|
|
42
43
|
offlineServerUrl = "",
|
|
43
44
|
uploadParams = {},
|
|
44
45
|
// ossUrl = "https://test-abt.hzabjt.com:18091/api/v1/user/oss/getWebOssConfig",
|
|
45
|
-
ossServerUrl = "/api/v1/
|
|
46
|
-
ossUrl = "/api/v1/
|
|
46
|
+
ossServerUrl = getFormRenderPCGlobalServeConfig()?.serverUrl || "/api/v1/user/oss/getWebOssConfig",
|
|
47
|
+
ossUrl = getFormRenderPCGlobalServeConfig()?.serverUrl || "/api/v1/user/oss/getWebOssConfig",
|
|
47
48
|
zIndex = 9999,
|
|
48
49
|
} = props;
|
|
49
50
|
const isPrivateStore =
|
|
@@ -4,6 +4,7 @@ import { isBase64Str } from "@hzab/utils/src/base64Str";
|
|
|
4
4
|
import { getUFileName, getFileName, getFullFileName, getFileExt } from "@hzab/utils/src/file/fileName";
|
|
5
5
|
import { getFileNameObj } from "@hzab/utils/src/upload/uploadUtils";
|
|
6
6
|
import { nanoidNumALetters } from "@hzab/utils/src/nanoid";
|
|
7
|
+
import { getFormRenderPCGlobalServeConfig } from "../../../globalConfig";
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* 出入参归一化
|
|
@@ -208,12 +209,16 @@ export const handleInputItem = (data, opt: IHandlerOpt) => {
|
|
|
208
209
|
file.originalFilename = getFullFileName(file.url);
|
|
209
210
|
file.type = getFileType(file.url);
|
|
210
211
|
file.ext = getFileExt(file.url);
|
|
211
|
-
|
|
212
|
+
if (getFormRenderPCGlobalServeConfig()?.showThumbnail) {
|
|
213
|
+
file.thumbUrl = `${_data}${thumbnailParams ? isSelf(selfUrlList, _data) + thumbnailParams : ""}`;
|
|
214
|
+
}
|
|
212
215
|
} else if (typeof _data === "object") {
|
|
213
216
|
const sourceData = _data.originFileObj || _data;
|
|
214
217
|
file.id = _data.id || _data.uid;
|
|
215
218
|
file.url = sourceData.url || sourceData.ossUrl;
|
|
216
|
-
|
|
219
|
+
if (getFormRenderPCGlobalServeConfig()?.showThumbnail) {
|
|
220
|
+
file.thumbUrl = `${file.url}${thumbnailParams ? isSelf(selfUrlList, file.url) + thumbnailParams : ""}`;
|
|
221
|
+
}
|
|
217
222
|
file.storeUrl = file.url;
|
|
218
223
|
file.originalFilename = _data.originalFilename || getFullFileName(file.url) || _data.name;
|
|
219
224
|
file.name = _data.filename || _data.name || getFullFileName(file.url);
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import OssUploadUtil, { axios, getSignature } from "@hzab/utils/src/upload/OssUploadUtil";
|
|
2
|
+
import { getFormRenderPCGlobalServeConfig } from "../../../globalConfig.ts";
|
|
2
3
|
|
|
3
4
|
/**
|
|
4
5
|
* 处理文件上传逻辑
|
|
@@ -13,7 +14,7 @@ export async function handleOssUpload(files, opt) {
|
|
|
13
14
|
...opt,
|
|
14
15
|
axios: opt.axios,
|
|
15
16
|
axiosConf: axiosConf,
|
|
16
|
-
serverUrl: ossUrl || "/api/v1/
|
|
17
|
+
serverUrl: ossUrl || getFormRenderPCGlobalServeConfig()?.serverUrl || "/api/v1/user/oss/getWebOssConfig",
|
|
17
18
|
});
|
|
18
19
|
|
|
19
20
|
const promise = [];
|
|
@@ -14,6 +14,7 @@ import { handleInputFileList, handleOutputFileList } from "./common/handleIOFile
|
|
|
14
14
|
import PreviewModal, { hasPreviewRender, hasPreviewMedium } from "./components/PreviewModal";
|
|
15
15
|
import { getOssUploadRequest, getOfflineUploadRequest } from "./common/customRequest";
|
|
16
16
|
import { handlePreviewUrls } from "./common/OfflineUpload";
|
|
17
|
+
import { getFormRenderPCGlobalServeConfig } from "../../globalConfig";
|
|
17
18
|
|
|
18
19
|
import "./uploader.less";
|
|
19
20
|
|
|
@@ -47,7 +48,7 @@ export function Uploader({ onChange, ...props }) {
|
|
|
47
48
|
listType = "text",
|
|
48
49
|
disabled = false,
|
|
49
50
|
readOnly = false,
|
|
50
|
-
ossServerUrl = "/api/v1/
|
|
51
|
+
ossServerUrl = getFormRenderPCGlobalServeConfig()?.serverUrl || "/api/v1/user/oss/getWebOssConfig",
|
|
51
52
|
// 是否使用 oss 上传文件
|
|
52
53
|
isOssUpload = true,
|
|
53
54
|
// 是否使用字符串结果
|
|
@@ -63,7 +64,8 @@ export function Uploader({ onChange, ...props }) {
|
|
|
63
64
|
isFileObj = false,
|
|
64
65
|
isFileJson = false,
|
|
65
66
|
thumbnailParams = "image_process=resize,p_30",
|
|
66
|
-
selfUrlList = ["https://self-oss.abt.hzabjt.com"]
|
|
67
|
+
selfUrlList = ["https://self-oss.abt.hzabjt.com"],
|
|
68
|
+
readPretty
|
|
67
69
|
} = props;
|
|
68
70
|
const isPrivateStore =
|
|
69
71
|
props.uploadParams?.fileAcl === "private" || props.ossOpt?.signatureParams?.fileAcl === "private";
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
window.formRenderPCGlobalServeConfig = {}
|
|
2
|
+
/** 获取全局配置(url、是否显示缩略图地址) */
|
|
3
|
+
export function getFormRenderPCGlobalServeConfig() {
|
|
4
|
+
return window.formRenderPCGlobalServeConfig || {}
|
|
5
|
+
}
|
|
6
|
+
/** 设置全局配置(url、是否显示缩略图地址)*/
|
|
7
|
+
export function setFormRenderPCGlobalServeConfigs(data) {
|
|
8
|
+
Object.assign(window.formRenderPCGlobalServeConfig || {}, data);
|
|
9
|
+
return window.formRenderPCGlobalServeConfig || {}
|
|
10
|
+
}
|
|
11
|
+
/** 设置全局单个配置(url、是否显示缩略图地址)*/
|
|
12
|
+
export function setFormRenderPCGlobalServeConfig(key, data) {
|
|
13
|
+
window.formRenderPCGlobalServeConfig[key] = data
|
|
14
|
+
return window.formRenderPCGlobalServeConfig || {}
|
|
15
|
+
}
|