@liuit/core 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -0
- package/dist/aop/AopUtil.d.ts +26 -0
- package/dist/aop/ClassUtil.d.ts +39 -0
- package/dist/aop/MethodHandler.d.ts +33 -0
- package/dist/aop/TestAopUtil.d.ts +5 -0
- package/dist/common/Constant.d.ts +8 -0
- package/dist/common/adapter/StorageApi.d.ts +48 -0
- package/dist/common/auto/AutoSize.d.ts +56 -0
- package/dist/common/enums/index.d.ts +25 -0
- package/dist/common/index.d.ts +20 -0
- package/dist/common/utils/AssertUtil.d.ts +17 -0
- package/dist/common/utils/BrowserUtil.d.ts +11 -0
- package/dist/common/utils/CommonTreeUtil.d.ts +20 -0
- package/dist/common/utils/CommonUtil.d.ts +200 -0
- package/dist/common/utils/ConfigUtil.d.ts +13 -0
- package/dist/common/utils/CookieUtil.d.ts +50 -0
- package/dist/common/utils/DateUtil.d.ts +50 -0
- package/dist/common/utils/EnumUtil.d.ts +101 -0
- package/dist/common/utils/EventBus.d.ts +22 -0
- package/dist/common/utils/FileUtil.d.ts +64 -0
- package/dist/common/utils/OssUtil.d.ts +29 -0
- package/dist/common/utils/ProxyUtil.d.ts +27 -0
- package/dist/common/utils/RegexUtil.d.ts +67 -0
- package/dist/common/utils/StorageUtil.d.ts +46 -0
- package/dist/common/utils/UrlUtil.d.ts +53 -0
- package/dist/common/utils/ZeroUtil.d.ts +68 -0
- package/dist/index.cjs.js +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.esm.js +2 -0
- package/dist/index.esm.js.map +1 -0
- package/dist/index.umd.js +1 -0
- package/dist/ioc/common/Container.d.ts +100 -0
- package/dist/ioc/common/IocContext.d.ts +61 -0
- package/dist/ioc/decorators/index.d.ts +19 -0
- package/dist/ioc/index.d.ts +11 -0
- package/dist/ioc/model/Meta.d.ts +51 -0
- package/dist/ioc/util/IocDecoratorUtil.d.ts +23 -0
- package/dist/ioc/util/IocUtil.d.ts +30 -0
- package/dist/logger/index.d.ts +117 -0
- package/dist/model/CommonMenuTree.d.ts +28 -0
- package/dist/model/CommonTree.d.ts +21 -0
- package/dist/model/DictDto.d.ts +41 -0
- package/dist/security/encrypt/AesUtil.d.ts +36 -0
- package/dist/security/encrypt/DesUtil.d.ts +38 -0
- package/dist/security/encrypt/Rc4Util.d.ts +24 -0
- package/dist/security/encrypt/RsaUtil.d.ts +94 -0
- package/dist/security/encrypt/RsaUtilPlus.d.ts +75 -0
- package/dist/security/encrypt/Sm2Util.d.ts +81 -0
- package/dist/security/encrypt/Sm4Util.d.ts +30 -0
- package/dist/security/hash/HashUtil.d.ts +23 -0
- package/dist/security/index.d.ts +18 -0
- package/dist/security/model/index.d.ts +31 -0
- package/dist/security/test/TestRsaUtil.d.ts +8 -0
- package/dist/security/test/TestRsaUtilPlus.d.ts +8 -0
- package/dist/security/test/TestSm2Enc.d.ts +1 -0
- package/dist/security/test/TestSm2Encrypt.d.ts +6 -0
- package/dist/security/test/TestSm2Util.d.ts +8 -0
- package/dist/security/test/TestSm4Util.d.ts +8 -0
- package/dist/security/test/TestSmExchange.d.ts +8 -0
- package/dist/utils/CryptoWebUtil.d.ts +21 -0
- package/dist/utils/TestPwd.d.ts +3 -0
- package/dist/validator/ValidatorUtil.d.ts +7 -0
- package/package.json +86 -0
package/README.md
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
### core 核心工具包
|
|
2
|
+
|
|
3
|
+
### 一. 本组介绍
|
|
4
|
+
|
|
5
|
+
```
|
|
6
|
+
作者: 黑肱
|
|
7
|
+
邮箱: zuiwoxing@qq.com
|
|
8
|
+
1. 项目描述: 主要提供前端开发常用工具
|
|
9
|
+
2. 组件功能:
|
|
10
|
+
2.1 IOC容器,类似spring的IOC容器
|
|
11
|
+
2.2 AOP 面向切面的编程组件
|
|
12
|
+
2.3 Logger 日志组件
|
|
13
|
+
2.4 Common Util 包含常用的工具(日期,Cookie,枚举,代理,文件,浏览器,配置信息,正则,Url工具,零宽字符,事件总线等)
|
|
14
|
+
2.5 安全工具包(提供客户端签名,加解密常用工具)
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
### 二. 组件安装
|
|
19
|
+
|
|
20
|
+
```text
|
|
21
|
+
npm i @liuit/core
|
|
22
|
+
或者
|
|
23
|
+
yarn add @liuit/core
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
### 三. 组件使用
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*@desc aop代理工具类
|
|
3
|
+
*@author liudejian
|
|
4
|
+
*@date 2020-03-20 21:45
|
|
5
|
+
**/
|
|
6
|
+
import { MethodHandler } from "./MethodHandler";
|
|
7
|
+
/**
|
|
8
|
+
* AOP工具类
|
|
9
|
+
*/
|
|
10
|
+
export declare class AopUtil {
|
|
11
|
+
/**
|
|
12
|
+
* 创建代理实例
|
|
13
|
+
* @param classType 原始类
|
|
14
|
+
* @param handler 方法拦截器
|
|
15
|
+
* @return 返回原始代理类实例
|
|
16
|
+
*/
|
|
17
|
+
static createProxyInstance<T>(classType: new () => T, handler: MethodHandler): T;
|
|
18
|
+
/**
|
|
19
|
+
* 创建代理
|
|
20
|
+
* @param classType 原始类
|
|
21
|
+
* @param handler 方法拦截器
|
|
22
|
+
* @param excludeMethods 排除的方法名[选填]
|
|
23
|
+
* @return 返回代理类
|
|
24
|
+
*/
|
|
25
|
+
static createProxy<T>(classType: new () => T, handler: MethodHandler, excludeMethods?: Array<string>): new () => T;
|
|
26
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import 'reflect-metadata';
|
|
2
|
+
/**
|
|
3
|
+
*@desc
|
|
4
|
+
*@author liudejian
|
|
5
|
+
*@date 2023-12-24 11:00
|
|
6
|
+
**/
|
|
7
|
+
export declare class ClassUtil {
|
|
8
|
+
/**
|
|
9
|
+
* 创建对象实例
|
|
10
|
+
* @param cls 类
|
|
11
|
+
* @param params 构造参数
|
|
12
|
+
*/
|
|
13
|
+
static newInstance(cls: any, params: any): any;
|
|
14
|
+
/**
|
|
15
|
+
* 判断一个对象是class 还是 class实例
|
|
16
|
+
* @param obj
|
|
17
|
+
*/
|
|
18
|
+
static isClass(obj: any): boolean;
|
|
19
|
+
/**
|
|
20
|
+
* 获取对象声明字段
|
|
21
|
+
* @param cls
|
|
22
|
+
*/
|
|
23
|
+
static getFields(cls: any): Array<string>;
|
|
24
|
+
/**
|
|
25
|
+
* 获取所有 声明方法
|
|
26
|
+
* @param cls
|
|
27
|
+
*/
|
|
28
|
+
static getMethodNames(cls: any): Array<string>;
|
|
29
|
+
/**
|
|
30
|
+
* 获取所有声明的方法
|
|
31
|
+
* @param cls
|
|
32
|
+
*/
|
|
33
|
+
static getMethods(cls: any): Array<Function>;
|
|
34
|
+
/**
|
|
35
|
+
* 获取方法参数名
|
|
36
|
+
* @param method
|
|
37
|
+
*/
|
|
38
|
+
static getMethodParamNames(method: Function): Array<string>;
|
|
39
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*@desc 方法处理
|
|
3
|
+
*@author liudejian
|
|
4
|
+
*@date 2020-03-20 21:59
|
|
5
|
+
**/
|
|
6
|
+
export interface MethodHandler {
|
|
7
|
+
/**
|
|
8
|
+
* 执行前
|
|
9
|
+
* @param target 目标函数
|
|
10
|
+
* @param args 入参
|
|
11
|
+
*/
|
|
12
|
+
before(target: Function, ...args: any): any;
|
|
13
|
+
/**
|
|
14
|
+
* 执行方法后
|
|
15
|
+
* @param target 目标函数
|
|
16
|
+
* @param result 执行方法返回的结果
|
|
17
|
+
* @param args 入参
|
|
18
|
+
*/
|
|
19
|
+
after(target: Function, result: any, ...args: any): void;
|
|
20
|
+
/**
|
|
21
|
+
* 异常
|
|
22
|
+
* @param target 目标函数
|
|
23
|
+
* @param e
|
|
24
|
+
*/
|
|
25
|
+
exception(target: Function, e: any): void;
|
|
26
|
+
/**
|
|
27
|
+
* 最终返回
|
|
28
|
+
* @param target 目标函数
|
|
29
|
+
* @param result 执行方法返回的结果
|
|
30
|
+
* @param args 入参
|
|
31
|
+
*/
|
|
32
|
+
finally(target: Function, result: any, ...args: any): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*@desc
|
|
3
|
+
*@author liudejian
|
|
4
|
+
*@date 2023-12-29 21:16
|
|
5
|
+
**/
|
|
6
|
+
export interface StorageApi {
|
|
7
|
+
/**
|
|
8
|
+
* 获取localStorage中的所有KEY
|
|
9
|
+
*/
|
|
10
|
+
getLocalStorageKeys(): Array<string>;
|
|
11
|
+
/**
|
|
12
|
+
* 获取sessionStorage中的所有KEY
|
|
13
|
+
*/
|
|
14
|
+
getSessionStorageKeys(): Array<string>;
|
|
15
|
+
/**
|
|
16
|
+
* 设置session key对应的值
|
|
17
|
+
* @param key
|
|
18
|
+
* @param value
|
|
19
|
+
*/
|
|
20
|
+
setSessionStorage(key: string, value: any): void;
|
|
21
|
+
/**
|
|
22
|
+
* 获取session存储
|
|
23
|
+
* @param key
|
|
24
|
+
*/
|
|
25
|
+
getSessionStorage(key: string): any;
|
|
26
|
+
/**
|
|
27
|
+
* 删除session对应的缓存
|
|
28
|
+
* @param key
|
|
29
|
+
*/
|
|
30
|
+
removeSessionStorage(key: string): void;
|
|
31
|
+
/**
|
|
32
|
+
* 清理sesssion
|
|
33
|
+
*/
|
|
34
|
+
clearSessionStorage(): void;
|
|
35
|
+
/**
|
|
36
|
+
* session存储
|
|
37
|
+
* @param key
|
|
38
|
+
* @param value
|
|
39
|
+
*/
|
|
40
|
+
setLocalStorage(key: string, value: any): void;
|
|
41
|
+
/**
|
|
42
|
+
* session获取
|
|
43
|
+
* @param key
|
|
44
|
+
*/
|
|
45
|
+
getLocalStorage(key: string): any;
|
|
46
|
+
removeLocalStorage(key: string): void;
|
|
47
|
+
clearLocalStorage(): void;
|
|
48
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*@desc 自动获取浏览器窗口 高宽
|
|
3
|
+
*@author liudejian
|
|
4
|
+
*@date 2023-03-31 14:41
|
|
5
|
+
**/
|
|
6
|
+
export declare class DataSize {
|
|
7
|
+
/**
|
|
8
|
+
* 高度
|
|
9
|
+
* @private
|
|
10
|
+
*/
|
|
11
|
+
height: number;
|
|
12
|
+
/**
|
|
13
|
+
* 宽度
|
|
14
|
+
* @private
|
|
15
|
+
*/
|
|
16
|
+
width: number;
|
|
17
|
+
static of(height: number, width: number): DataSize;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* 动态获取高宽
|
|
21
|
+
*/
|
|
22
|
+
export declare class AutoSize {
|
|
23
|
+
flag: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* 抹去的高度/宽度
|
|
26
|
+
* @private
|
|
27
|
+
*/
|
|
28
|
+
private eraseSize;
|
|
29
|
+
/**
|
|
30
|
+
* 1= window.innerHeight / window.innerWidth
|
|
31
|
+
* 2= document.body.clientHeight / document.body.clientWidth
|
|
32
|
+
* @private
|
|
33
|
+
*/
|
|
34
|
+
private clientType;
|
|
35
|
+
/**
|
|
36
|
+
* 结果高度/宽度
|
|
37
|
+
* @private
|
|
38
|
+
*/
|
|
39
|
+
private resultSize;
|
|
40
|
+
/**
|
|
41
|
+
* 回调函数
|
|
42
|
+
* @private
|
|
43
|
+
*/
|
|
44
|
+
private callback;
|
|
45
|
+
/**
|
|
46
|
+
* 结果 高宽
|
|
47
|
+
*/
|
|
48
|
+
getSize(): DataSize;
|
|
49
|
+
/**
|
|
50
|
+
*
|
|
51
|
+
* @param eraseHeight 抹去的高度
|
|
52
|
+
* @param callback 高度变化就回调
|
|
53
|
+
*/
|
|
54
|
+
constructor(callback: Function, eraseSize?: DataSize, clientType?: number);
|
|
55
|
+
private initWindowResize;
|
|
56
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*@desc
|
|
3
|
+
*@author liudejian
|
|
4
|
+
*@date 2022-09-19 11:14
|
|
5
|
+
**/
|
|
6
|
+
export declare enum Sex {
|
|
7
|
+
MALE = 1,
|
|
8
|
+
FEMALE = 2
|
|
9
|
+
}
|
|
10
|
+
export declare enum CommonYn {
|
|
11
|
+
YES = 1,
|
|
12
|
+
NO = 2
|
|
13
|
+
}
|
|
14
|
+
export declare enum Status {
|
|
15
|
+
ENABLE = 1,
|
|
16
|
+
DISABLE = 2
|
|
17
|
+
}
|
|
18
|
+
export declare enum LoginType {
|
|
19
|
+
BASIC = 1,
|
|
20
|
+
TOKEN = 2,
|
|
21
|
+
MOBILE = 3,
|
|
22
|
+
OPENID = 4,
|
|
23
|
+
PASSWORD = 5,
|
|
24
|
+
EMAIL = 6
|
|
25
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { AssertUtil } from "./utils/AssertUtil";
|
|
2
|
+
export { CommonUtil } from "./utils/CommonUtil";
|
|
3
|
+
export { CookieUtil } from "./utils/CookieUtil";
|
|
4
|
+
export { DateUtil } from "./utils/DateUtil";
|
|
5
|
+
export { EnumUtil } from "./utils/EnumUtil";
|
|
6
|
+
export { EventBus } from "./utils/EventBus";
|
|
7
|
+
export { FileUtil } from "./utils/FileUtil";
|
|
8
|
+
export { OssUtil } from "./utils/OssUtil";
|
|
9
|
+
export { ProxyUtil } from "./utils/ProxyUtil";
|
|
10
|
+
export { StorageUtil } from "./utils/StorageUtil";
|
|
11
|
+
export { UrlUtil } from "./utils/UrlUtil";
|
|
12
|
+
export { ZeroUtil } from "./utils/ZeroUtil";
|
|
13
|
+
export { CommonTreeUtil } from "./utils/CommonTreeUtil";
|
|
14
|
+
export { ConfigUtil } from "./utils/ConfigUtil";
|
|
15
|
+
export { RegexUtil, Word } from "./utils/RegexUtil";
|
|
16
|
+
export { AutoSize, DataSize } from "./auto/AutoSize";
|
|
17
|
+
export { BrowserUtil } from "./utils/BrowserUtil";
|
|
18
|
+
export type { ThumbnailMode } from "./utils/OssUtil";
|
|
19
|
+
export type { ImageHw } from "./utils/FileUtil";
|
|
20
|
+
export type { StorageApi } from "./adapter/StorageApi";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*@desc
|
|
3
|
+
*@author liudejian
|
|
4
|
+
*@date 2020-06-12 10:11
|
|
5
|
+
**/
|
|
6
|
+
export declare class AssertUtil {
|
|
7
|
+
/**
|
|
8
|
+
* 不能为空判断
|
|
9
|
+
* @param obj
|
|
10
|
+
*/
|
|
11
|
+
static notNull(obj: any, message?: string): any;
|
|
12
|
+
/**
|
|
13
|
+
* 包装空对象
|
|
14
|
+
* @param obj
|
|
15
|
+
*/
|
|
16
|
+
static wrapNull(obj: any): any;
|
|
17
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*@desc 通用树
|
|
3
|
+
*@author liudejian
|
|
4
|
+
*@date 2020-07-03 16:03
|
|
5
|
+
**/
|
|
6
|
+
import { CommonTree } from "../../model/CommonTree";
|
|
7
|
+
export declare class CommonTreeUtil {
|
|
8
|
+
/**
|
|
9
|
+
* 将分类转为树结构
|
|
10
|
+
* @param categorys
|
|
11
|
+
* @param checkedIds
|
|
12
|
+
* @param maxLevel
|
|
13
|
+
*/
|
|
14
|
+
static convertToTree(treeBos: Array<CommonTree>, checkedIds: Array<number>, maxLevel: number): Array<CommonTree>;
|
|
15
|
+
/**
|
|
16
|
+
* 排序
|
|
17
|
+
* @param rts
|
|
18
|
+
*/
|
|
19
|
+
static sortTree(rts: Array<CommonTree>): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
export declare class CommonUtil {
|
|
2
|
+
/**
|
|
3
|
+
* 雪花算法ID (18位)
|
|
4
|
+
*/
|
|
5
|
+
static genSnowflake(): number | bigint;
|
|
6
|
+
/**
|
|
7
|
+
* map 转对象
|
|
8
|
+
* @param mapData
|
|
9
|
+
*/
|
|
10
|
+
static mapToObject(mapData: Map<string, any>): any;
|
|
11
|
+
/**
|
|
12
|
+
* 随机数生成
|
|
13
|
+
* @param min 最小值
|
|
14
|
+
* @param max 最大值
|
|
15
|
+
*/
|
|
16
|
+
static genRandom(min: number, max: number): number;
|
|
17
|
+
/**
|
|
18
|
+
* 产生UID
|
|
19
|
+
* @param len 长度
|
|
20
|
+
* @param radix 因子长度
|
|
21
|
+
* @returns {string}
|
|
22
|
+
*/
|
|
23
|
+
static genUid(len: number, radix?: number): string;
|
|
24
|
+
/**
|
|
25
|
+
* 左右对其
|
|
26
|
+
* @param str
|
|
27
|
+
*/
|
|
28
|
+
static trim(str: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* 判断obj对象是否为空
|
|
31
|
+
* @method isEmptyObject
|
|
32
|
+
* @param { * } obj 需要判断的对象
|
|
33
|
+
* @remind 如果判断的对象是NULL, 将直接返回true, 如果是数组且为空, 返回true, 如果是字符串, 且字符串为空,
|
|
34
|
+
* 返回true, 如果是普通对象, 且该对象没有任何实例属性, 返回true
|
|
35
|
+
* @return { Boolean } 对象是否为空
|
|
36
|
+
* @example
|
|
37
|
+
* ```javascript
|
|
38
|
+
*
|
|
39
|
+
* //output: true
|
|
40
|
+
* console.log( utils.isEmptyObject( {} ) );
|
|
41
|
+
*
|
|
42
|
+
* //output: true
|
|
43
|
+
* console.log( utils.isEmptyObject( [] ) );
|
|
44
|
+
*
|
|
45
|
+
* //output: true
|
|
46
|
+
* console.log( utils.isEmptyObject( "" ) );
|
|
47
|
+
*
|
|
48
|
+
* //output: false
|
|
49
|
+
* console.log( utils.isEmptyObject( { key: 1 } ) );
|
|
50
|
+
*
|
|
51
|
+
* //output: false
|
|
52
|
+
* console.log( utils.isEmptyObject( [1] ) );
|
|
53
|
+
*
|
|
54
|
+
* //output: false
|
|
55
|
+
* console.log( utils.isEmptyObject( "1" ) );
|
|
56
|
+
*
|
|
57
|
+
* ```
|
|
58
|
+
*/
|
|
59
|
+
static isEmptyObject(obj: any): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* 单词首字母大写
|
|
62
|
+
* @param str
|
|
63
|
+
* @returns {string}
|
|
64
|
+
*/
|
|
65
|
+
static firstWordUpperCase(str: string): string;
|
|
66
|
+
/**
|
|
67
|
+
* 获取模板值
|
|
68
|
+
* @param template 模板 {username}/{age}
|
|
69
|
+
* @param data {username:'good',age:100}
|
|
70
|
+
* @return good/100
|
|
71
|
+
* @example templateEngine(template,data);
|
|
72
|
+
*/
|
|
73
|
+
static templateEngine(template: string, json: any): string;
|
|
74
|
+
static isArray(object: any): boolean;
|
|
75
|
+
static isNumber(object: any): boolean;
|
|
76
|
+
static isString(object: any): boolean;
|
|
77
|
+
static isFunction(object: any): boolean;
|
|
78
|
+
static isObject(object: any): boolean;
|
|
79
|
+
static isDate(object: any): boolean;
|
|
80
|
+
static isRegExp(object: any): boolean;
|
|
81
|
+
static isMap(object: any): boolean;
|
|
82
|
+
static isSet(object: any): boolean;
|
|
83
|
+
/**
|
|
84
|
+
* 对象copy
|
|
85
|
+
* @param target 目标对象
|
|
86
|
+
* @param source 原始对象
|
|
87
|
+
* @param deep 是否深度copy
|
|
88
|
+
*/
|
|
89
|
+
static copy(target: any, source: any, deep: boolean): any;
|
|
90
|
+
/**
|
|
91
|
+
* 空判断
|
|
92
|
+
* @param str
|
|
93
|
+
* @returns {boolean}
|
|
94
|
+
*/
|
|
95
|
+
static isBlank(str: string): boolean;
|
|
96
|
+
/**
|
|
97
|
+
*
|
|
98
|
+
* @param str
|
|
99
|
+
* @returns {boolean}
|
|
100
|
+
*/
|
|
101
|
+
static isNotBlank(str: string): boolean;
|
|
102
|
+
/**
|
|
103
|
+
* 开始
|
|
104
|
+
* @param str
|
|
105
|
+
* @param prefix 前缀
|
|
106
|
+
*/
|
|
107
|
+
static startWith(str: string, prefix: string): boolean;
|
|
108
|
+
/**
|
|
109
|
+
* 以 stuff结尾
|
|
110
|
+
* @param str
|
|
111
|
+
* @param stuff
|
|
112
|
+
* @returns {boolean}
|
|
113
|
+
*/
|
|
114
|
+
static endWith(str: string, stuff: string): boolean;
|
|
115
|
+
/**
|
|
116
|
+
* 时间格式化
|
|
117
|
+
* @param time 后台时间长整型/date
|
|
118
|
+
* @param fmt 时间格式 yyyy-MM-dd hh:mm:ss
|
|
119
|
+
*/
|
|
120
|
+
static dateFormat(time: Date | number | string, fmt?: string): string;
|
|
121
|
+
/**
|
|
122
|
+
* 数据格式化(针对el-table-column的)
|
|
123
|
+
* @param datas 数据集
|
|
124
|
+
* @param keyName 指定对比KEY名称
|
|
125
|
+
* @param returnValueName 返回值 KEY名称
|
|
126
|
+
* @returns {{}|*}
|
|
127
|
+
*/
|
|
128
|
+
static dataFormat(datas: Array<any>, returnValueName: string, keyName: string, value: string | number): string;
|
|
129
|
+
/**
|
|
130
|
+
* 根据编码获取对应的标签值
|
|
131
|
+
* @param appCode 应用编号
|
|
132
|
+
* @param dictCode 枚举字典编码
|
|
133
|
+
* @param code 对应的枚举值编码
|
|
134
|
+
* @param codeName
|
|
135
|
+
* @param codeCnName
|
|
136
|
+
*/
|
|
137
|
+
static getEnumLabelByCode(appCode: string, dictCode: string, code: number, codeName?: string, codeCnName?: string): string;
|
|
138
|
+
/**
|
|
139
|
+
* @param enumAlls 枚举集合[AppCode:[{codeCn: "用户系统", code: 1, ordianl: 0, codeEn: "UC"},{codeCn: "代理系统", code: 2, ordianl: 1, codeEn: "PROXY"}]]
|
|
140
|
+
* @param enumName 枚举名称 AppCode
|
|
141
|
+
* @param key 比如: code
|
|
142
|
+
* @param keyValue 比如:1
|
|
143
|
+
* @param keyCnName 比如:codeCn
|
|
144
|
+
*/
|
|
145
|
+
static getEnumValue(enumAlls: Map<string, Array<any>>, enumName: string, key: string, keyValue: string | number, keyCnName: string): string | number;
|
|
146
|
+
/**
|
|
147
|
+
*
|
|
148
|
+
* @param enums
|
|
149
|
+
* @param code
|
|
150
|
+
* @param codeName
|
|
151
|
+
* @param codeCnName
|
|
152
|
+
*/
|
|
153
|
+
static getEnumLabel(enums: any[], code: number, codeName?: string, codeCnName?: string): string;
|
|
154
|
+
/**
|
|
155
|
+
* 枚举格式化(针对el-table-column的)
|
|
156
|
+
* @param enums 枚举集合
|
|
157
|
+
* @param row 行
|
|
158
|
+
* @param column 列
|
|
159
|
+
* @param cellVal 当前值
|
|
160
|
+
* @param index 当前值的行索引
|
|
161
|
+
* @param manulEnumName 手动传入枚举名称
|
|
162
|
+
* @param appCode 应用编码
|
|
163
|
+
* @returns {*}
|
|
164
|
+
*/
|
|
165
|
+
static enumFormat(enums: Map<string, Array<any>>, row: any, column: any, cellVal?: any, manulEnumName?: string): string | number;
|
|
166
|
+
/**
|
|
167
|
+
* 枚举格式化(针对el-table-column的)
|
|
168
|
+
* @param enums 枚举集合
|
|
169
|
+
* @param row 行
|
|
170
|
+
* @param column 列
|
|
171
|
+
* @param cellVal 当前值
|
|
172
|
+
* @param index 当前值的行索引
|
|
173
|
+
* @param manulEnumName 手动传入枚举名称
|
|
174
|
+
* @param appCode 应用编码
|
|
175
|
+
* @returns {*}
|
|
176
|
+
*/
|
|
177
|
+
static enumDefaultFormat(row: any, column: any, cellVal?: any, manulEnumName?: any, appCode?: any): string | number;
|
|
178
|
+
/**
|
|
179
|
+
* 添加前缀
|
|
180
|
+
* @param value
|
|
181
|
+
* @param prefix
|
|
182
|
+
*/
|
|
183
|
+
static addPrefix(value: any, prefix: any): any;
|
|
184
|
+
/**
|
|
185
|
+
* 添加后缀
|
|
186
|
+
* @param value
|
|
187
|
+
* @param suffix
|
|
188
|
+
*/
|
|
189
|
+
static addSuffix(value: any, suffix: any): any;
|
|
190
|
+
/**
|
|
191
|
+
* 清空一个数组
|
|
192
|
+
* @param ary
|
|
193
|
+
*/
|
|
194
|
+
static clearArray(ary: Array<any>): Array<any>;
|
|
195
|
+
/**
|
|
196
|
+
* 将时间秒转为HH:MM:SS
|
|
197
|
+
* @param second 时间秒
|
|
198
|
+
*/
|
|
199
|
+
static formatSecondToHms(seconds: number): string;
|
|
200
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*@desc
|
|
3
|
+
*@author liudejian
|
|
4
|
+
*@date 2020-04-05 22:17
|
|
5
|
+
**/
|
|
6
|
+
export declare class ConfigUtil {
|
|
7
|
+
static getConfigMap(): Map<string, any>;
|
|
8
|
+
static getConfigMapToObject(): any;
|
|
9
|
+
static put(key: string, value: any): Map<string, any>;
|
|
10
|
+
static remove(key: string): boolean;
|
|
11
|
+
static get(key: string): any;
|
|
12
|
+
static has(key: string): boolean;
|
|
13
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*@desc cookie工具
|
|
3
|
+
*@author liudejian
|
|
4
|
+
*@date 2020-03-26 17:28
|
|
5
|
+
**/
|
|
6
|
+
import { CookieAttributes } from 'js-cookie';
|
|
7
|
+
/**
|
|
8
|
+
* cookie工具
|
|
9
|
+
*/
|
|
10
|
+
export declare class CookieUtil {
|
|
11
|
+
/**
|
|
12
|
+
* 默认cookie配置
|
|
13
|
+
*/
|
|
14
|
+
static defaultCookieConfig(): CookieAttributes;
|
|
15
|
+
/**
|
|
16
|
+
* 设置cookie
|
|
17
|
+
* @param key
|
|
18
|
+
* @param value
|
|
19
|
+
* @param options
|
|
20
|
+
*/
|
|
21
|
+
static setCookie(key: string, value: string, options: CookieAttributes): string | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* 设置cookie
|
|
24
|
+
* @param key
|
|
25
|
+
* @param value
|
|
26
|
+
*/
|
|
27
|
+
static setDefaultCookie(key: string, value: string): string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* 设置对象cookie
|
|
30
|
+
* @param key
|
|
31
|
+
* @param value
|
|
32
|
+
* @param options
|
|
33
|
+
*/
|
|
34
|
+
static setObjCookie(key: string, value: any, options: CookieAttributes): string | undefined;
|
|
35
|
+
/**
|
|
36
|
+
* 获取cookie
|
|
37
|
+
* @param key
|
|
38
|
+
*/
|
|
39
|
+
static getObjCookie<T>(key: string): T;
|
|
40
|
+
/**
|
|
41
|
+
* 获取cookie
|
|
42
|
+
* @param key
|
|
43
|
+
*/
|
|
44
|
+
static getCookie(key: string): string | undefined;
|
|
45
|
+
/**
|
|
46
|
+
* 删除cookie
|
|
47
|
+
* @param key
|
|
48
|
+
*/
|
|
49
|
+
static removeCookie(key: string): void;
|
|
50
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
/**
|
|
2
|
+
*@desc 日期工具类
|
|
3
|
+
*@author liudejian
|
|
4
|
+
*@date 2020-01-13 17:47
|
|
5
|
+
**/
|
|
6
|
+
export declare class DateUtil {
|
|
7
|
+
/**
|
|
8
|
+
* 时间格式化
|
|
9
|
+
* @param time 后台时间长整型/date
|
|
10
|
+
* @param fmt 时间格式 yyyy-MM-dd hh:mm:ss
|
|
11
|
+
* @returns {*}
|
|
12
|
+
*/
|
|
13
|
+
static dateFormat(time: Date | number, fmt?: string): string;
|
|
14
|
+
static formatDate(date: Date, format?: string): string;
|
|
15
|
+
/**
|
|
16
|
+
* 10秒: 10 * 1000
|
|
17
|
+
* 1分: 60 * 1000
|
|
18
|
+
* 1小时: 60 * 60 * 1000
|
|
19
|
+
* 24小时:60 * 60 * 24 * 1000
|
|
20
|
+
* 3天: 60 * 60* 24 * 1000 * 3
|
|
21
|
+
*
|
|
22
|
+
* let data = new Date()
|
|
23
|
+
* formatPast(data) // 刚刚
|
|
24
|
+
* formatPast(data - 11 * 1000) // 11秒前
|
|
25
|
+
* formatPast(data - 2 * 60 * 1000) // 2分钟前
|
|
26
|
+
* formatPast(data - 60 * 60 * 2 * 1000) // 2小时前
|
|
27
|
+
* formatPast(data - 60 * 60 * 2 * 1000) // 2小时前
|
|
28
|
+
* formatPast(data - 60 * 60 * 71 * 1000) // 2天前
|
|
29
|
+
* formatPast("2020-06-01") // 2020-06-01
|
|
30
|
+
* formatPast("2020-06-01", "YYYY-mm-dd HH:MM:SS WWW QQQQ") // 2020-06-01 08:00:00 星期一 第二季度
|
|
31
|
+
*/
|
|
32
|
+
static formatPast(param: any, format?: string): string;
|
|
33
|
+
/**
|
|
34
|
+
* formatAxis(new Date()) // 上午好
|
|
35
|
+
*/
|
|
36
|
+
static formatAxis(param: any): string;
|
|
37
|
+
/**
|
|
38
|
+
* 获取当前月第一天
|
|
39
|
+
*/
|
|
40
|
+
static getMonthFirstDay(): Date;
|
|
41
|
+
/**
|
|
42
|
+
* 获取当前月最后一天
|
|
43
|
+
*/
|
|
44
|
+
static getMonthLastDay(): Date;
|
|
45
|
+
/**
|
|
46
|
+
* 将时间秒转为HH:MM:SS
|
|
47
|
+
* @param second 时间秒
|
|
48
|
+
*/
|
|
49
|
+
static formatSecondToHms(second: any): string;
|
|
50
|
+
}
|