@ibiz-template/core 0.7.41-alpha.1 → 0.7.41-alpha.106
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 +75 -15
- package/dist/index.system.min.js +1 -1
- package/out/context/index.d.ts.map +1 -1
- package/out/environment/environment.d.ts.map +1 -1
- package/out/environment/environment.js +8 -1
- package/out/error/http-error/http-error.d.ts +2 -2
- package/out/error/http-error/http-error.d.ts.map +1 -1
- package/out/interface/api/chat-message/i-api-chat-message.d.ts +63 -0
- package/out/interface/api/chat-message/i-api-chat-message.d.ts.map +1 -0
- package/out/interface/api/chat-message/i-api-chat-message.js +1 -0
- package/out/interface/api/chat-message/index.d.ts +2 -0
- package/out/interface/api/chat-message/index.d.ts.map +1 -0
- package/out/interface/api/chat-message/index.js +1 -0
- package/out/interface/api/environment/i-devtool-config.d.ts +11 -1
- package/out/interface/api/environment/i-devtool-config.d.ts.map +1 -1
- package/out/interface/api/environment/i-environment.d.ts +138 -1
- package/out/interface/api/environment/i-environment.d.ts.map +1 -1
- package/out/interface/api/ibizsys/i-app-data.d.ts +57 -0
- package/out/interface/api/ibizsys/i-app-data.d.ts.map +1 -0
- package/out/interface/api/ibizsys/i-app-data.js +1 -0
- package/out/interface/api/ibizsys/i-org-data.d.ts +1 -1
- package/out/interface/api/ibizsys/index.d.ts +1 -0
- package/out/interface/api/ibizsys/index.d.ts.map +1 -1
- package/out/interface/api/index.d.ts +1 -0
- package/out/interface/api/index.d.ts.map +1 -1
- package/out/interface/api/index.js +1 -0
- package/out/interface/api/utils/i-api-i18n.d.ts +9 -9
- package/out/interface/api/utils/index.d.ts +1 -0
- package/out/interface/api/utils/index.d.ts.map +1 -1
- package/out/interface/api/utils/message-center/base/i-message-base.d.ts +3 -3
- package/out/interface/api/utils/message-center/command/add-in-changed/i-command-add-in-changed.d.ts +1 -1
- package/out/interface/api/utils/message-center/command/async-action/i-command-async-action.d.ts +1 -1
- package/out/interface/api/utils/message-center/command/i-message-command.d.ts +1 -1
- package/out/interface/api/utils/message-center/command/internal-message/i-command-internal-message.d.ts +1 -1
- package/out/interface/api/utils/message-center/command/mark-open-data/i-command-mark-open-data.d.ts +1 -1
- package/out/interface/api/utils/message-center/common/i-message-center-event.d.ts +5 -0
- package/out/interface/api/utils/message-center/common/i-message-center-event.d.ts.map +1 -1
- package/out/interface/api/utils/message-center/common/i-portal-message.d.ts +3 -3
- package/out/interface/api/utils/message-center/console/i-message-console.d.ts +1 -1
- package/out/interface/api/utils/message-center/error/i-message-error.d.ts +1 -1
- package/out/interface/api/utils/message-center/i-message-center.d.ts +2 -2
- package/out/interface/api/utils/net/i-api-http-error.d.ts +39 -0
- package/out/interface/api/utils/net/i-api-http-error.d.ts.map +1 -0
- package/out/interface/api/utils/net/i-api-http-error.js +1 -0
- package/out/interface/api/utils/net/i-api-net.d.ts +1 -1
- package/out/interface/i-chat-message/i-chat-message.d.ts +2 -49
- package/out/interface/i-chat-message/i-chat-message.d.ts.map +1 -1
- package/out/utils/download-file/download-file.d.ts.map +1 -1
- package/out/utils/download-file/download-file.js +11 -1
- package/out/utils/interceptor/core-interceptor.js +2 -1
- package/out/utils/net/http-response.d.ts +2 -1
- package/out/utils/net/http-response.d.ts.map +1 -1
- package/out/utils/net/http-response.js +5 -1
- package/out/utils/net/net.d.ts +1 -1
- package/out/utils/net/net.d.ts.map +1 -1
- package/out/utils/recursive/find-recursive-child.d.ts +20 -0
- package/out/utils/recursive/find-recursive-child.d.ts.map +1 -1
- package/out/utils/recursive/find-recursive-child.js +69 -7
- package/out/utils/string-util/string-util.d.ts.map +1 -1
- package/out/utils/string-util/string-util.js +2 -4
- package/package.json +5 -4
- package/src/command/command-register.ts +121 -0
- package/src/command/command.ts +78 -0
- package/src/command/index.ts +8 -0
- package/src/command/utils/index.ts +2 -0
- package/src/command/utils/linked-list.ts +136 -0
- package/src/command/utils/util.ts +103 -0
- package/src/constant/core/core.ts +54 -0
- package/src/constant/emoji/emoji.ts +2929 -0
- package/src/constant/http-status-message/http-status-message.ts +18 -0
- package/src/constant/index.ts +4 -0
- package/src/constant/util/util.ts +3 -0
- package/src/context/index.ts +231 -0
- package/src/environment/environment.ts +64 -0
- package/src/error/http-error/entity-error.ts +29 -0
- package/src/error/http-error/http-error-factory.ts +24 -0
- package/src/error/http-error/http-error.ts +52 -0
- package/src/error/index.ts +7 -0
- package/src/error/model-error/model-error.ts +27 -0
- package/src/error/notice-error/notice-error.ts +16 -0
- package/src/error/runtime-error/runtime-error.ts +13 -0
- package/src/error/runtime-model-error/runtime-model-error.ts +27 -0
- package/src/ibizsys.ts +82 -0
- package/src/index.ts +14 -0
- package/src/install.ts +12 -0
- package/src/interface/api/chat-message/i-api-chat-message.ts +71 -0
- package/src/interface/api/chat-message/index.ts +1 -0
- package/src/interface/api/constant/index.ts +2 -0
- package/src/interface/api/constant/login-mode/login-mode.ts +25 -0
- package/src/interface/api/constant/menu-permission-mode/menu-permission-mode.ts +20 -0
- package/src/interface/api/environment/i-devtool-config.ts +56 -0
- package/src/interface/api/environment/i-environment.ts +523 -0
- package/src/interface/api/environment/index.ts +2 -0
- package/src/interface/api/global-param/i-api-context.ts +37 -0
- package/src/interface/api/global-param/i-global-param.ts +27 -0
- package/src/interface/api/global-param/index.ts +2 -0
- package/src/interface/api/ibizsys/i-api-ibizsys.ts +54 -0
- package/src/interface/api/ibizsys/i-app-data.ts +64 -0
- package/src/interface/api/ibizsys/i-org-data.ts +31 -0
- package/src/interface/api/ibizsys/index.ts +3 -0
- package/src/interface/api/index.ts +6 -0
- package/src/interface/api/utils/i-api-i18n.ts +56 -0
- package/src/interface/api/utils/index.ts +5 -0
- package/src/interface/api/utils/message-center/base/i-message-all.ts +8 -0
- package/src/interface/api/utils/message-center/base/i-message-base.ts +29 -0
- package/src/interface/api/utils/message-center/base/index.ts +2 -0
- package/src/interface/api/utils/message-center/command/add-in-changed/i-add-in-changed.ts +25 -0
- package/src/interface/api/utils/message-center/command/add-in-changed/i-command-add-in-changed.ts +16 -0
- package/src/interface/api/utils/message-center/command/async-action/i-command-async-action.ts +17 -0
- package/src/interface/api/utils/message-center/command/change/i-command-change.ts +8 -0
- package/src/interface/api/utils/message-center/command/create/i-command-create.ts +18 -0
- package/src/interface/api/utils/message-center/command/i-command-base.ts +23 -0
- package/src/interface/api/utils/message-center/command/i-message-command.ts +94 -0
- package/src/interface/api/utils/message-center/command/index.ts +20 -0
- package/src/interface/api/utils/message-center/command/internal-message/i-command-internal-message.ts +17 -0
- package/src/interface/api/utils/message-center/command/internal-message/i-internal-message.ts +132 -0
- package/src/interface/api/utils/message-center/command/mark-open-data/i-command-mark-open-data.ts +17 -0
- package/src/interface/api/utils/message-center/command/mark-open-data/i-mark-open-data.ts +47 -0
- package/src/interface/api/utils/message-center/command/remove/i-command-remove.ts +18 -0
- package/src/interface/api/utils/message-center/command/update/i-command-update.ts +18 -0
- package/src/interface/api/utils/message-center/common/i-app-data-entity.ts +16 -0
- package/src/interface/api/utils/message-center/common/i-message-center-event.ts +15 -0
- package/src/interface/api/utils/message-center/common/i-msg-meta-data.ts +13 -0
- package/src/interface/api/utils/message-center/common/i-portal-async-action.ts +144 -0
- package/src/interface/api/utils/message-center/common/i-portal-message.ts +84 -0
- package/src/interface/api/utils/message-center/common/index.ts +5 -0
- package/src/interface/api/utils/message-center/console/i-message-console.ts +17 -0
- package/src/interface/api/utils/message-center/error/i-message-error.ts +17 -0
- package/src/interface/api/utils/message-center/i-message-center.ts +53 -0
- package/src/interface/api/utils/message-center/index.ts +6 -0
- package/src/interface/api/utils/net/i-api-http-error.ts +43 -0
- package/src/interface/api/utils/net/i-api-net.ts +93 -0
- package/src/interface/api/utils/net/i-http-response.ts +67 -0
- package/src/interface/click-outside/click-outside.ts +51 -0
- package/src/interface/command/command/i-command-option.ts +47 -0
- package/src/interface/command/command/i-command.ts +68 -0
- package/src/interface/command/disposable/i-disposable.ts +12 -0
- package/src/interface/command/i-command-controller.ts +50 -0
- package/src/interface/command/index.ts +11 -0
- package/src/interface/context/index.ts +42 -0
- package/src/interface/error/index.ts +13 -0
- package/src/interface/i-chat-message/i-chat-message.ts +16 -0
- package/src/interface/ibizsys/i-ibizsys.ts +33 -0
- package/src/interface/ibizsys/index.ts +1 -0
- package/src/interface/index.ts +11 -0
- package/src/interface/utils/i-18n.ts +22 -0
- package/src/interface/utils/index.ts +1 -0
- package/src/locale/en/index.ts +30 -0
- package/src/locale/index.ts +2 -0
- package/src/locale/zh-CN/index.ts +28 -0
- package/src/params/params.ts +131 -0
- package/src/types.ts +26 -0
- package/src/utils/bit-mask/bit-mask.ts +87 -0
- package/src/utils/click-outside/click-outside.ts +108 -0
- package/src/utils/clone/clone.ts +38 -0
- package/src/utils/color/color.ts +84 -0
- package/src/utils/cookie-util/cookie-util.ts +192 -0
- package/src/utils/data-type/data-types.ts +93 -0
- package/src/utils/download-file/download-file.ts +110 -0
- package/src/utils/event/event.ts +69 -0
- package/src/utils/history-list/history-item.ts +41 -0
- package/src/utils/history-list/history-list.ts +137 -0
- package/src/utils/index.ts +24 -0
- package/src/utils/interceptor/core-interceptor.ts +127 -0
- package/src/utils/interceptor/index.ts +2 -0
- package/src/utils/interceptor/interceptor.ts +122 -0
- package/src/utils/logger/logger.ts +34 -0
- package/src/utils/message-center/base/message-all.ts +10 -0
- package/src/utils/message-center/base/message-base.ts +73 -0
- package/src/utils/message-center/command/add-in-changed/command-add-in-changed.ts +23 -0
- package/src/utils/message-center/command/async-action/command-async-action.ts +23 -0
- package/src/utils/message-center/command/change/command-change.ts +11 -0
- package/src/utils/message-center/command/command-base/command-base.ts +35 -0
- package/src/utils/message-center/command/create/command-create.ts +25 -0
- package/src/utils/message-center/command/internal-message/command-internal-message.ts +26 -0
- package/src/utils/message-center/command/mark-open-data/command-mark-open-data.ts +23 -0
- package/src/utils/message-center/command/message-command.ts +162 -0
- package/src/utils/message-center/command/remove/command-remove.ts +25 -0
- package/src/utils/message-center/command/update/command-update.ts +25 -0
- package/src/utils/message-center/console/message-console.ts +27 -0
- package/src/utils/message-center/error/message-error.ts +27 -0
- package/src/utils/message-center/index.ts +1 -0
- package/src/utils/message-center/message-center.ts +77 -0
- package/src/utils/namespace/namespace.ts +217 -0
- package/src/utils/net/http-response.ts +60 -0
- package/src/utils/net/net.ts +448 -0
- package/src/utils/recursive/find-recursive-child.ts +238 -0
- package/src/utils/string-util/string-util.ts +76 -0
- package/src/utils/style/remote-style.ts +17 -0
- package/src/utils/sync/await-timeout.ts +29 -0
- package/src/utils/sync/count-latch.ts +79 -0
- package/src/utils/sync/index.ts +2 -0
- package/src/utils/types/types.ts +24 -0
- package/src/utils/upload/select-file.ts +93 -0
- package/src/utils/upload/upload-file.ts +194 -0
- package/src/utils/url-helper/url-helper.ts +52 -0
- package/src/utils/util/util.ts +580 -0
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
import {
|
|
2
|
+
AxiosRequestConfig,
|
|
3
|
+
AxiosResponse,
|
|
4
|
+
RawAxiosRequestHeaders,
|
|
5
|
+
} from 'axios';
|
|
6
|
+
import { IHttpResponse } from './i-http-response';
|
|
7
|
+
import { IApiData, IApiParams } from '../../global-param';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @description 网络请求工具
|
|
11
|
+
* @export
|
|
12
|
+
* @interface IApiNet
|
|
13
|
+
*/
|
|
14
|
+
export interface IApiNet {
|
|
15
|
+
/**
|
|
16
|
+
* @description Post 请求
|
|
17
|
+
* @param {string} url 请求地址
|
|
18
|
+
* @param {IApiData} data 请求数据
|
|
19
|
+
* @param {IApiParams} [params={}] 请求参数
|
|
20
|
+
* @param {RawAxiosRequestHeaders} [headers={}] 请求头
|
|
21
|
+
* @returns {*} {Promise<IHttpResponse>}
|
|
22
|
+
* @memberof IApiNet
|
|
23
|
+
*/
|
|
24
|
+
post(
|
|
25
|
+
url: string,
|
|
26
|
+
data: IApiData,
|
|
27
|
+
params?: IApiParams,
|
|
28
|
+
headers?: RawAxiosRequestHeaders,
|
|
29
|
+
): Promise<IHttpResponse>;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* @description Get 请求
|
|
33
|
+
* @param {string} url 请求地址
|
|
34
|
+
* @param {IApiParams} [params={}] 请求参数
|
|
35
|
+
* @param {RawAxiosRequestHeaders} [headers={}] 请求头
|
|
36
|
+
* @param {AxiosRequestConfig} [option={}] 请求配置
|
|
37
|
+
* @returns {*} {Promise<IHttpResponse>}
|
|
38
|
+
* @memberof IApiNet
|
|
39
|
+
*/
|
|
40
|
+
get(
|
|
41
|
+
url: string,
|
|
42
|
+
params?: IApiParams,
|
|
43
|
+
headers?: RawAxiosRequestHeaders,
|
|
44
|
+
option?: AxiosRequestConfig,
|
|
45
|
+
): Promise<IHttpResponse>;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @description Delete 请求
|
|
49
|
+
* @param {string} url 请求地址
|
|
50
|
+
* @param {IApiParams} [params] 请求参数
|
|
51
|
+
* @param {RawAxiosRequestHeaders} [headers] 请求头
|
|
52
|
+
* @returns {*} {Promise<IHttpResponse>}
|
|
53
|
+
* @memberof IApiNet
|
|
54
|
+
*/
|
|
55
|
+
delete(
|
|
56
|
+
url: string,
|
|
57
|
+
params?: IApiParams,
|
|
58
|
+
headers?: RawAxiosRequestHeaders,
|
|
59
|
+
): Promise<IHttpResponse>;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @description Put 请求
|
|
63
|
+
* @param {string} url 请求地址
|
|
64
|
+
* @param {IApiData} data 请求数据
|
|
65
|
+
* @param {IApiParams} [params={}] 请求参数
|
|
66
|
+
* @param {RawAxiosRequestHeaders} [headers={}] 请求头
|
|
67
|
+
* @returns {*} {Promise<IHttpResponse>}
|
|
68
|
+
* @memberof IApiNet
|
|
69
|
+
*/
|
|
70
|
+
put(
|
|
71
|
+
url: string,
|
|
72
|
+
data: IApiData,
|
|
73
|
+
params?: IApiParams,
|
|
74
|
+
headers?: RawAxiosRequestHeaders,
|
|
75
|
+
): Promise<IHttpResponse>;
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* @description 基础请求方法,会合并预置配置
|
|
79
|
+
* @param {string} url 请求地址
|
|
80
|
+
* @param {AxiosRequestConfig} [config={}] 请求配置
|
|
81
|
+
* @returns {*} {Promise<IHttpResponse>}
|
|
82
|
+
* @memberof IApiNet
|
|
83
|
+
*/
|
|
84
|
+
request(url: string, config?: AxiosRequestConfig): Promise<IHttpResponse>;
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* @description 创建标准 axios 请求,此方法会跳过预置网络拦截器
|
|
88
|
+
* @param {AxiosRequestConfig<IApiData>} config 请求配置
|
|
89
|
+
* @returns {*} {Promise<AxiosResponse>}
|
|
90
|
+
* @memberof IApiNet
|
|
91
|
+
*/
|
|
92
|
+
axios(config: AxiosRequestConfig<IApiData>): Promise<AxiosResponse>;
|
|
93
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { IApiData } from '../../global-param';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @description Http请求返回接口
|
|
6
|
+
* @export
|
|
7
|
+
* @interface IHttpResponse
|
|
8
|
+
* @extends {AxiosResponse}
|
|
9
|
+
* @template T
|
|
10
|
+
*/
|
|
11
|
+
export interface IHttpResponse<T = IApiData> extends AxiosResponse {
|
|
12
|
+
/**
|
|
13
|
+
* @description 是否请求成功,当状态码为 200-299 时认为成功
|
|
14
|
+
* @type {boolean}
|
|
15
|
+
* @memberof IHttpResponse
|
|
16
|
+
*/
|
|
17
|
+
ok: boolean;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @description 是否为本地仿造响应,只有当值为 true 时, 才认为是本地仿造响应
|
|
21
|
+
* @type {boolean}
|
|
22
|
+
* @memberof IHttpResponse
|
|
23
|
+
*/
|
|
24
|
+
local: boolean;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @description 响应数据
|
|
28
|
+
* @type {T}
|
|
29
|
+
* @memberof IHttpResponse
|
|
30
|
+
*/
|
|
31
|
+
data: T;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @description 当前页
|
|
35
|
+
* @type {number}
|
|
36
|
+
* @memberof IHttpResponse
|
|
37
|
+
*/
|
|
38
|
+
page?: number;
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @description 分页条数
|
|
42
|
+
* @type {number}
|
|
43
|
+
* @memberof IHttpResponse
|
|
44
|
+
*/
|
|
45
|
+
size?: number;
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* @description 总条数
|
|
49
|
+
* @type {number}
|
|
50
|
+
* @memberof IHttpResponse
|
|
51
|
+
*/
|
|
52
|
+
total?: number;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* @description 全部计数条数
|
|
56
|
+
* @type {number}
|
|
57
|
+
* @memberof IHttpResponse
|
|
58
|
+
*/
|
|
59
|
+
totalx?: number;
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* @description 总页数
|
|
63
|
+
* @type {number}
|
|
64
|
+
* @memberof IHttpResponse
|
|
65
|
+
*/
|
|
66
|
+
totalPages?: number;
|
|
67
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description 可选配置参数
|
|
3
|
+
* @export
|
|
4
|
+
* @interface OnClickOutsideOptions
|
|
5
|
+
*/
|
|
6
|
+
export interface OnClickOutsideOptions {
|
|
7
|
+
/**
|
|
8
|
+
* @description 指定使用的window,不给就用默认的window
|
|
9
|
+
* @type {Window}
|
|
10
|
+
* @memberof OnClickOutsideOptions
|
|
11
|
+
*/
|
|
12
|
+
window?: Window;
|
|
13
|
+
/**
|
|
14
|
+
* @description 指定需要忽略的元素,用于排除某些外部的元素
|
|
15
|
+
* @type {HTMLElement[]}
|
|
16
|
+
* @memberof OnClickOutsideOptions
|
|
17
|
+
*/
|
|
18
|
+
ignore?: HTMLElement[];
|
|
19
|
+
/**
|
|
20
|
+
* @description 是否捕获内部元素。默认为是,内部元素不会触发回调。
|
|
21
|
+
* @type {boolean}
|
|
22
|
+
* @memberof OnClickOutsideOptions
|
|
23
|
+
*/
|
|
24
|
+
capture?: boolean;
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
// 回调处理函数类型
|
|
28
|
+
export type OnClickOutsideHandler = (_evt: PointerEvent | MouseEvent) => void;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @description OnClickOutside返回对象类型
|
|
32
|
+
* @export
|
|
33
|
+
* @interface OnClickOutsideResult
|
|
34
|
+
*/
|
|
35
|
+
export interface OnClickOutsideResult {
|
|
36
|
+
/**
|
|
37
|
+
* @description 停止监听,并移除相关监听事件
|
|
38
|
+
* @memberof OnClickOutsideResult
|
|
39
|
+
*/
|
|
40
|
+
stop: () => void;
|
|
41
|
+
/**
|
|
42
|
+
* @description 暂停监听
|
|
43
|
+
* @memberof OnClickOutsideResult
|
|
44
|
+
*/
|
|
45
|
+
pause: () => void;
|
|
46
|
+
/**
|
|
47
|
+
* @description 继续监听
|
|
48
|
+
* @memberof OnClickOutsideResult
|
|
49
|
+
*/
|
|
50
|
+
proceed: () => void;
|
|
51
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
/**
|
|
3
|
+
* @description 指令参数, 主要用于在指令呈现时的展示参数
|
|
4
|
+
* @export
|
|
5
|
+
* @interface ICommandOption
|
|
6
|
+
*/
|
|
7
|
+
export interface ICommandOption {
|
|
8
|
+
/**
|
|
9
|
+
* @description 唯一标识符(必需)
|
|
10
|
+
* @type {string}
|
|
11
|
+
* @memberof ICommandOption
|
|
12
|
+
*/
|
|
13
|
+
readonly id: string;
|
|
14
|
+
/**
|
|
15
|
+
* @description 显示标题(必需)
|
|
16
|
+
* @type {string}
|
|
17
|
+
* @memberof ICommandOption
|
|
18
|
+
*/
|
|
19
|
+
readonly title: string;
|
|
20
|
+
/**
|
|
21
|
+
* @description 悬停提示(可选)
|
|
22
|
+
* @type {string}
|
|
23
|
+
* @memberof ICommandOption
|
|
24
|
+
*/
|
|
25
|
+
readonly tooltip?: string;
|
|
26
|
+
/**
|
|
27
|
+
* @description 描述(可选)
|
|
28
|
+
* @type {string}
|
|
29
|
+
* @memberof ICommandOption
|
|
30
|
+
*/
|
|
31
|
+
readonly description?: string;
|
|
32
|
+
/**
|
|
33
|
+
* @description svg图标(可选)
|
|
34
|
+
* @type {string}
|
|
35
|
+
* @memberof ICommandOption
|
|
36
|
+
*/
|
|
37
|
+
readonly icon?: string;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* @description 指令处理回调
|
|
42
|
+
* @export
|
|
43
|
+
* @interface ICommandHandler
|
|
44
|
+
*/
|
|
45
|
+
export interface ICommandHandler {
|
|
46
|
+
(...args: any[]): unknown | Promise<unknown>;
|
|
47
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { IDisposable } from '../disposable/i-disposable';
|
|
3
|
+
import { ICommandHandler, ICommandOption } from './i-command-option';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @description 指令声明
|
|
7
|
+
* @export
|
|
8
|
+
* @interface ICommand
|
|
9
|
+
*/
|
|
10
|
+
export interface ICommand {
|
|
11
|
+
id: string;
|
|
12
|
+
handler: ICommandHandler;
|
|
13
|
+
opts?: ICommandOption;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* 指令控制器集
|
|
18
|
+
*/
|
|
19
|
+
export type ICommandsMap = Map<string, ICommand>;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @description 指令注册器
|
|
23
|
+
* @export
|
|
24
|
+
* @interface ICommandRegistry
|
|
25
|
+
*/
|
|
26
|
+
export interface ICommandRegistry {
|
|
27
|
+
/**
|
|
28
|
+
* @description 注册指令
|
|
29
|
+
* @param {string} id 指令id
|
|
30
|
+
* @param {ICommandHandler} command 指令处理回调
|
|
31
|
+
* @param {ICommandOption} opts 指令参数
|
|
32
|
+
* @returns {*} {IDisposable} 指令释放对象
|
|
33
|
+
* @memberof ICommandRegistry
|
|
34
|
+
*/
|
|
35
|
+
registerCommand(
|
|
36
|
+
id: string,
|
|
37
|
+
command: ICommandHandler,
|
|
38
|
+
opts: ICommandOption,
|
|
39
|
+
): IDisposable;
|
|
40
|
+
/**
|
|
41
|
+
* @description 注册指令
|
|
42
|
+
* @param {string} id 指令id
|
|
43
|
+
* @param {ICommandHandler} command 指令处理回调
|
|
44
|
+
* @returns {*} {IDisposable} 指令释放对象
|
|
45
|
+
* @memberof ICommandRegistry
|
|
46
|
+
*/
|
|
47
|
+
registerCommand(id: string, command: ICommandHandler): IDisposable;
|
|
48
|
+
/**
|
|
49
|
+
* @description 注册指令
|
|
50
|
+
* @param {ICommand} command 指令
|
|
51
|
+
* @returns {*} {IDisposable} 指令释放对象
|
|
52
|
+
* @memberof ICommandRegistry
|
|
53
|
+
*/
|
|
54
|
+
registerCommand(command: ICommand): IDisposable;
|
|
55
|
+
/**
|
|
56
|
+
* @description 获取指令
|
|
57
|
+
* @param {string} id 指令id
|
|
58
|
+
* @returns {*} {(ICommand | undefined)}
|
|
59
|
+
* @memberof ICommandRegistry
|
|
60
|
+
*/
|
|
61
|
+
getCommand(id: string): ICommand | undefined;
|
|
62
|
+
/**
|
|
63
|
+
* @description 获取所有指令
|
|
64
|
+
* @returns {*} {ICommandsMap}
|
|
65
|
+
* @memberof ICommandRegistry
|
|
66
|
+
*/
|
|
67
|
+
getCommands(): ICommandsMap;
|
|
68
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { ICommandHandler, ICommandOption } from '../../command';
|
|
2
|
+
import { IDisposable } from './disposable/i-disposable';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @description 指令控制器接口
|
|
6
|
+
* @export
|
|
7
|
+
* @interface ICommandController
|
|
8
|
+
*/
|
|
9
|
+
export interface ICommandController {
|
|
10
|
+
/**
|
|
11
|
+
* @description 注册指令
|
|
12
|
+
* @param {string} id 指令id
|
|
13
|
+
* @param {ICommandHandler} handler 指令处理回调
|
|
14
|
+
* @param {ICommandOption} [opts] 指令参数
|
|
15
|
+
* @returns {*} {IDisposable} 指令释放对象
|
|
16
|
+
* @memberof ICommandController
|
|
17
|
+
*/
|
|
18
|
+
register(
|
|
19
|
+
id: string,
|
|
20
|
+
handler: ICommandHandler,
|
|
21
|
+
opts?: ICommandOption,
|
|
22
|
+
): IDisposable;
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @description 执行指令
|
|
26
|
+
* @template T
|
|
27
|
+
* @param {string} id 指令id
|
|
28
|
+
* @param {...unknown[]} args 指令参数
|
|
29
|
+
* @returns {*} {Promise<T>} 指令返回值
|
|
30
|
+
* @memberof ICommandController
|
|
31
|
+
*/
|
|
32
|
+
execute<T = undefined>(id: string, ...args: unknown[]): Promise<T>;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* @description 判断指令是否存在,没有则直接抛出异常
|
|
36
|
+
* @param {string} id 指令id
|
|
37
|
+
* @param {boolean} [err] 是否抛出异常
|
|
38
|
+
* @returns {*} {boolean} 是否存在
|
|
39
|
+
* @memberof ICommandController
|
|
40
|
+
*/
|
|
41
|
+
hasCommand(id: string, err?: boolean): boolean;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @description 获取指令参数
|
|
45
|
+
* @param {string} id 指令id
|
|
46
|
+
* @returns {*} {(ICommandOption | undefined)} 指令参数
|
|
47
|
+
* @memberof ICommandController
|
|
48
|
+
*/
|
|
49
|
+
getCommandOpts(id: string): ICommandOption | undefined;
|
|
50
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export type {
|
|
2
|
+
ICommand,
|
|
3
|
+
ICommandsMap,
|
|
4
|
+
ICommandRegistry,
|
|
5
|
+
} from './command/i-command';
|
|
6
|
+
export type {
|
|
7
|
+
ICommandOption,
|
|
8
|
+
ICommandHandler,
|
|
9
|
+
} from './command/i-command-option';
|
|
10
|
+
export type { IDisposable } from './disposable/i-disposable';
|
|
11
|
+
export type { ICommandController } from './i-command-controller';
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description 应用上下文处理接口
|
|
3
|
+
* @export
|
|
4
|
+
* @interface IIBizContext
|
|
5
|
+
* @extends {IContext}
|
|
6
|
+
*/
|
|
7
|
+
export interface IIBizContext extends IContext {
|
|
8
|
+
/**
|
|
9
|
+
* @description 返回自身的上下文,独有的和与父有差异的
|
|
10
|
+
* @returns {*} {IData}
|
|
11
|
+
* @memberof IIBizContext
|
|
12
|
+
*/
|
|
13
|
+
getOwnContext(): IData;
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @description 销毁当前上下文
|
|
17
|
+
* @memberof IIBizContext
|
|
18
|
+
*/
|
|
19
|
+
destroy(): void;
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @description 克隆当前上下文
|
|
23
|
+
* @returns {*} {IContext}
|
|
24
|
+
* @memberof IIBizContext
|
|
25
|
+
*/
|
|
26
|
+
clone(): IContext;
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @description 深度克隆
|
|
30
|
+
* @return {*} {IData}
|
|
31
|
+
* @memberof IIBizContext
|
|
32
|
+
*/
|
|
33
|
+
deepClone(): IData;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @description 在不改变对象引用的情况下,重置上下文,等效于重新实例化,但是引用不变
|
|
37
|
+
* @param {IData} [context] 默认值
|
|
38
|
+
* @param {IContext} [parent] 父上下文
|
|
39
|
+
* @memberof IIBizContext
|
|
40
|
+
*/
|
|
41
|
+
reset(context?: IData, parent?: IContext): void;
|
|
42
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { IPortalAsyncAction } from '../api';
|
|
2
|
+
import { IApiChatMessage } from '../api/chat-message';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* @description AI聊天消息
|
|
6
|
+
* @export
|
|
7
|
+
* @interface IChatMessage
|
|
8
|
+
*/
|
|
9
|
+
export interface IChatMessage extends IApiChatMessage {
|
|
10
|
+
/**
|
|
11
|
+
* @description 消息数据
|
|
12
|
+
* @type {(IPortalAsyncAction | IData | string | unknown)}
|
|
13
|
+
* @memberof IChatMessage
|
|
14
|
+
*/
|
|
15
|
+
data?: IPortalAsyncAction | IData | string | unknown;
|
|
16
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
import { Logger } from 'loglevel';
|
|
3
|
+
import { IApiIBizsys } from '../api';
|
|
4
|
+
import { ICommandController } from '../command';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @description 全局对象
|
|
8
|
+
* @export
|
|
9
|
+
* @interface IIBizsys
|
|
10
|
+
*/
|
|
11
|
+
export interface IIBizsys extends IApiIBizsys {
|
|
12
|
+
/**
|
|
13
|
+
* @description 日志输出工具
|
|
14
|
+
* @type {Logger}
|
|
15
|
+
* @memberof IIBizsys
|
|
16
|
+
*/
|
|
17
|
+
log: Logger;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* @description 指令控制器
|
|
21
|
+
* @type {ICommandController}
|
|
22
|
+
* @memberof IIBizsys
|
|
23
|
+
*/
|
|
24
|
+
commands: ICommandController;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* @description 注册全局扩展,用于替换预置能力
|
|
28
|
+
* @param {keyof IBizSys} key
|
|
29
|
+
* @param {*} value
|
|
30
|
+
* @memberof IIBizsys
|
|
31
|
+
*/
|
|
32
|
+
registerExtension(key: keyof IApiIBizsys, value: any): void;
|
|
33
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { IIBizsys } from './i-ibizsys';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { IOrgData } from './api/ibizsys/i-org-data';
|
|
2
|
+
|
|
3
|
+
export * from './api';
|
|
4
|
+
export * from './click-outside/click-outside';
|
|
5
|
+
export * from './command';
|
|
6
|
+
export * from './context';
|
|
7
|
+
export * from './error';
|
|
8
|
+
export type { IChatMessage } from './i-chat-message/i-chat-message';
|
|
9
|
+
export type OrgData = IOrgData;
|
|
10
|
+
export * from './ibizsys';
|
|
11
|
+
export * from './utils';
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { IApiI18n } from '../api';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @description 多语言工具接口
|
|
5
|
+
* @export
|
|
6
|
+
* @interface I18n
|
|
7
|
+
*/
|
|
8
|
+
export interface I18n extends IApiI18n {
|
|
9
|
+
/**
|
|
10
|
+
* @description 异步初始化,加载多语言文件
|
|
11
|
+
* @returns {*} {Promise<void>}
|
|
12
|
+
* @memberof I18n
|
|
13
|
+
*/
|
|
14
|
+
init(): Promise<void>;
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* @description 设置异步加载的多语言模块
|
|
18
|
+
* @param {Record<string, () => Promise<IData>>} languages
|
|
19
|
+
* @memberof I18n
|
|
20
|
+
*/
|
|
21
|
+
setLangConfigs(languages: Record<string, () => Promise<IData>>): void;
|
|
22
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type { I18n } from './i-18n';
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export const en = {
|
|
2
|
+
core: {
|
|
3
|
+
command: {
|
|
4
|
+
unregisteredCommand:
|
|
5
|
+
'Unregistered command: {id}, please register the command first',
|
|
6
|
+
},
|
|
7
|
+
error: {
|
|
8
|
+
networkAbnormality: 'Network abnormality, please try again later',
|
|
9
|
+
modelMsg: '「{id}」 model {msg}',
|
|
10
|
+
unsupportedModels: 'Unsupported models',
|
|
11
|
+
modelConfigurationMissing: 'Model Configuration Missing',
|
|
12
|
+
serviceException: 'Exception in service handling',
|
|
13
|
+
serviceResNotExist: 'Request resource path does not exist',
|
|
14
|
+
serviceResNotPermission: 'Requesting resources without permission',
|
|
15
|
+
},
|
|
16
|
+
utils: {
|
|
17
|
+
powerOfTwo: '{permission} is not a power of two.',
|
|
18
|
+
targetElement: 'The target element does not exist',
|
|
19
|
+
cannotFindWindow: 'Cannot find window',
|
|
20
|
+
unrealized: 'unrealized',
|
|
21
|
+
remoteStylesheet: 'Failed to load remote stylesheet',
|
|
22
|
+
notMatchLockUnlock: 'The lock and unlock counts do not match!',
|
|
23
|
+
multiApplicationMode:
|
|
24
|
+
'Multi-application mode waiting for reimplementation requests',
|
|
25
|
+
uploadFailed: '{file}Upload failed',
|
|
26
|
+
invalidInputValue: 'Invalid input value, must be >= 0',
|
|
27
|
+
},
|
|
28
|
+
noReInstall: 'ibiz already exists, no need to re-install it',
|
|
29
|
+
},
|
|
30
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
export const zhCn = {
|
|
2
|
+
core: {
|
|
3
|
+
command: {
|
|
4
|
+
unregisteredCommand: '未注册指令: {id},请先注册指令',
|
|
5
|
+
},
|
|
6
|
+
error: {
|
|
7
|
+
networkAbnormality: '网络异常,请稍后重试',
|
|
8
|
+
modelMsg: '「{id}」模型 {msg}',
|
|
9
|
+
unsupportedModels: '未支持的模型',
|
|
10
|
+
modelConfigurationMissing: '模型配置缺失',
|
|
11
|
+
serviceException: '服务处理异常',
|
|
12
|
+
serviceResNotExist: '请求资源路径不存在',
|
|
13
|
+
serviceResNotPermission: '请求资源无权限',
|
|
14
|
+
},
|
|
15
|
+
utils: {
|
|
16
|
+
powerOfTwo: '{permission}不是2的幂',
|
|
17
|
+
targetElement: 'target元素不存在',
|
|
18
|
+
cannotFindWindow: '找不到window',
|
|
19
|
+
unrealized: '未实现',
|
|
20
|
+
remoteStylesheet: '未实现加载远程样式表失败',
|
|
21
|
+
notMatchLockUnlock: 'lock和unlock次数不匹配!',
|
|
22
|
+
multiApplicationMode: '多应用模式等待重新实现请求',
|
|
23
|
+
uploadFailed: '{file}Upload failed',
|
|
24
|
+
invalidInputValue: '无效输入值,必须>=0',
|
|
25
|
+
},
|
|
26
|
+
noReInstall: 'ibiz 已经存在, 无需重复安装',
|
|
27
|
+
},
|
|
28
|
+
};
|