@ibiz-template/core 0.7.41-alpha.14 → 0.7.41-alpha.140
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 +118 -39
- package/dist/index.system.min.js +1 -1
- package/out/environment/environment.d.ts.map +1 -1
- package/out/environment/environment.js +10 -0
- package/out/error/http-error/http-error-factory.d.ts +1 -1
- package/out/error/http-error/http-error-factory.d.ts.map +1 -1
- package/out/error/http-error/http-error-factory.js +11 -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 +29 -1
- package/out/interface/api/environment/i-devtool-config.d.ts.map +1 -1
- package/out/interface/api/environment/i-environment.d.ts +146 -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 +5 -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/net/net.js +16 -6
- 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/out/utils/upload/select-file.d.ts.map +1 -1
- package/out/utils/upload/select-file.js +31 -15
- 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 +67 -0
- package/src/error/http-error/entity-error.ts +29 -0
- package/src/error/http-error/http-error-factory.ts +33 -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 +76 -0
- package/src/interface/api/environment/i-environment.ts +532 -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 +463 -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 +105 -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,103 @@
|
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-this-alias */
|
|
2
|
+
/* eslint-disable @typescript-eslint/ban-types */
|
|
3
|
+
/* eslint-disable func-names */
|
|
4
|
+
/* eslint-disable prefer-rest-params */
|
|
5
|
+
/* eslint-disable no-underscore-dangle */
|
|
6
|
+
import { IDisposable } from '../../interface';
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @description 创建一个只能执行一次的包装函数
|
|
10
|
+
* @export
|
|
11
|
+
* @template T 函数类型
|
|
12
|
+
* @param {unknown} this 函数执行上下文
|
|
13
|
+
* @param {T} fn 需要包装的原始函数
|
|
14
|
+
* @returns {*} {T} 包装后的函数,只会执行一次原始函数
|
|
15
|
+
*/
|
|
16
|
+
export function once<T extends Function>(this: unknown, fn: T): T {
|
|
17
|
+
const _this = this;
|
|
18
|
+
let didCall = false;
|
|
19
|
+
let result: unknown;
|
|
20
|
+
|
|
21
|
+
return function () {
|
|
22
|
+
if (didCall) {
|
|
23
|
+
return result;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
didCall = true;
|
|
27
|
+
result = fn.apply(_this, arguments);
|
|
28
|
+
|
|
29
|
+
return result;
|
|
30
|
+
} as unknown as T;
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* @description 将普通函数转换为一次性可销毁对象
|
|
35
|
+
* @export
|
|
36
|
+
* @param {() => void} fn 需要转换的函数
|
|
37
|
+
* @returns {*} {IDisposable} 可销毁对象
|
|
38
|
+
*/
|
|
39
|
+
export function toDisposable(fn: () => void): IDisposable {
|
|
40
|
+
const self = {
|
|
41
|
+
dispose: once(() => {
|
|
42
|
+
fn();
|
|
43
|
+
}),
|
|
44
|
+
};
|
|
45
|
+
return self;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @description 函数防抖
|
|
50
|
+
* @export
|
|
51
|
+
* @param {((...args: unknown[]) => void | Promise<void>)} func 要执行的函数
|
|
52
|
+
* @param {number} wait 延迟时间(毫秒)
|
|
53
|
+
* @param {boolean} [immediate] 是否立即执行
|
|
54
|
+
* @returns {*} {(...args: unknown[]) => void} 包装后的防抖函数
|
|
55
|
+
*/
|
|
56
|
+
export function debounce(
|
|
57
|
+
func: (...args: unknown[]) => void | Promise<void>,
|
|
58
|
+
wait: number,
|
|
59
|
+
immediate?: boolean,
|
|
60
|
+
): (...args: unknown[]) => void {
|
|
61
|
+
let timer: unknown;
|
|
62
|
+
|
|
63
|
+
return function (this: unknown, ...args: unknown[]): void {
|
|
64
|
+
if (timer) {
|
|
65
|
+
clearTimeout(timer as number);
|
|
66
|
+
}
|
|
67
|
+
if (immediate) {
|
|
68
|
+
const callNow = !timer;
|
|
69
|
+
timer = setTimeout(() => {
|
|
70
|
+
timer = null;
|
|
71
|
+
}, wait);
|
|
72
|
+
if (callNow) {
|
|
73
|
+
func.apply(this, args);
|
|
74
|
+
}
|
|
75
|
+
} else {
|
|
76
|
+
timer = setTimeout(() => {
|
|
77
|
+
func.apply(this, args);
|
|
78
|
+
}, wait);
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @description 节流函数,限制函数在指定时间间隔内只能执行一次
|
|
85
|
+
* @export
|
|
86
|
+
* @param {((...args: unknown[]) => void | Promise<void>)} fn 要执行的函数
|
|
87
|
+
* @param {number} wait 节流时间间隔(毫秒)
|
|
88
|
+
* @returns {*} {(...args: unknown[]) => void} 包装后的节流函数
|
|
89
|
+
*/
|
|
90
|
+
export function throttle(
|
|
91
|
+
fn: (...args: unknown[]) => void | Promise<void>,
|
|
92
|
+
wait: number,
|
|
93
|
+
): (...args: unknown[]) => void {
|
|
94
|
+
let timer: unknown = null;
|
|
95
|
+
return function (this: unknown, ...args: unknown[]): void {
|
|
96
|
+
if (!timer) {
|
|
97
|
+
timer = setTimeout(() => {
|
|
98
|
+
fn.apply(this, args);
|
|
99
|
+
timer = null;
|
|
100
|
+
}, wait);
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description 核心全局静态变量
|
|
3
|
+
* @export
|
|
4
|
+
* @class CoreConst
|
|
5
|
+
*/
|
|
6
|
+
export class CoreConst {
|
|
7
|
+
/**
|
|
8
|
+
* @description 默认模型服务标识
|
|
9
|
+
* @static
|
|
10
|
+
* @memberof CoreConst
|
|
11
|
+
*/
|
|
12
|
+
static readonly DEFAULT_MODEL_SERVICE_TAG = 'default';
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @description 访问令牌标识
|
|
16
|
+
* @static
|
|
17
|
+
* @memberof CoreConst
|
|
18
|
+
*/
|
|
19
|
+
static readonly TOKEN = 'ibzuaa-token';
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @description 刷新令牌标识
|
|
23
|
+
* @static
|
|
24
|
+
* @memberof CoreConst
|
|
25
|
+
*/
|
|
26
|
+
static readonly REFRESH_TOKEN = 'ibzuaa-refresh-token';
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* @description 访问令牌标识过期时间
|
|
30
|
+
* @static
|
|
31
|
+
* @memberof CoreConst
|
|
32
|
+
*/
|
|
33
|
+
static readonly TOKEN_EXPIRES = 'ibzuaa-token-expires';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* @description 认证信息是走记住我模式的 cookie 标识
|
|
37
|
+
* @static
|
|
38
|
+
* @memberof CoreConst
|
|
39
|
+
*/
|
|
40
|
+
static readonly TOKEN_REMEMBER = 'ibizuaa-token-remember';
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* @description 是否是匿名用户登录的 cookie 标识
|
|
44
|
+
* @static
|
|
45
|
+
* @memberof CoreConst
|
|
46
|
+
*/
|
|
47
|
+
static readonly IS_ANONYMOUS = 'ibizuaa-is-anonymous';
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* @description 存储访问相关数据键的集合名称
|
|
51
|
+
* @static
|
|
52
|
+
*/
|
|
53
|
+
static readonly ACCESS_STORE_AREA_KEYS = 'ibizuaa-access-store-area-keys';
|
|
54
|
+
}
|