@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
@@ -1 +1 @@
1
- {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/environment/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAiC,MAAM,cAAc,CAAC;AAE3E,eAAO,MAAM,WAAW,EAAE,YA6DzB,CAAC"}
1
+ {"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/environment/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAiC,MAAM,cAAc,CAAC;AAE3E,eAAO,MAAM,WAAW,EAAE,YA8DzB,CAAC"}
@@ -61,4 +61,5 @@ export const Environment = {
61
61
  mobLoadingCaption: '',
62
62
  mobLoadingDescription: '',
63
63
  mobLoadingBackground: '',
64
+ isAdaptiveScreenWidth: false,
64
65
  };
@@ -465,5 +465,13 @@ export interface IEnvironment {
465
465
  * @memberof IEnvironment
466
466
  */
467
467
  mobLoadingBackground?: string;
468
+ /**
469
+ * @description 是否启用屏幕宽度自适应
470
+ * @type {boolean}
471
+ * @platform web
472
+ * @default false
473
+ * @memberof IEnvironment
474
+ */
475
+ isAdaptiveScreenWidth?: boolean;
468
476
  }
469
477
  //# sourceMappingURL=i-environment.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"i-environment.d.ts","sourceRoot":"","sources":["../../../../src/interface/api/environment/i-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IA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;;OAMG;IACH,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAE5B;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;;;OAMG;IACH,YAAY,CAAC,EAAE,YAAY,GAAG,UAAU,CAAC;IAEzC;;;;;OAKG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IAExB;;;;;;;OAOG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;;OAMG;IACH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B"}
1
+ {"version":3,"file":"i-environment.d.ts","sourceRoot":"","sources":["../../../../src/interface/api/environment/i-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,mCAAmC,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,uDAAuD,CAAC;AAC3F,OAAO,EAAE,UAAU,EAAE,MAAM,gCAAgC,CAAC;AAE5D;;;;;GAKG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;;OAOG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;OAOG;IACH,GAAG,EAAE,OAAO,CAAC;IAEb;;;;;;;OAOG;IACH,GAAG,EAAE,OAAO,CAAC;IAEb;;;;;;;OAOG;IACH,UAAU,EAAE,OAAO,CAAC;IAEpB;;;;;;;OAOG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;;OAOG;IACH,QAAQ,EAAE,YAAY,CAA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AKG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;;;OAKG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAE/B;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAE9B;;;;;;OAMG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;CACjC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ibiz-template/core",
3
- "version": "0.7.41-alpha.101",
3
+ "version": "0.7.41-alpha.113",
4
4
  "description": "运行时核心库",
5
5
  "type": "module",
6
6
  "main": "out/index.js",
@@ -9,6 +9,7 @@
9
9
  "files": [
10
10
  "dist",
11
11
  "out",
12
+ "src",
12
13
  "README.md"
13
14
  ],
14
15
  "scripts": {
@@ -50,5 +51,5 @@
50
51
  "qx-util": "^0.4.8",
51
52
  "ramda": "^0.29.0"
52
53
  },
53
- "gitHead": "f9d085280db4778ad952333525a03889fc37e2ab"
54
+ "gitHead": "74e0e6c2da67e6310ccca411945b5cf172a77955"
54
55
  }
@@ -0,0 +1,121 @@
1
+ import {
2
+ ICommand,
3
+ ICommandHandler,
4
+ ICommandOption,
5
+ ICommandRegistry,
6
+ ICommandsMap,
7
+ IDisposable,
8
+ } from '../interface';
9
+ import { LinkedList, toDisposable } from './utils';
10
+
11
+ /**
12
+ * @description 指令注册中心
13
+ * @export
14
+ * @class CommandsRegistry
15
+ * @implements {ICommandRegistry}
16
+ */
17
+ export class CommandsRegistry implements ICommandRegistry {
18
+ /**
19
+ * @description 已经注册的所有指令
20
+ * @private
21
+ * @memberof CommandsRegistry
22
+ */
23
+ private readonly commands = new Map<string, LinkedList<ICommand>>();
24
+
25
+ /**
26
+ * @description 注册指令
27
+ * @param {(string | ICommand)} idOrCommand 指令id或者指令对象
28
+ * @param {ICommandHandler} [handler] 指令处理器
29
+ * @param {ICommandOption} [opts] 指令配置参数
30
+ * @returns {*} {IDisposable} 返回一个可销毁对象,用于取消注册该指令
31
+ * @memberof CommandsRegistry
32
+ */
33
+ registerCommand(
34
+ idOrCommand: string | ICommand,
35
+ handler?: ICommandHandler,
36
+ opts?: ICommandOption,
37
+ ): IDisposable {
38
+ if (!idOrCommand) {
39
+ throw new Error(`invalid command`);
40
+ }
41
+
42
+ if (typeof idOrCommand === 'string') {
43
+ if (!handler) {
44
+ throw new Error(`invalid command`);
45
+ }
46
+ return this.registerCommand({ id: idOrCommand, handler, opts });
47
+ }
48
+
49
+ const { id } = idOrCommand;
50
+
51
+ let commands = this.commands.get(id);
52
+ if (!commands) {
53
+ commands = new LinkedList<ICommand>();
54
+ this.commands.set(id, commands);
55
+ }
56
+
57
+ const removeFn = commands.unshift(idOrCommand);
58
+
59
+ const ret = toDisposable(() => {
60
+ removeFn();
61
+ const command = this.commands.get(id);
62
+ if (command?.isEmpty()) {
63
+ this.commands.delete(id);
64
+ }
65
+ });
66
+
67
+ return ret;
68
+ }
69
+
70
+ /**
71
+ * @description 指令是否已经注册
72
+ * @param {string} id
73
+ * @returns {*} {boolean}
74
+ * @memberof CommandsRegistry
75
+ */
76
+ hasCommand(id: string): boolean {
77
+ return this.commands.has(id);
78
+ }
79
+
80
+ /**
81
+ * @description 查找指令
82
+ * @param {string} id
83
+ * @returns {*} {(ICommand | undefined)}
84
+ * @memberof CommandsRegistry
85
+ */
86
+ getCommand(id: string): ICommand | undefined {
87
+ const list = this.commands.get(id);
88
+ if (!list || list.isEmpty()) {
89
+ return undefined;
90
+ }
91
+ return list[Symbol.iterator]().next().value;
92
+ }
93
+
94
+ /**
95
+ * @description 获取所有指令
96
+ * @returns {*} {ICommandsMap}
97
+ * @memberof CommandsRegistry
98
+ */
99
+ getCommands(): ICommandsMap {
100
+ const result = new Map<string, ICommand>();
101
+ const keys = this.commands.keys();
102
+ for (const key of keys) {
103
+ const command = this.getCommand(key);
104
+ if (command) {
105
+ result.set(key, command);
106
+ }
107
+ }
108
+ return result;
109
+ }
110
+
111
+ /**
112
+ * @description 获取指令配置参数
113
+ * @param {string} id
114
+ * @returns {*} {(ICommandOption | undefined)}
115
+ * @memberof CommandsRegistry
116
+ */
117
+ getCommandOpt(id: string): ICommandOption | undefined {
118
+ const cmd = this.getCommand(id);
119
+ return cmd?.opts;
120
+ }
121
+ }
@@ -0,0 +1,78 @@
1
+ import {
2
+ ICommandController,
3
+ ICommandHandler,
4
+ ICommandOption,
5
+ IDisposable,
6
+ } from '../interface/command';
7
+ import { CommandsRegistry } from './command-register';
8
+
9
+ /**
10
+ * @description 指令控制器
11
+ * @export
12
+ * @class CommandController
13
+ */
14
+ export class CommandController implements ICommandController {
15
+ /**
16
+ * @description 指令注册器
17
+ * @private
18
+ * @memberof CommandController
19
+ */
20
+ private commandRegister = new CommandsRegistry();
21
+
22
+ /**
23
+ * @description 注册指令
24
+ * @param {string} id 指令id
25
+ * @param {ICommandHandler} handler 指令处理回调
26
+ * @param {ICommandOption} [opts] 指令参数
27
+ * @returns {*} {IDisposable} 指令释放对象
28
+ * @memberof CommandController
29
+ */
30
+ register(
31
+ id: string,
32
+ handler: ICommandHandler,
33
+ opts?: ICommandOption,
34
+ ): IDisposable {
35
+ return this.commandRegister.registerCommand(id, handler, opts);
36
+ }
37
+
38
+ /**
39
+ * @description 执行指令
40
+ * @template T
41
+ * @param {string} id 指令id
42
+ * @param {...unknown[]} args 指令参数
43
+ * @returns {*} {Promise<T>} 指令返回值
44
+ * @memberof CommandController
45
+ */
46
+ async execute<T = undefined>(id: string, ...args: unknown[]): Promise<T> {
47
+ const command = this.commandRegister.getCommand(id);
48
+ if (command) {
49
+ return command.handler(...args) as T | Promise<T>;
50
+ }
51
+ throw new Error(ibiz.i18n.t('core.command.unregisteredCommand', { id }));
52
+ }
53
+
54
+ /**
55
+ * @description 判断指令是否存在,没有则直接抛出异常
56
+ * @param {string} id 指令id
57
+ * @param {boolean} [err] 是否抛出异常
58
+ * @returns {*} {boolean} 是否存在
59
+ * @memberof CommandController
60
+ */
61
+ hasCommand(id: string, err?: boolean): boolean {
62
+ const bol = !!this.commandRegister.hasCommand(id);
63
+ if (err === true && bol === true) {
64
+ throw new Error(`未注册指令: ${id},请先注册指令`);
65
+ }
66
+ return bol;
67
+ }
68
+
69
+ /**
70
+ * @description 获取指令参数
71
+ * @param {string} id 指令id
72
+ * @returns {*} {(ICommandOption | undefined)} 指令参数
73
+ * @memberof CommandController
74
+ */
75
+ getCommandOpts(id: string): ICommandOption | undefined {
76
+ return this.commandRegister.getCommandOpt(id);
77
+ }
78
+ }
@@ -0,0 +1,8 @@
1
+ import { CommandController } from './command';
2
+
3
+ export * from '../interface/command';
4
+ export * from './utils';
5
+ export { CommandsRegistry } from './command-register';
6
+ export { CommandController } from './command';
7
+ // 命令控制器
8
+ export const commands = new CommandController();
@@ -0,0 +1,2 @@
1
+ export { LinkedList } from './linked-list';
2
+ export { toDisposable, debounce, throttle } from './util';
@@ -0,0 +1,136 @@
1
+ /* eslint-disable @typescript-eslint/no-non-null-assertion */
2
+ /* eslint-disable no-underscore-dangle */
3
+ /* eslint-disable max-classes-per-file */
4
+ class Node<E> {
5
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6
+ static readonly Undefined = new Node<any>(undefined);
7
+
8
+ element: E;
9
+
10
+ next: Node<E>;
11
+
12
+ prev: Node<E>;
13
+
14
+ constructor(element: E) {
15
+ this.element = element;
16
+ this.next = Node.Undefined;
17
+ this.prev = Node.Undefined;
18
+ }
19
+ }
20
+
21
+ export class LinkedList<E> {
22
+ private _first: Node<E> = Node.Undefined;
23
+
24
+ private _last: Node<E> = Node.Undefined;
25
+
26
+ private _size: number = 0;
27
+
28
+ get size(): number {
29
+ return this._size;
30
+ }
31
+
32
+ isEmpty(): boolean {
33
+ return this._first === Node.Undefined;
34
+ }
35
+
36
+ clear(): void {
37
+ let node = this._first;
38
+ while (node !== Node.Undefined) {
39
+ const { next } = node;
40
+ node.prev = Node.Undefined;
41
+ node.next = Node.Undefined;
42
+ node = next;
43
+ }
44
+
45
+ this._first = Node.Undefined;
46
+ this._last = Node.Undefined;
47
+ this._size = 0;
48
+ }
49
+
50
+ unshift(element: E): () => void {
51
+ return this._insert(element, false);
52
+ }
53
+
54
+ push(element: E): () => void {
55
+ return this._insert(element, true);
56
+ }
57
+
58
+ private _insert(element: E, atTheEnd: boolean): () => void {
59
+ const newNode = new Node(element);
60
+ if (this._first === Node.Undefined) {
61
+ this._first = newNode;
62
+ this._last = newNode;
63
+ } else if (atTheEnd) {
64
+ // push
65
+ const oldLast = this._last!;
66
+ this._last = newNode;
67
+ newNode.prev = oldLast;
68
+ oldLast.next = newNode;
69
+ } else {
70
+ // unshift
71
+ const oldFirst = this._first;
72
+ this._first = newNode;
73
+ newNode.next = oldFirst;
74
+ oldFirst.prev = newNode;
75
+ }
76
+ this._size += 1;
77
+
78
+ let didRemove = false;
79
+ return () => {
80
+ if (!didRemove) {
81
+ didRemove = true;
82
+ this._remove(newNode);
83
+ }
84
+ };
85
+ }
86
+
87
+ shift(): E | undefined {
88
+ if (this._first === Node.Undefined) {
89
+ return undefined;
90
+ }
91
+ const res = this._first.element;
92
+ this._remove(this._first);
93
+ return res;
94
+ }
95
+
96
+ pop(): E | undefined {
97
+ if (this._last === Node.Undefined) {
98
+ return undefined;
99
+ }
100
+ const res = this._last.element;
101
+ this._remove(this._last);
102
+ return res;
103
+ }
104
+
105
+ private _remove(node: Node<E>): void {
106
+ if (node.prev !== Node.Undefined && node.next !== Node.Undefined) {
107
+ // middle
108
+ const anchor = node.prev;
109
+ anchor.next = node.next;
110
+ node.next.prev = anchor;
111
+ } else if (node.prev === Node.Undefined && node.next === Node.Undefined) {
112
+ // only node
113
+ this._first = Node.Undefined;
114
+ this._last = Node.Undefined;
115
+ } else if (node.next === Node.Undefined) {
116
+ // last
117
+ this._last = this._last!.prev!;
118
+ this._last.next = Node.Undefined;
119
+ } else if (node.prev === Node.Undefined) {
120
+ // first
121
+ this._first = this._first!.next!;
122
+ this._first.prev = Node.Undefined;
123
+ }
124
+
125
+ // done
126
+ this._size -= 1;
127
+ }
128
+
129
+ *[Symbol.iterator](): Iterator<E> {
130
+ let node = this._first;
131
+ while (node !== Node.Undefined) {
132
+ yield node.element;
133
+ node = node.next;
134
+ }
135
+ }
136
+ }
@@ -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
+ }