xframelib 0.3.7 → 0.4.2
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 +77 -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 +17 -1
- package/dist/index.css +146 -76
- package/dist/index.d.ts +10 -813
- package/dist/index.js +17 -1
- 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 +36 -0
- package/dist/model/Token.d.ts +66 -0
- package/dist/model/index.d.ts +4 -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 +21 -17
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 刷新提前量(毫秒,ms)
|
|
3
|
+
*/
|
|
4
|
+
export declare const TOKEN_REFRESH_TIME: number;
|
|
5
|
+
/**
|
|
6
|
+
* 用户和Token相关服务API
|
|
7
|
+
*/
|
|
8
|
+
export declare const USER_TOKEN_API: {
|
|
9
|
+
Login: string;
|
|
10
|
+
CheckLogin: string;
|
|
11
|
+
Logout: string;
|
|
12
|
+
ChangePWD: string;
|
|
13
|
+
RefreshToken: string;
|
|
14
|
+
CheckToken: string;
|
|
15
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Component } from 'vue';
|
|
2
|
+
export declare type Lazy<T> = () => Promise<T>;
|
|
3
|
+
/**
|
|
4
|
+
*布局枚举类型
|
|
5
|
+
*/
|
|
6
|
+
export declare enum LayoutContainerEnum {
|
|
7
|
+
top = 0,
|
|
8
|
+
bottom = 1,
|
|
9
|
+
centerBack = 2,
|
|
10
|
+
centerMain = 3,
|
|
11
|
+
centerFront = 4,
|
|
12
|
+
left = 5,
|
|
13
|
+
right = 6
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* 组件布局
|
|
17
|
+
*/
|
|
18
|
+
export interface IWidgetLayout {
|
|
19
|
+
top?: number;
|
|
20
|
+
left?: number;
|
|
21
|
+
right?: number;
|
|
22
|
+
bottom?: number;
|
|
23
|
+
width?: string;
|
|
24
|
+
height?: string;
|
|
25
|
+
}
|
|
26
|
+
export interface IWidgetConfig {
|
|
27
|
+
id: string;
|
|
28
|
+
label?: string;
|
|
29
|
+
icon?: string;
|
|
30
|
+
container: LayoutContainerEnum;
|
|
31
|
+
component: Lazy<Component>;
|
|
32
|
+
preload?: boolean;
|
|
33
|
+
afterid?: string;
|
|
34
|
+
group?: string;
|
|
35
|
+
layout?: IWidgetLayout;
|
|
36
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 当前存储的token对象
|
|
3
|
+
*/
|
|
4
|
+
export interface ITokenInfo {
|
|
5
|
+
id: string;
|
|
6
|
+
name: string;
|
|
7
|
+
token: string;
|
|
8
|
+
expire: string;
|
|
9
|
+
refresh: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* 单个token对象内容
|
|
13
|
+
* 与后台相匹配
|
|
14
|
+
*/
|
|
15
|
+
export interface IToken {
|
|
16
|
+
/**
|
|
17
|
+
* token内容
|
|
18
|
+
*/
|
|
19
|
+
tokenContent: string;
|
|
20
|
+
/**
|
|
21
|
+
* 超时时间
|
|
22
|
+
*/
|
|
23
|
+
expires: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* 双Token接口定义
|
|
27
|
+
*/
|
|
28
|
+
export interface IDoubleToken {
|
|
29
|
+
/**
|
|
30
|
+
* 当前有效token
|
|
31
|
+
*/
|
|
32
|
+
accessToken: IToken;
|
|
33
|
+
/**
|
|
34
|
+
* 用于刷新的token
|
|
35
|
+
*/
|
|
36
|
+
refreshToken: IToken;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* 系统用户
|
|
40
|
+
*/
|
|
41
|
+
export interface ISystemUser {
|
|
42
|
+
/**
|
|
43
|
+
* 用户ID
|
|
44
|
+
*/
|
|
45
|
+
id: string;
|
|
46
|
+
/**
|
|
47
|
+
* 用户名
|
|
48
|
+
*/
|
|
49
|
+
name: string;
|
|
50
|
+
/**
|
|
51
|
+
* 用户组ID
|
|
52
|
+
*/
|
|
53
|
+
groupid?: string;
|
|
54
|
+
photo?: string;
|
|
55
|
+
mobile?: string;
|
|
56
|
+
qq?: string;
|
|
57
|
+
email?: string;
|
|
58
|
+
img?: string;
|
|
59
|
+
issystem?: boolean;
|
|
60
|
+
createtime?: string;
|
|
61
|
+
updatetime?: string;
|
|
62
|
+
issecurity?: boolean;
|
|
63
|
+
appkey?: string;
|
|
64
|
+
role?: string;
|
|
65
|
+
doubleToken?: IDoubleToken;
|
|
66
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export declare type ResponseType = 'arraybuffer' | 'blob' | 'document' | 'json' | 'text' | 'stream';
|
|
2
|
+
/**
|
|
3
|
+
* Get服务请求
|
|
4
|
+
* @param apiUrl API接口路径
|
|
5
|
+
* @param baseUrl 基础服务路径
|
|
6
|
+
* @param _params 参数
|
|
7
|
+
* @param headers headers参数
|
|
8
|
+
* @param responseType 响应类型,默认为json
|
|
9
|
+
* @param cancelToken 取消标识
|
|
10
|
+
* @returns 返回Promise对象
|
|
11
|
+
*/
|
|
12
|
+
declare function requestGet(apiUrl: string, baseUrl?: string, _params?: any, headers?: any, responseType?: ResponseType, cancelToken?: any): Promise<any>;
|
|
13
|
+
/**
|
|
14
|
+
* Post服务请求-FormData
|
|
15
|
+
* @param apiUrl API接口路径
|
|
16
|
+
* @param baseUrl 基础服务路径
|
|
17
|
+
* @param _params 参数
|
|
18
|
+
* @param headers headers参数
|
|
19
|
+
* @returns 返回Promise对象
|
|
20
|
+
*/
|
|
21
|
+
declare function requestPost(apiUrl: string, baseUrl?: string, _bodyParams?: any, _queryParams?: any, headers?: any, responseType?: ResponseType): Promise<any>;
|
|
22
|
+
/**
|
|
23
|
+
* Post服务请求-Body方式
|
|
24
|
+
* @param apiUrl API接口路径
|
|
25
|
+
* @param baseUrl 基础服务路径
|
|
26
|
+
* @param _params 参数
|
|
27
|
+
* @returns 返回Promise对象
|
|
28
|
+
*/
|
|
29
|
+
declare function requestPostBody(apiUrl: string, baseUrl?: string, _bodyParams?: any, _queryParams?: any, headers?: any, responseType?: ResponseType): Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* 业务服务Get请求
|
|
32
|
+
* @param apiUrl API接口路径
|
|
33
|
+
* @param _params 参数
|
|
34
|
+
* @returns 返回Promise对象
|
|
35
|
+
*/
|
|
36
|
+
declare function get(apiUrl: string, _params?: any): Promise<any>;
|
|
37
|
+
/**
|
|
38
|
+
* 业务服务Post请求
|
|
39
|
+
* @param apiUrl API接口路径
|
|
40
|
+
* @param _params 参数
|
|
41
|
+
* @returns 返回Promise对象
|
|
42
|
+
*/
|
|
43
|
+
declare function post(apiUrl: string, _params?: any): Promise<any>;
|
|
44
|
+
/**
|
|
45
|
+
* 独立的外部Get请求(无token验证信息)
|
|
46
|
+
* @param fullRequestURL 完整请求路径
|
|
47
|
+
* @param _params 请求参数
|
|
48
|
+
* @returns 返回Promise对象
|
|
49
|
+
*/
|
|
50
|
+
declare function getData(fullRequestURL: string, _params?: any): Promise<any>;
|
|
51
|
+
export { get, post, requestPost, requestGet, getData, requestPostBody };
|
|
@@ -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;
|