xframelib 0.5.5 → 0.5.8
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 +51 -2
- package/dist/controls/layoutcontainer/LayoutManager.d.ts +9 -3
- package/dist/controls/layoutcontainer/layout.vue.d.ts +19 -8
- package/dist/controls/vuewindow/window/index.vue.d.ts +1 -0
- package/dist/core/Global.d.ts +1 -25
- package/dist/core/IModel.d.ts +11 -0
- package/dist/core/Init.d.ts +20 -0
- package/dist/core/index.d.ts +1 -0
- package/dist/index.cjs +7 -7
- package/dist/index.css +69 -69
- package/dist/index.js +8 -8
- package/dist/model/Config.d.ts +42 -1
- package/dist/model/Layout.d.ts +12 -4
- package/dist/public/mitm.html +143 -129
- package/dist/utils/H5Tool.d.ts +19 -0
- package/package.json +14 -14
package/dist/model/Config.d.ts
CHANGED
|
@@ -20,12 +20,18 @@ export interface IUIObject {
|
|
|
20
20
|
WebSite?: string;
|
|
21
21
|
/**
|
|
22
22
|
* 超时锁屏时间(单位:秒s)
|
|
23
|
+
* 自动锁屏时间,为0不锁屏。
|
|
23
24
|
*/
|
|
24
25
|
LockTime?: number;
|
|
25
26
|
/**
|
|
26
27
|
* 是否是能访问互联网,还是内网部署应用
|
|
27
28
|
* */
|
|
28
29
|
IsInternet?: boolean;
|
|
30
|
+
/**
|
|
31
|
+
* 网站灰色模式,用于可能悼念的日期开启
|
|
32
|
+
* 默认为false
|
|
33
|
+
*/
|
|
34
|
+
GrayMode?: boolean;
|
|
29
35
|
/**
|
|
30
36
|
* 其他扩展的属性
|
|
31
37
|
*/
|
|
@@ -38,7 +44,19 @@ export interface IServiceURL {
|
|
|
38
44
|
/**
|
|
39
45
|
* 用户登录(统一用户登录)
|
|
40
46
|
*/
|
|
41
|
-
LoginAuthURL
|
|
47
|
+
LoginAuthURL?: string;
|
|
48
|
+
/**
|
|
49
|
+
* 文件管理服务地址(统一文件管理:后台)
|
|
50
|
+
*/
|
|
51
|
+
FileServiceURL?: string;
|
|
52
|
+
/**
|
|
53
|
+
* 文件管理(统一文件管理:前台)
|
|
54
|
+
*/
|
|
55
|
+
FileOnlineURL?: string;
|
|
56
|
+
/**
|
|
57
|
+
* 在线日志服务(统一文件管理)
|
|
58
|
+
*/
|
|
59
|
+
LogServiceURL?: string;
|
|
42
60
|
/**
|
|
43
61
|
* Axios普通WebAPI的BaseURL
|
|
44
62
|
* 全局默认的http请求地址(一般与主hprose相同或不同);文件上传地址
|
|
@@ -100,3 +118,26 @@ export interface ISystemConfig {
|
|
|
100
118
|
APIPath?: object;
|
|
101
119
|
[props: string]: any;
|
|
102
120
|
}
|
|
121
|
+
import { Component } from 'vue';
|
|
122
|
+
export declare type Lazy<T> = () => Promise<T>;
|
|
123
|
+
/**
|
|
124
|
+
* 窗体内容配置接口
|
|
125
|
+
*/
|
|
126
|
+
export interface IModalConfig {
|
|
127
|
+
/**
|
|
128
|
+
* 唯一ID,与组件名一致
|
|
129
|
+
*/
|
|
130
|
+
id: string;
|
|
131
|
+
/**
|
|
132
|
+
* 说明信息
|
|
133
|
+
*/
|
|
134
|
+
label?: string;
|
|
135
|
+
/**
|
|
136
|
+
* 动态加载的组件
|
|
137
|
+
*/
|
|
138
|
+
component: Lazy<Component>;
|
|
139
|
+
/**
|
|
140
|
+
* 其他可扩展的属性
|
|
141
|
+
*/
|
|
142
|
+
[props: string]: any;
|
|
143
|
+
}
|
package/dist/model/Layout.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Component } from 'vue';
|
|
2
|
-
|
|
2
|
+
import type { Lazy } from './Config';
|
|
3
3
|
/**
|
|
4
4
|
*布局枚举类型
|
|
5
5
|
*/
|
|
@@ -24,6 +24,10 @@ export interface IWidgetLayout {
|
|
|
24
24
|
height?: string;
|
|
25
25
|
}
|
|
26
26
|
export interface IWidgetConfig {
|
|
27
|
+
/**
|
|
28
|
+
* Layout标识名,以支撑多个布局使用
|
|
29
|
+
*/
|
|
30
|
+
layoutID?: string;
|
|
27
31
|
/**
|
|
28
32
|
* 唯一ID,与组件名一致
|
|
29
33
|
*/
|
|
@@ -57,13 +61,13 @@ export interface IWidgetConfig {
|
|
|
57
61
|
*/
|
|
58
62
|
preload?: boolean;
|
|
59
63
|
/**
|
|
60
|
-
*
|
|
64
|
+
* 前置组件 ID,一般也就是bindid
|
|
61
65
|
*/
|
|
62
66
|
afterid?: string;
|
|
63
67
|
/**
|
|
64
|
-
*
|
|
68
|
+
* 20220424 WM:暂时去掉,容易混乱和循环引用
|
|
69
|
+
* 绑定依赖组件ID,不一定有afterid
|
|
65
70
|
*/
|
|
66
|
-
bindid?: string;
|
|
67
71
|
/**
|
|
68
72
|
* 所属组,用于业务分类
|
|
69
73
|
*/
|
|
@@ -72,4 +76,8 @@ export interface IWidgetConfig {
|
|
|
72
76
|
* 外部定义布局(备用)
|
|
73
77
|
*/
|
|
74
78
|
layout?: IWidgetLayout;
|
|
79
|
+
/**
|
|
80
|
+
* 扩展属性,支持应用
|
|
81
|
+
*/
|
|
82
|
+
[props: string]: any;
|
|
75
83
|
}
|
package/dist/public/mitm.html
CHANGED
|
@@ -12,155 +12,169 @@
|
|
|
12
12
|
to open up a link that will start the download
|
|
13
13
|
-->
|
|
14
14
|
<script>
|
|
15
|
-
// This will prevent the sw from restarting
|
|
16
|
-
let keepAlive = () => {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
// message event is the first thing we need to setup a listner for
|
|
29
|
-
// don't want the opener to do a random timeout - instead they can listen for
|
|
30
|
-
// the ready event
|
|
31
|
-
// but since we need to wait for the Service Worker registration, we store the
|
|
32
|
-
// message for later
|
|
33
|
-
let messages = []
|
|
34
|
-
window.onmessage = evt => messages.push(evt)
|
|
35
|
-
|
|
36
|
-
let sw = null
|
|
37
|
-
let scope = ''
|
|
38
|
-
|
|
39
|
-
function registerWorker() {
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
scope = swReg.scope
|
|
46
|
-
|
|
47
|
-
return (sw = swReg.active) || new Promise(resolve => {
|
|
48
|
-
swRegTmp.addEventListener('statechange', fn = () => {
|
|
49
|
-
if (swRegTmp.state === 'activated') {
|
|
50
|
-
swRegTmp.removeEventListener('statechange', fn)
|
|
51
|
-
sw = swReg.active
|
|
52
|
-
resolve()
|
|
53
|
-
}
|
|
15
|
+
// This will prevent the sw from restarting
|
|
16
|
+
let keepAlive = () => {
|
|
17
|
+
keepAlive = () => {};
|
|
18
|
+
var ping = location.href.substring(0, location.href.lastIndexOf('/')) + '/ping';
|
|
19
|
+
var interval = setInterval(() => {
|
|
20
|
+
if (sw) {
|
|
21
|
+
sw.postMessage('ping');
|
|
22
|
+
} else {
|
|
23
|
+
fetch(ping).then(res => res.text(!res.ok && clearInterval(interval)));
|
|
24
|
+
}
|
|
25
|
+
}, 10000);
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
// message event is the first thing we need to setup a listner for
|
|
29
|
+
// don't want the opener to do a random timeout - instead they can listen for
|
|
30
|
+
// the ready event
|
|
31
|
+
// but since we need to wait for the Service Worker registration, we store the
|
|
32
|
+
// message for later
|
|
33
|
+
let messages = [];
|
|
34
|
+
window.onmessage = evt => messages.push(evt);
|
|
35
|
+
|
|
36
|
+
let sw = null;
|
|
37
|
+
let scope = '';
|
|
38
|
+
|
|
39
|
+
function registerWorker() {
|
|
40
|
+
return navigator.serviceWorker
|
|
41
|
+
.getRegistration('./')
|
|
42
|
+
.then(swReg => {
|
|
43
|
+
return swReg || navigator.serviceWorker.register('sw.js', { scope: './' });
|
|
54
44
|
})
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
45
|
+
.then(swReg => {
|
|
46
|
+
const swRegTmp = swReg.installing || swReg.waiting;
|
|
47
|
+
|
|
48
|
+
scope = swReg.scope;
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
(sw = swReg.active) ||
|
|
52
|
+
new Promise(resolve => {
|
|
53
|
+
swRegTmp.addEventListener(
|
|
54
|
+
'statechange',
|
|
55
|
+
(fn = () => {
|
|
56
|
+
if (swRegTmp.state === 'activated') {
|
|
57
|
+
swRegTmp.removeEventListener('statechange', fn);
|
|
58
|
+
sw = swReg.active;
|
|
59
|
+
resolve();
|
|
60
|
+
}
|
|
61
|
+
})
|
|
62
|
+
);
|
|
63
|
+
})
|
|
64
|
+
);
|
|
65
|
+
});
|
|
67
66
|
}
|
|
68
67
|
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
68
|
+
// Now that we have the Service Worker registered we can process messages
|
|
69
|
+
function onMessage(event) {
|
|
70
|
+
let { data, ports, origin } = event;
|
|
72
71
|
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
72
|
+
// It's important to have a messageChannel, don't want to interfere
|
|
73
|
+
// with other simultaneous downloads
|
|
74
|
+
if (!ports || !ports.length) {
|
|
75
|
+
throw new TypeError("[StreamSaver] You didn't send a messageChannel");
|
|
76
|
+
}
|
|
76
77
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
if (typeof data !== 'object') {
|
|
79
|
+
throw new TypeError("[StreamSaver] You didn't send a object");
|
|
80
|
+
}
|
|
80
81
|
|
|
81
|
-
|
|
82
|
-
|
|
82
|
+
// the default public service worker for StreamSaver is shared among others.
|
|
83
|
+
// so all download links needs to be prefixed to avoid any other conflict
|
|
84
|
+
data.origin = origin;
|
|
83
85
|
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
86
|
+
// if we ever (in some feature versoin of streamsaver) would like to
|
|
87
|
+
// redirect back to the page of who initiated a http request
|
|
88
|
+
data.referrer = data.referrer || document.referrer || origin;
|
|
87
89
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
console.warn("[StreamSaver] pass `data.headers` that you would like to pass along to the service worker\nit should be a 2D array or a key/val object that fetch's Headers api accepts")
|
|
91
|
-
} else {
|
|
92
|
-
// test if it's correct
|
|
93
|
-
// should thorw a typeError if not
|
|
94
|
-
new Headers(data.headers)
|
|
95
|
-
}
|
|
90
|
+
// pass along version for possible backwards compatibility in sw.js
|
|
91
|
+
data.streamSaverVersion = new URLSearchParams(location.search).get('version');
|
|
96
92
|
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
// Do what File constructor do with fileNames
|
|
101
|
-
data.filename = data.filename.replace(/\//g, ':')
|
|
102
|
-
}
|
|
93
|
+
if (data.streamSaverVersion === '1.2.0') {
|
|
94
|
+
console.warn('[StreamSaver] please update streamsaver');
|
|
95
|
+
}
|
|
103
96
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
97
|
+
/** @since v2.0.0 */
|
|
98
|
+
if (!data.headers) {
|
|
99
|
+
console.warn(
|
|
100
|
+
"[StreamSaver] pass `data.headers` that you would like to pass along to the service worker\nit should be a 2D array or a key/val object that fetch's Headers api accepts"
|
|
101
|
+
);
|
|
102
|
+
} else {
|
|
103
|
+
// test if it's correct
|
|
104
|
+
// should thorw a typeError if not
|
|
105
|
+
new Headers(data.headers);
|
|
106
|
+
}
|
|
108
107
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
108
|
+
/** @since v2.0.0 */
|
|
109
|
+
if (typeof data.filename === 'string') {
|
|
110
|
+
console.warn(
|
|
111
|
+
"[StreamSaver] You shouldn't send `data.filename` anymore. It should be included in the Content-Disposition header option"
|
|
112
|
+
);
|
|
113
|
+
// Do what File constructor do with fileNames
|
|
114
|
+
data.filename = data.filename.replace(/\//g, ':');
|
|
115
|
+
}
|
|
113
116
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
117
|
+
/** @since v2.0.0 */
|
|
118
|
+
if (data.size) {
|
|
119
|
+
console.warn(
|
|
120
|
+
"[StreamSaver] You shouldn't send `data.size` anymore. It should be included in the content-length header option"
|
|
121
|
+
);
|
|
122
|
+
}
|
|
119
123
|
|
|
120
|
-
|
|
121
|
-
|
|
124
|
+
/** @since v2.0.0 */
|
|
125
|
+
if (data.readableStream) {
|
|
126
|
+
console.warn(
|
|
127
|
+
'[StreamSaver] You should send the readableStream in the messageChannel, not throught mitm'
|
|
128
|
+
);
|
|
129
|
+
}
|
|
122
130
|
|
|
123
|
-
|
|
124
|
-
|
|
131
|
+
/** @since v2.0.0 */
|
|
132
|
+
if (!data.pathname) {
|
|
133
|
+
console.warn('[StreamSaver] Please send `data.pathname` (eg: /pictures/summer.jpg)');
|
|
134
|
+
data.pathname = Math.random().toString().slice(-6) + '/' + data.filename;
|
|
135
|
+
}
|
|
125
136
|
|
|
126
|
-
|
|
127
|
-
|
|
137
|
+
// remove all leading slashes
|
|
138
|
+
data.pathname = data.pathname.replace(/^\/+/g, '');
|
|
128
139
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
140
|
+
// remove protocol
|
|
141
|
+
let org = origin.replace(/(^\w+:|^)\/\//, '');
|
|
142
|
+
|
|
143
|
+
// set the absolute pathname to the download url.
|
|
144
|
+
data.url = new URL(`${scope + org}/${data.pathname}`).toString();
|
|
132
145
|
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
146
|
+
if (!data.url.startsWith(`${scope + org}/`)) {
|
|
147
|
+
throw new TypeError('[StreamSaver] bad `data.pathname`');
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// This sends the message data as well as transferring
|
|
151
|
+
// messageChannel.port2 to the service worker. The service worker can
|
|
152
|
+
// then use the transferred port to reply via postMessage(), which
|
|
153
|
+
// will in turn trigger the onmessage handler on messageChannel.port1.
|
|
137
154
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
155
|
+
const transferable = data.readableStream ? [ports[0], data.readableStream] : [ports[0]];
|
|
156
|
+
|
|
157
|
+
if (!(data.readableStream || data.transferringReadable)) {
|
|
158
|
+
keepAlive();
|
|
159
|
+
}
|
|
141
160
|
|
|
142
|
-
|
|
143
|
-
keepAlive()
|
|
161
|
+
return sw.postMessage(data, transferable);
|
|
144
162
|
}
|
|
145
163
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
// (telling them that we are ready to accept postMessage's)
|
|
152
|
-
window.opener.postMessage('StreamSaver::loadedPopup', '*')
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
if (navigator.serviceWorker) {
|
|
156
|
-
registerWorker().then(() => {
|
|
157
|
-
window.onmessage = onMessage
|
|
158
|
-
messages.forEach(window.onmessage)
|
|
159
|
-
})
|
|
160
|
-
} else {
|
|
161
|
-
// FF can ping sw with fetch from a secure hidden iframe
|
|
162
|
-
// shouldn't really be possible?
|
|
163
|
-
keepAlive()
|
|
164
|
-
}
|
|
164
|
+
if (window.opener) {
|
|
165
|
+
// The opener can't listen to onload event, so we need to help em out!
|
|
166
|
+
// (telling them that we are ready to accept postMessage's)
|
|
167
|
+
window.opener.postMessage('StreamSaver::loadedPopup', '*');
|
|
168
|
+
}
|
|
165
169
|
|
|
170
|
+
if (navigator.serviceWorker) {
|
|
171
|
+
registerWorker().then(() => {
|
|
172
|
+
window.onmessage = onMessage;
|
|
173
|
+
messages.forEach(window.onmessage);
|
|
174
|
+
});
|
|
175
|
+
} else {
|
|
176
|
+
// FF can ping sw with fetch from a secure hidden iframe
|
|
177
|
+
// shouldn't really be possible?
|
|
178
|
+
keepAlive();
|
|
179
|
+
}
|
|
166
180
|
</script>
|
package/dist/utils/H5Tool.d.ts
CHANGED
|
@@ -95,4 +95,23 @@ export default class H5Tool {
|
|
|
95
95
|
* @param text
|
|
96
96
|
*/
|
|
97
97
|
static copyText: (text: string) => Promise<unknown>;
|
|
98
|
+
/**
|
|
99
|
+
* 设置是否开启网站灰模式
|
|
100
|
+
* @param isGray 是否暗灰模式
|
|
101
|
+
*/
|
|
102
|
+
static setGrayMode(isGray: boolean): void;
|
|
103
|
+
/**
|
|
104
|
+
* 开关 HTML元素的Style类名
|
|
105
|
+
* @param flag
|
|
106
|
+
* @param clsName
|
|
107
|
+
* @param target
|
|
108
|
+
*/
|
|
109
|
+
static toggleClass(flag: boolean, clsName: string, target?: HTMLElement): void;
|
|
110
|
+
/**
|
|
111
|
+
* 设置 css 变量(全局)
|
|
112
|
+
* @param prop
|
|
113
|
+
* @param val
|
|
114
|
+
* @param dom
|
|
115
|
+
*/
|
|
116
|
+
static setCssVar(prop: string, val: any, dom?: HTMLElement): void;
|
|
98
117
|
}
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "xframelib",
|
|
3
|
-
"version": "0.5.
|
|
3
|
+
"version": "0.5.8",
|
|
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",
|
|
9
|
+
"dev": "vite --port 8090",
|
|
10
10
|
"build": "vite build",
|
|
11
11
|
"lib": "rollup -c ",
|
|
12
12
|
"serve": "vite preview",
|
|
@@ -34,26 +34,26 @@
|
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@rollup/plugin-alias": "^3.1.9",
|
|
37
|
-
"@rollup/plugin-commonjs": "^
|
|
37
|
+
"@rollup/plugin-commonjs": "^22.0.0",
|
|
38
38
|
"@rollup/plugin-json": "^4.1.0",
|
|
39
|
-
"@rollup/plugin-node-resolve": "^13.1
|
|
40
|
-
"@rollup/plugin-typescript": "^8.3.
|
|
39
|
+
"@rollup/plugin-node-resolve": "^13.2.1",
|
|
40
|
+
"@rollup/plugin-typescript": "^8.3.2",
|
|
41
41
|
"@types/streamsaver": "^2.0.1",
|
|
42
|
-
"@vitejs/plugin-vue": "^2.
|
|
43
|
-
"@vue/compiler-sfc": "^3.2.
|
|
44
|
-
"esbuild": "^0.14.
|
|
42
|
+
"@vitejs/plugin-vue": "^2.3.1",
|
|
43
|
+
"@vue/compiler-sfc": "^3.2.33",
|
|
44
|
+
"esbuild": "^0.14.38",
|
|
45
45
|
"rimraf": "^3.0.2",
|
|
46
46
|
"rollup-plugin-copy": "^3.4.0",
|
|
47
|
-
"rollup-plugin-esbuild": "^4.
|
|
47
|
+
"rollup-plugin-esbuild": "^4.9.1",
|
|
48
48
|
"rollup-plugin-scss": "^3.0.0",
|
|
49
49
|
"rollup-plugin-terser": "^7.0.2",
|
|
50
50
|
"rollup-plugin-typescript2": "^0.31.2",
|
|
51
51
|
"rollup-plugin-vue": "^6.0.0",
|
|
52
|
-
"sass": "^1.
|
|
53
|
-
"typescript": "^4.6.
|
|
54
|
-
"vite": "^2.
|
|
55
|
-
"vue": "^3.2.
|
|
52
|
+
"sass": "^1.50.1",
|
|
53
|
+
"typescript": "^4.6.3",
|
|
54
|
+
"vite": "^2.9.5",
|
|
55
|
+
"vue": "^3.2.33",
|
|
56
56
|
"vue-router": "^4.0.14",
|
|
57
|
-
"vue-tsc": "^0.
|
|
57
|
+
"vue-tsc": "^0.34.10"
|
|
58
58
|
}
|
|
59
59
|
}
|