@hzab/form-render-mobile 1.1.4 → 1.1.5
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,7 +1,7 @@
|
|
|
1
1
|
declare global {
|
|
2
2
|
interface Window {
|
|
3
3
|
resolveLocalFileSystemURL?: (url: string, successCallback: (entry: any) => void, errorCallback?: (error: any) => void) => void;
|
|
4
|
-
chooser?:{
|
|
4
|
+
chooser?: {
|
|
5
5
|
getFile: any
|
|
6
6
|
}
|
|
7
7
|
}
|
|
@@ -91,7 +91,7 @@ export function onGalleryUopload(opt?: IGalleryUopload) {
|
|
|
91
91
|
const reader = new FileReader();
|
|
92
92
|
reader.onloadend = function (e) {
|
|
93
93
|
if (reader.result) {
|
|
94
|
-
const imgBlob: any = new Blob([reader.result], { type: "
|
|
94
|
+
const imgBlob: any = new Blob([reader.result], { type: "jpeg" });
|
|
95
95
|
|
|
96
96
|
const _blob = addBlobAttributeUtil(imgBlob)
|
|
97
97
|
|
|
@@ -214,7 +214,7 @@ export class ChooserUploader extends UploadManager implements IUploader {
|
|
|
214
214
|
|
|
215
215
|
async upload(options: IUploadOptions) {
|
|
216
216
|
try {
|
|
217
|
-
const { mimeTypes} = options?.additionalParams || {}
|
|
217
|
+
const { mimeTypes } = options?.additionalParams || {}
|
|
218
218
|
const mergeAccepts = [...this.defaultAccept, ...(mimeTypes || [])]
|
|
219
219
|
// const maxFileSize = _maxFileSize || this.maxFileSize;
|
|
220
220
|
|
|
@@ -228,17 +228,17 @@ export class ChooserUploader extends UploadManager implements IUploader {
|
|
|
228
228
|
options?.errorCallback?.(ErrorCallbackEnum.FILE_TYPE_ERROR)
|
|
229
229
|
return
|
|
230
230
|
// 超出文件最大限制
|
|
231
|
-
}
|
|
231
|
+
}
|
|
232
232
|
// else if (size > maxFileSize) {
|
|
233
233
|
// options?.errorCallback?.(ErrorCallbackEnum.SIZE_EXCEED_ERROR)
|
|
234
234
|
// return
|
|
235
|
-
// }
|
|
235
|
+
// }
|
|
236
236
|
else {
|
|
237
237
|
window.resolveLocalFileSystemURL(path, (fileEntry: any) => {
|
|
238
238
|
fileEntry.file((file: File) => {
|
|
239
239
|
const reader = new FileReader();
|
|
240
240
|
reader.onloadend = () => {
|
|
241
|
-
const blob: any = new Blob([reader.result as ArrayBuffer], { type: mimeType });
|
|
241
|
+
const blob: any = new Blob([reader.result as ArrayBuffer], { type: mimeType.replace(/.*\//, "") });
|
|
242
242
|
const _blob = addBlobAttributeUtil(blob)
|
|
243
243
|
|
|
244
244
|
options.onSuccess?.({ blob: _blob, fileType: mimeType });
|
|
@@ -13,6 +13,7 @@ export const Uploader = forwardRef((props, ref) => {
|
|
|
13
13
|
useImperativeHandle(ref, () => {
|
|
14
14
|
return {
|
|
15
15
|
onSelectFile: (key) => uploadRef.current?.onPicker?.({ key: key || "select" }),
|
|
16
|
+
setActionSheetVisible: (visible) => uploadRef.current?.setActionSheetVisible?.(visible),
|
|
16
17
|
};
|
|
17
18
|
});
|
|
18
19
|
|
|
@@ -51,7 +51,7 @@ function Uploader(props, ref) {
|
|
|
51
51
|
setFileList(handleInputFileList(value, maxCount));
|
|
52
52
|
}, [value]);
|
|
53
53
|
|
|
54
|
-
useImperativeHandle(ref, () => ({ onPicker }));
|
|
54
|
+
useImperativeHandle(ref, () => ({ onPicker, setActionSheetVisible }));
|
|
55
55
|
|
|
56
56
|
async function onFileChange(e) {
|
|
57
57
|
e.persist();
|