@gct-paas/core 0.1.4-dev.3 → 0.1.4-dev.4
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.min.cjs +1 -1
- package/dist/index.system.min.js +1 -1
- package/es/controller/form/form.controller.mjs +1 -2
- package/es/controller/gct-form/gct-form.controller.mjs +1 -2
- package/es/global/gct/gct.d.ts +1 -1
- package/es/interface/controller/form/form.controller.mjs +1 -1
- package/es/interface/hooks/i-designer-hooks.mjs +1 -1
- package/es/interface/i-modal/i-modal.mjs +1 -1
- package/es/modules/api-service/api-manage.mjs +1 -1
- package/es/modules/api-service/api-service.interface.d.ts +2 -2
- package/es/modules/api-service/api-service.interface.mjs +2 -2
- package/es/modules/api-service/api-service.mjs +1 -1
- package/es/modules/api-service/index.mjs +2 -4
- package/es/modules/env-manager/env-manager.d.ts +1 -1
- package/es/modules/env-manager/env-manager.interface.d.ts +1 -1
- package/es/modules/platform-config/useBasicSetting.d.ts +2 -2
- package/es/modules/platform-config/useDeploySetting.d.ts +1 -1
- package/es/modules/platform-config/useLoginSetting.d.ts +1 -1
- package/es/modules/platform-config/useOrgSetting.d.ts +1 -1
- package/es/modules/platform-config/useSecuritySetting.d.ts +1 -1
- package/es/modules/platform-config/useThemeSetting.d.ts +1 -1
- package/es/modules/platform-config/useWatermarkSetting.d.ts +1 -1
- package/es/register/designer-register/designer-register.mjs +1 -2
- package/es/register/render-register/render-register.mjs +1 -2
- package/es/store/global-store.mjs +1 -1
- package/es/types/index.d.ts +2 -2
- package/es/utils/plugin-pkg-util/plugin-pkg-util.mjs +1 -1
- package/es/utils/plugin-static-resource/plugin-static-resource.mjs +1 -1
- package/es/utils/tools/tools.mjs +1 -2
- package/package.json +6 -8
- package/es/_virtual/_commonjs-dynamic-modules.mjs +0 -5
- package/es/_virtual/_commonjsHelpers.mjs +0 -44
- package/es/_virtual/aes.mjs +0 -3
- package/es/_virtual/blowfish.mjs +0 -3
- package/es/_virtual/cipher-core.mjs +0 -3
- package/es/_virtual/core.mjs +0 -3
- package/es/_virtual/enc-base64.mjs +0 -3
- package/es/_virtual/enc-base64url.mjs +0 -3
- package/es/_virtual/enc-utf16.mjs +0 -3
- package/es/_virtual/evpkdf.mjs +0 -3
- package/es/_virtual/format-hex.mjs +0 -3
- package/es/_virtual/hmac.mjs +0 -3
- package/es/_virtual/index.mjs +0 -7
- package/es/_virtual/index2.mjs +0 -7
- package/es/_virtual/index3.mjs +0 -3
- package/es/_virtual/lib-typedarrays.mjs +0 -3
- package/es/_virtual/md5.mjs +0 -3
- package/es/_virtual/mode-cfb.mjs +0 -3
- package/es/_virtual/mode-ctr-gladman.mjs +0 -3
- package/es/_virtual/mode-ctr.mjs +0 -3
- package/es/_virtual/mode-ecb.mjs +0 -3
- package/es/_virtual/mode-ofb.mjs +0 -3
- package/es/_virtual/pad-ansix923.mjs +0 -3
- package/es/_virtual/pad-iso10126.mjs +0 -3
- package/es/_virtual/pad-iso97971.mjs +0 -3
- package/es/_virtual/pad-nopadding.mjs +0 -3
- package/es/_virtual/pad-zeropadding.mjs +0 -3
- package/es/_virtual/pbkdf2.mjs +0 -3
- package/es/_virtual/rabbit-legacy.mjs +0 -3
- package/es/_virtual/rabbit.mjs +0 -3
- package/es/_virtual/rc4.mjs +0 -3
- package/es/_virtual/ripemd160.mjs +0 -3
- package/es/_virtual/sha1.mjs +0 -3
- package/es/_virtual/sha224.mjs +0 -3
- package/es/_virtual/sha256.mjs +0 -3
- package/es/_virtual/sha3.mjs +0 -3
- package/es/_virtual/sha384.mjs +0 -3
- package/es/_virtual/sha512.mjs +0 -3
- package/es/_virtual/tripledes.mjs +0 -3
- package/es/_virtual/x64-core.mjs +0 -3
- package/es/node_modules/.pnpm/@gct-paas_api-apaas@0.0.2-dev.4/node_modules/@gct-paas/api-apaas/es/index.mjs +0 -3
- package/es/node_modules/.pnpm/@gct-paas_api-apaas@0.0.2-dev.4/node_modules/@gct-paas/api-apaas/es/service/api-config.mjs +0 -8213
- package/es/node_modules/.pnpm/@gct-paas_api-platform@0.0.2-dev.4/node_modules/@gct-paas/api-platform/es/index.mjs +0 -3
- package/es/node_modules/.pnpm/@gct-paas_api-platform@0.0.2-dev.4/node_modules/@gct-paas/api-platform/es/service/api-config.mjs +0 -7156
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/aes.mjs +0 -255
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/blowfish.mjs +0 -492
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/cipher-core.mjs +0 -913
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/core.mjs +0 -824
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64.mjs +0 -153
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-base64url.mjs +0 -165
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/enc-utf16.mjs +0 -166
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/evpkdf.mjs +0 -153
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/format-hex.mjs +0 -84
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/hmac.mjs +0 -160
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/index.mjs +0 -69
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/lib-typedarrays.mjs +0 -93
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/md5.mjs +0 -285
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-cfb.mjs +0 -98
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr-gladman.mjs +0 -134
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ctr.mjs +0 -76
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ecb.mjs +0 -58
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/mode-ofb.mjs +0 -72
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-ansix923.mjs +0 -67
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso10126.mjs +0 -62
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-iso97971.mjs +0 -58
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-nopadding.mjs +0 -48
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pad-zeropadding.mjs +0 -65
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/pbkdf2.mjs +0 -164
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit-legacy.mjs +0 -211
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rabbit.mjs +0 -213
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/rc4.mjs +0 -160
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/ripemd160.mjs +0 -284
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha1.mjs +0 -167
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha224.mjs +0 -98
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha256.mjs +0 -216
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha3.mjs +0 -344
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha384.mjs +0 -102
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/sha512.mjs +0 -344
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/tripledes.mjs +0 -800
- package/es/node_modules/.pnpm/crypto-js@4.2.0/node_modules/crypto-js/x64-core.mjs +0 -321
- package/es/node_modules/.pnpm/path-browserify@1.0.1/node_modules/path-browserify/index.mjs +0 -541
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/hook/async-series-hook/async-series-hook.mjs +0 -73
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/hook/index.mjs +0 -2
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/hook/sync-series-hook/sync-series-hook.mjs +0 -100
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/index.mjs +0 -2
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/array/array.mjs +0 -47
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/index.mjs +0 -5
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/object/object.mjs +0 -24
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/qx-event/qx-event.mjs +0 -94
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/qx-event-emitter/qx-event-emitter.mjs +0 -146
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/type-util/type-util.mjs +0 -149
- package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/util/util.mjs +0 -227
|
@@ -1,100 +0,0 @@
|
|
|
1
|
-
import '../../utils/index.mjs';
|
|
2
|
-
import { isFunc } from '../../utils/type-util/type-util.mjs';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 串联钩子,按照注册顺序执行
|
|
6
|
-
*
|
|
7
|
-
* @export
|
|
8
|
-
* @class SyncSeriesHook
|
|
9
|
-
* @template T 输入值类型
|
|
10
|
-
* @template C 上下文声明对象
|
|
11
|
-
*/
|
|
12
|
-
class SyncSeriesHook {
|
|
13
|
-
constructor() {
|
|
14
|
-
/**
|
|
15
|
-
* 已注册的钩子回调
|
|
16
|
-
*
|
|
17
|
-
* @protected
|
|
18
|
-
* @type {IHookCallItem[]}
|
|
19
|
-
* @memberof SyncSeriesHook
|
|
20
|
-
*/
|
|
21
|
-
this.items = [];
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* 当前注册钩子个数
|
|
25
|
-
*
|
|
26
|
-
* @author chitanda
|
|
27
|
-
* @date 2021-04-30 14:04:43
|
|
28
|
-
* @readonly
|
|
29
|
-
* @type {number}
|
|
30
|
-
*/
|
|
31
|
-
get size() {
|
|
32
|
-
return this.items.length;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* 触发钩子,当某个钩子返回「null」时,中断后续执行。
|
|
36
|
-
*
|
|
37
|
-
* @param {C} context
|
|
38
|
-
* @param {...AsArray<T>} args
|
|
39
|
-
* @return {*} {C}
|
|
40
|
-
* @memberof SyncSeriesHook
|
|
41
|
-
*/
|
|
42
|
-
callSync(context, ...args) {
|
|
43
|
-
const _context = context || Object.create({});
|
|
44
|
-
let bol;
|
|
45
|
-
for (let i = 0; i < this.items.length; i++) {
|
|
46
|
-
const item = this.items[i];
|
|
47
|
-
if (item.fn) {
|
|
48
|
-
bol = item.fn(_context, ...args);
|
|
49
|
-
}
|
|
50
|
-
if (bol === null) {
|
|
51
|
-
console.warn(`因${item.fn ? item.fn.name : null}方法返回值为「null」,钩子中断执行。`, item);
|
|
52
|
-
break;
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
return _context;
|
|
56
|
-
}
|
|
57
|
-
/**
|
|
58
|
-
* 注册钩子
|
|
59
|
-
*
|
|
60
|
-
* @param {((...args: AsArray<T>) => void)} fn 回调
|
|
61
|
-
* @memberof SyncSeriesHook
|
|
62
|
-
*/
|
|
63
|
-
tap(fn) {
|
|
64
|
-
if (fn && isFunc(fn)) {
|
|
65
|
-
const opt = {
|
|
66
|
-
mode: 'sync',
|
|
67
|
-
};
|
|
68
|
-
opt.fn = fn;
|
|
69
|
-
this.items.push(opt);
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* 删除钩子注册
|
|
74
|
-
*
|
|
75
|
-
* @author chitanda
|
|
76
|
-
* @date 2021-04-30 14:04:31
|
|
77
|
-
* @param {(context: C, ...args: AsArray<T>) => void} callBack
|
|
78
|
-
*/
|
|
79
|
-
removeTap(callBack) {
|
|
80
|
-
if (callBack) {
|
|
81
|
-
for (let i = 0; i < this.items.length; i++) {
|
|
82
|
-
const item = this.items[i];
|
|
83
|
-
if (callBack === item.fn) {
|
|
84
|
-
this.items.splice(i, 1);
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
/**
|
|
90
|
-
* 释放已注册的钩子
|
|
91
|
-
*
|
|
92
|
-
* @author chitanda
|
|
93
|
-
* @date 2022-08-15 22:08:44
|
|
94
|
-
*/
|
|
95
|
-
clear() {
|
|
96
|
-
this.items = [];
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
export { SyncSeriesHook };
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 正序排序
|
|
3
|
-
*
|
|
4
|
-
* @export
|
|
5
|
-
* @param {any[]} list 需要排序的数据
|
|
6
|
-
* @param {string} [sortField] 排序字段,无排序字段对比本身
|
|
7
|
-
* @return {*} {any[]}
|
|
8
|
-
*/
|
|
9
|
-
function ascSort(list, sortField) {
|
|
10
|
-
return list.sort((a, b) => {
|
|
11
|
-
const v1 = sortField ? a[sortField] : a;
|
|
12
|
-
const v2 = sortField ? b[sortField] : b;
|
|
13
|
-
if (v1 > v2) {
|
|
14
|
-
return 1;
|
|
15
|
-
}
|
|
16
|
-
if (v1 < v2) {
|
|
17
|
-
return -1;
|
|
18
|
-
}
|
|
19
|
-
return 0;
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* 倒叙排序
|
|
24
|
-
*
|
|
25
|
-
* @author chitanda
|
|
26
|
-
* @date 2022-08-30 14:08:10
|
|
27
|
-
* @export
|
|
28
|
-
* @template T
|
|
29
|
-
* @param {T[]} list 需要排序的数据
|
|
30
|
-
* @param {string} [sortField] 排序字段,无排序字段对比本身
|
|
31
|
-
* @return {*} {T[]}
|
|
32
|
-
*/
|
|
33
|
-
function descSort(list, sortField) {
|
|
34
|
-
return list.sort((a, b) => {
|
|
35
|
-
const v1 = sortField ? a[sortField] : a;
|
|
36
|
-
const v2 = sortField ? b[sortField] : b;
|
|
37
|
-
if (v1 < v2) {
|
|
38
|
-
return 1;
|
|
39
|
-
}
|
|
40
|
-
if (v1 > v2) {
|
|
41
|
-
return -1;
|
|
42
|
-
}
|
|
43
|
-
return 0;
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
export { ascSort, descSort };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { ascSort, descSort } from './array/array.mjs';
|
|
2
|
-
export { clearAll } from './object/object.mjs';
|
|
3
|
-
export { QXEvent } from './qx-event/qx-event.mjs';
|
|
4
|
-
export { isArray, isAsync, isBoolean, isFunc, isMap, isNumber, isObject, isPromise, isSet, isString, isWeakMap, typeOf } from './type-util/type-util.mjs';
|
|
5
|
-
export { clearCookie, createUUID, formatHttpParams, generateOrderValue, getCookie, getQueryVariable, isNilOrEmpty, notNilEmpty, setCookie, setUrlQuery } from './util/util.mjs';
|
package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/object/object.mjs
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 在不改变内存地址的情况下,清空「对象、数组」内的值。
|
|
3
|
-
*
|
|
4
|
-
* @export
|
|
5
|
-
* @param {unknown} data
|
|
6
|
-
*/
|
|
7
|
-
function clearAll(data) {
|
|
8
|
-
if (data instanceof Array) {
|
|
9
|
-
if (data && data.length > 0) {
|
|
10
|
-
data.splice(0, data.length);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
else if (data instanceof Object) {
|
|
14
|
-
if (data) {
|
|
15
|
-
for (const key in data) {
|
|
16
|
-
if (Object.prototype.hasOwnProperty.call(data, key)) {
|
|
17
|
-
delete data[key];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { clearAll };
|
package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/qx-event/qx-event.mjs
DELETED
|
@@ -1,94 +0,0 @@
|
|
|
1
|
-
import { QXEventEmitter } from '../qx-event-emitter/qx-event-emitter.mjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 事件
|
|
5
|
-
*
|
|
6
|
-
* @author chitanda
|
|
7
|
-
* @date 2022-08-30 13:08:53
|
|
8
|
-
* @export
|
|
9
|
-
* @class QXEvent
|
|
10
|
-
* @template T
|
|
11
|
-
*/
|
|
12
|
-
class QXEvent {
|
|
13
|
-
/**
|
|
14
|
-
* Creates an instance of QXEvent.
|
|
15
|
-
* @param {number} [maxListeners] 最大单个事件监听个数
|
|
16
|
-
* @memberof QXEvent
|
|
17
|
-
*/
|
|
18
|
-
constructor(maxListeners) {
|
|
19
|
-
this.e = new QXEventEmitter();
|
|
20
|
-
// 设置最大监控事件数量
|
|
21
|
-
this.e.setMaxListeners(maxListeners || 300);
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* 获取指定事件当前监听个数
|
|
25
|
-
*
|
|
26
|
-
* @author chitanda
|
|
27
|
-
* @date 2022-10-26 19:10:39
|
|
28
|
-
* @template K
|
|
29
|
-
* @param {K} name
|
|
30
|
-
* @return {*} {number}
|
|
31
|
-
*/
|
|
32
|
-
getSize(name) {
|
|
33
|
-
return this.e.getSize(name);
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* 订阅事件
|
|
37
|
-
*
|
|
38
|
-
* @author chitanda
|
|
39
|
-
* @date 2022-08-21 18:08:31
|
|
40
|
-
* @template K
|
|
41
|
-
* @param {K} name
|
|
42
|
-
* @param {(...args: Parameters<T[K]>) => ReturnType<T[K]>} cb
|
|
43
|
-
*/
|
|
44
|
-
on(name, cb) {
|
|
45
|
-
this.e.addListener(name, cb);
|
|
46
|
-
}
|
|
47
|
-
/**
|
|
48
|
-
* 取消订阅事件
|
|
49
|
-
*
|
|
50
|
-
* @author chitanda
|
|
51
|
-
* @date 2022-08-21 18:08:46
|
|
52
|
-
* @template K
|
|
53
|
-
* @param {K} name
|
|
54
|
-
* @param {(...args: Parameters<T[K]>) => ReturnType<T[K]>} cb
|
|
55
|
-
*/
|
|
56
|
-
off(name, cb) {
|
|
57
|
-
this.e.removeListener(name, cb);
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* 发送事件
|
|
61
|
-
*
|
|
62
|
-
* @template K
|
|
63
|
-
* @param {K} name
|
|
64
|
-
* @param {T[K]} [arg]
|
|
65
|
-
* @memberof QXEvent
|
|
66
|
-
*/
|
|
67
|
-
emit(name, ...args) {
|
|
68
|
-
this.e.emit(name, ...args);
|
|
69
|
-
}
|
|
70
|
-
/**
|
|
71
|
-
* 发送事件,并等待所有监听器执行完毕
|
|
72
|
-
*
|
|
73
|
-
* @author chitanda
|
|
74
|
-
* @date 2022-08-21 18:08:30
|
|
75
|
-
* @template K
|
|
76
|
-
* @param {K} name
|
|
77
|
-
* @param {...Parameters<T[K]>} args
|
|
78
|
-
* @return {*} {(Promise<Awaited<ReturnType<T[K]>>[]>)}
|
|
79
|
-
*/
|
|
80
|
-
asyncEmit(name, ...args) {
|
|
81
|
-
return this.e.asyncEmit(name, ...args);
|
|
82
|
-
}
|
|
83
|
-
/**
|
|
84
|
-
* 释放所有事件监听
|
|
85
|
-
*
|
|
86
|
-
* @author chitanda
|
|
87
|
-
* @date 2022-08-30 17:08:09
|
|
88
|
-
*/
|
|
89
|
-
reset() {
|
|
90
|
-
this.e.reset();
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
|
|
94
|
-
export { QXEvent };
|
|
@@ -1,146 +0,0 @@
|
|
|
1
|
-
import { clearAll } from '../object/object.mjs';
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* 事件
|
|
5
|
-
*
|
|
6
|
-
* @author chitanda
|
|
7
|
-
* @date 2022-08-30 17:08:14
|
|
8
|
-
* @export
|
|
9
|
-
* @class QXEventEmitter
|
|
10
|
-
*/
|
|
11
|
-
class QXEventEmitter {
|
|
12
|
-
constructor() {
|
|
13
|
-
/**
|
|
14
|
-
* 事件组
|
|
15
|
-
*
|
|
16
|
-
* @private
|
|
17
|
-
* @type {Map<string, any[]>}
|
|
18
|
-
* @memberof QXEventEmitter
|
|
19
|
-
*/
|
|
20
|
-
this.map = new Map();
|
|
21
|
-
/**
|
|
22
|
-
* 最大事件监听数量
|
|
23
|
-
*
|
|
24
|
-
* @private
|
|
25
|
-
* @type {number}
|
|
26
|
-
* @memberof QXEventEmitter
|
|
27
|
-
*/
|
|
28
|
-
this.maxListeners = 100;
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* 设置单个事件最大监听数量
|
|
32
|
-
*
|
|
33
|
-
* @param {number} num
|
|
34
|
-
* @memberof QXEventEmitter
|
|
35
|
-
*/
|
|
36
|
-
setMaxListeners(num) {
|
|
37
|
-
this.maxListeners = num;
|
|
38
|
-
}
|
|
39
|
-
/**
|
|
40
|
-
* 获取指定事件当前监听个数
|
|
41
|
-
*
|
|
42
|
-
* @author chitanda
|
|
43
|
-
* @date 2022-10-26 19:10:54
|
|
44
|
-
* @param {string} name
|
|
45
|
-
* @return {*} {number}
|
|
46
|
-
*/
|
|
47
|
-
getSize(name) {
|
|
48
|
-
if (this.map.has(name)) {
|
|
49
|
-
const events = this.map.get(name);
|
|
50
|
-
return events.length;
|
|
51
|
-
}
|
|
52
|
-
return 0;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* 订阅事件
|
|
56
|
-
*
|
|
57
|
-
* @author chitanda
|
|
58
|
-
* @date 2022-08-21 18:08:36
|
|
59
|
-
* @param {string} name
|
|
60
|
-
* @param {(...args: AsArray<any>) => unknown} fn
|
|
61
|
-
*/
|
|
62
|
-
addListener(name, fn) {
|
|
63
|
-
if (fn instanceof Function) {
|
|
64
|
-
if (!this.map.has(name)) {
|
|
65
|
-
this.map.set(name, []);
|
|
66
|
-
}
|
|
67
|
-
const events = this.map.get(name);
|
|
68
|
-
if (events.length < this.maxListeners) {
|
|
69
|
-
events.push(fn);
|
|
70
|
-
}
|
|
71
|
-
else {
|
|
72
|
-
throw new Error(`事件监听已达最大上限[${this.maxListeners}],无法新增监听!`);
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* 取消订阅
|
|
78
|
-
*
|
|
79
|
-
* @author chitanda
|
|
80
|
-
* @date 2022-08-21 18:08:30
|
|
81
|
-
* @param {string} name
|
|
82
|
-
* @param {(...args: AsArray<any>) => unknown} fn
|
|
83
|
-
*/
|
|
84
|
-
removeListener(name, fn) {
|
|
85
|
-
if (this.map.has(name)) {
|
|
86
|
-
const events = this.map.get(name);
|
|
87
|
-
if (events.length > 0) {
|
|
88
|
-
for (let i = 0; i < events.length; i++) {
|
|
89
|
-
const item = events[i];
|
|
90
|
-
if (item === fn) {
|
|
91
|
-
events.splice(i, 1);
|
|
92
|
-
break;
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* 发送事件
|
|
100
|
-
*
|
|
101
|
-
* @author chitanda
|
|
102
|
-
* @date 2022-08-21 18:08:00
|
|
103
|
-
* @param {string} name
|
|
104
|
-
* @param {...AsArray<any>} args
|
|
105
|
-
*/
|
|
106
|
-
emit(name, ...args) {
|
|
107
|
-
if (this.map.has(name)) {
|
|
108
|
-
const events = this.map.get(name);
|
|
109
|
-
events.forEach((fn) => {
|
|
110
|
-
fn(...args);
|
|
111
|
-
});
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
/**
|
|
115
|
-
* 等待所有事件执行完毕
|
|
116
|
-
*
|
|
117
|
-
* @author chitanda
|
|
118
|
-
* @date 2022-08-21 18:08:44
|
|
119
|
-
* @template R
|
|
120
|
-
* @param {string} name
|
|
121
|
-
* @param {...AsArray<any>} args
|
|
122
|
-
* @return {*} {Promise<R[]>}
|
|
123
|
-
*/
|
|
124
|
-
async asyncEmit(name, ...args) {
|
|
125
|
-
if (this.map.has(name)) {
|
|
126
|
-
const events = this.map.get(name);
|
|
127
|
-
const all = events.map((fn) => fn(...args));
|
|
128
|
-
return Promise.all(all);
|
|
129
|
-
}
|
|
130
|
-
return [];
|
|
131
|
-
}
|
|
132
|
-
/**
|
|
133
|
-
* 释放所有事件监听
|
|
134
|
-
*
|
|
135
|
-
* @author chitanda
|
|
136
|
-
* @date 2022-08-30 17:08:04
|
|
137
|
-
*/
|
|
138
|
-
reset() {
|
|
139
|
-
this.map.forEach(val => {
|
|
140
|
-
clearAll(val);
|
|
141
|
-
});
|
|
142
|
-
this.map.clear();
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
export { QXEventEmitter };
|
package/es/node_modules/.pnpm/qx-util@0.4.8/node_modules/qx-util/out/utils/type-util/type-util.mjs
DELETED
|
@@ -1,149 +0,0 @@
|
|
|
1
|
-
const { toString } = Object.prototype;
|
|
2
|
-
/**
|
|
3
|
-
* 是否为方法
|
|
4
|
-
*
|
|
5
|
-
* @export
|
|
6
|
-
* @param {*} fn 需要判断的方法
|
|
7
|
-
* @return {*} {boolean}
|
|
8
|
-
*/
|
|
9
|
-
function isFunc(fn) {
|
|
10
|
-
return typeOf(fn) === 'function';
|
|
11
|
-
}
|
|
12
|
-
/**
|
|
13
|
-
* 是否为异步方法
|
|
14
|
-
*
|
|
15
|
-
* @export
|
|
16
|
-
* @param {*} fn 需要判断的方法
|
|
17
|
-
* @return {*} {boolean}
|
|
18
|
-
*/
|
|
19
|
-
function isAsync(fn) {
|
|
20
|
-
return toString.call(fn) === '[object AsyncFunction]';
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* 是否为Promise对象
|
|
24
|
-
*
|
|
25
|
-
* @export
|
|
26
|
-
* @param {*} obj
|
|
27
|
-
* @return {*} {boolean}
|
|
28
|
-
*/
|
|
29
|
-
function isPromise(obj) {
|
|
30
|
-
return toString.call(obj) === '[object Promise]';
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* 是否为对象类型
|
|
34
|
-
*
|
|
35
|
-
* @export
|
|
36
|
-
* @param {*} obj
|
|
37
|
-
* @return {*} {boolean}
|
|
38
|
-
*/
|
|
39
|
-
function isObject(obj) {
|
|
40
|
-
return typeOf(obj) === 'object';
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* 是否为数组类型
|
|
44
|
-
*
|
|
45
|
-
* @export
|
|
46
|
-
* @param {*} obj
|
|
47
|
-
* @return {*} {boolean}
|
|
48
|
-
*/
|
|
49
|
-
function isArray(obj) {
|
|
50
|
-
return typeOf(obj) === 'array';
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* 是否为 Map 类型
|
|
54
|
-
*
|
|
55
|
-
* @author chitanda
|
|
56
|
-
* @date 2022-09-07 23:09:05
|
|
57
|
-
* @export
|
|
58
|
-
* @param {unknown} obj
|
|
59
|
-
* @return {*} {boolean}
|
|
60
|
-
*/
|
|
61
|
-
function isMap(obj) {
|
|
62
|
-
return typeOf(obj) === 'map';
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* 是否为 WeakMap 类型
|
|
66
|
-
*
|
|
67
|
-
* @author chitanda
|
|
68
|
-
* @date 2022-09-07 23:09:25
|
|
69
|
-
* @export
|
|
70
|
-
* @param {unknown} obj
|
|
71
|
-
* @return {*} {boolean}
|
|
72
|
-
*/
|
|
73
|
-
function isWeakMap(obj) {
|
|
74
|
-
return typeOf(obj) === 'weakmap';
|
|
75
|
-
}
|
|
76
|
-
/**
|
|
77
|
-
* 是否为 Set 类型
|
|
78
|
-
*
|
|
79
|
-
* @author chitanda
|
|
80
|
-
* @date 2022-09-07 23:09:54
|
|
81
|
-
* @export
|
|
82
|
-
* @param {unknown} obj
|
|
83
|
-
* @return {*} {boolean}
|
|
84
|
-
*/
|
|
85
|
-
function isSet(obj) {
|
|
86
|
-
return typeOf(obj) === 'set';
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* 是否为字符串类型
|
|
90
|
-
*
|
|
91
|
-
* @export
|
|
92
|
-
* @param {*} obj
|
|
93
|
-
* @return {*} {boolean}
|
|
94
|
-
*/
|
|
95
|
-
function isString(obj) {
|
|
96
|
-
return typeOf(obj) === 'string';
|
|
97
|
-
}
|
|
98
|
-
/**
|
|
99
|
-
* 是否为数值类型
|
|
100
|
-
*
|
|
101
|
-
* @export
|
|
102
|
-
* @param {*} obj
|
|
103
|
-
* @return {*} {boolean}
|
|
104
|
-
*/
|
|
105
|
-
function isNumber(obj) {
|
|
106
|
-
return typeOf(obj) === 'number';
|
|
107
|
-
}
|
|
108
|
-
/**
|
|
109
|
-
* 是否为布尔类型
|
|
110
|
-
*
|
|
111
|
-
* @export
|
|
112
|
-
* @param {*} obj
|
|
113
|
-
* @return {*} {boolean}
|
|
114
|
-
*/
|
|
115
|
-
function isBoolean(obj) {
|
|
116
|
-
return typeOf(obj) === 'boolean';
|
|
117
|
-
}
|
|
118
|
-
/**
|
|
119
|
-
* 支持判断的数据类型
|
|
120
|
-
*/
|
|
121
|
-
const typeMap = {
|
|
122
|
-
'[object Boolean]': 'boolean',
|
|
123
|
-
'[object Number]': 'number',
|
|
124
|
-
'[object String]': 'string',
|
|
125
|
-
'[object Function]': 'function',
|
|
126
|
-
'[object Array]': 'array',
|
|
127
|
-
'[object Date]': 'date',
|
|
128
|
-
'[object RegExp]': 'regExp',
|
|
129
|
-
'[object Undefined]': 'undefined',
|
|
130
|
-
'[object Null]': 'null',
|
|
131
|
-
'[object Object]': 'object',
|
|
132
|
-
'[object Set]': 'set',
|
|
133
|
-
'[object Map]': 'map',
|
|
134
|
-
'[object WeakMap]': 'weakmap',
|
|
135
|
-
};
|
|
136
|
-
/**
|
|
137
|
-
* 判断数据类型
|
|
138
|
-
*
|
|
139
|
-
* @author chitanda
|
|
140
|
-
* @date 2021-05-18 11:05:23
|
|
141
|
-
* @export
|
|
142
|
-
* @param {*} obj 需要判断的数据
|
|
143
|
-
* @return {*} {('boolean' | 'number' | 'string' | 'function' | 'array' | 'date' | 'regExp' | 'undefined' | 'null' | 'object')}
|
|
144
|
-
*/
|
|
145
|
-
function typeOf(obj) {
|
|
146
|
-
return typeMap[toString.call(obj)];
|
|
147
|
-
}
|
|
148
|
-
|
|
149
|
-
export { isArray, isAsync, isBoolean, isFunc, isMap, isNumber, isObject, isPromise, isSet, isString, isWeakMap, typeOf };
|