@ibiz-template/core 0.7.41-alpha.101 → 0.7.41-alpha.113

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.
Files changed (143) hide show
  1. package/dist/index.esm.js +2 -1
  2. package/dist/index.system.min.js +1 -1
  3. package/out/environment/environment.d.ts.map +1 -1
  4. package/out/environment/environment.js +1 -0
  5. package/out/interface/api/environment/i-environment.d.ts +8 -0
  6. package/out/interface/api/environment/i-environment.d.ts.map +1 -1
  7. package/package.json +3 -2
  8. package/src/command/command-register.ts +121 -0
  9. package/src/command/command.ts +78 -0
  10. package/src/command/index.ts +8 -0
  11. package/src/command/utils/index.ts +2 -0
  12. package/src/command/utils/linked-list.ts +136 -0
  13. package/src/command/utils/util.ts +103 -0
  14. package/src/constant/core/core.ts +54 -0
  15. package/src/constant/emoji/emoji.ts +2929 -0
  16. package/src/constant/http-status-message/http-status-message.ts +18 -0
  17. package/src/constant/index.ts +4 -0
  18. package/src/constant/util/util.ts +3 -0
  19. package/src/context/index.ts +231 -0
  20. package/src/environment/environment.ts +65 -0
  21. package/src/error/http-error/entity-error.ts +29 -0
  22. package/src/error/http-error/http-error-factory.ts +24 -0
  23. package/src/error/http-error/http-error.ts +52 -0
  24. package/src/error/index.ts +7 -0
  25. package/src/error/model-error/model-error.ts +27 -0
  26. package/src/error/notice-error/notice-error.ts +16 -0
  27. package/src/error/runtime-error/runtime-error.ts +13 -0
  28. package/src/error/runtime-model-error/runtime-model-error.ts +27 -0
  29. package/src/ibizsys.ts +82 -0
  30. package/src/index.ts +14 -0
  31. package/src/install.ts +12 -0
  32. package/src/interface/api/chat-message/i-api-chat-message.ts +71 -0
  33. package/src/interface/api/chat-message/index.ts +1 -0
  34. package/src/interface/api/constant/index.ts +2 -0
  35. package/src/interface/api/constant/login-mode/login-mode.ts +25 -0
  36. package/src/interface/api/constant/menu-permission-mode/menu-permission-mode.ts +20 -0
  37. package/src/interface/api/environment/i-devtool-config.ts +56 -0
  38. package/src/interface/api/environment/i-environment.ts +532 -0
  39. package/src/interface/api/environment/index.ts +2 -0
  40. package/src/interface/api/global-param/i-api-context.ts +37 -0
  41. package/src/interface/api/global-param/i-global-param.ts +27 -0
  42. package/src/interface/api/global-param/index.ts +2 -0
  43. package/src/interface/api/ibizsys/i-api-ibizsys.ts +54 -0
  44. package/src/interface/api/ibizsys/i-app-data.ts +64 -0
  45. package/src/interface/api/ibizsys/i-org-data.ts +31 -0
  46. package/src/interface/api/ibizsys/index.ts +3 -0
  47. package/src/interface/api/index.ts +6 -0
  48. package/src/interface/api/utils/i-api-i18n.ts +56 -0
  49. package/src/interface/api/utils/index.ts +5 -0
  50. package/src/interface/api/utils/message-center/base/i-message-all.ts +8 -0
  51. package/src/interface/api/utils/message-center/base/i-message-base.ts +29 -0
  52. package/src/interface/api/utils/message-center/base/index.ts +2 -0
  53. package/src/interface/api/utils/message-center/command/add-in-changed/i-add-in-changed.ts +25 -0
  54. package/src/interface/api/utils/message-center/command/add-in-changed/i-command-add-in-changed.ts +16 -0
  55. package/src/interface/api/utils/message-center/command/async-action/i-command-async-action.ts +17 -0
  56. package/src/interface/api/utils/message-center/command/change/i-command-change.ts +8 -0
  57. package/src/interface/api/utils/message-center/command/create/i-command-create.ts +18 -0
  58. package/src/interface/api/utils/message-center/command/i-command-base.ts +23 -0
  59. package/src/interface/api/utils/message-center/command/i-message-command.ts +94 -0
  60. package/src/interface/api/utils/message-center/command/index.ts +20 -0
  61. package/src/interface/api/utils/message-center/command/internal-message/i-command-internal-message.ts +17 -0
  62. package/src/interface/api/utils/message-center/command/internal-message/i-internal-message.ts +132 -0
  63. package/src/interface/api/utils/message-center/command/mark-open-data/i-command-mark-open-data.ts +17 -0
  64. package/src/interface/api/utils/message-center/command/mark-open-data/i-mark-open-data.ts +47 -0
  65. package/src/interface/api/utils/message-center/command/remove/i-command-remove.ts +18 -0
  66. package/src/interface/api/utils/message-center/command/update/i-command-update.ts +18 -0
  67. package/src/interface/api/utils/message-center/common/i-app-data-entity.ts +16 -0
  68. package/src/interface/api/utils/message-center/common/i-message-center-event.ts +15 -0
  69. package/src/interface/api/utils/message-center/common/i-msg-meta-data.ts +13 -0
  70. package/src/interface/api/utils/message-center/common/i-portal-async-action.ts +144 -0
  71. package/src/interface/api/utils/message-center/common/i-portal-message.ts +84 -0
  72. package/src/interface/api/utils/message-center/common/index.ts +5 -0
  73. package/src/interface/api/utils/message-center/console/i-message-console.ts +17 -0
  74. package/src/interface/api/utils/message-center/error/i-message-error.ts +17 -0
  75. package/src/interface/api/utils/message-center/i-message-center.ts +53 -0
  76. package/src/interface/api/utils/message-center/index.ts +6 -0
  77. package/src/interface/api/utils/net/i-api-http-error.ts +43 -0
  78. package/src/interface/api/utils/net/i-api-net.ts +93 -0
  79. package/src/interface/api/utils/net/i-http-response.ts +67 -0
  80. package/src/interface/click-outside/click-outside.ts +51 -0
  81. package/src/interface/command/command/i-command-option.ts +47 -0
  82. package/src/interface/command/command/i-command.ts +68 -0
  83. package/src/interface/command/disposable/i-disposable.ts +12 -0
  84. package/src/interface/command/i-command-controller.ts +50 -0
  85. package/src/interface/command/index.ts +11 -0
  86. package/src/interface/context/index.ts +42 -0
  87. package/src/interface/error/index.ts +13 -0
  88. package/src/interface/i-chat-message/i-chat-message.ts +16 -0
  89. package/src/interface/ibizsys/i-ibizsys.ts +33 -0
  90. package/src/interface/ibizsys/index.ts +1 -0
  91. package/src/interface/index.ts +11 -0
  92. package/src/interface/utils/i-18n.ts +22 -0
  93. package/src/interface/utils/index.ts +1 -0
  94. package/src/locale/en/index.ts +30 -0
  95. package/src/locale/index.ts +2 -0
  96. package/src/locale/zh-CN/index.ts +28 -0
  97. package/src/params/params.ts +131 -0
  98. package/src/types.ts +26 -0
  99. package/src/utils/bit-mask/bit-mask.ts +87 -0
  100. package/src/utils/click-outside/click-outside.ts +108 -0
  101. package/src/utils/clone/clone.ts +38 -0
  102. package/src/utils/color/color.ts +84 -0
  103. package/src/utils/cookie-util/cookie-util.ts +192 -0
  104. package/src/utils/data-type/data-types.ts +93 -0
  105. package/src/utils/download-file/download-file.ts +110 -0
  106. package/src/utils/event/event.ts +69 -0
  107. package/src/utils/history-list/history-item.ts +41 -0
  108. package/src/utils/history-list/history-list.ts +137 -0
  109. package/src/utils/index.ts +24 -0
  110. package/src/utils/interceptor/core-interceptor.ts +127 -0
  111. package/src/utils/interceptor/index.ts +2 -0
  112. package/src/utils/interceptor/interceptor.ts +122 -0
  113. package/src/utils/logger/logger.ts +34 -0
  114. package/src/utils/message-center/base/message-all.ts +10 -0
  115. package/src/utils/message-center/base/message-base.ts +73 -0
  116. package/src/utils/message-center/command/add-in-changed/command-add-in-changed.ts +23 -0
  117. package/src/utils/message-center/command/async-action/command-async-action.ts +23 -0
  118. package/src/utils/message-center/command/change/command-change.ts +11 -0
  119. package/src/utils/message-center/command/command-base/command-base.ts +35 -0
  120. package/src/utils/message-center/command/create/command-create.ts +25 -0
  121. package/src/utils/message-center/command/internal-message/command-internal-message.ts +26 -0
  122. package/src/utils/message-center/command/mark-open-data/command-mark-open-data.ts +23 -0
  123. package/src/utils/message-center/command/message-command.ts +162 -0
  124. package/src/utils/message-center/command/remove/command-remove.ts +25 -0
  125. package/src/utils/message-center/command/update/command-update.ts +25 -0
  126. package/src/utils/message-center/console/message-console.ts +27 -0
  127. package/src/utils/message-center/error/message-error.ts +27 -0
  128. package/src/utils/message-center/index.ts +1 -0
  129. package/src/utils/message-center/message-center.ts +77 -0
  130. package/src/utils/namespace/namespace.ts +217 -0
  131. package/src/utils/net/http-response.ts +60 -0
  132. package/src/utils/net/net.ts +448 -0
  133. package/src/utils/recursive/find-recursive-child.ts +238 -0
  134. package/src/utils/string-util/string-util.ts +76 -0
  135. package/src/utils/style/remote-style.ts +17 -0
  136. package/src/utils/sync/await-timeout.ts +29 -0
  137. package/src/utils/sync/count-latch.ts +79 -0
  138. package/src/utils/sync/index.ts +2 -0
  139. package/src/utils/types/types.ts +24 -0
  140. package/src/utils/upload/select-file.ts +93 -0
  141. package/src/utils/upload/upload-file.ts +194 -0
  142. package/src/utils/url-helper/url-helper.ts +52 -0
  143. package/src/utils/util/util.ts +580 -0
@@ -0,0 +1,122 @@
1
+ /* eslint-disable @typescript-eslint/no-explicit-any */
2
+ import {
3
+ AxiosInstance,
4
+ InternalAxiosRequestConfig,
5
+ AxiosResponse,
6
+ } from 'axios';
7
+
8
+ /**
9
+ * @description 拦截器基类
10
+ * @export
11
+ * @class Interceptor
12
+ */
13
+ export class Interceptor {
14
+ /**
15
+ * @description 请求拦截器绑定标识
16
+ * @private
17
+ * @type {number}
18
+ * @memberof Interceptor
19
+ */
20
+ private requestTag?: number;
21
+
22
+ /**
23
+ * @description 响应拦截器绑定标识
24
+ * @private
25
+ * @type {number}
26
+ * @memberof Interceptor
27
+ */
28
+ private responseTag?: number;
29
+
30
+ /**
31
+ * @description axios实例
32
+ * @protected
33
+ * @type {(AxiosInstance | undefined)}
34
+ * @memberof Interceptor
35
+ */
36
+ protected instance: AxiosInstance | undefined;
37
+
38
+ /**
39
+ * @description 请求之前处理
40
+ * @protected
41
+ * @param {InternalAxiosRequestConfig} config
42
+ * @returns {*} {Promise<InternalAxiosRequestConfig>}
43
+ * @memberof Interceptor
44
+ */
45
+ protected async onBeforeRequest(
46
+ config: InternalAxiosRequestConfig,
47
+ ): Promise<InternalAxiosRequestConfig> {
48
+ return config;
49
+ }
50
+
51
+ /**
52
+ * @description 请求失败之后处理
53
+ * @protected
54
+ * @param {Error} error
55
+ * @returns {*} {Promise<never>}
56
+ * @memberof Interceptor
57
+ */
58
+ protected onRequestError(error: Error): Promise<never> {
59
+ // 处理请求错误
60
+ return Promise.reject(error);
61
+ }
62
+
63
+ /**
64
+ * @description 响应成功之后处理
65
+ * @protected
66
+ * @param {AxiosResponse} config
67
+ * @returns {*} {Promise<AxiosResponse>}
68
+ * @memberof Interceptor
69
+ */
70
+ protected async onResponseSuccess(
71
+ config: AxiosResponse,
72
+ ): Promise<AxiosResponse> {
73
+ return config;
74
+ }
75
+
76
+ /**
77
+ * @description 响应失败之后处理
78
+ * @protected
79
+ * @param {Error} error
80
+ * @returns {*} {Promise<never>}
81
+ * @memberof Interceptor
82
+ */
83
+ protected onResponseError(error: Error): Promise<never> {
84
+ // 处理响应错误
85
+ return Promise.reject(error);
86
+ }
87
+
88
+ /**
89
+ * @description 使用拦截器
90
+ * @param {AxiosInstance} instance
91
+ * @memberof Interceptor
92
+ */
93
+ use(instance: AxiosInstance): void {
94
+ this.instance = instance;
95
+ this.onBeforeRequest = this.onBeforeRequest.bind(this);
96
+ this.onRequestError = this.onRequestError.bind(this);
97
+ this.onResponseSuccess = this.onResponseSuccess.bind(this);
98
+ this.onResponseError = this.onResponseError.bind(this);
99
+ this.requestTag = instance.interceptors.request.use(
100
+ this.onBeforeRequest,
101
+ this.onRequestError,
102
+ );
103
+ this.responseTag = instance.interceptors.response.use(
104
+ this.onResponseSuccess,
105
+ this.onResponseError,
106
+ );
107
+ }
108
+
109
+ /**
110
+ * @description 移出拦截器
111
+ * @param {AxiosInstance} instance
112
+ * @memberof Interceptor
113
+ */
114
+ eject(instance: AxiosInstance): void {
115
+ if (this.requestTag) {
116
+ instance.interceptors.request.eject(this.requestTag);
117
+ }
118
+ if (this.responseTag) {
119
+ instance.interceptors.response.eject(this.responseTag);
120
+ }
121
+ }
122
+ }
@@ -0,0 +1,34 @@
1
+ /* eslint-disable @typescript-eslint/no-unused-vars */
2
+ /* eslint-disable @typescript-eslint/explicit-function-return-type */
3
+ import Logger from 'loglevel';
4
+ import prefix from 'loglevel-plugin-prefix';
5
+
6
+ // 重写 methodFactory
7
+ const originalFactory = Logger.methodFactory;
8
+ const NOOP = (message: string) => {};
9
+ Logger.methodFactory = (methodName, logLevel, loggerName) => {
10
+ const rawMethod = originalFactory(methodName, logLevel, loggerName);
11
+ if (window.Environment?.environmentTag === 'production') {
12
+ if (
13
+ methodName === 'error' ||
14
+ methodName === 'warn' ||
15
+ methodName === 'debug'
16
+ ) {
17
+ return NOOP;
18
+ }
19
+ }
20
+ if (window.Environment?.environmentTag === 'test') {
21
+ if (methodName === 'error' || methodName === 'warn') {
22
+ return NOOP;
23
+ }
24
+ }
25
+ return rawMethod;
26
+ };
27
+
28
+ const logger = Logger.noConflict();
29
+
30
+ prefix.reg(logger);
31
+
32
+ prefix.apply(logger);
33
+
34
+ export { logger };
@@ -0,0 +1,10 @@
1
+ import { IMessageAll } from '../../../interface';
2
+ import { MessageBase } from './message-base';
3
+
4
+ /**
5
+ * @description 所有消息控制器
6
+ * @export
7
+ * @class MessageAll
8
+ * @extends {MessageBase}
9
+ */
10
+ export class MessageAll extends MessageBase implements IMessageAll {}
@@ -0,0 +1,73 @@
1
+ import { QXEvent } from 'qx-util';
2
+ import {
3
+ IMessageBase,
4
+ IMessageCenterEvent,
5
+ IPortalMessage,
6
+ } from '../../../interface';
7
+
8
+ /**
9
+ * @description 消息基类控制器,各个类型消息继承此类
10
+ * @export
11
+ * @abstract
12
+ * @class MessageBase
13
+ * @implements {IMessageBase}
14
+ */
15
+ export abstract class MessageBase implements IMessageBase {
16
+ /**
17
+ * @description 事件对象
18
+ * @protected
19
+ * @type {QXEvent<IMessageCenterEvent>}
20
+ * @memberof MessageBase
21
+ */
22
+ protected evt: QXEvent<IMessageCenterEvent> = new QXEvent(1000);
23
+
24
+ /**
25
+ * Creates an instance of MessageBase.
26
+ * @param {MessageBase} [parent]
27
+ * @memberof MessageBase
28
+ */
29
+ constructor(protected parent?: MessageBase) {}
30
+
31
+ /**
32
+ * @description 推送标准结构消息
33
+ * @param {IPortalMessage} msg
34
+ * @memberof MessageBase
35
+ */
36
+ next(msg: IPortalMessage): void {
37
+ this.evt.emit('all', msg);
38
+ if (this.parent) {
39
+ this.nextParent(msg);
40
+ }
41
+ }
42
+
43
+ /**
44
+ * @description 向父级推送消息(私有方法)
45
+ * @protected
46
+ * @param {IPortalMessage} msg
47
+ * @memberof MessageBase
48
+ */
49
+ protected nextParent(msg: IPortalMessage): void {
50
+ if (this.parent) {
51
+ this.parent.evt.emit('all', msg);
52
+ this.parent.nextParent(msg);
53
+ }
54
+ }
55
+
56
+ /**
57
+ * @description 订阅消息
58
+ * @param {(msg: IPortalMessage) => void} cb
59
+ * @memberof MessageBase
60
+ */
61
+ on(cb: (msg: IPortalMessage) => void): void {
62
+ this.evt.on('all', cb);
63
+ }
64
+
65
+ /**
66
+ * @description 取消订阅消息
67
+ * @param {(msg: IPortalMessage) => void} cb
68
+ * @memberof MessageBase
69
+ */
70
+ off(cb: (msg: IPortalMessage) => void): void {
71
+ this.evt.off('all', cb);
72
+ }
73
+ }
@@ -0,0 +1,23 @@
1
+ import { IAddInChanged, ICommandAddInChanged } from '../../../../interface';
2
+ import { CommandBase } from '../command-base/command-base';
3
+
4
+ /**
5
+ * @description 添加变更指令消息控制器
6
+ * @export
7
+ * @class CommandAddInChanged
8
+ * @extends {CommandBase}
9
+ * @implements {ICommandAddInChanged}
10
+ */
11
+ export class CommandAddInChanged
12
+ extends CommandBase
13
+ implements ICommandAddInChanged
14
+ {
15
+ /**
16
+ * @description 发送消息
17
+ * @param {IAddInChanged} data
18
+ * @memberof CommandAddInChanged
19
+ */
20
+ send(data: IAddInChanged): void {
21
+ this.sendCommand(data, 'ADDINCHANGED');
22
+ }
23
+ }
@@ -0,0 +1,23 @@
1
+ import { ICommandAsyncAction, IPortalAsyncAction } from '../../../../interface';
2
+ import { CommandBase } from '../command-base/command-base';
3
+
4
+ /**
5
+ * @description 异步作业指令消息控制器
6
+ * @export
7
+ * @class CommandAsyncAction
8
+ * @extends {CommandBase}
9
+ * @implements {ICommandAsyncAction}
10
+ */
11
+ export class CommandAsyncAction
12
+ extends CommandBase
13
+ implements ICommandAsyncAction
14
+ {
15
+ /**
16
+ * @description 发送消息
17
+ * @param {IPortalAsyncAction} data
18
+ * @memberof CommandAsyncAction
19
+ */
20
+ send(data: IPortalAsyncAction): void {
21
+ this.sendCommand(data, 'ASYNCACTION');
22
+ }
23
+ }
@@ -0,0 +1,11 @@
1
+ import { ICommandChange } from '../../../../interface';
2
+ import { CommandBase } from '../command-base/command-base';
3
+
4
+ /**
5
+ * @description 数据变更指令消息控制器
6
+ * @export
7
+ * @class CommandChange
8
+ * @extends {CommandBase}
9
+ * @implements {ICommandChange}
10
+ */
11
+ export class CommandChange extends CommandBase implements ICommandChange {}
@@ -0,0 +1,35 @@
1
+ import { createUUID } from 'qx-util';
2
+ import { ICommandBase, IPortalMessage } from '../../../../interface';
3
+ import { MessageBase } from '../../base/message-base';
4
+
5
+ /**
6
+ * @description 指令消息基类控制器
7
+ * @export
8
+ * @class CommandBase
9
+ * @extends {MessageBase}
10
+ * @implements {ICommandBase}
11
+ */
12
+ export class CommandBase extends MessageBase implements ICommandBase {
13
+ /**
14
+ * @description 发送指令消息
15
+ * @param {IData} data
16
+ * @param {IPortalMessage['subtype']} subtype
17
+ * @param {string} [triggerKey]
18
+ * @memberof CommandBase
19
+ */
20
+ sendCommand(
21
+ data: IData,
22
+ subtype: IPortalMessage['subtype'],
23
+ triggerKey?: string,
24
+ ): void {
25
+ const msg: IPortalMessage = {
26
+ messageid: createUUID(),
27
+ messagename: 'command',
28
+ type: 'COMMAND',
29
+ subtype,
30
+ triggerKey,
31
+ data,
32
+ };
33
+ this.next(msg);
34
+ }
35
+ }
@@ -0,0 +1,25 @@
1
+ import {
2
+ IAppDataEntity,
3
+ ICommandCreate,
4
+ IMsgMetaData,
5
+ } from '../../../../interface';
6
+ import { CommandBase } from '../command-base/command-base';
7
+
8
+ /**
9
+ * @description 创建指令消息控制器
10
+ * @export
11
+ * @class CommandCreate
12
+ * @extends {CommandBase}
13
+ * @implements {ICommandCreate}
14
+ */
15
+ export class CommandCreate extends CommandBase implements ICommandCreate {
16
+ /**
17
+ * @description 发送消息
18
+ * @param {IAppDataEntity} data
19
+ * @param {IMsgMetaData} [meta]
20
+ * @memberof CommandCreate
21
+ */
22
+ send(data: IAppDataEntity, meta?: IMsgMetaData): void {
23
+ this.sendCommand(data, 'OBJECTCREATED', meta?.triggerKey);
24
+ }
25
+ }
@@ -0,0 +1,26 @@
1
+ import {
2
+ ICommandInternalMessage,
3
+ IInternalMessage,
4
+ } from '../../../../interface';
5
+ import { CommandBase } from '../command-base/command-base';
6
+
7
+ /**
8
+ * @description 站内信指令消息控制器
9
+ * @export
10
+ * @class CommandInternalMessage
11
+ * @extends {CommandBase}
12
+ * @implements {ICommandInternalMessage}
13
+ */
14
+ export class CommandInternalMessage
15
+ extends CommandBase
16
+ implements ICommandInternalMessage
17
+ {
18
+ /**
19
+ * @description 发送消息
20
+ * @param {IInternalMessage} data
21
+ * @memberof CommandInternalMessage
22
+ */
23
+ send(data: IInternalMessage): void {
24
+ this.sendCommand(data, 'INTERNALMESSAGE');
25
+ }
26
+ }
@@ -0,0 +1,23 @@
1
+ import { ICommandMarkOpenData, IMarkOpenData } from '../../../../interface';
2
+ import { CommandBase } from '../command-base/command-base';
3
+
4
+ /**
5
+ * @description 协同指令消息控制器
6
+ * @export
7
+ * @class CommandMarkOpenData
8
+ * @extends {CommandBase}
9
+ * @implements {ICommandMarkOpenData}
10
+ */
11
+ export class CommandMarkOpenData
12
+ extends CommandBase
13
+ implements ICommandMarkOpenData
14
+ {
15
+ /**
16
+ * @description 发送消息
17
+ * @param {IMarkOpenData} data
18
+ * @memberof CommandMarkOpenData
19
+ */
20
+ send(data: IMarkOpenData): void {
21
+ this.sendCommand(data, 'MARKOPENDATA');
22
+ }
23
+ }
@@ -0,0 +1,162 @@
1
+ import { createUUID } from 'qx-util';
2
+ import { IMessageCommand, 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
+ import { CommandAsyncAction } from './async-action/command-async-action';
9
+ import { CommandInternalMessage } from './internal-message/command-internal-message';
10
+ import { CommandMarkOpenData } from './mark-open-data/command-mark-open-data';
11
+ import { CommandAddInChanged } from './add-in-changed/command-add-in-changed';
12
+
13
+ /**
14
+ * @description 指令消息控制器
15
+ * @export
16
+ * @class MessageCommand
17
+ * @extends {MessageBase}
18
+ * @implements {IMessageCommand}
19
+ */
20
+ export class MessageCommand extends MessageBase implements IMessageCommand {
21
+ /**
22
+ * @description 数据变更指令消息控制器
23
+ * @type {CommandChange}
24
+ * @memberof MessageCommand
25
+ */
26
+ readonly change: CommandChange = new CommandChange();
27
+
28
+ /**
29
+ * @description 新建数据指令消息控制器
30
+ * @type {CommandCreate}
31
+ * @memberof MessageCommand
32
+ */
33
+ readonly create: CommandCreate = new CommandCreate(this);
34
+
35
+ /**
36
+ * @description 更新数据指令消息控制器
37
+ * @type {CommandUpdate}
38
+ * @memberof MessageCommand
39
+ */
40
+ readonly update: CommandUpdate = new CommandUpdate(this);
41
+
42
+ /**
43
+ * @description 删除数据指令消息控制器
44
+ * @type {CommandRemove}
45
+ * @memberof MessageCommand
46
+ */
47
+ readonly remove: CommandRemove = new CommandRemove(this);
48
+
49
+ /**
50
+ * @description 异步指令消息控制器
51
+ * @type {CommandAsyncAction}
52
+ * @memberof MessageCommand
53
+ */
54
+ readonly asyncAction: CommandAsyncAction = new CommandAsyncAction(this);
55
+
56
+ /**
57
+ * @description 站内信消息指令消息控制器
58
+ * @type {CommandInternalMessage}
59
+ * @memberof MessageCommand
60
+ */
61
+ readonly internalMessage: CommandInternalMessage = new CommandInternalMessage(
62
+ this,
63
+ );
64
+
65
+ /**
66
+ * @description 协同指令消息控制器
67
+ * @type {CommandMarkOpenData}
68
+ * @memberof MessageCommand
69
+ */
70
+ readonly markOpenData: CommandMarkOpenData = new CommandMarkOpenData(this);
71
+
72
+ /**
73
+ * @description 添加变更指令消息控制器
74
+ * @type {CommandAddInChanged}
75
+ * @memberof MessageCommand
76
+ */
77
+ readonly addInChanged: CommandAddInChanged = new CommandAddInChanged(this);
78
+
79
+ /**
80
+ * @description 推送指令消息
81
+ * @param {IPortalMessage} msg
82
+ * @memberof MessageCommand
83
+ */
84
+ next(msg: IPortalMessage): void {
85
+ // 消息分子类型,子类型发完消息后,会让父发消息
86
+ // 所以子类型有父时,会一级一级的往上发消息。不需要在此处发全局消息
87
+ // change 特殊处理,不给父发消息
88
+ switch (msg.subtype) {
89
+ case 'OBJECTCREATED':
90
+ this.create.next(msg);
91
+ this.change.next(msg);
92
+ break;
93
+ case 'OBJECTUPDATED':
94
+ this.update.next(msg);
95
+ this.change.next(msg);
96
+ break;
97
+ case 'OBJECTREMOVED':
98
+ this.remove.next(msg);
99
+ this.change.next(msg);
100
+ break;
101
+ case 'ASYNCACTION':
102
+ this.asyncAction.next(msg);
103
+ break;
104
+ case 'INTERNALMESSAGE':
105
+ this.internalMessage.next(msg);
106
+ break;
107
+ case 'MARKOPENDATA':
108
+ this.markOpenData.next(msg);
109
+ break;
110
+ case 'ADDINCHANGED':
111
+ this.addInChanged.next(msg);
112
+ break;
113
+ default:
114
+ super.next(msg);
115
+ }
116
+ }
117
+
118
+ /**
119
+ * @description 发送消息给父级
120
+ * @protected
121
+ * @param {IPortalMessage} msg
122
+ * @memberof MessageCommand
123
+ */
124
+ protected nextParent(msg: IPortalMessage): void {
125
+ switch (msg.subtype) {
126
+ case 'OBJECTCREATED':
127
+ this.change.next(msg);
128
+ break;
129
+ case 'OBJECTUPDATED':
130
+ this.change.next(msg);
131
+ break;
132
+ case 'OBJECTREMOVED':
133
+ this.change.next(msg);
134
+ break;
135
+ default:
136
+ }
137
+ super.nextParent(msg);
138
+ }
139
+
140
+ /**
141
+ * @description 发送指令消息
142
+ * @param {IData} data
143
+ * @param {IPortalMessage['subtype']} subtype
144
+ * @param {string} [triggerKey]
145
+ * @memberof MessageCommand
146
+ */
147
+ send(
148
+ data: IData,
149
+ subtype: IPortalMessage['subtype'],
150
+ triggerKey?: string,
151
+ ): void {
152
+ const msg: IPortalMessage = {
153
+ messageid: createUUID(),
154
+ messagename: 'command',
155
+ type: 'COMMAND',
156
+ subtype,
157
+ triggerKey,
158
+ data,
159
+ };
160
+ this.next(msg);
161
+ }
162
+ }
@@ -0,0 +1,25 @@
1
+ import {
2
+ IAppDataEntity,
3
+ ICommandRemove,
4
+ IMsgMetaData,
5
+ } from '../../../../interface';
6
+ import { CommandBase } from '../command-base/command-base';
7
+
8
+ /**
9
+ * @description 删除指令消息控制器
10
+ * @export
11
+ * @class CommandRemove
12
+ * @extends {CommandBase}
13
+ * @implements {ICommandRemove}
14
+ */
15
+ export class CommandRemove extends CommandBase implements ICommandRemove {
16
+ /**
17
+ * @description 发送消息
18
+ * @param {IAppDataEntity} data 实体数据
19
+ * @param {IMsgMetaData} [meta] 元数据
20
+ * @memberof CommandRemove
21
+ */
22
+ send(data: IAppDataEntity, meta?: IMsgMetaData): void {
23
+ this.sendCommand(data, 'OBJECTREMOVED', meta?.triggerKey);
24
+ }
25
+ }
@@ -0,0 +1,25 @@
1
+ import {
2
+ IAppDataEntity,
3
+ ICommandUpdate,
4
+ IMsgMetaData,
5
+ } from '../../../../interface';
6
+ import { CommandBase } from '../command-base/command-base';
7
+
8
+ /**
9
+ * @description 更新指令消息控制器
10
+ * @export
11
+ * @class CommandUpdate
12
+ * @extends {CommandBase}
13
+ * @implements {ICommandUpdate}
14
+ */
15
+ export class CommandUpdate extends CommandBase implements ICommandUpdate {
16
+ /**
17
+ * @description 发送消息
18
+ * @param {IAppDataEntity} data 实体数据
19
+ * @param {IMsgMetaData} [meta] 元数据
20
+ * @memberof CommandUpdate
21
+ */
22
+ send(data: IAppDataEntity, meta?: IMsgMetaData): void {
23
+ this.sendCommand(data, 'OBJECTUPDATED', meta?.triggerKey);
24
+ }
25
+ }
@@ -0,0 +1,27 @@
1
+ import { createUUID } from 'qx-util';
2
+ import { IMessageConsole, IPortalMessage } from '../../../interface';
3
+ import { MessageBase } from '../base/message-base';
4
+
5
+ /**
6
+ * @description 日志消息控制器
7
+ * @export
8
+ * @class MessageConsole
9
+ * @extends {MessageBase}
10
+ * @implements {IMessageConsole}
11
+ */
12
+ export class MessageConsole extends MessageBase implements IMessageConsole {
13
+ /**
14
+ * @description 发送消息
15
+ * @param {(IData | string)} data
16
+ * @memberof MessageConsole
17
+ */
18
+ send(data: IData | string): void {
19
+ const msg: IPortalMessage = {
20
+ messageid: createUUID(),
21
+ messagename: 'console',
22
+ type: 'CONSOLE',
23
+ data,
24
+ };
25
+ this.next(msg);
26
+ }
27
+ }
@@ -0,0 +1,27 @@
1
+ import { createUUID } from 'qx-util';
2
+ import { IMessageError, IPortalMessage } from '../../../interface';
3
+ import { MessageBase } from '../base/message-base';
4
+
5
+ /**
6
+ * @description 错误消息控制器
7
+ * @export
8
+ * @class MessageError
9
+ * @extends {MessageBase}
10
+ * @implements {IMessageError}
11
+ */
12
+ export class MessageError extends MessageBase implements IMessageError {
13
+ /**
14
+ * @description 发送消息
15
+ * @param {(IData | string)} data
16
+ * @memberof MessageError
17
+ */
18
+ send(data: IData | string): void {
19
+ const msg: IPortalMessage = {
20
+ messageid: createUUID(),
21
+ messagename: 'error',
22
+ type: 'ERROR',
23
+ data,
24
+ };
25
+ this.next(msg);
26
+ }
27
+ }
@@ -0,0 +1 @@
1
+ export { MessageCenter } from './message-center';