import { LinkTargetContext } from '@vill-v/ts'; import { Properties, PropertiesHyphen } from 'csstype'; /** * base64 to blob * @param base64Buf */ declare function imgDataURLtoBlob(base64Buf: string): Blob; /** * img url to base64 * @param url * @param mineType */ declare function imgUrlToBase64(url: string, mineType?: string): Promise; /** * blob转json * 用于axios选择转换为blob时,对后台正常json报错进行读取 * * 使用 `FileReader` 进行转换 * @param blob * @param format */ declare const blobToJsonLegacy: = Record>(blob: Blob, format?: string) => Promise; /** * blob转json * 用于axios选择转换为blob时,对后台正常json报错进行读取 * * 使用 `blob.text()` 进行转换 * @param blob */ declare const blobToJsonModern: = Record>(blob: Blob) => Promise; /** * blob转json * 用于axios选择转换为blob时,对后台正常json报错进行读取 * * 在现代浏览器 使用 `blob.text()` 进行转换 * 在不支持该特性的浏览器内 使用 `FileReader` 进行转换 * @param blob * @param format */ declare function blobToJson = Record>(blob: Blob, format?: string): Promise; /** * 通过url下载在线图片 * @param url * @param filename * @param mime * @param bom */ declare function downloadImageByOnlineUrl(url: string, filename: string, mime?: string, bom?: BlobPart): void; /** * 通过base64下载图片 * @param buf * @param filename * @param mime * @param bom */ declare function downloadImageByBase64(buf: string, filename: string, mime?: string, bom?: BlobPart): void; /** * 根据后台返回的文件流下载 * @param {*} data * @param target * @param {*} filename * @param {*} mime * @param {*} bom */ declare function downloadByData({ data, target, filename, mime, bom, }: { data: BlobPart; target?: LinkTargetContext; filename: string; mime?: string; bom?: BlobPart; }): void; /** * 通过请求的方式下载 * @param url * @param target * @param fileName */ declare function downloadByUrlRequest({ url, target, fileName, }: { url: string; target?: LinkTargetContext; fileName?: string; }): Promise; /** * 根据文件地址下载文件 * @param url * @param target * @param fileName */ declare function downloadByUrl({ url, target, fileName, }: { url: string; target?: LinkTargetContext; fileName?: string; }): boolean; /** * 简易的将文字转为文件下载 * @param text * @param filename */ declare function simpleDownloadTextFile(text: string, filename: string): void; declare const resolveImage: (src: string) => Promise; interface ScrollToOptions { getContainer?: () => HTMLElement | Window | Document; callback?: () => any; duration?: number; } /** * 滚动至纵向距离 * @param y * @param options */ declare function scrollTo(y: number, options?: ScrollToOptions): void; /** * 获取滚动距离
* {@link https://github.com/vueComponent/ant-design-vue/blob/next/components/_util/getScroll.ts} * @param target * @param top */ declare function getScroll(target: HTMLElement | Window | Document | null, top: boolean): number; interface RafMap { [id: number]: number; } /** * 延迟指定帧调用requestAnimationFrame * @param callback * @param delayFrames */ declare function wrapperRaf(callback: () => void, delayFrames?: number): number; declare namespace wrapperRaf { var cancel: (pid?: number) => void; var ids: RafMap; } /** * classnames动态样式class组装
* {@link https://github.com/vueComponent/ant-design-vue/blob/next/components/_util/classNames.ts} * @param args */ declare function classNames(...args: any[]): string; interface CSSProperties extends Properties, PropertiesHyphen { } /** * CSSProperties 的提示工具 * @param style */ declare const createStyleObject: (style?: CSSProperties) => any; /** * @licence https://github.com/vueComponent/ant-design-vue */ declare function canUseDom(): boolean; declare const canUseDocElement: () => false | HTMLElement; declare const isStyleSupport: (styleName: string | Array) => boolean; declare function openWindow(url: string, opt?: { target?: LinkTargetContext | string; noopener?: boolean; noreferrer?: boolean; }): Window | null; declare function openNewTag(url: string, opt?: { target?: LinkTargetContext | string; }): void; declare function getBoundingClientRect(element: Element): DOMRect | undefined; interface StorageCacheStoreParseType { get: (value: string) => T; set: (value: T) => string; } /** * 一个如果当前平台不存在 `Storage` 的实现时的,后备选项 * 主要为了兼容 ssr */ declare const fallbackStorage: Storage; /** * Storage缓存商店 * 提供自动json数据处理功能 */ declare class StorageCache { /** * Storage实例 * @private */ private readonly storage; /** * 解析器 * @private */ private readonly parse; private readonly _key; constructor(storage: Storage, key: string, parse?: StorageCacheStoreParseType | true); private _changeParse; get key(): string; /** * 是否存在该缓存 */ has(): boolean; /** * 获取原始值 */ rawGet(): string | null; /** * 设置原始值 * @param value */ rawSet(value?: string | null): void; get(): T | null; set(value?: T | null): void; get value(): T | null; set value(value: T | null | undefined); get rawValue(): string | null | undefined; set rawValue(value: string | null | undefined); remove(): void; /** * 原值是否相等 * @param value */ rawEq(value?: string | null): boolean; /** * 值是否相等 * 暂时只是用===比较 * @param value */ eq(value?: string | null): boolean; } declare const createStorageCache: (storage: Storage, key: string, parse?: StorageCacheStoreParseType | true) => StorageCache; /** * sessionStorage缓存商店 */ declare class SessionStorageCache extends StorageCache { constructor(key: string, parse?: StorageCacheStoreParseType | true); } /** * sessionStorage缓存商店 * @param key * @param parse */ declare const createSessionStorageCache: (key: string, parse?: StorageCacheStoreParseType | true) => SessionStorageCache; /** * localStorage缓存商店 */ declare class LocalStorageCache extends StorageCache { constructor(key: string, parse?: StorageCacheStoreParseType | true); } /** * localStorage缓存商店 * @param key * @param parse */ declare const createLocalStorageCache: (key: string, parse?: StorageCacheStoreParseType | true) => LocalStorageCache; /** * 这个api是否可以使用 * @param api */ declare function canIUse(api: keyof typeof window | (keyof typeof window)[]): boolean; export { type CSSProperties, LocalStorageCache, SessionStorageCache, StorageCache, type StorageCacheStoreParseType, blobToJson, blobToJsonLegacy, blobToJsonModern, canIUse, canUseDocElement, canUseDom, classNames, createLocalStorageCache, createSessionStorageCache, createStorageCache, createStyleObject, createStyleObject as cso, downloadByData, downloadByUrl, downloadByUrlRequest, downloadImageByBase64, downloadImageByOnlineUrl, fallbackStorage, getBoundingClientRect, getScroll, imgDataURLtoBlob, imgUrlToBase64, isStyleSupport, openNewTag, openWindow, wrapperRaf as raf, resolveImage, scrollTo, simpleDownloadTextFile, wrapperRaf };