@hzab/form-render-mobile 1.2.6 → 1.2.7
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
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hzab/form-render-mobile",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.7",
|
|
4
4
|
"description": "formily-form-render-mobile",
|
|
5
5
|
"main": "src",
|
|
6
6
|
"scripts": {
|
|
@@ -49,6 +49,7 @@
|
|
|
49
49
|
"@formily/core": "2.2.29",
|
|
50
50
|
"@formily/react": "2.2.29",
|
|
51
51
|
"@hzab/data-model": "^0.0.3",
|
|
52
|
+
"@hzab/utils": "^1.0.16",
|
|
52
53
|
"antd-mobile": "^5.32.0",
|
|
53
54
|
"antd-mobile-icons": "^0.2.2",
|
|
54
55
|
"nanoid": "^3.3.7",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { nanoid } from "nanoid";
|
|
2
2
|
import { getFormRenderGlobalServeConfig } from "../../../globalConfig";
|
|
3
|
-
|
|
3
|
+
import { addQuery } from "@hzab/utils/src/url";
|
|
4
4
|
/**
|
|
5
5
|
* 建立一个可以存取该 file 的 url
|
|
6
6
|
* @param {Object} file 文件
|
|
@@ -104,16 +104,7 @@ export function handleMaxCount(fileList, maxCount) {
|
|
|
104
104
|
}
|
|
105
105
|
return list;
|
|
106
106
|
}
|
|
107
|
-
|
|
108
|
-
const isSelf = (selfUrlList, fileUrl) => {
|
|
109
|
-
let flag = "?";
|
|
110
|
-
selfUrlList?.forEach((el) => {
|
|
111
|
-
if (fileUrl?.startsWith(el)) {
|
|
112
|
-
flag = "&";
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
return flag;
|
|
116
|
-
};
|
|
107
|
+
|
|
117
108
|
/**
|
|
118
109
|
* 处理传入的数据,数据格式统一转成 Array<fileObject>
|
|
119
110
|
* @param {Array} fileList Array<fileObject|string>
|
|
@@ -134,7 +125,7 @@ export function handleInputFileList(_fileList, maxCount = 1, opt) {
|
|
|
134
125
|
const uid = nanoid();
|
|
135
126
|
let thumbnailUrl = "";
|
|
136
127
|
if (getFormRenderGlobalServeConfig()?.showThumbnail) {
|
|
137
|
-
thumbnailUrl =
|
|
128
|
+
thumbnailUrl = addQuery(file, opt?.thumbnailParams);
|
|
138
129
|
}
|
|
139
130
|
return {
|
|
140
131
|
name: uid,
|
|
@@ -43,14 +43,12 @@ function Uploader(props, ref) {
|
|
|
43
43
|
// cordova插件上传类型 cordova-plugin-chooser | cordova-plugin-camera
|
|
44
44
|
cordovaPlugin = "cordova-plugin-camera",
|
|
45
45
|
uploaderProps,
|
|
46
|
-
thumbnailParams = "
|
|
47
|
-
selfUrlList = ["https://self-oss.abt.hzabjt.com"]
|
|
46
|
+
thumbnailParams = { image_process: "resize,w_200" },
|
|
48
47
|
} = props;
|
|
49
48
|
const [loading, setLoading] = useState(false);
|
|
50
49
|
const [fileList, setFileList] = useState(handleInputFileList(value, maxCount, {
|
|
51
50
|
thumbnailParams,
|
|
52
51
|
ossOpt,
|
|
53
|
-
selfUrlList
|
|
54
52
|
}));
|
|
55
53
|
const [actionSheetVisible, setActionSheetVisible] = useState(false);
|
|
56
54
|
const uploadManagerRef = useRef(new uploadManager(new ChooserUploader()));
|
|
@@ -59,9 +57,8 @@ function Uploader(props, ref) {
|
|
|
59
57
|
setFileList(handleInputFileList(value, maxCount, {
|
|
60
58
|
thumbnailParams,
|
|
61
59
|
ossOpt,
|
|
62
|
-
selfUrlList
|
|
63
60
|
}));
|
|
64
|
-
}, [value,
|
|
61
|
+
}, [value, ossOpt]);
|
|
65
62
|
|
|
66
63
|
useImperativeHandle(ref, () => ({ onPicker, setActionSheetVisible }));
|
|
67
64
|
|