xframelib 0.5.9 → 0.6.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 +3 -0
- package/dist/api/Token.d.ts +2 -2
- package/dist/core/MsgHelper.d.ts +1 -0
- package/dist/index.cjs +8 -8
- package/dist/index.css +76 -76
- package/dist/index.js +7 -7
- package/dist/model/Config.d.ts +19 -11
- package/dist/model/Constants.d.ts +4 -0
- package/dist/public/WSynchro.js +67 -0
- package/dist/utils/FileUpload.d.ts +1 -1
- package/dist/utils/H5Tool.d.ts +10 -1
- package/dist/utils/Storage.d.ts +10 -1
- package/package.json +4 -4
package/dist/model/Config.d.ts
CHANGED
|
@@ -42,9 +42,13 @@ export interface IUIObject {
|
|
|
42
42
|
*/
|
|
43
43
|
export interface IServiceURL {
|
|
44
44
|
/**
|
|
45
|
-
*
|
|
45
|
+
* 用户登录验证服务(统一用户登录:后台)
|
|
46
46
|
*/
|
|
47
47
|
LoginAuthURL?: string;
|
|
48
|
+
/**
|
|
49
|
+
* 用户登录界面(统一用户登录界面:前台)
|
|
50
|
+
*/
|
|
51
|
+
UILoginURL?: string;
|
|
48
52
|
/**
|
|
49
53
|
* 文件管理服务地址(统一文件管理:后台)
|
|
50
54
|
*/
|
|
@@ -52,11 +56,15 @@ export interface IServiceURL {
|
|
|
52
56
|
/**
|
|
53
57
|
* 文件管理(统一文件管理:前台)
|
|
54
58
|
*/
|
|
55
|
-
|
|
59
|
+
UIFileURL?: string;
|
|
56
60
|
/**
|
|
57
|
-
*
|
|
61
|
+
* 在线日志服务(统一日志记录)
|
|
58
62
|
*/
|
|
59
63
|
LogServiceURL?: string;
|
|
64
|
+
/**
|
|
65
|
+
* 图标在线服务地址
|
|
66
|
+
*/
|
|
67
|
+
IconServiceURL?: string;
|
|
60
68
|
/**
|
|
61
69
|
* Axios普通WebAPI的BaseURL
|
|
62
70
|
* 全局默认的http请求地址(一般与主hprose相同或不同);文件上传地址
|
|
@@ -76,21 +84,21 @@ export interface IServiceURL {
|
|
|
76
84
|
*/
|
|
77
85
|
export interface IMapKeys {
|
|
78
86
|
/**
|
|
79
|
-
* 天地图Key
|
|
87
|
+
* 天地图Key ,单个或数组
|
|
80
88
|
*/
|
|
81
|
-
TDTKey?: string;
|
|
89
|
+
TDTKey?: string | string[];
|
|
82
90
|
/**
|
|
83
|
-
* MapboxKey
|
|
91
|
+
* MapboxKey ,单个或数组
|
|
84
92
|
*/
|
|
85
|
-
MapboxKey?: string;
|
|
93
|
+
MapboxKey?: string | string[];
|
|
86
94
|
/**
|
|
87
|
-
* Cesium Key
|
|
95
|
+
* Cesium Key ,单个或数组
|
|
88
96
|
*/
|
|
89
|
-
CesiumKey?: string;
|
|
97
|
+
CesiumKey?: string | string[];
|
|
90
98
|
/**
|
|
91
|
-
* Google地图Key
|
|
99
|
+
* Google地图Key ,单个或数组
|
|
92
100
|
*/
|
|
93
|
-
GoogleKey?: string;
|
|
101
|
+
GoogleKey?: string | string[];
|
|
94
102
|
/**
|
|
95
103
|
* 其他扩展的Key属性
|
|
96
104
|
*/
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/** WSynchro object to synchronize windows
|
|
2
|
+
* - windows: array of windows to synchro (
|
|
3
|
+
* - source: the window source (undefined if first window)
|
|
4
|
+
*/
|
|
5
|
+
if (!window.WSynchro) {
|
|
6
|
+
var WSynchro = { windows: [] };
|
|
7
|
+
}
|
|
8
|
+
/** Open a new window to synchronize
|
|
9
|
+
* @param {url|undefined} url to open, default current window url
|
|
10
|
+
* @param {specs|undefined|null} specs (as for window.open), undefined to open in a new window, null to open in a new tab, default new window
|
|
11
|
+
*/
|
|
12
|
+
WSynchro.open = function (href, specs)
|
|
13
|
+
{ var w = window.open (href || window.location.href, "_blank", typeof(specs)=="undefined"? "location=1,menubar=1,toolbar=1,scrollbars=1" : specs);
|
|
14
|
+
if (!w.WSynchro) w.WSynchro = { windows: [ window ], source:window };
|
|
15
|
+
else
|
|
16
|
+
{ w.WSynchro.windows = [ window ];
|
|
17
|
+
w.WSynchro.source = window;
|
|
18
|
+
}
|
|
19
|
+
this.windows.push(w);
|
|
20
|
+
}
|
|
21
|
+
/** Trigger function
|
|
22
|
+
* @param {synchronize}
|
|
23
|
+
* @param {function} synchronize function
|
|
24
|
+
*/
|
|
25
|
+
WSynchro.on = function (e, syncFn)
|
|
26
|
+
{ if (!this.syncFn_) this.syncFn_ = [];
|
|
27
|
+
if (e==='synchronize') this.syncFn_.push(syncFn);
|
|
28
|
+
}
|
|
29
|
+
/** Synchronize windows
|
|
30
|
+
* @param {Object|undefined} if undefined stop synchro (when the window is synchronize)
|
|
31
|
+
*/
|
|
32
|
+
WSynchro.synchronize = function(params)
|
|
33
|
+
{ this.synchronize_ (params);
|
|
34
|
+
}
|
|
35
|
+
/** Synchronize windows:
|
|
36
|
+
* @param {Array} array of arguments to use with fn
|
|
37
|
+
* @param {} internal syncrho time to avoid stnchro loops
|
|
38
|
+
* @private
|
|
39
|
+
*/
|
|
40
|
+
WSynchro.synchronize_ = function(args, sync) {
|
|
41
|
+
var i;
|
|
42
|
+
// Stop condition
|
|
43
|
+
if (!sync)
|
|
44
|
+
{ if (this.synchronizing) sync = this.sync;
|
|
45
|
+
else this.sync = sync = (new Date()).getTime();
|
|
46
|
+
this.synchronizing = false;
|
|
47
|
+
}
|
|
48
|
+
else
|
|
49
|
+
{ // Don't synchronize twice
|
|
50
|
+
if (sync == this.sync) return;
|
|
51
|
+
this.sync = sync;
|
|
52
|
+
this.synchronizing = true;
|
|
53
|
+
try
|
|
54
|
+
{ if (WSynchro.syncFn_)
|
|
55
|
+
{ args.type = "synchronize";
|
|
56
|
+
for (i=0; i<WSynchro.syncFn_.length; i++)
|
|
57
|
+
{ WSynchro.syncFn_[i].apply (null, [args]);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
} catch(e) { /* */ }
|
|
61
|
+
}
|
|
62
|
+
if (args) for (i=0; i<this.windows.length; i++)
|
|
63
|
+
{ try
|
|
64
|
+
{ this.windows[i].WSynchro.synchronize_(args, sync);
|
|
65
|
+
} catch(e) { /* */ }
|
|
66
|
+
}
|
|
67
|
+
}
|
package/dist/utils/H5Tool.d.ts
CHANGED
|
@@ -79,7 +79,16 @@ export default class H5Tool {
|
|
|
79
79
|
* @param fileObj file对象
|
|
80
80
|
* @param handleMd5Result 处理文件MD5结果
|
|
81
81
|
*/
|
|
82
|
-
static getFileShortMD5(fileObj:
|
|
82
|
+
static getFileShortMD5(fileObj: File, handleMd5Result: (data: {
|
|
83
|
+
isOK: boolean;
|
|
84
|
+
data: string;
|
|
85
|
+
}) => void): any;
|
|
86
|
+
/**
|
|
87
|
+
* 获取文件完整的MD5摘要
|
|
88
|
+
* @param fileObj
|
|
89
|
+
* @param handleMd5Result
|
|
90
|
+
*/
|
|
91
|
+
static getFileMD5(fileObj: File, handleMd5Result: (data: {
|
|
83
92
|
isOK: boolean;
|
|
84
93
|
data: string;
|
|
85
94
|
}) => void): any;
|
package/dist/utils/Storage.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ declare class StorageHelper {
|
|
|
10
10
|
* @description 设置缓存
|
|
11
11
|
* @param {string} key 缓存键
|
|
12
12
|
* @param {*} value 缓存值
|
|
13
|
-
* @param expire
|
|
13
|
+
* @param expire 超时时间为秒
|
|
14
14
|
*/
|
|
15
15
|
set(key: string, value: any, expire?: number | null): void;
|
|
16
16
|
/**
|
|
@@ -19,6 +19,15 @@ declare class StorageHelper {
|
|
|
19
19
|
* @param {*=} def 默认值
|
|
20
20
|
*/
|
|
21
21
|
get(key: string, def?: any): any;
|
|
22
|
+
/**
|
|
23
|
+
* 获取存储对象,带expire属性
|
|
24
|
+
* 返回:
|
|
25
|
+
* {
|
|
26
|
+
* value:any,
|
|
27
|
+
* expire:null|Time
|
|
28
|
+
* }
|
|
29
|
+
*/
|
|
30
|
+
getJsonObject(key: string): any;
|
|
22
31
|
/**
|
|
23
32
|
* 从缓存删除某项
|
|
24
33
|
* @param {string} key
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xframelib",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "积累的前端开发基础库",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"common": "dist/index.cjs",
|
|
7
7
|
"typings": "dist/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
|
-
"dev": "vite --port
|
|
9
|
+
"dev": "vite --port 8099",
|
|
10
10
|
"build": "vite build",
|
|
11
11
|
"lib": "rollup -c ",
|
|
12
12
|
"serve": "vite preview",
|
|
@@ -26,11 +26,11 @@
|
|
|
26
26
|
"@hprose/io": "^3.0.10",
|
|
27
27
|
"@hprose/rpc-core": "^3.0.10",
|
|
28
28
|
"@hprose/rpc-html5": "^3.0.10",
|
|
29
|
+
"axios": "^0.26.1",
|
|
29
30
|
"localforage": "^1.10.0",
|
|
30
31
|
"spark-md5": "^3.0.2",
|
|
31
32
|
"streamsaver": "^2.0.6",
|
|
32
|
-
"xhr": "^2.6.0"
|
|
33
|
-
"axios": "^0.26.1"
|
|
33
|
+
"xhr": "^2.6.0"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@rollup/plugin-alias": "^3.1.9",
|