cosey 0.3.10 → 0.3.11
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.
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { type AxiosRequestConfig } from 'axios';
|
|
1
2
|
import { type MediaCardBaseProps } from '../media-card';
|
|
2
3
|
import { type UploadContext } from '../upload-context';
|
|
3
4
|
export type UploadFileStatus = 'unready' | 'ready' | 'loading' | 'success' | 'error';
|
|
@@ -25,6 +26,7 @@ export interface UploadProps {
|
|
|
25
26
|
selectOnly?: boolean;
|
|
26
27
|
size?: MediaCardBaseProps['size'];
|
|
27
28
|
request?: UploadContext['request'];
|
|
29
|
+
requestConfig?: AxiosRequestConfig;
|
|
28
30
|
}
|
|
29
31
|
export declare const defaultUploadProps: {
|
|
30
32
|
accept: string;
|
|
@@ -64,6 +64,10 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
64
64
|
request: {
|
|
65
65
|
type: Function,
|
|
66
66
|
required: false
|
|
67
|
+
},
|
|
68
|
+
requestConfig: {
|
|
69
|
+
type: Object,
|
|
70
|
+
required: false
|
|
67
71
|
}
|
|
68
72
|
}, defaultUploadProps),
|
|
69
73
|
emits: ["exceed", "update:modelValue", "change"],
|
|
@@ -189,11 +193,13 @@ var stdin_default = /* @__PURE__ */defineComponent({
|
|
|
189
193
|
};
|
|
190
194
|
const doUpload = async options => {
|
|
191
195
|
return (props.request || request)?.(options.data, {
|
|
196
|
+
...props.requestConfig,
|
|
192
197
|
signal: options.signal,
|
|
193
198
|
onUploadProgress(event) {
|
|
194
199
|
if (event.total) {
|
|
195
200
|
options.onProgress(event.loaded / event.total * 100);
|
|
196
201
|
}
|
|
202
|
+
props.requestConfig?.onUploadProgress?.(event);
|
|
197
203
|
}
|
|
198
204
|
}).then(url => {
|
|
199
205
|
options.onSuccess(url);
|