@ibiz-template/core 0.1.14 → 0.1.20
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/dist/index.esm.js +341 -0
- package/dist/index.system.min.js +1 -1
- package/dist/index.system.min.js.map +1 -1
- package/out/error/index.d.ts +1 -0
- package/out/error/index.d.ts.map +1 -1
- package/out/error/index.js +1 -0
- package/out/error/notice-error/notice-error.d.ts +16 -0
- package/out/error/notice-error/notice-error.d.ts.map +1 -0
- package/out/error/notice-error/notice-error.js +17 -0
- package/out/ibizsys.d.ts +9 -1
- package/out/ibizsys.d.ts.map +1 -1
- package/out/ibizsys.js +9 -1
- package/out/interface/i-portal-async-action/i-portal-async-action.d.ts +83 -0
- package/out/interface/i-portal-async-action/i-portal-async-action.d.ts.map +1 -0
- package/out/interface/i-portal-async-action/i-portal-async-action.js +1 -0
- package/out/interface/i-portal-message/i-portal-message.d.ts +68 -0
- package/out/interface/i-portal-message/i-portal-message.d.ts.map +1 -0
- package/out/interface/i-portal-message/i-portal-message.js +1 -0
- package/out/interface/index.d.ts +2 -0
- package/out/interface/index.d.ts.map +1 -1
- package/out/utils/index.d.ts +1 -0
- package/out/utils/index.d.ts.map +1 -1
- package/out/utils/index.js +1 -0
- package/out/utils/message-center/base/message-all.d.ts +13 -0
- package/out/utils/message-center/base/message-all.d.ts.map +1 -0
- package/out/utils/message-center/base/message-all.js +12 -0
- package/out/utils/message-center/base/message-base.d.ts +68 -0
- package/out/utils/message-center/base/message-base.d.ts.map +1 -0
- package/out/utils/message-center/base/message-base.js +70 -0
- package/out/utils/message-center/command/change/command-change.d.ts +13 -0
- package/out/utils/message-center/command/change/command-change.d.ts.map +1 -0
- package/out/utils/message-center/command/change/command-change.js +12 -0
- package/out/utils/message-center/command/command-base/command-base.d.ts +20 -0
- package/out/utils/message-center/command/command-base/command-base.d.ts.map +1 -0
- package/out/utils/message-center/command/command-base/command-base.js +28 -0
- package/out/utils/message-center/command/create/command-create.d.ts +22 -0
- package/out/utils/message-center/command/create/command-create.d.ts.map +1 -0
- package/out/utils/message-center/command/create/command-create.js +22 -0
- package/out/utils/message-center/command/message-command.d.ts +68 -0
- package/out/utils/message-center/command/message-command.d.ts.map +1 -0
- package/out/utils/message-center/command/message-command.js +113 -0
- package/out/utils/message-center/command/remove/command-remove.d.ts +22 -0
- package/out/utils/message-center/command/remove/command-remove.d.ts.map +1 -0
- package/out/utils/message-center/command/remove/command-remove.js +22 -0
- package/out/utils/message-center/command/update/command-update.d.ts +22 -0
- package/out/utils/message-center/command/update/command-update.d.ts.map +1 -0
- package/out/utils/message-center/command/update/command-update.js +22 -0
- package/out/utils/message-center/console/message-console.d.ts +21 -0
- package/out/utils/message-center/console/message-console.d.ts.map +1 -0
- package/out/utils/message-center/console/message-console.js +29 -0
- package/out/utils/message-center/index.d.ts +2 -0
- package/out/utils/message-center/index.d.ts.map +1 -0
- package/out/utils/message-center/index.js +1 -0
- package/out/utils/message-center/interface/i-app-data-entity.d.ts +20 -0
- package/out/utils/message-center/interface/i-app-data-entity.d.ts.map +1 -0
- package/out/utils/message-center/interface/i-app-data-entity.js +1 -0
- package/out/utils/message-center/interface/index.d.ts +2 -0
- package/out/utils/message-center/interface/index.d.ts.map +1 -0
- package/out/utils/message-center/interface/index.js +1 -0
- package/out/utils/message-center/message-center.d.ts +63 -0
- package/out/utils/message-center/message-center.d.ts.map +1 -0
- package/out/utils/message-center/message-center.js +79 -0
- package/package.json +2 -2
- package/src/error/index.ts +1 -0
- package/src/error/notice-error/notice-error.ts +19 -0
- package/src/ibizsys.ts +10 -1
- package/src/interface/i-portal-async-action/i-portal-async-action.ts +90 -0
- package/src/interface/i-portal-message/i-portal-message.ts +79 -0
- package/src/interface/index.ts +2 -0
- package/src/utils/index.ts +1 -0
- package/src/utils/message-center/base/message-all.ts +12 -0
- package/src/utils/message-center/base/message-base.ts +86 -0
- package/src/utils/message-center/command/change/command-change.ts +12 -0
- package/src/utils/message-center/command/command-base/command-base.ts +30 -0
- package/src/utils/message-center/command/create/command-create.ts +24 -0
- package/src/utils/message-center/command/message-command.ts +118 -0
- package/src/utils/message-center/command/remove/command-remove.ts +24 -0
- package/src/utils/message-center/command/update/command-update.ts +24 -0
- package/src/utils/message-center/console/message-console.ts +31 -0
- package/src/utils/message-center/index.ts +1 -0
- package/src/utils/message-center/interface/i-app-data-entity.ts +19 -0
- package/src/utils/message-center/interface/index.ts +1 -0
- package/src/utils/message-center/message-center.ts +82 -0
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 异步作业信息
|
|
3
|
+
*
|
|
4
|
+
* @author chitanda
|
|
5
|
+
* @date 2023-09-05 15:09:59
|
|
6
|
+
* @export
|
|
7
|
+
* @interface IPortalAsyncAction
|
|
8
|
+
*/
|
|
9
|
+
export interface IPortalAsyncAction {
|
|
10
|
+
/**
|
|
11
|
+
* 会话标识
|
|
12
|
+
*
|
|
13
|
+
* @author chitanda
|
|
14
|
+
* @date 2023-09-05 15:09:57
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
fulltopictag: string;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* 异步作业类型
|
|
21
|
+
*
|
|
22
|
+
* @author chitanda
|
|
23
|
+
* @date 2023-09-05 15:09:09
|
|
24
|
+
* @type {string}
|
|
25
|
+
*/
|
|
26
|
+
actiontype: string;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 异步作业执行结果
|
|
30
|
+
*
|
|
31
|
+
* @author chitanda
|
|
32
|
+
* @date 2023-09-05 15:09:33
|
|
33
|
+
* @type {unknown}
|
|
34
|
+
*/
|
|
35
|
+
actionresult?: unknown;
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 步骤信息
|
|
39
|
+
*
|
|
40
|
+
* @author chitanda
|
|
41
|
+
* @date 2023-09-05 15:09:55
|
|
42
|
+
* @type {string}
|
|
43
|
+
*/
|
|
44
|
+
stepinfo?: string;
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 异步结果下载路径,目前是留给导出数据使用
|
|
48
|
+
*
|
|
49
|
+
* @author chitanda
|
|
50
|
+
* @date 2023-09-05 15:09:03
|
|
51
|
+
* @type {string}
|
|
52
|
+
*/
|
|
53
|
+
asyncresultdownloadurl?: string;
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 预留参数
|
|
57
|
+
*
|
|
58
|
+
* @author chitanda
|
|
59
|
+
* @date 2023-09-05 15:09:32
|
|
60
|
+
* @type {unknown}
|
|
61
|
+
*/
|
|
62
|
+
actionparam?: unknown;
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
*预留参数2
|
|
66
|
+
*
|
|
67
|
+
* @author chitanda
|
|
68
|
+
* @date 2023-09-05 15:09:41
|
|
69
|
+
* @type {unknown}
|
|
70
|
+
*/
|
|
71
|
+
actionparam2?: unknown;
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
*预留参数3
|
|
75
|
+
*
|
|
76
|
+
* @author chitanda
|
|
77
|
+
* @date 2023-09-05 15:09:43
|
|
78
|
+
* @type {unknown}
|
|
79
|
+
*/
|
|
80
|
+
actionparam3?: unknown;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
*预留参数4
|
|
84
|
+
*
|
|
85
|
+
* @author chitanda
|
|
86
|
+
* @date 2023-09-05 15:09:45
|
|
87
|
+
* @type {unknown}
|
|
88
|
+
*/
|
|
89
|
+
actionparam4?: unknown;
|
|
90
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { IPortalAsyncAction } from '../i-portal-async-action/i-portal-async-action';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 消息数据
|
|
5
|
+
*
|
|
6
|
+
* @author chitanda
|
|
7
|
+
* @date 2023-09-05 15:09:02
|
|
8
|
+
* @export
|
|
9
|
+
* @interface IPortalMessage
|
|
10
|
+
*/
|
|
11
|
+
export interface IPortalMessage {
|
|
12
|
+
/**
|
|
13
|
+
* 消息标识
|
|
14
|
+
*
|
|
15
|
+
* @author chitanda
|
|
16
|
+
* @date 2023-09-05 15:09:43
|
|
17
|
+
* @type {string}
|
|
18
|
+
*/
|
|
19
|
+
messageid: string;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* 消息名称
|
|
23
|
+
*
|
|
24
|
+
* @author chitanda
|
|
25
|
+
* @date 2023-09-05 15:09:49
|
|
26
|
+
* @type {string}
|
|
27
|
+
*/
|
|
28
|
+
messagename: string;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* 消息类型
|
|
32
|
+
*
|
|
33
|
+
* @author chitanda
|
|
34
|
+
* @date 2023-09-05 15:09:09
|
|
35
|
+
* @type {('CONSOLE' | 'COMMAND')} 日志消息 | 命令
|
|
36
|
+
*/
|
|
37
|
+
type: 'CONSOLE' | 'COMMAND';
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 消息子类型
|
|
41
|
+
*
|
|
42
|
+
* @author chitanda
|
|
43
|
+
* @date 2023-09-05 15:09:50
|
|
44
|
+
* @type {('MARKOPENDATA' | 'ASYNCACTION')} 标注打开数据 | 异步作业 | 数据更新 | 数据删除 | 数据创建
|
|
45
|
+
*/
|
|
46
|
+
subtype?:
|
|
47
|
+
| 'MARKOPENDATA'
|
|
48
|
+
| 'ASYNCACTION'
|
|
49
|
+
| 'OBJECTUPDATED'
|
|
50
|
+
| 'OBJECTREMOVED'
|
|
51
|
+
| 'OBJECTCREATED';
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* 内容摘要
|
|
55
|
+
*
|
|
56
|
+
* @author chitanda
|
|
57
|
+
* @date 2023-09-05 15:09:23
|
|
58
|
+
* @type {string}
|
|
59
|
+
*/
|
|
60
|
+
content?: string;
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* 消息数据
|
|
64
|
+
*
|
|
65
|
+
* @author chitanda
|
|
66
|
+
* @date 2023-09-05 15:09:55
|
|
67
|
+
* @type {(IPortalAsyncAction | IData | string | unknown)}
|
|
68
|
+
*/
|
|
69
|
+
data?: IPortalAsyncAction | IData | string | unknown;
|
|
70
|
+
|
|
71
|
+
/**
|
|
72
|
+
* 消息路径
|
|
73
|
+
*
|
|
74
|
+
* @author chitanda
|
|
75
|
+
* @date 2023-09-05 15:09:25
|
|
76
|
+
* @type {string}
|
|
77
|
+
*/
|
|
78
|
+
url?: string;
|
|
79
|
+
}
|
package/src/interface/index.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
export * from './click-outside/click-outside';
|
|
2
2
|
export type { I18n } from './i-18n/i-18n';
|
|
3
3
|
export type { IEnvironment } from './i-environment/i-environment';
|
|
4
|
+
export type { IPortalAsyncAction } from './i-portal-async-action/i-portal-async-action';
|
|
5
|
+
export type { IPortalMessage } from './i-portal-message/i-portal-message';
|
|
4
6
|
export type { OrgData } from './org-data/org-data';
|
package/src/utils/index.ts
CHANGED
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { QXEvent } from 'qx-util';
|
|
2
|
+
import { IPortalMessage } from '../../../interface';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 消息事件
|
|
6
|
+
*
|
|
7
|
+
* @author chitanda
|
|
8
|
+
* @date 2023-09-05 16:09:17
|
|
9
|
+
* @interface MessageCenterEvent
|
|
10
|
+
*/
|
|
11
|
+
interface MessageCenterEvent {
|
|
12
|
+
all: (msg: IPortalMessage) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* 消息基类,各个类型消息继承此类
|
|
17
|
+
*
|
|
18
|
+
* @author chitanda
|
|
19
|
+
* @date 2023-09-05 16:09:41
|
|
20
|
+
* @export
|
|
21
|
+
* @class MessageBase
|
|
22
|
+
*/
|
|
23
|
+
export abstract class MessageBase {
|
|
24
|
+
/**
|
|
25
|
+
* 事件
|
|
26
|
+
*
|
|
27
|
+
* @author chitanda
|
|
28
|
+
* @date 2023-09-05 16:09:58
|
|
29
|
+
* @protected
|
|
30
|
+
* @type {QXEvent<MessageCenterEvent>}
|
|
31
|
+
*/
|
|
32
|
+
protected evt: QXEvent<MessageCenterEvent> = new QXEvent(1000);
|
|
33
|
+
|
|
34
|
+
constructor(protected parent?: MessageBase) {}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* 推送标准结构消息
|
|
38
|
+
*
|
|
39
|
+
* @author chitanda
|
|
40
|
+
* @date 2023-09-05 16:09:40
|
|
41
|
+
* @param {IPortalMessage} msg
|
|
42
|
+
*/
|
|
43
|
+
next(msg: IPortalMessage): void {
|
|
44
|
+
this.evt.emit('all', msg);
|
|
45
|
+
if (this.parent) {
|
|
46
|
+
this.nextParent(msg);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* 私有方法,专门向父级推送消息
|
|
52
|
+
*
|
|
53
|
+
* @author chitanda
|
|
54
|
+
* @date 2023-09-05 17:09:08
|
|
55
|
+
* @protected
|
|
56
|
+
* @param {IPortalMessage} msg
|
|
57
|
+
*/
|
|
58
|
+
protected nextParent(msg: IPortalMessage): void {
|
|
59
|
+
if (this.parent) {
|
|
60
|
+
this.parent.evt.emit('all', msg);
|
|
61
|
+
this.parent.nextParent(msg);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* 订阅消息
|
|
67
|
+
*
|
|
68
|
+
* @author chitanda
|
|
69
|
+
* @date 2023-09-05 15:09:21
|
|
70
|
+
* @param {(msg: IPortalMessage) => void} evt
|
|
71
|
+
*/
|
|
72
|
+
on(cb: (msg: IPortalMessage) => void): void {
|
|
73
|
+
this.evt.on('all', cb);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/**
|
|
77
|
+
* 取消订阅
|
|
78
|
+
*
|
|
79
|
+
* @author chitanda
|
|
80
|
+
* @date 2023-09-05 15:09:50
|
|
81
|
+
* @param {(msg: IPortalMessage) => void} cb
|
|
82
|
+
*/
|
|
83
|
+
off(cb: (msg: IPortalMessage) => void): void {
|
|
84
|
+
this.evt.off('all', cb);
|
|
85
|
+
}
|
|
86
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { CommandBase } from '../command-base/command-base';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* 数据变更指令消息
|
|
5
|
+
*
|
|
6
|
+
* @author chitanda
|
|
7
|
+
* @date 2023-09-05 17:09:49
|
|
8
|
+
* @export
|
|
9
|
+
* @class CommandChange
|
|
10
|
+
* @extends {CommandBase}
|
|
11
|
+
*/
|
|
12
|
+
export class CommandChange extends CommandBase {}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { createUUID } from 'qx-util';
|
|
2
|
+
import { IPortalMessage } from '../../../../interface';
|
|
3
|
+
import { MessageBase } from '../../base/message-base';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 指令消息基类
|
|
7
|
+
*
|
|
8
|
+
* @author chitanda
|
|
9
|
+
* @date 2023-09-05 16:09:11
|
|
10
|
+
* @export
|
|
11
|
+
* @class CommandBase
|
|
12
|
+
* @extends {MessageBase}
|
|
13
|
+
*/
|
|
14
|
+
export class CommandBase extends MessageBase {
|
|
15
|
+
/**
|
|
16
|
+
* 发送指令消息
|
|
17
|
+
* @param data 更新的数据
|
|
18
|
+
* @param subtype 数据更新 | 数据删除 | 数据创建
|
|
19
|
+
*/
|
|
20
|
+
protected sendCommand(data: IData, subtype: IPortalMessage['subtype']): void {
|
|
21
|
+
const msg: IPortalMessage = {
|
|
22
|
+
messageid: createUUID(),
|
|
23
|
+
messagename: 'command',
|
|
24
|
+
type: 'COMMAND',
|
|
25
|
+
subtype,
|
|
26
|
+
data,
|
|
27
|
+
};
|
|
28
|
+
this.next(msg);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IAppDataEntity } from '../../interface';
|
|
2
|
+
import { CommandBase } from '../command-base/command-base';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 创建指令消息
|
|
6
|
+
*
|
|
7
|
+
* @author chitanda
|
|
8
|
+
* @date 2023-09-05 17:09:57
|
|
9
|
+
* @export
|
|
10
|
+
* @class CommandCreate
|
|
11
|
+
* @extends {CommandBase}
|
|
12
|
+
*/
|
|
13
|
+
export class CommandCreate extends CommandBase {
|
|
14
|
+
/**
|
|
15
|
+
* 发送新建的数据
|
|
16
|
+
*
|
|
17
|
+
* @author chitanda
|
|
18
|
+
* @date 2023-09-05 17:09:13
|
|
19
|
+
* @param {IAppDataEntity} data
|
|
20
|
+
*/
|
|
21
|
+
send(data: IAppDataEntity): void {
|
|
22
|
+
this.sendCommand(data, 'OBJECTCREATED');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
import { createUUID } from 'qx-util';
|
|
2
|
+
import { IPortalMessage } from '../../../interface';
|
|
3
|
+
import { MessageBase } from '../base/message-base';
|
|
4
|
+
import { CommandCreate } from './create/command-create';
|
|
5
|
+
import { CommandUpdate } from './update/command-update';
|
|
6
|
+
import { CommandRemove } from './remove/command-remove';
|
|
7
|
+
import { CommandChange } from './change/command-change';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* 指令消息
|
|
11
|
+
*
|
|
12
|
+
* @author chitanda
|
|
13
|
+
* @date 2023-09-05 16:09:41
|
|
14
|
+
* @export
|
|
15
|
+
* @class MessageCommand
|
|
16
|
+
* @extends {MessageBase}
|
|
17
|
+
*/
|
|
18
|
+
export class MessageCommand extends MessageBase {
|
|
19
|
+
/**
|
|
20
|
+
* 数据变更指令消息
|
|
21
|
+
*
|
|
22
|
+
* @author chitanda
|
|
23
|
+
* @date 2023-09-05 17:09:15
|
|
24
|
+
* @type {CommandChange}
|
|
25
|
+
*/
|
|
26
|
+
readonly change: CommandChange = new CommandChange();
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* 新建消息
|
|
30
|
+
*
|
|
31
|
+
* @author chitanda
|
|
32
|
+
* @date 2023-09-05 17:09:55
|
|
33
|
+
* @type {CommandCreate}
|
|
34
|
+
*/
|
|
35
|
+
readonly create: CommandCreate = new CommandCreate(this);
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* 更新消息
|
|
39
|
+
*
|
|
40
|
+
* @author chitanda
|
|
41
|
+
* @date 2023-09-05 17:09:01
|
|
42
|
+
* @type {CommandUpdate}
|
|
43
|
+
*/
|
|
44
|
+
readonly update: CommandUpdate = new CommandUpdate(this);
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* 删除消息
|
|
48
|
+
*
|
|
49
|
+
* @author chitanda
|
|
50
|
+
* @date 2023-09-05 17:09:05
|
|
51
|
+
* @type {CommandRemove}
|
|
52
|
+
*/
|
|
53
|
+
readonly remove: CommandRemove = new CommandRemove(this);
|
|
54
|
+
|
|
55
|
+
/**
|
|
56
|
+
* 推送指令消息
|
|
57
|
+
*
|
|
58
|
+
* @author chitanda
|
|
59
|
+
* @date 2023-09-05 17:09:50
|
|
60
|
+
* @param {IPortalMessage} msg
|
|
61
|
+
*/
|
|
62
|
+
next(msg: IPortalMessage): void {
|
|
63
|
+
// 消息分子类型,子类型发完消息后,会让父发消息
|
|
64
|
+
// 所以子类型有父时,会一级一级的往上发消息。不需要在此处发全局消息
|
|
65
|
+
// change 特殊处理,不给父发消息
|
|
66
|
+
switch (msg.subtype) {
|
|
67
|
+
case 'OBJECTCREATED':
|
|
68
|
+
this.create.next(msg);
|
|
69
|
+
this.change.next(msg);
|
|
70
|
+
break;
|
|
71
|
+
case 'OBJECTUPDATED':
|
|
72
|
+
this.update.next(msg);
|
|
73
|
+
this.change.next(msg);
|
|
74
|
+
break;
|
|
75
|
+
case 'OBJECTREMOVED':
|
|
76
|
+
this.remove.next(msg);
|
|
77
|
+
this.change.next(msg);
|
|
78
|
+
break;
|
|
79
|
+
default:
|
|
80
|
+
super.next(msg);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
protected nextParent(msg: IPortalMessage): void {
|
|
85
|
+
switch (msg.subtype) {
|
|
86
|
+
case 'OBJECTCREATED':
|
|
87
|
+
this.change.next(msg);
|
|
88
|
+
break;
|
|
89
|
+
case 'OBJECTUPDATED':
|
|
90
|
+
this.change.next(msg);
|
|
91
|
+
break;
|
|
92
|
+
case 'OBJECTREMOVED':
|
|
93
|
+
this.change.next(msg);
|
|
94
|
+
break;
|
|
95
|
+
default:
|
|
96
|
+
}
|
|
97
|
+
super.nextParent(msg);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* 发送指令消息
|
|
102
|
+
*
|
|
103
|
+
* @author chitanda
|
|
104
|
+
* @date 2023-09-05 17:09:35
|
|
105
|
+
* @param {IData} data
|
|
106
|
+
* @param {IPortalMessage['subtype']} subtype
|
|
107
|
+
*/
|
|
108
|
+
send(data: IData, subtype: IPortalMessage['subtype']): void {
|
|
109
|
+
const msg: IPortalMessage = {
|
|
110
|
+
messageid: createUUID(),
|
|
111
|
+
messagename: 'command',
|
|
112
|
+
type: 'COMMAND',
|
|
113
|
+
subtype,
|
|
114
|
+
data,
|
|
115
|
+
};
|
|
116
|
+
this.next(msg);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IAppDataEntity } from '../../interface';
|
|
2
|
+
import { CommandBase } from '../command-base/command-base';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 删除指令消息
|
|
6
|
+
*
|
|
7
|
+
* @author chitanda
|
|
8
|
+
* @date 2023-09-05 17:09:03
|
|
9
|
+
* @export
|
|
10
|
+
* @class CommandRemove
|
|
11
|
+
* @extends {CommandBase}
|
|
12
|
+
*/
|
|
13
|
+
export class CommandRemove extends CommandBase {
|
|
14
|
+
/**
|
|
15
|
+
* 发送删除的数据
|
|
16
|
+
*
|
|
17
|
+
* @author chitanda
|
|
18
|
+
* @date 2023-09-05 17:09:29
|
|
19
|
+
* @param {IAppDataEntity} data
|
|
20
|
+
*/
|
|
21
|
+
send(data: IAppDataEntity): void {
|
|
22
|
+
this.sendCommand(data, 'OBJECTREMOVED');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { IAppDataEntity } from '../../interface';
|
|
2
|
+
import { CommandBase } from '../command-base/command-base';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* 更新指令消息
|
|
6
|
+
*
|
|
7
|
+
* @author chitanda
|
|
8
|
+
* @date 2023-09-05 17:09:54
|
|
9
|
+
* @export
|
|
10
|
+
* @class CommandUpdate
|
|
11
|
+
* @extends {CommandBase}
|
|
12
|
+
*/
|
|
13
|
+
export class CommandUpdate extends CommandBase {
|
|
14
|
+
/**
|
|
15
|
+
* 发送更新的数据
|
|
16
|
+
*
|
|
17
|
+
* @author chitanda
|
|
18
|
+
* @date 2023-09-05 17:09:37
|
|
19
|
+
* @param {IAppDataEntity} data
|
|
20
|
+
*/
|
|
21
|
+
send(data: IAppDataEntity): void {
|
|
22
|
+
this.sendCommand(data, 'OBJECTUPDATED');
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { createUUID } from 'qx-util';
|
|
2
|
+
import { IPortalMessage } from '../../../interface';
|
|
3
|
+
import { MessageBase } from '../base/message-base';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* 日志消息
|
|
7
|
+
*
|
|
8
|
+
* @author chitanda
|
|
9
|
+
* @date 2023-09-05 16:09:33
|
|
10
|
+
* @export
|
|
11
|
+
* @class MessageConsole
|
|
12
|
+
* @extends {MessageBase}
|
|
13
|
+
*/
|
|
14
|
+
export class MessageConsole extends MessageBase {
|
|
15
|
+
/**
|
|
16
|
+
* 发送日志消息
|
|
17
|
+
*
|
|
18
|
+
* @author chitanda
|
|
19
|
+
* @date 2023-09-05 16:09:25
|
|
20
|
+
* @param {(IData | string)} data
|
|
21
|
+
*/
|
|
22
|
+
send(data: IData | string): void {
|
|
23
|
+
const msg: IPortalMessage = {
|
|
24
|
+
messageid: createUUID(),
|
|
25
|
+
messagename: 'console',
|
|
26
|
+
type: 'CONSOLE',
|
|
27
|
+
data,
|
|
28
|
+
};
|
|
29
|
+
this.next(msg);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MessageCenter } from './message-center';
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 应用实体数据对象
|
|
3
|
+
*
|
|
4
|
+
* @author chitanda
|
|
5
|
+
* @date 2023-09-05 17:09:39
|
|
6
|
+
* @export
|
|
7
|
+
* @interface IAppDataEntity
|
|
8
|
+
* @extends {IData}
|
|
9
|
+
*/
|
|
10
|
+
export interface IAppDataEntity extends IData {
|
|
11
|
+
/**
|
|
12
|
+
* 应用实体数据对象标识
|
|
13
|
+
*
|
|
14
|
+
* @author chitanda
|
|
15
|
+
* @date 2023-09-05 17:09:57
|
|
16
|
+
* @type {string}
|
|
17
|
+
*/
|
|
18
|
+
srfdecodename: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { IAppDataEntity } from './i-app-data-entity';
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { IPortalMessage } from '../../interface';
|
|
2
|
+
import { MessageAll } from './base/message-all';
|
|
3
|
+
import { MessageCommand } from './command/message-command';
|
|
4
|
+
import { MessageConsole } from './console/message-console';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 界面消息中心
|
|
8
|
+
*
|
|
9
|
+
* @author chitanda
|
|
10
|
+
* @date 2023-09-05 15:09:14
|
|
11
|
+
* @export
|
|
12
|
+
* @class MessageCenter
|
|
13
|
+
*/
|
|
14
|
+
export class MessageCenter {
|
|
15
|
+
/**
|
|
16
|
+
* 所有消息
|
|
17
|
+
*
|
|
18
|
+
* @author chitanda
|
|
19
|
+
* @date 2023-09-05 16:09:12
|
|
20
|
+
* @type {MessageAll}
|
|
21
|
+
*/
|
|
22
|
+
protected all: MessageAll = new MessageAll();
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* 指令消息
|
|
26
|
+
*
|
|
27
|
+
* @author chitanda
|
|
28
|
+
* @date 2023-09-05 16:09:28
|
|
29
|
+
* @type {MessageCommand}
|
|
30
|
+
*/
|
|
31
|
+
readonly command: MessageCommand = new MessageCommand(this.all);
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* 日志消息
|
|
35
|
+
*
|
|
36
|
+
* @author chitanda
|
|
37
|
+
* @date 2023-09-05 16:09:48
|
|
38
|
+
* @type {MessageConsole}
|
|
39
|
+
*/
|
|
40
|
+
readonly console: MessageConsole = new MessageConsole(this.all);
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* 发送消息
|
|
44
|
+
*
|
|
45
|
+
* @author chitanda
|
|
46
|
+
* @date 2023-09-05 15:09:49
|
|
47
|
+
* @param {IPortalMessage} msg
|
|
48
|
+
*/
|
|
49
|
+
next(msg: IPortalMessage): void {
|
|
50
|
+
// 消息分子类型,子类型发完消息后,会让父发消息
|
|
51
|
+
// 所以子类型有父时,会一级一级的往上发消息。不需要在此处发全局消息
|
|
52
|
+
if (msg.type === 'COMMAND') {
|
|
53
|
+
this.command.next(msg);
|
|
54
|
+
} else if (msg.type === 'CONSOLE') {
|
|
55
|
+
this.console.next(msg);
|
|
56
|
+
} else {
|
|
57
|
+
this.all.next(msg);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* 订阅消息
|
|
63
|
+
*
|
|
64
|
+
* @author chitanda
|
|
65
|
+
* @date 2023-09-05 17:09:32
|
|
66
|
+
* @param {(msg: IPortalMessage) => void} callback
|
|
67
|
+
*/
|
|
68
|
+
on(callback: (msg: IPortalMessage) => void): void {
|
|
69
|
+
this.all.on(callback);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* 取消订阅
|
|
74
|
+
*
|
|
75
|
+
* @author chitanda
|
|
76
|
+
* @date 2023-09-05 17:09:38
|
|
77
|
+
* @param {(msg: IPortalMessage) => void} callback
|
|
78
|
+
*/
|
|
79
|
+
off(callback: (msg: IPortalMessage) => void): void {
|
|
80
|
+
this.all.off(callback);
|
|
81
|
+
}
|
|
82
|
+
}
|