import previewImage from '../../preview-image';
import { FILE_UPLOAD_STATUS } from '../constants';
export function defaultGetThumbSrcFromFile(file) {
    return new Promise(function (resolve, reject) {
        var fileReader = new FileReader();
        fileReader.onloadend = function () { return resolve(fileReader.result); };
        fileReader.onerror = reject;
        fileReader.readAsDataURL(file);
    });
}
export function defaultPreview(file, fileList) {
    var previewFiles = fileList.filter(function (item) { return item.status !== FILE_UPLOAD_STATUS.failed; });
    var previewIndex = previewFiles.indexOf(file);
    previewImage({
        index: previewIndex,
        images: previewFiles.map(function (item) { return item.src || item.thumbSrc; }),
    });
}
