react-alioss
Version:
说明: 基于阿里云实现前端上传图片到阿里云 需要通过后台接口获取阿里云上传凭证
124 lines (121 loc) • 3.24 kB
TypeScript
import * as React from "react";
export declare type UploadFileStatus =
| "error"
| "success"
| "done"
| "uploading"
| "removed";
export interface HttpRequestHeader {
[key: string]: string;
}
export interface RcFile extends File {
uid: string;
readonly lastModifiedDate: Date;
readonly webkitRelativePath: string;
}
export interface UploadFile {
uid: string;
size: number;
name: string;
fileName?: string;
lastModified?: number;
lastModifiedDate?: Date;
url?: string;
status?: UploadFileStatus;
percent?: number;
thumbUrl?: string;
originFileObj?: File | Blob;
response?: any;
error?: any;
linkProps?: any;
type: string;
[propsName: string]: any;
}
export interface UploadChangeParam<T extends object = UploadFile> {
file: T;
fileList: Array<UploadFile>;
event?: {
percent: number;
};
}
export interface ShowUploadListInterface {
showRemoveIcon?: boolean;
showPreviewIcon?: boolean;
}
export interface UploadLocale {
uploading?: string;
removeFile?: string;
uploadError?: string;
previewFile?: string;
}
export declare type UploadType = "drag" | "select";
export declare type UploadListType = "text" | "picture" | "picture-card";
declare type PreviewFileHandler = (file: File | Blob) => PromiseLike<string>;
export interface UploadProps {
type?: UploadType;
name?: string;
defaultFileList?: Array<UploadFile>;
fileList?: Array<UploadFile>;
action?:
| string
| ((file: RcFile) => string)
| ((file: RcFile) => PromiseLike<string>);
directory?: boolean;
data?: object | ((file: UploadFile) => object);
headers?: HttpRequestHeader;
showUploadList?: boolean | ShowUploadListInterface;
multiple?: boolean;
accept?: string;
beforeUpload?: (
file: RcFile,
FileList: RcFile[]
) => boolean | PromiseLike<void>;
onChange?: (info: UploadChangeParam) => void;
listType?: UploadListType;
className?: string;
onPreview?: (file: UploadFile) => void;
onRemove?: (file: UploadFile) => void | boolean | Promise<void | boolean>;
supportServerRender?: boolean;
style?: React.CSSProperties;
disabled?: boolean;
prefixCls?: string;
customRequest?: (option: object) => void;
withCredentials?: boolean;
openFileDialogOnClick?: boolean;
locale?: UploadLocale;
id?: string;
previewFile?: PreviewFileHandler;
}
export interface UploadState {
fileList: UploadFile[];
dragState: string;
}
export interface UploadListProps {
listType?: UploadListType;
onPreview?: (file: UploadFile) => void;
onRemove?: (file: UploadFile) => void | boolean;
items?: Array<UploadFile>;
progressAttr?: Object;
prefixCls?: string;
showRemoveIcon?: boolean;
showPreviewIcon?: boolean;
locale: UploadLocale;
previewFile?: PreviewFileHandler;
}
export interface ITEMT {
aliurl?: string;
url: string;
fail?: string;
changeUrl?: string;
}
export interface UpProps {
clientOss: any;
keyOss: any;
limit?: number;
uploadMess?: ITEMT[];
id?: string;
radio?: string;
tips: () => {}; //额外信息
[propName: string]: any; //添加带有任意数量的其它属性
}
export {};