/** * 从本地相册选择图片或使用相机拍照接口请求参数 */ export type FabricChooseImageOptions = { /** * 最多可以选择的图片张数 * @default 9 */ count?: number; /** 是否需要返回图片base64内容, 可指定尺寸 */ resizedBase64?: null | { width: number; height: number; }; /** 是否需要裁剪图片, 可指定裁剪比例 */ crop?: null | { ratio: number; }; /** * 图片质量, original: 原图、compressed: 压缩图、Number: (0-1] * @default 'original' */ sizeType?: "original" | "compressed" | T; /** * 图片来源, album: 相册、camera: 相机、all: 相册 + 相机 * @default 'album' */ sourceType?: "album" | "camera" | "all"; }; /** * 从本地相册选择图片或使用相机拍照, 结果返回. */ export type FabricChooseImageCallbackData = { /** 图片的本地临时文件列表 */ tempFiles: Array<{ /** 本地临时文件路径 */ path: string; /** 配置 resizedBase64 时才返回 */ base64?: string; /** 本地临时文件大小,单位 B */ size: number; }>; }; export type FabricPhotoChooseImageFileApi = (options?: FabricChooseImageOptions) => Promise; declare class FabricError extends Error { code: string; message: string; data: any; protected constructor(code: string, message: string, data: any); toJSON: () => { name: any; code: any; data: any; message: any; description: any; number: any; fileName: any; lineNumber: any; columnNumber: any; stack: any; }; } export type FabricPreviewImageUrlItem = { /** * 唯一标识, 可选, 可能增加click点击事件的时候需要回传. */ id?: string; /** * Http网络图片地址, 或者本地图片地址. */ url: string; /** * 当前图片的描述信息 */ desc?: string; }; export type WatermarkInfo = { /** * 水平间距 * @default 80 */ horizontalSpace?: number; /** * 垂直间距 * @default 100 */ verticalSpace?: number; /** * 水印文字大小 * @default 17 */ fontSize?: number; /** * 水印文字颜色 * @default `#FFFFFFFF` */ textColor?: string; /** * 水印文字 * @default '' */ text?: string; }; /** * 在新页面中全屏预览图片。 */ export type FabricPreviewImageOptions = { /** * 需要预览的图片链接列表。可以是本地链接, 也可以是网络地址 */ urls: FabricPreviewImageUrlItem[]; /** * 描述信息显示的总行数 */ lines: number; /** * 当前显示图片的链接位置索引值, 默认:urls 的第一张 * @default 0 */ current?: number; /** * 水印信息 */ watermark?: WatermarkInfo; }; export type FabricPhotoPreviewImageFileApi = (options: FabricPreviewImageOptions, callback?: (err: FabricError | null, id?: string) => void) => void; /** * 关闭图片预览器 */ export type FabricClosePhotoPreviewImageFileApi = () => void; /** * 保存图片到本地相册; 比如保存二维码.接口请求参数 */ export type FabricPhotoSaveImageToPhotosAlbumOptions = { /** * 当前图片类型, 网络图片, 本地图片, base64 */ type: "http" | "local" | "base64"; /** * 图片文件路径,可以是临时文件路径或永久文件路径 (本地路径) ,或者网络路径 或者 文件数据(base64), */ filePath: string; }; /** * 保存图片到本地相册后的返回路径, 可以是本地的虚拟路径, 此路径可以预览接口一样 * 可以进行上传, 访问 `previewImage`访问 */ export type FabricPhotoSaveImageToPhotosAlbumCallbackData = { /** * 图片保存后的本地路径. */ filePath: string; }; export type FabricPhotoSaveImageToPhotosAlbumApi = (options: FabricPhotoSaveImageToPhotosAlbumOptions) => Promise; export type FabricPhotoApi = { /** * 从本地相册选择图片或使用相机拍照。 */ chooseImage: FabricPhotoChooseImageFileApi; /** * 关闭当前图片预览器 */ closePreviewImage: FabricClosePhotoPreviewImageFileApi; /** * 在新页面中全屏预览图片。 */ previewImage: FabricPhotoPreviewImageFileApi; /** * 保存图片到本地相册; 比如保存二维码. */ saveImageToPhotosAlbum: FabricPhotoSaveImageToPhotosAlbumApi; }; export declare const fabricPhoto: FabricPhotoApi; export {};