UNPKG

2.19 kBTypeScriptView Raw
1import type { ComponentPublicInstance } from 'vue';
2import type { ImageFit } from '../image';
3import type { Numeric, Interceptor } from '../utils';
4import type { UploaderProps } from './Uploader';
5export type UploaderResultType = 'dataUrl' | 'text' | 'file';
6export type UploaderFileListItem = {
7 url?: string;
8 file?: File;
9 objectUrl?: string;
10 content?: string;
11 isImage?: boolean;
12 status?: '' | 'uploading' | 'done' | 'failed';
13 message?: string;
14 imageFit?: ImageFit;
15 deletable?: boolean;
16 reupload?: boolean;
17 previewSize?: Numeric;
18 beforeDelete?: Interceptor;
19};
20export type UploaderMaxSize = Numeric | ((file: File) => boolean);
21export type UploaderBeforeRead = (file: File | File[], detail: {
22 name: Numeric;
23 index: number;
24}) => boolean | undefined | Promise<File | File[] | undefined>;
25export type UploaderAfterRead = (items: UploaderFileListItem | UploaderFileListItem[], detail: {
26 name: Numeric;
27 index: number;
28}) => void;
29export type UploaderExpose = {
30 chooseFile: () => void;
31 closeImagePreview: () => void;
32 reuploadFile: (index: number) => void;
33};
34export type UploaderInstance = ComponentPublicInstance<UploaderProps, UploaderExpose>;
35export type UploaderThemeVars = {
36 uploaderSize?: string;
37 uploaderIconSize?: string;
38 uploaderIconColor?: string;
39 uploaderTextColor?: string;
40 uploaderTextFontSize?: string;
41 uploaderUploadBackground?: string;
42 uploaderUploadActiveColor?: string;
43 uploaderDeleteColor?: string;
44 uploaderDeleteIconSize?: string;
45 uploaderDeleteBackground?: string;
46 uploaderFileBackground?: string;
47 uploaderFileIconSize?: string;
48 uploaderFileIconColor?: string;
49 uploaderFileNamePadding?: string;
50 uploaderFileNameMarginTop?: string;
51 uploaderFileNameFontSize?: string;
52 uploaderFileNameTextColor?: string;
53 uploaderMaskTextColor?: string;
54 uploaderMaskBackground?: string;
55 uploaderMaskIconSize?: string;
56 uploaderMaskMessageFontSize?: string;
57 uploaderMaskMessageLineHeight?: number | string;
58 uploaderLoadingIconSize?: string;
59 uploaderLoadingIconColor?: string;
60 uploaderDisabledOpacity?: number | string;
61};