xframelib 0.4.0 → 0.4.5
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 +5 -0
- package/dist/api/Token.d.ts +20 -0
- package/dist/api/User.d.ts +45 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/controls/collapsepanel/VCollapsiblePanel.vue.d.ts +26 -0
- package/dist/controls/collapsepanel/VCollapsiblePanelGroup.vue.d.ts +30 -0
- package/dist/controls/collapsepanel/color.util.d.ts +1 -0
- package/dist/controls/collapsepanel/composables/store.d.ts +7 -0
- package/dist/controls/collapsepanel/constant.d.ts +1 -0
- package/dist/controls/collapsepanel/index.d.ts +3 -0
- package/dist/controls/layoutcontainer/LayoutManager.d.ts +107 -0
- package/dist/controls/layoutcontainer/index.d.ts +3 -0
- package/dist/controls/layoutcontainer/layout.vue.d.ts +37 -0
- package/dist/controls/splitpanes/index.d.ts +3 -0
- package/dist/controls/vuewindow/SinglePointerEvent.d.ts +23 -0
- package/dist/controls/vuewindow/dom.d.ts +16 -0
- package/dist/controls/vuewindow/draggable_helper.d.ts +20 -0
- package/dist/controls/vuewindow/index.d.ts +6 -0
- package/dist/controls/vuewindow/resizable_helper.d.ts +16 -0
- package/dist/controls/vuewindow/style.d.ts +110 -0
- package/dist/controls/vuewindow/window/Button.vue.d.ts +26 -0
- package/dist/controls/vuewindow/window/index.vue.d.ts +160 -0
- package/dist/controls/vuewindow/window/utils.d.ts +17 -0
- package/dist/controls/vuewindow/z_element.d.ts +11 -0
- package/dist/core/Global.d.ts +26 -0
- package/dist/core/IModel.d.ts +34 -0
- package/dist/core/MsgHelper.d.ts +12 -0
- package/dist/core/SysEvents.d.ts +16 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/hprose/HproseClient.d.ts +20 -0
- package/dist/hprose/ProxyClient.d.ts +22 -0
- package/dist/hprose/index.d.ts +11 -0
- package/dist/index.cjs +3 -3
- package/dist/index.css +69 -0
- package/dist/index.d.ts +10 -1024
- package/dist/index.js +3 -3
- package/dist/mitt/index.d.ts +25 -0
- package/dist/model/Config.d.ts +94 -0
- package/dist/model/Constants.d.ts +15 -0
- package/dist/model/Layout.d.ts +75 -0
- package/dist/model/Token.d.ts +66 -0
- package/dist/model/index.d.ts +4 -0
- package/dist/public/mitm.html +166 -0
- package/dist/public/sw.js +128 -0
- package/dist/utils/AxiosHelper.d.ts +51 -0
- package/dist/utils/BigFileDownload.d.ts +106 -0
- package/dist/utils/Color.d.ts +74 -0
- package/dist/utils/FileDownload.d.ts +36 -0
- package/dist/utils/FileUpload.d.ts +90 -0
- package/dist/utils/H5Tool.d.ts +98 -0
- package/dist/utils/IsTool.d.ts +101 -0
- package/dist/utils/JQuery.d.ts +35 -0
- package/dist/utils/LockHelper.d.ts +17 -0
- package/dist/utils/Storage.d.ts +57 -0
- package/dist/utils/StringUtils.d.ts +15 -0
- package/dist/utils/Time.d.ts +1 -0
- package/dist/utils/TokenHelper.d.ts +18 -0
- package/dist/utils/URLTool.d.ts +18 -0
- package/dist/utils/index.d.ts +16 -0
- package/dist/utils/uuid.d.ts +3 -0
- package/package.json +15 -15
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 下载文件信息模型
|
|
3
|
+
*/
|
|
4
|
+
export interface IFileMeta {
|
|
5
|
+
id?: string;
|
|
6
|
+
name: string;
|
|
7
|
+
length: number;
|
|
8
|
+
downloadID: string;
|
|
9
|
+
chunkSize?: number;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 文件下载事件
|
|
13
|
+
*/
|
|
14
|
+
export declare type FileDownloadEvent = 'init' | 'info' | 'error' | 'downloadProgress' | 'saveProgress' | 'success';
|
|
15
|
+
/**
|
|
16
|
+
* 大文件分片/断点续传下载
|
|
17
|
+
*/
|
|
18
|
+
export declare class BigFileDownload {
|
|
19
|
+
private fileID;
|
|
20
|
+
private downloadURL;
|
|
21
|
+
ChunkUnitM: number;
|
|
22
|
+
private chunkByteSize;
|
|
23
|
+
private totalChunks;
|
|
24
|
+
private currentDB?;
|
|
25
|
+
private keys?;
|
|
26
|
+
private fileMetaData;
|
|
27
|
+
private finishNum;
|
|
28
|
+
private eventTarget;
|
|
29
|
+
private cancelSource;
|
|
30
|
+
private isStarting;
|
|
31
|
+
private fileName?;
|
|
32
|
+
constructor(fileID: string, downloadURL: string, chunkSizeM?: number);
|
|
33
|
+
/**
|
|
34
|
+
* 订阅事件
|
|
35
|
+
*/
|
|
36
|
+
on(eventName: FileDownloadEvent, fn: (event: any) => void): void;
|
|
37
|
+
/**
|
|
38
|
+
* 发送消息
|
|
39
|
+
*/
|
|
40
|
+
private dispatch;
|
|
41
|
+
/**
|
|
42
|
+
* 抛出异常信息
|
|
43
|
+
* @param data 异常描述
|
|
44
|
+
*/
|
|
45
|
+
private dispatchError;
|
|
46
|
+
/**
|
|
47
|
+
* 推送文字进度
|
|
48
|
+
* @param data 文字消息
|
|
49
|
+
*/
|
|
50
|
+
private dispatchInfo;
|
|
51
|
+
/**
|
|
52
|
+
* Get请求获取文件元数据信息
|
|
53
|
+
* @param baseURL 根URL路径
|
|
54
|
+
* @param apiPath 方法路径
|
|
55
|
+
* @param queryParams 请求参数
|
|
56
|
+
* @returns IFileMeta
|
|
57
|
+
*/
|
|
58
|
+
queryDownloadFileMeta(baseURL: string, apiPath?: string, queryParams?: any): Promise<IFileMeta | null>;
|
|
59
|
+
/**
|
|
60
|
+
*获取本地的File元数据信息
|
|
61
|
+
*/
|
|
62
|
+
getIFileMeta(): Promise<IFileMeta | null>;
|
|
63
|
+
/**
|
|
64
|
+
* 初始化信息
|
|
65
|
+
*/
|
|
66
|
+
private initIndexDB;
|
|
67
|
+
/**
|
|
68
|
+
* 初始化要下载的文件元数据
|
|
69
|
+
* @param url 下载路径
|
|
70
|
+
* @returns
|
|
71
|
+
*/
|
|
72
|
+
init(fileMeta: IFileMeta): Promise<void>;
|
|
73
|
+
/**
|
|
74
|
+
* 获取分片大小
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
getTotalChunks(): number;
|
|
78
|
+
/**
|
|
79
|
+
* 暂停下载
|
|
80
|
+
*/
|
|
81
|
+
pause(): void;
|
|
82
|
+
/**
|
|
83
|
+
* 重新开始
|
|
84
|
+
*/
|
|
85
|
+
restart(): void;
|
|
86
|
+
/**
|
|
87
|
+
* 删除下载任务
|
|
88
|
+
*/
|
|
89
|
+
delete(): void;
|
|
90
|
+
/**
|
|
91
|
+
* 开始分段下载
|
|
92
|
+
*/
|
|
93
|
+
download(downURL?: string): void;
|
|
94
|
+
/**
|
|
95
|
+
* 下载完成进度
|
|
96
|
+
*/
|
|
97
|
+
private downloadProgress;
|
|
98
|
+
/**
|
|
99
|
+
* 输出保存文件进度-分片统计
|
|
100
|
+
*/
|
|
101
|
+
private outputProgress;
|
|
102
|
+
/**
|
|
103
|
+
* 保存文件
|
|
104
|
+
*/
|
|
105
|
+
private savefile;
|
|
106
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* rgb转十六进制
|
|
3
|
+
* @param colorRGB rgb颜色值
|
|
4
|
+
* @returns
|
|
5
|
+
*/
|
|
6
|
+
export declare function getHexColor(colorRGB: string): string;
|
|
7
|
+
/**
|
|
8
|
+
* 十六进制转RGB
|
|
9
|
+
* @param color16 十六进制颜色值
|
|
10
|
+
* @returns
|
|
11
|
+
*/
|
|
12
|
+
export declare function getRGBColor(color16: string): string;
|
|
13
|
+
/**
|
|
14
|
+
* 解决十六进制短颜色问题
|
|
15
|
+
* @param colorHex 十六进制颜色
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
export declare function getLongHexColor(colorHex: string): string;
|
|
19
|
+
export declare enum EnumColor {
|
|
20
|
+
RGBA = 0,
|
|
21
|
+
Hex = 1,
|
|
22
|
+
Hsla = 2
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* 判断是否是16进制颜色
|
|
26
|
+
* @param colorStr 颜色字符串
|
|
27
|
+
* @returns
|
|
28
|
+
*/
|
|
29
|
+
export declare function isEnumColor(colorStr: string): EnumColor | undefined;
|
|
30
|
+
export declare function getRGBColorFromHSLA(colorHSLA: string): string | undefined;
|
|
31
|
+
/**
|
|
32
|
+
* 判断是否 十六进制颜色值.
|
|
33
|
+
* 输入形式可为 #fff000 #f00
|
|
34
|
+
*
|
|
35
|
+
* @param String color 十六进制颜色值
|
|
36
|
+
* @return Boolean
|
|
37
|
+
*/
|
|
38
|
+
export declare function isHexColor(color: string): boolean;
|
|
39
|
+
/**
|
|
40
|
+
* RGB 颜色值转换为 十六进制颜色值.
|
|
41
|
+
* r, g, 和 b 需要在 [0, 255] 范围内
|
|
42
|
+
*
|
|
43
|
+
* @return String 类似#ff00ff
|
|
44
|
+
* @param r
|
|
45
|
+
* @param g
|
|
46
|
+
* @param b
|
|
47
|
+
*/
|
|
48
|
+
export declare function rgbToHex(r: number, g: number, b: number): string;
|
|
49
|
+
/**
|
|
50
|
+
* Transform a HEX color to its RGB representation
|
|
51
|
+
* @param {string} hex The color to transform
|
|
52
|
+
* @returns The RGB representation of the passed color
|
|
53
|
+
*/
|
|
54
|
+
export declare function hexToRGB(hex: string): string;
|
|
55
|
+
export declare function colorIsDark(color: string): boolean | undefined;
|
|
56
|
+
/**
|
|
57
|
+
* Darkens a HEX color given the passed percentage
|
|
58
|
+
* @param {string} color The color to process
|
|
59
|
+
* @param {number} amount The amount to change the color by
|
|
60
|
+
* @returns {string} The HEX representation of the processed color
|
|
61
|
+
*/
|
|
62
|
+
export declare function darken(color: string, amount: number): string;
|
|
63
|
+
/**
|
|
64
|
+
* Lightens a 6 char HEX color according to the passed percentage
|
|
65
|
+
* @param {string} color The color to change
|
|
66
|
+
* @param {number} amount The amount to change the color by
|
|
67
|
+
* @returns {string} The processed color represented as HEX
|
|
68
|
+
*/
|
|
69
|
+
export declare function lighten(color: string, amount: number): string;
|
|
70
|
+
/**
|
|
71
|
+
* Determines what the best text color is (black or white) based con the contrast with the background
|
|
72
|
+
* @param hexColor - Last selected color by the user
|
|
73
|
+
*/
|
|
74
|
+
export declare function calculateBestTextColor(hexColor: string): "#000000" | "#FFFFFF";
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 下载文件
|
|
3
|
+
* @param content 文本或二进制文件
|
|
4
|
+
* @param filename 文件名
|
|
5
|
+
*/
|
|
6
|
+
declare const Download: (content: string | any, filename: string) => void;
|
|
7
|
+
/**
|
|
8
|
+
* URL方式保存文件到本地
|
|
9
|
+
* @param data 文件的blob数据
|
|
10
|
+
* @param name 文件名
|
|
11
|
+
*/
|
|
12
|
+
declare function SaveAs(data: string | any, name: string): void;
|
|
13
|
+
/**
|
|
14
|
+
* JSON对象下载为.json文件
|
|
15
|
+
* @param jsonObject Json对象
|
|
16
|
+
* @param jsonID 名称(不需要后缀名)
|
|
17
|
+
*/
|
|
18
|
+
declare const JsonDownload: (jsonObject: object, jsonID: string) => void;
|
|
19
|
+
/**
|
|
20
|
+
* 从Web上下载文件
|
|
21
|
+
* (通过axios下载)
|
|
22
|
+
* @param requestUrl URL下载地址
|
|
23
|
+
* @param fileName 文件名
|
|
24
|
+
*/
|
|
25
|
+
declare const HttpDownload: (axios: any, requestUrl: string, fileName: string) => void;
|
|
26
|
+
/**
|
|
27
|
+
* 根据文件地址下载文件
|
|
28
|
+
* (网站内部文件或外部图片地址)
|
|
29
|
+
* @param {*} sUrl
|
|
30
|
+
*/
|
|
31
|
+
declare function DownloadByUrl({ url, target, fileName }: {
|
|
32
|
+
url: string;
|
|
33
|
+
target?: '_self' | '_blank';
|
|
34
|
+
fileName?: string;
|
|
35
|
+
}): Promise<boolean>;
|
|
36
|
+
export { Download, SaveAs, JsonDownload, HttpDownload, DownloadByUrl };
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import { XhrHeaders } from 'xhr';
|
|
2
|
+
export declare type FileEventName = 'attempt' | 'attemptFailure' | 'chunkSuccess' | 'error' | 'offline' | 'online' | 'progress' | 'success';
|
|
3
|
+
export declare type AllowedMethods = 'PUT' | 'POST' | 'PATCH';
|
|
4
|
+
/**
|
|
5
|
+
* 文件上传配置
|
|
6
|
+
*/
|
|
7
|
+
export interface FileUploadOptions {
|
|
8
|
+
endpoint: string | ((file?: File) => Promise<string>);
|
|
9
|
+
file: File;
|
|
10
|
+
method?: AllowedMethods;
|
|
11
|
+
headers?: XhrHeaders;
|
|
12
|
+
maxFileSize?: number;
|
|
13
|
+
chunkSize?: number;
|
|
14
|
+
attempts?: number;
|
|
15
|
+
/**
|
|
16
|
+
* 单位:秒
|
|
17
|
+
*/
|
|
18
|
+
delayBeforeAttempt?: number;
|
|
19
|
+
md5?: string;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* 文件上传类
|
|
23
|
+
*/
|
|
24
|
+
export default class FileUpload {
|
|
25
|
+
endpoint: string | ((file?: File) => Promise<string>);
|
|
26
|
+
file: File;
|
|
27
|
+
headers: XhrHeaders;
|
|
28
|
+
method: AllowedMethods;
|
|
29
|
+
chunkSize: number;
|
|
30
|
+
attempts: number;
|
|
31
|
+
delayBeforeAttempt: number;
|
|
32
|
+
md5: string;
|
|
33
|
+
private chunk?;
|
|
34
|
+
private chunkCount;
|
|
35
|
+
private chunkByteSize;
|
|
36
|
+
private maxFileBytes;
|
|
37
|
+
private endpointValue?;
|
|
38
|
+
private totalChunks;
|
|
39
|
+
private attemptCount;
|
|
40
|
+
private offline;
|
|
41
|
+
private paused;
|
|
42
|
+
private success;
|
|
43
|
+
private currentXhr?;
|
|
44
|
+
private reader;
|
|
45
|
+
private eventTarget;
|
|
46
|
+
private fileName;
|
|
47
|
+
constructor(options: FileUploadOptions);
|
|
48
|
+
/**
|
|
49
|
+
* 订阅事件
|
|
50
|
+
*/
|
|
51
|
+
on(FileEventName: FileEventName, fn: (event: any) => void): void;
|
|
52
|
+
abort(): void;
|
|
53
|
+
pause(): void;
|
|
54
|
+
resume(): void;
|
|
55
|
+
/**
|
|
56
|
+
* 发送消息
|
|
57
|
+
*/
|
|
58
|
+
private dispatch;
|
|
59
|
+
/**
|
|
60
|
+
*验证参数的正确性
|
|
61
|
+
*/
|
|
62
|
+
private validateOptions;
|
|
63
|
+
/**
|
|
64
|
+
* Endpoint can either be a URL or a function that returns a promise that resolves to a string.
|
|
65
|
+
*/
|
|
66
|
+
private getEndpoint;
|
|
67
|
+
/**
|
|
68
|
+
* Get portion of the file of x bytes corresponding to chunkSize
|
|
69
|
+
*/
|
|
70
|
+
private getChunk;
|
|
71
|
+
private xhrPromise;
|
|
72
|
+
/**
|
|
73
|
+
* Send chunk of the file with appropriate headers and add post parameters if it's last chunk
|
|
74
|
+
*/
|
|
75
|
+
private sendChunk;
|
|
76
|
+
/**
|
|
77
|
+
* 失败处理和尝试
|
|
78
|
+
*/
|
|
79
|
+
private manageRetries;
|
|
80
|
+
/**
|
|
81
|
+
* 进行分片上传,并处理错误和重试
|
|
82
|
+
*/
|
|
83
|
+
private sendChunks;
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* 创建文件上传对象方法
|
|
87
|
+
* @param options
|
|
88
|
+
* @returns
|
|
89
|
+
*/
|
|
90
|
+
export declare const createFileUpload: (options: FileUploadOptions) => FileUpload;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 常用H5相关操作
|
|
3
|
+
*/
|
|
4
|
+
export default class H5Tool {
|
|
5
|
+
/**
|
|
6
|
+
* HTML元素事件监听
|
|
7
|
+
* @param element Window或HTMLElement
|
|
8
|
+
* @param type 事件名称
|
|
9
|
+
* @param handler 处理函数
|
|
10
|
+
*/
|
|
11
|
+
static addHandler(element: Window | HTMLElement | any, type: string, handler: Function): void;
|
|
12
|
+
/**
|
|
13
|
+
* 窗体变化事件
|
|
14
|
+
* @param handlerFunc 窗体变化处理函数
|
|
15
|
+
*/
|
|
16
|
+
static windowResizeHandler(handlerFunc: Function): void;
|
|
17
|
+
/**
|
|
18
|
+
* 是否支持全屏操作
|
|
19
|
+
* @returns true/false
|
|
20
|
+
*/
|
|
21
|
+
static fullscreenEnabled(): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 全屏
|
|
24
|
+
* @param el HTML元素
|
|
25
|
+
* @param isfull 是否全屏
|
|
26
|
+
*/
|
|
27
|
+
static fullScreen(element: any | Element, isfull: boolean): void;
|
|
28
|
+
/**
|
|
29
|
+
* 进入全屏
|
|
30
|
+
* @param element 全屏要素容器
|
|
31
|
+
*/
|
|
32
|
+
static requestFullScreen(el?: any | Element): void;
|
|
33
|
+
/**
|
|
34
|
+
* 退出全屏
|
|
35
|
+
*/
|
|
36
|
+
static exitFullScreen(): void;
|
|
37
|
+
/**
|
|
38
|
+
* 获取全屏的容器元素
|
|
39
|
+
* @returns 全屏的容器元素
|
|
40
|
+
*/
|
|
41
|
+
static fullScreenElement(): Element | HTMLElement | Document | null;
|
|
42
|
+
/**
|
|
43
|
+
* 是否是全屏
|
|
44
|
+
* @returns 全屏状态
|
|
45
|
+
*/
|
|
46
|
+
static isFullScreen(): boolean;
|
|
47
|
+
/**
|
|
48
|
+
* 监听全屏变化状态
|
|
49
|
+
* @param handlerFunc 全屏状态变化的处理函数
|
|
50
|
+
*/
|
|
51
|
+
static onFullScreenChanged(handlerFunc: (isfullscreen: boolean) => any): void;
|
|
52
|
+
/**
|
|
53
|
+
* 解决对象Json化循环引用问题
|
|
54
|
+
* @param key
|
|
55
|
+
* @param value
|
|
56
|
+
* @returns
|
|
57
|
+
*/
|
|
58
|
+
static stringifyCircularHandler(key: string, value: any): any;
|
|
59
|
+
/**
|
|
60
|
+
* 对象Json化——解决循环引用问题
|
|
61
|
+
* @param obj 传入对象参数
|
|
62
|
+
* @returns 无循环引用的新对象
|
|
63
|
+
*/
|
|
64
|
+
static jsonStringify(obj: any): string;
|
|
65
|
+
/**
|
|
66
|
+
* 去掉JSON循环引用关系
|
|
67
|
+
* @param obj 传入对象参数
|
|
68
|
+
* @returns 无循环引用的新对象
|
|
69
|
+
*/
|
|
70
|
+
static jsonParse(obj: any): any;
|
|
71
|
+
/**
|
|
72
|
+
* 获取input File的对象的数据路径
|
|
73
|
+
* @param file File对象
|
|
74
|
+
* @returns
|
|
75
|
+
*/
|
|
76
|
+
static getObjectURL(file: any): string | undefined;
|
|
77
|
+
/**
|
|
78
|
+
* 获取文件的短MD5摘要
|
|
79
|
+
* @param fileObj file对象
|
|
80
|
+
* @param handleMd5Result 处理文件MD5结果
|
|
81
|
+
*/
|
|
82
|
+
static getFileShortMD5(fileObj: any, handleMd5Result: (data: {
|
|
83
|
+
isOK: boolean;
|
|
84
|
+
data: string;
|
|
85
|
+
}) => void): any;
|
|
86
|
+
/**
|
|
87
|
+
* 提供MD5值计算
|
|
88
|
+
* @param content 字符串
|
|
89
|
+
* @param needRawHash 是否需要是二进制格式的结果,默认为false
|
|
90
|
+
* @returns MD5值
|
|
91
|
+
*/
|
|
92
|
+
static MD5(content: string, needRawHash?: boolean): string;
|
|
93
|
+
/**
|
|
94
|
+
* 复制文本
|
|
95
|
+
* @param text
|
|
96
|
+
*/
|
|
97
|
+
static copyText: (text: string) => Promise<unknown>;
|
|
98
|
+
}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description: 判断值是否未某个类型
|
|
3
|
+
*/
|
|
4
|
+
export declare function is(val: unknown, type: string): boolean;
|
|
5
|
+
/**
|
|
6
|
+
* @description: 是否为函数
|
|
7
|
+
*/
|
|
8
|
+
export declare function isFunction<T = Function>(val: unknown): val is T;
|
|
9
|
+
/**
|
|
10
|
+
* @description: 是否已定义
|
|
11
|
+
*/
|
|
12
|
+
export declare const isDef: <T = unknown>(val?: T | undefined) => val is T;
|
|
13
|
+
export declare const isUnDef: <T = unknown>(val?: T | undefined) => val is T;
|
|
14
|
+
export declare function isNull(val: unknown): val is null;
|
|
15
|
+
export declare function isNullAndUnDef(val: unknown): val is null | undefined;
|
|
16
|
+
export declare function isNullOrUnDef(val: unknown): val is null | undefined;
|
|
17
|
+
/**
|
|
18
|
+
* @description: 是否为对象
|
|
19
|
+
*/
|
|
20
|
+
export declare const isObject: (val: any) => val is Record<any, any>;
|
|
21
|
+
/**
|
|
22
|
+
* @description: 是否为时间
|
|
23
|
+
*/
|
|
24
|
+
export declare function isDate(val: unknown): val is Date;
|
|
25
|
+
/**
|
|
26
|
+
* @description: 是否为数值
|
|
27
|
+
*/
|
|
28
|
+
export declare function isNumber(val: unknown): val is number;
|
|
29
|
+
/**
|
|
30
|
+
* @description: 是否为AsyncFunction
|
|
31
|
+
*/
|
|
32
|
+
export declare function isAsyncFunction<T = any>(val: unknown): val is Promise<T>;
|
|
33
|
+
/**
|
|
34
|
+
* @description: 是否为promise
|
|
35
|
+
*/
|
|
36
|
+
export declare function isPromise<T = any>(val: unknown): val is Promise<T>;
|
|
37
|
+
/**
|
|
38
|
+
* @description: 是否为字符串
|
|
39
|
+
*/
|
|
40
|
+
export declare function isString(val: unknown): val is string;
|
|
41
|
+
/**
|
|
42
|
+
* @description: 是否为boolean类型
|
|
43
|
+
*/
|
|
44
|
+
export declare function isBoolean(val: unknown): val is boolean;
|
|
45
|
+
/**
|
|
46
|
+
* @description: 是否为数组
|
|
47
|
+
*/
|
|
48
|
+
export declare function isArray(val: any): val is Array<any>;
|
|
49
|
+
/**
|
|
50
|
+
* @description: 是否客户端
|
|
51
|
+
*/
|
|
52
|
+
export declare const isClient: () => boolean;
|
|
53
|
+
/**
|
|
54
|
+
* @description: 是否为浏览器
|
|
55
|
+
*/
|
|
56
|
+
export declare const isWindow: (val: any) => val is Window;
|
|
57
|
+
export declare const isElement: (val: unknown) => val is Element;
|
|
58
|
+
export declare const isServer: boolean;
|
|
59
|
+
export declare function isImageDom(o: Element): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* 是否为空
|
|
62
|
+
* @param source
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
export declare function isEmpty(source: unknown): boolean;
|
|
66
|
+
/**
|
|
67
|
+
* 是否是异常
|
|
68
|
+
* @param val
|
|
69
|
+
* @returns
|
|
70
|
+
*/
|
|
71
|
+
export declare function isError(val: unknown): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* 判断元素是否为WeakSet
|
|
74
|
+
* @param source
|
|
75
|
+
* @returns
|
|
76
|
+
*/
|
|
77
|
+
export declare function isWeakSet(source: unknown): boolean;
|
|
78
|
+
/**
|
|
79
|
+
* @description 判断元素是否为WeakMap
|
|
80
|
+
* @param {*} source 元素
|
|
81
|
+
* @return {Boolen}
|
|
82
|
+
*/
|
|
83
|
+
export declare function isWeakMap(source: unknown): boolean;
|
|
84
|
+
/**
|
|
85
|
+
* @description 判断元素是否为Symbol
|
|
86
|
+
* @param {*} source 元素
|
|
87
|
+
* @return {Boolen}
|
|
88
|
+
*/
|
|
89
|
+
export declare function isSymbol(source: unknown): boolean;
|
|
90
|
+
/**
|
|
91
|
+
* @description 判断元素是否为Map
|
|
92
|
+
* @param {*} source 元素
|
|
93
|
+
* @return {Boolen}
|
|
94
|
+
*/
|
|
95
|
+
export declare function isMap(source: unknown): boolean;
|
|
96
|
+
/**
|
|
97
|
+
* 是否有效的URL地址
|
|
98
|
+
* @param url
|
|
99
|
+
* @returns
|
|
100
|
+
*/
|
|
101
|
+
export declare const isValidURL: (url: string) => boolean;
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 模仿JQuery相关方法
|
|
3
|
+
*/
|
|
4
|
+
declare class JQuery {
|
|
5
|
+
/**
|
|
6
|
+
* 是否有Style类名
|
|
7
|
+
* @param ele HTML元素
|
|
8
|
+
* @param className 类名
|
|
9
|
+
* @returns
|
|
10
|
+
*/
|
|
11
|
+
hasClass(ele: HTMLElement, className: string): RegExpMatchArray | null;
|
|
12
|
+
/**
|
|
13
|
+
* 为元素添加Style类名
|
|
14
|
+
* @param ele HTML元素
|
|
15
|
+
* @param className 类名
|
|
16
|
+
*/
|
|
17
|
+
addClass(ele: HTMLElement, className: string): void;
|
|
18
|
+
/**
|
|
19
|
+
* 移除元素的Style类名
|
|
20
|
+
* @param ele HTML元素
|
|
21
|
+
* @param className 类名
|
|
22
|
+
*/
|
|
23
|
+
removeClass(ele: HTMLElement, className: string): void;
|
|
24
|
+
/**
|
|
25
|
+
* 切换Style类名
|
|
26
|
+
* @param ele HTML元素
|
|
27
|
+
* @param className 类名
|
|
28
|
+
*/
|
|
29
|
+
toggleClass(ele: HTMLElement, className: string): void;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* jquery对象
|
|
33
|
+
*/
|
|
34
|
+
export declare const jquery: JQuery;
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export interface ILockState {
|
|
2
|
+
isLock: boolean;
|
|
3
|
+
lockTime: number;
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* 获取当前Lock状态
|
|
7
|
+
* @returns 是否Locked
|
|
8
|
+
*/
|
|
9
|
+
export declare function getLockState(): any;
|
|
10
|
+
/**
|
|
11
|
+
* 全局监听Lock
|
|
12
|
+
*/
|
|
13
|
+
export declare function onLockListener(): void;
|
|
14
|
+
/**
|
|
15
|
+
* 取消全局监听Lock
|
|
16
|
+
*/
|
|
17
|
+
export declare function unLockListener(): void;
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 创建本地缓存对象
|
|
3
|
+
*/
|
|
4
|
+
declare class StorageHelper {
|
|
5
|
+
private prefixKey;
|
|
6
|
+
private storage;
|
|
7
|
+
constructor(prefixKey?: string, storage?: Storage);
|
|
8
|
+
private getKey;
|
|
9
|
+
/**
|
|
10
|
+
* @description 设置缓存
|
|
11
|
+
* @param {string} key 缓存键
|
|
12
|
+
* @param {*} value 缓存值
|
|
13
|
+
* @param expire
|
|
14
|
+
*/
|
|
15
|
+
set(key: string, value: any, expire?: number | null): void;
|
|
16
|
+
/**
|
|
17
|
+
* 读取缓存
|
|
18
|
+
* @param {string} key 缓存键
|
|
19
|
+
* @param {*=} def 默认值
|
|
20
|
+
*/
|
|
21
|
+
get(key: string, def?: any): any;
|
|
22
|
+
/**
|
|
23
|
+
* 从缓存删除某项
|
|
24
|
+
* @param {string} key
|
|
25
|
+
*/
|
|
26
|
+
remove(key: string): void;
|
|
27
|
+
/**
|
|
28
|
+
* 清空所有缓存
|
|
29
|
+
* @memberOf Cache
|
|
30
|
+
*/
|
|
31
|
+
clear(): void;
|
|
32
|
+
/**
|
|
33
|
+
* 设置cookie
|
|
34
|
+
* @param {string} name cookie 名称
|
|
35
|
+
* @param {*} value cookie 值
|
|
36
|
+
* @param {number=} expire 过期时间
|
|
37
|
+
* 如果过期时间为设置,默认关闭浏览器自动删除
|
|
38
|
+
* @example
|
|
39
|
+
*/
|
|
40
|
+
setCookie(name: string, value: any, expire?: number | null): void;
|
|
41
|
+
/**
|
|
42
|
+
* 根据名字获取cookie值
|
|
43
|
+
* @param name
|
|
44
|
+
*/
|
|
45
|
+
getCookie(name: string): string;
|
|
46
|
+
/**
|
|
47
|
+
* 根据名字删除指定的cookie
|
|
48
|
+
* @param {string} key
|
|
49
|
+
*/
|
|
50
|
+
removeCookie(key: string): void;
|
|
51
|
+
/**
|
|
52
|
+
* 清空cookie,使所有cookie失效
|
|
53
|
+
*/
|
|
54
|
+
clearCookie(): void;
|
|
55
|
+
}
|
|
56
|
+
export declare const storage: StorageHelper;
|
|
57
|
+
export default StorageHelper;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare class StringUtils {
|
|
2
|
+
/**
|
|
3
|
+
* 判断字符串是否为空或undefined,不判断为0,不判断为false
|
|
4
|
+
* @param str
|
|
5
|
+
* @returns {boolean}
|
|
6
|
+
*/
|
|
7
|
+
static isNullOrEmpty: (str: any) => boolean;
|
|
8
|
+
static isNotEmpty: (str: any) => boolean;
|
|
9
|
+
/**
|
|
10
|
+
* / _ - 转换成驼峰并将view替换成空字符串
|
|
11
|
+
* @param {*} name name
|
|
12
|
+
*/
|
|
13
|
+
static toHump(name: any): any;
|
|
14
|
+
}
|
|
15
|
+
export default StringUtils;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function sleep(delay: any): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ITokenInfo } from '../model/Token';
|
|
2
|
+
import StorageHelper from '../utils/Storage';
|
|
3
|
+
export declare const storageHelper: StorageHelper;
|
|
4
|
+
/**
|
|
5
|
+
* 获取token中的授权Key
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
declare function getLocalToken(): ITokenInfo;
|
|
9
|
+
/**
|
|
10
|
+
* 清除本地Token
|
|
11
|
+
*/
|
|
12
|
+
declare function clearLocalToken(): void;
|
|
13
|
+
/**
|
|
14
|
+
* 获得RefreshToken
|
|
15
|
+
* @returns
|
|
16
|
+
*/
|
|
17
|
+
declare function getRefreshToken(): string;
|
|
18
|
+
export { getLocalToken, getRefreshToken, clearLocalToken };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 将对象添加当作参数拼接到URL上面
|
|
3
|
+
* @param baseUrl 需要拼接的url
|
|
4
|
+
* @param obj 参数对象
|
|
5
|
+
* @returns {string} 拼接后的对象
|
|
6
|
+
* 例子:
|
|
7
|
+
* let obj = {a: '3', b: '4'}
|
|
8
|
+
* setObjToUrlParams('www.baidu.com', obj)
|
|
9
|
+
* ==>www.baidu.com?a=3&b=4
|
|
10
|
+
*/
|
|
11
|
+
export declare function ObjToUrlParams(baseUrl: string, obj: object): string;
|
|
12
|
+
/**
|
|
13
|
+
* 深入拷贝对象
|
|
14
|
+
* @param src
|
|
15
|
+
* @param target
|
|
16
|
+
* @returns
|
|
17
|
+
*/
|
|
18
|
+
export declare function deepMerge<T = any>(src?: any, target?: any): T;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import H5Tool from './H5Tool';
|
|
2
|
+
import StringUtils from './StringUtils';
|
|
3
|
+
import StorageHelper, { storage } from './Storage';
|
|
4
|
+
import uuid, { newGuid } from './uuid';
|
|
5
|
+
export * from './Color';
|
|
6
|
+
export * from './FileDownload';
|
|
7
|
+
export * from './Time';
|
|
8
|
+
export { H5Tool, StringUtils, StorageHelper as Storage, storage, uuid, newGuid };
|
|
9
|
+
export * from './AxiosHelper';
|
|
10
|
+
export * from './TokenHelper';
|
|
11
|
+
export * from './FileUpload';
|
|
12
|
+
export * from './JQuery';
|
|
13
|
+
export * from './LockHelper';
|
|
14
|
+
export * from './BigFileDownload';
|
|
15
|
+
export * from './IsTool';
|
|
16
|
+
export * from './URLTool';
|