@hzab/form-render-mobile 1.2.4 → 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,15 +1,19 @@
|
|
|
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": {
|
|
7
7
|
"dev": "npm run prepare && webpack serve -c ./config/webpack.config.js --env local",
|
|
8
8
|
"build": "webpack -c ./config/webpack.config.js --env production",
|
|
9
|
-
"
|
|
10
|
-
"publish
|
|
11
|
-
"
|
|
12
|
-
"publish
|
|
9
|
+
"version:alpha": "npm version prerelease --preid=alpha",
|
|
10
|
+
"publish:alpha": "npm publish --tag alpha",
|
|
11
|
+
"version:beta": "npm version prerelease --preid=beta",
|
|
12
|
+
"publish:beta": "npm publish --tag beta",
|
|
13
|
+
"version:patch": "npm version patch",
|
|
14
|
+
"version:minior": "npm version minor",
|
|
15
|
+
"version:major": "npm version major",
|
|
16
|
+
"publish:stable": "npm publish --access public",
|
|
13
17
|
"prepare": "husky install",
|
|
14
18
|
"mac-chmod": "chmod +x .husky && chmod +x .husky/pre-commit",
|
|
15
19
|
"docs": "typedoc"
|
|
@@ -45,6 +49,7 @@
|
|
|
45
49
|
"@formily/core": "2.2.29",
|
|
46
50
|
"@formily/react": "2.2.29",
|
|
47
51
|
"@hzab/data-model": "^0.0.3",
|
|
52
|
+
"@hzab/utils": "^1.0.16",
|
|
48
53
|
"antd-mobile": "^5.32.0",
|
|
49
54
|
"antd-mobile-icons": "^0.2.2",
|
|
50
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
|
|