2019-01-12 03:33:27 +00:00
|
|
|
import PropsTypes from '../_util/vue-types';
|
2018-04-13 08:19:50 +00:00
|
|
|
|
2019-01-12 03:33:27 +00:00
|
|
|
export const UploadFileStatus = PropsTypes.oneOf([
|
|
|
|
'error',
|
|
|
|
'success',
|
|
|
|
'done',
|
|
|
|
'uploading',
|
|
|
|
'removed',
|
|
|
|
]);
|
2018-04-13 08:19:50 +00:00
|
|
|
|
|
|
|
// export const HttpRequestHeader {
|
|
|
|
// [key: string]: string;
|
|
|
|
// }
|
|
|
|
|
2018-07-02 08:24:19 +00:00
|
|
|
// export const UploadFile = PropsTypes.shape({
|
|
|
|
// uid: PropsTypes.oneOfType([
|
|
|
|
// PropsTypes.string,
|
|
|
|
// PropsTypes.number,
|
|
|
|
// ]),
|
|
|
|
// size: PropsTypes.number,
|
|
|
|
// name: PropsTypes.string,
|
|
|
|
// filename: PropsTypes.string,
|
|
|
|
// lastModified: PropsTypes.number,
|
|
|
|
// lastModifiedDate: PropsTypes.any,
|
|
|
|
// url: PropsTypes.string,
|
|
|
|
// status: UploadFileStatus,
|
|
|
|
// percent: PropsTypes.number,
|
|
|
|
// thumbUrl: PropsTypes.string,
|
|
|
|
// originFileObj: PropsTypes.any,
|
|
|
|
// response: PropsTypes.any,
|
|
|
|
// error: PropsTypes.any,
|
|
|
|
// linkProps: PropsTypes.any,
|
|
|
|
// type: PropsTypes.string,
|
|
|
|
// }).loose
|
|
|
|
|
2019-01-12 03:33:27 +00:00
|
|
|
function UploadFile({ uid, name }) {
|
|
|
|
if (!uid && uid !== 0) return false;
|
|
|
|
if (!['string', 'number'].includes(typeof uid)) return false;
|
|
|
|
if (name === '' || typeof name !== 'string') return false;
|
|
|
|
return true;
|
2018-07-02 08:24:19 +00:00
|
|
|
}
|
2018-04-13 08:19:50 +00:00
|
|
|
|
|
|
|
export const UploadChangeParam = {
|
2018-07-02 08:24:19 +00:00
|
|
|
file: PropsTypes.custom(UploadFile),
|
|
|
|
fileList: PropsTypes.arrayOf(PropsTypes.custom(UploadFile)),
|
2018-04-13 08:19:50 +00:00
|
|
|
event: PropsTypes.object,
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|
2018-04-13 08:19:50 +00:00
|
|
|
|
|
|
|
export const ShowUploadListInterface = PropsTypes.shape({
|
|
|
|
showRemoveIcon: PropsTypes.bool,
|
|
|
|
showPreviewIcon: PropsTypes.bool,
|
2019-01-12 03:33:27 +00:00
|
|
|
}).loose;
|
2018-04-13 08:19:50 +00:00
|
|
|
|
|
|
|
export const UploadLocale = PropsTypes.shape({
|
|
|
|
uploading: PropsTypes.string,
|
|
|
|
removeFile: PropsTypes.string,
|
|
|
|
uploadError: PropsTypes.string,
|
|
|
|
previewFile: PropsTypes.string,
|
2019-01-12 03:33:27 +00:00
|
|
|
}).loose;
|
2018-07-11 04:03:19 +00:00
|
|
|
|
2018-04-13 08:19:50 +00:00
|
|
|
export const UploadProps = {
|
|
|
|
type: PropsTypes.oneOf(['drag', 'select']),
|
|
|
|
name: PropsTypes.string,
|
2018-07-02 08:24:19 +00:00
|
|
|
defaultFileList: PropsTypes.arrayOf(PropsTypes.custom(UploadFile)),
|
|
|
|
fileList: PropsTypes.arrayOf(PropsTypes.custom(UploadFile)),
|
2018-09-05 13:28:54 +00:00
|
|
|
action: PropsTypes.oneOfType([PropsTypes.string, PropsTypes.func]),
|
|
|
|
directory: PropsTypes.bool,
|
2018-04-13 08:19:50 +00:00
|
|
|
data: PropsTypes.oneOfType([PropsTypes.object, PropsTypes.func]),
|
|
|
|
headers: PropsTypes.object,
|
|
|
|
showUploadList: PropsTypes.oneOfType([PropsTypes.bool, ShowUploadListInterface]),
|
|
|
|
multiple: PropsTypes.bool,
|
|
|
|
accept: PropsTypes.string,
|
|
|
|
beforeUpload: PropsTypes.func,
|
|
|
|
// onChange: PropsTypes.func,
|
|
|
|
listType: PropsTypes.oneOf(['text', 'picture', 'picture-card']),
|
|
|
|
// className: PropsTypes.string,
|
|
|
|
// onPreview: PropsTypes.func,
|
2018-11-16 02:32:11 +00:00
|
|
|
remove: PropsTypes.func,
|
2018-04-13 08:19:50 +00:00
|
|
|
supportServerRender: PropsTypes.bool,
|
|
|
|
// style: PropsTypes.object,
|
|
|
|
disabled: PropsTypes.bool,
|
|
|
|
prefixCls: PropsTypes.string,
|
|
|
|
customRequest: PropsTypes.func,
|
|
|
|
withCredentials: PropsTypes.bool,
|
2018-12-05 10:31:58 +00:00
|
|
|
openFileDialogOnClick: PropsTypes.bool,
|
2018-04-13 08:19:50 +00:00
|
|
|
locale: UploadLocale,
|
|
|
|
height: PropsTypes.number,
|
2019-03-28 11:51:27 +00:00
|
|
|
id: PropsTypes.string,
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|
2018-04-13 08:19:50 +00:00
|
|
|
|
|
|
|
export const UploadState = {
|
2018-07-02 08:24:19 +00:00
|
|
|
fileList: PropsTypes.arrayOf(PropsTypes.custom(UploadFile)),
|
2018-04-13 08:19:50 +00:00
|
|
|
dragState: PropsTypes.string,
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|
2018-04-13 08:19:50 +00:00
|
|
|
|
|
|
|
export const UploadListProps = {
|
|
|
|
listType: PropsTypes.oneOf(['text', 'picture', 'picture-card']),
|
|
|
|
// onPreview: PropsTypes.func,
|
|
|
|
// onRemove: PropsTypes.func,
|
2018-07-02 08:24:19 +00:00
|
|
|
// items: PropsTypes.arrayOf(UploadFile),
|
|
|
|
items: PropsTypes.arrayOf(PropsTypes.custom(UploadFile)),
|
2018-04-13 08:19:50 +00:00
|
|
|
// items: PropsTypes.any,
|
|
|
|
progressAttr: PropsTypes.object,
|
|
|
|
prefixCls: PropsTypes.string,
|
|
|
|
showRemoveIcon: PropsTypes.bool,
|
|
|
|
showPreviewIcon: PropsTypes.bool,
|
|
|
|
locale: UploadLocale,
|
2019-01-12 03:33:27 +00:00
|
|
|
};
|