import { UtilFmtDateConfig, UtilFmtCurrencyConfig, UtilFmtNumberConfig, UtilFmtNumberLabelConfig, UtilImageView2ParamsConfig, HtmlSpecialCharacterRegEncodeFn, HtmlSpecialCharacterRegDecodeFn } from './options' export class fmt { /** * 日期格式化 * @param date * @param format */ public static date(date: any, format?: string): string /** * 日期格式化 * @param date * @param format */ public static dateFormat(date: Date, format: string): string /** * 货币格式化 * @param money * @param opt */ public static currency(money: number, opt?: UtilFmtCurrencyConfig): string /** * 数值格式化 * @param value * @param opt */ public static number(value: number, opt?: UtilFmtNumberConfig): string /** * 数值格式化成中文 * @param value * @param opt */ public static numberLabel(value: number, opt?: UtilFmtNumberLabelConfig): string /** * 对象/数组,根据key/下标取值 * @param key * @param obj * @param defaultValue */ public static value(key: string | number | symbol, obj: object, defaultValue?: any): any /** * url补全 * @param url */ public static url(url: string): string /** * 对象深度取值 * @param propStr * @param obj * @param defaultValue */ public static prop(propStr: string, obj: object, defaultValue?: any): any } /** * 返回对象类型 * @param obj */ export function type(obj: any): string /** * 空函数 */ export function noop(): void /** * 对象遍历 * @param obj * @param fn */ export function eachOwn(obj: T, fn: (value: any, key: keyof T, obj: T) => void): void /** * 当前地址是否为域名地址 */ export function isDomain(): boolean /** * url参数补全 * @param url * @param data */ export function compatUrl(url: string, data: object): string /** * 移除对象中的空数据 * @param data */ export function removeEmpty(data: object): object /** * url分解 * @param url */ export function decomposeUrl(url: string): { readonly source: string, readonly protocol: string, readonly host: string, readonly port: string, readonly hostname: string, readonly origin: string, readonly query: string, readonly params: object, readonly file: string, readonly hash: string, readonly path: string, readonly uri: string, readonly segments: string[] } /** * 模拟事件触发 * @param el * @param evtType * @param keyCode */ export function fireKeyEvent(el: any, evtType: string, keyCode: number): void /** * 是否为绝对地址 * @param url */ export function isAbsoluteUrl(url: string): boolean /** * vue上下文转化 * @param viewModel * @param expression */ export function transformContext(viewModel: any, expression: string): { readonly viewModel: any, readonly target: object, readonly key: string } /** * 是否为application/form * @param contentType */ export function isApplicationForm(contentType: string): boolean /** * 随机字符串 * @param len 长度 */ export function randText(len: number): string /** * 随机数值 * @param min * @param max */ export function randRange(min: number, max: number): number /** * 字符串转驼峰 * @param str */ export function strToHump(str: string): string /** * 对象转驼峰 * @param data */ export function dataToHump(data: object): object /** * 字符串转下划线 * @param str */ export function strToUnderline(str: string): string /** * 对象转下划线 * @param data */ export function dataToUnderline(data: object): object /** * 添加事件监听 * @param target * @param eventName * @param listener */ export function addEventListener(target: any, eventName: string, listener: Function): void /** * 移除事件监听 * @param target * @param eventName * @param listener */ export function removeEventListener(target: any, eventName: string, listener: Function): void /** * require.context * @param requireContext * @param excludeObjKeyOrArr * @param flatContext */ export function requireContext(requireContext: any, excludeObjKeyOrArr?: string[], flatContext?: boolean): any[] /** * require.context * @param requireContext * @param excludeObjKeyOrArr * @param flatContext */ export function requireContextToObj(requireContext: any, excludeObjKeyOrArr?: string[], flatContext?: boolean): object /** * hmac计算 * @param config */ export function hmac(config: { macId: string macKey: string httpMethod: string requestURI: string host: string }): string /** * 获得hmac的http headers * @param config */ export function getAuthMacHeaders(config: { url: string, method: string, macId: string, macKey: string }): { readonly Authorization: string, readonly mac_key: string } /** * 是否为父子节点 * @param node * @param parentNode */ export function isParentNode(node: any, parentNode: any): boolean /** * 骑牛的imageView2显示策略 * @param url * @param w * @param h * @param m * @param opts */ export function imageView2(url: string, w: number, h: number, m?: number, opts?: UtilImageView2ParamsConfig): string /** * 下载blob为文件 * @param blob * @param fileName * @param clearTime */ export function downloadFile(blob: Blob, fileName?: string, clearTime?: number): void /** * 下载base64为图片 * @param base64Code * @param fileName * @param clearTime */ export function downloadBase64Img(base64Code: string, fileName?: string, clearTime?: number): void /** * base64转blob * @param base64Code */ export function base64ToBlob(base64Code: string): Blob /** * 清理search.params * @param params */ export function clearSearch(params: object): object /** * 修复IOS图片旋转问题 * @param file * @param maxWidth * @param maxHeight * @param opts */ export function compressImg(file: File, maxWidth?: number, maxHeight?: number, opts?: object): Promise<{ readonly blob: Blob, readonly width: number, readonly height: number, readonly originWidth: number, readonly originHeight: number, readonly originSize: number, readonly fileName: string, readonly fileType: string }> /** * 旋转图片 * @param img * @param deg * @param canvas */ export function rotateAngleImg(img: any, deg: number, canvas?: any): any /** * 文件读取为图片 * @param file */ export function readFileAsImg(file: File): Promise /** * 文件/blob转base64 * @param fileOrBlob */ export function fileOrBlobToDataURL(fileOrBlob: File | Blob): Promise /** * base64转blob * @param dataUtl */ export function dataURLToBlob(dataUtl: string): Blob /** * html特殊字符处理 */ export interface htmlSpecialCharacter { encode(html: string): string decode(text: string): string encodeReg(html: string, regEncodeFn?: HtmlSpecialCharacterRegEncodeFn): string decodeReg(html: string, regDecodeFn?: HtmlSpecialCharacterRegDecodeFn): string } /** * window.message */ export interface message { listenerMap: object originalOnMessageFn: null | Function onMessageFn: null | Function active: boolean on(name: string, listener: Function): number off(name: string, indexOrFn: number | Function): void emit(name: string, data: any): void init(messageFn?: Function): void destroy(): void } /** * 类数组转数组 * @param list * @param start */ export function toArray(list: ArrayLike, start?: number): T[] /** * 文本加密 */ export class cipher { static encode(str: string, r?: number): string static decode(str: string, r?: number): any static encodeJSON(json: T, r?: number): T static decodeJSON(json: T, r?: number): T static encodeEnv(json: T, r?: number): T } /** * 是否为原生对象 * @param Ctor 构造函数 */ export function isNative(Ctor: Function): boolean /** * 函数防抖 * * @export * @param {FUnction} fn * @param {number} delayMilliseconds * @returns {Function} */ export function debounce(fn: Function, delayMilliseconds: number): Function /** * 函数节流 * * @export * @param {Function} fn * @param {number} cycleMilliseconds * @returns {Function} */ export function throttle(fn: Function, cycleMilliseconds: number): Function /** * 数据脱敏 * * @export * @param {string} value * @param {number} [beginIndex=3] * @param {number} [size=4] * @returns {string} */ export function drug(value: string, beginIndex?: number, size?: number): string /** * 字符串转json * * @export * @param {string} data * @returns {(data | Object)} */ export function parseJSON(data: string): string | object /** * window.console * * @export * @class logger */ export class logger { public static log(...args: any[]): void public static debug(...args: any[]): void public static info(...args: any[]): void public static warn(...args: any[]): void public static error(...args: any[]): void } /** * 两个对象是否相等 * * @export * @template T * @template any * @param {T} o1 * @param {T} o2 * @returns {boolean} */ export function isObjEqual(o1: T, o2: T): boolean /** * 读取文件后缀 * * @export * @param {File} file * @returns {string} */ export function getFileExt(file: File): string /** * 读取文件的MD5值 * * @export * @param {File} file * @returns {Promise} */ export function getFileMD5(file: File): Promise