export declare const DefaultEncoding = "utf-8"; /** * 类型 * @author pao */ export interface Type { new (): T; } export declare type Predicate = (controlDef: T) => any; export declare type EventFunc = (e: any) => void; /** * 异步类型 */ export declare type NullablePromise = Promise | undefined; /** * 返回类型 */ export declare type PromiseType = Promise | T; /** * 允许为空 */ export declare type Nullable = T | undefined | null; /** * 字典 */ export interface Dictionary { [key: string]: T; } /** * 新建Guid * @author pao */ export declare function newGuid(): string; /** * 将字典/对象转换成数组 */ export declare function mapDict(dict?: Dictionary): [T, string][]; /** * 遍历并生成需要的数组 */ export declare function selectDict(dict: Dictionary, mapFunc: (obj: T, key: string) => P, filter?: (obj: T, key: string) => Boolean): P[]; /** * 获取当前日期字符串(精确到日) * @author pao */ export declare function getCurrentDateString(): string; /** * 获取当前时间字符串(精确到毫秒) * @author pao */ export declare function getCurrentTimeString(): string; /** * 等待 * @param checkBreak 每次检查的时间间隔,单位:毫秒, 默认为100 * @param checkFunc 检查函数 * @param timeout 超时时间,单位:毫秒 * @returns Timer标识 */ export declare function wait(checkFunc: () => boolean, timeout?: number, checkBreak?: number): Promise; /** * 停止等待 * @param intervalID 等待TimerID */ export declare function stopWait(intervalID: any): void; /** * 判断对象是否为空,如果为空,则用另外一个对象替代 * @param originObject 原始对象 * @param newObject 新对象 * @returns 如果原始对象为空,则返回原始对象,否则用另外一个对象替代 */ export declare function nullIf(originObject: T, newObject: any): T; /** * 函数调用 * @param func 函数 */ export declare function call(func: Nullable, ...args: any[]): any; /** * 函数调用 * @param func 函数 */ export declare function callMember(caller: Object, func: Nullable, ...args: any[]): any; /** * 随机整数 * @param min 最小值 * @param max 最大值 */ export declare function randomInteger(max: number, min?: number): number; /** * 深度合并 * @param firstObj 第一个对象 * @param secondObj 第二个对象 */ export declare function deepMergeObject(firstObj: any, secondObj: any, mergeArray?: boolean): any; /** * 深度合并 * @param firstObj 第一个对象 * @param secondObj 第二个对象 */ export declare function deepMergeObjects(...objects: any[]): {}; /** * 深度克隆 */ export declare function deepClone(srcObj: T): T; /** * 用路径获取项目值 */ export declare function getItemValueByPath(rootObject: any, path?: string): T; /** * 用路径设置项目值 */ export declare function setItemValueByPath(rootObject: any, path?: string, value?: T, copyNullValue?: boolean, deleteUndefinedProp?: boolean): any; /** * 执行函数字符串 * @param functionString 函数字符串 * @param params 参数 */ export declare function executeFunctionString(functionString: string, ...params: any[]): any; export declare function deleteUndefinedProperties(obj: any): void; export declare function isClient(): boolean; export declare function isServer(): boolean; export declare function serverRequire(moduleName: string): any; export declare function clientRequire(moduleName: string): any; /** * 格式化错误信息 * @param error 错误或错误信息 */ export declare function formatErrorMessage(error?: Error | string): string;