@ibiz-template/core 0.6.0 → 0.6.1-alpha.3
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 +27 -21
- package/dist/index.system.min.js +1 -1
- package/out/interface/i-devtool-config/i-devtool-config.d.ts +7 -0
- package/out/interface/i-devtool-config/i-devtool-config.d.ts.map +1 -1
- package/out/utils/bit-mask/bit-mask.d.ts +27 -0
- package/out/utils/bit-mask/bit-mask.d.ts.map +1 -1
- package/out/utils/bit-mask/bit-mask.js +27 -0
- package/out/utils/color/color.d.ts.map +1 -1
- package/out/utils/color/color.js +8 -4
- package/out/utils/download-file/download-file.js +17 -17
- package/out/utils/string-util/string-util.d.ts +6 -0
- package/out/utils/string-util/string-util.d.ts.map +1 -1
- package/out/utils/string-util/string-util.js +6 -0
- package/out/utils/sync/await-timeout.d.ts +6 -0
- package/out/utils/sync/await-timeout.d.ts.map +1 -1
- package/out/utils/sync/await-timeout.js +6 -0
- package/out/utils/types/types.d.ts +3 -1
- package/out/utils/types/types.d.ts.map +1 -1
- package/out/utils/util/util.d.ts +137 -0
- package/out/utils/util/util.d.ts.map +1 -1
- package/out/utils/util/util.js +137 -0
- package/package.json +4 -5
- package/src/command/command-register.ts +0 -135
- package/src/command/command.ts +0 -79
- package/src/command/index.ts +0 -11
- package/src/command/interface/command/command-option.ts +0 -22
- package/src/command/interface/command/command.ts +0 -86
- package/src/command/interface/disposable/disposable.ts +0 -3
- package/src/command/interface/index.ts +0 -9
- package/src/command/utils/index.ts +0 -2
- package/src/command/utils/linked-list.ts +0 -136
- package/src/command/utils/util.ts +0 -95
- package/src/constant/core/core.ts +0 -63
- package/src/constant/http-status-message/http-status-message.ts +0 -20
- package/src/constant/index.ts +0 -5
- package/src/constant/login-mode/login-mode.ts +0 -23
- package/src/constant/menu-permission-mode/menu-permission-mode.ts +0 -23
- package/src/constant/util/util.ts +0 -5
- package/src/context/index.ts +0 -231
- package/src/environment/environment.ts +0 -39
- package/src/error/http-error/http-error.ts +0 -45
- package/src/error/index.ts +0 -5
- package/src/error/model-error/model-error.ts +0 -26
- package/src/error/notice-error/notice-error.ts +0 -19
- package/src/error/runtime-error/runtime-error.ts +0 -16
- package/src/error/runtime-model-error/runtime-model-error.ts +0 -27
- package/src/ibizsys.ts +0 -78
- package/src/index.ts +0 -14
- package/src/install.ts +0 -15
- package/src/interface/click-outside/click-outside.ts +0 -71
- package/src/interface/i-18n/i-18n.ts +0 -68
- package/src/interface/i-chat-message/i-chat-message.ts +0 -83
- package/src/interface/i-devtool-config/i-devtool-config.ts +0 -16
- package/src/interface/i-environment/i-environment.ts +0 -289
- package/src/interface/i-internal-message/i-internal-message.ts +0 -151
- package/src/interface/i-mark-open-data/i-mark-open-data.ts +0 -39
- package/src/interface/i-portal-async-action/i-portal-async-action.ts +0 -177
- package/src/interface/i-portal-message/i-portal-message.ts +0 -84
- package/src/interface/index.ts +0 -14
- package/src/interface/org-data/org-data.ts +0 -42
- package/src/params/params.ts +0 -134
- package/src/types.ts +0 -110
- package/src/utils/bit-mask/bit-mask.ts +0 -85
- package/src/utils/click-outside/click-outside.ts +0 -110
- package/src/utils/clone/clone.ts +0 -43
- package/src/utils/color/color.ts +0 -84
- package/src/utils/data-type/data-types.ts +0 -99
- package/src/utils/download-file/download-file.ts +0 -109
- package/src/utils/event/event.ts +0 -77
- package/src/utils/history-list/history-item.ts +0 -45
- package/src/utils/history-list/history-list.ts +0 -151
- package/src/utils/index.ts +0 -24
- package/src/utils/interceptor/core-interceptor.ts +0 -40
- package/src/utils/interceptor/index.ts +0 -2
- package/src/utils/interceptor/interceptor.ts +0 -126
- package/src/utils/logger/logger.ts +0 -10
- package/src/utils/message-center/base/message-all.ts +0 -12
- package/src/utils/message-center/base/message-base.ts +0 -86
- package/src/utils/message-center/command/async-action/command-async-action.ts +0 -24
- package/src/utils/message-center/command/change/command-change.ts +0 -12
- package/src/utils/message-center/command/command-base/command-base.ts +0 -30
- package/src/utils/message-center/command/create/command-create.ts +0 -24
- package/src/utils/message-center/command/internal-message/command-internal-message.ts +0 -24
- package/src/utils/message-center/command/mark-open-data/command-mark-open-data.ts +0 -24
- package/src/utils/message-center/command/message-command.ts +0 -158
- package/src/utils/message-center/command/remove/command-remove.ts +0 -24
- package/src/utils/message-center/command/update/command-update.ts +0 -24
- package/src/utils/message-center/console/message-console.ts +0 -31
- package/src/utils/message-center/index.ts +0 -1
- package/src/utils/message-center/interface/i-app-data-entity.ts +0 -19
- package/src/utils/message-center/interface/index.ts +0 -1
- package/src/utils/message-center/message-center.ts +0 -82
- package/src/utils/namespace/namespace.ts +0 -247
- package/src/utils/net/http-response.ts +0 -106
- package/src/utils/net/net.ts +0 -469
- package/src/utils/recursive/find-recursive-child.ts +0 -133
- package/src/utils/string-util/string-util.ts +0 -60
- package/src/utils/style/remote-style.ts +0 -20
- package/src/utils/sync/await-timeout.ts +0 -27
- package/src/utils/sync/count-latch.ts +0 -95
- package/src/utils/sync/index.ts +0 -2
- package/src/utils/types/types.ts +0 -22
- package/src/utils/upload/select-file.ts +0 -86
- package/src/utils/upload/upload-file.ts +0 -208
- package/src/utils/url-helper/url-helper.ts +0 -63
- package/src/utils/util/util.ts +0 -376
package/src/command/command.ts
DELETED
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import { ICommandHandler, ICommandOption, IDisposable } from './interface';
|
|
2
|
-
import { CommandsRegistry } from './command-register';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 指令控制器
|
|
6
|
-
*
|
|
7
|
-
* @author chitanda
|
|
8
|
-
* @date 2022-06-28 19:06:51
|
|
9
|
-
* @export
|
|
10
|
-
* @class CommandController
|
|
11
|
-
*/
|
|
12
|
-
export class CommandController {
|
|
13
|
-
private commandRegister = new CommandsRegistry();
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* 注册指令
|
|
17
|
-
*
|
|
18
|
-
* @author chitanda
|
|
19
|
-
* @date 2022-06-28 19:06:45
|
|
20
|
-
* @param {string} id
|
|
21
|
-
* @param {ICommandHandler} handler
|
|
22
|
-
* @param {ICommandOption} [opts]
|
|
23
|
-
* @return {*} {IDisposable}
|
|
24
|
-
*/
|
|
25
|
-
register(
|
|
26
|
-
id: string,
|
|
27
|
-
handler: ICommandHandler,
|
|
28
|
-
opts?: ICommandOption,
|
|
29
|
-
): IDisposable {
|
|
30
|
-
return this.commandRegister.registerCommand(id, handler, opts);
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* 执行指令
|
|
35
|
-
*
|
|
36
|
-
* @author chitanda
|
|
37
|
-
* @date 2022-06-28 19:06:38
|
|
38
|
-
* @template T
|
|
39
|
-
* @param {string} id
|
|
40
|
-
* @param {...unknown[]} args
|
|
41
|
-
* @return {*} {Promise<T>}
|
|
42
|
-
*/
|
|
43
|
-
async execute<T = undefined>(id: string, ...args: unknown[]): Promise<T> {
|
|
44
|
-
const command = this.commandRegister.getCommand(id);
|
|
45
|
-
if (command) {
|
|
46
|
-
return command.handler(...args) as T | Promise<T>;
|
|
47
|
-
}
|
|
48
|
-
throw new Error(`未注册指令: ${id},请先注册指令`);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* 判断指令是否存在,可直接抛出异常
|
|
53
|
-
*
|
|
54
|
-
* @author chitanda
|
|
55
|
-
* @date 2022-06-28 19:06:11
|
|
56
|
-
* @param {string} id
|
|
57
|
-
* @param {boolean} [err]
|
|
58
|
-
* @return {*} {boolean}
|
|
59
|
-
*/
|
|
60
|
-
hasCommand(id: string, err?: boolean): boolean {
|
|
61
|
-
const bol = !!this.commandRegister.hasCommand(id);
|
|
62
|
-
if (err === true && bol === true) {
|
|
63
|
-
throw new Error(`未注册指令: ${id},请先注册指令`);
|
|
64
|
-
}
|
|
65
|
-
return bol;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* 获取指令配置参数
|
|
70
|
-
*
|
|
71
|
-
* @author chitanda
|
|
72
|
-
* @date 2022-07-21 17:07:11
|
|
73
|
-
* @param {string} id
|
|
74
|
-
* @return {*} {(ICommandOption | undefined)}
|
|
75
|
-
*/
|
|
76
|
-
getCommandOpts(id: string): ICommandOption | undefined {
|
|
77
|
-
return this.commandRegister.getCommandOpt(id);
|
|
78
|
-
}
|
|
79
|
-
}
|
package/src/command/index.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { CommandController } from './command';
|
|
2
|
-
|
|
3
|
-
export * from './interface';
|
|
4
|
-
export * from './utils';
|
|
5
|
-
export { CommandsRegistry } from './command-register';
|
|
6
|
-
export { CommandController } from './command';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* 命令控制器
|
|
10
|
-
*/
|
|
11
|
-
export const commands = new CommandController();
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 指令参数, 主要用于在指令呈现时的展示参数
|
|
3
|
-
*
|
|
4
|
-
* @author chitanda
|
|
5
|
-
* @date 2022-06-28 17:06:47
|
|
6
|
-
* @export
|
|
7
|
-
* @interface ICommandOption
|
|
8
|
-
*/
|
|
9
|
-
export interface ICommandOption {
|
|
10
|
-
readonly id: string;
|
|
11
|
-
readonly title: string;
|
|
12
|
-
readonly tooltip?: string;
|
|
13
|
-
readonly description?: string;
|
|
14
|
-
/**
|
|
15
|
-
* 只支持 svg 图标
|
|
16
|
-
*
|
|
17
|
-
* @author chitanda
|
|
18
|
-
* @date 2022-06-29 14:06:42
|
|
19
|
-
* @type {string}
|
|
20
|
-
*/
|
|
21
|
-
readonly icon?: string;
|
|
22
|
-
}
|
|
@@ -1,86 +0,0 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
import { IDisposable } from '../disposable/disposable';
|
|
3
|
-
import { ICommandOption } from './command-option';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 注册指令
|
|
7
|
-
*
|
|
8
|
-
* @author chitanda
|
|
9
|
-
* @date 2022-06-27 13:06:25
|
|
10
|
-
* @export
|
|
11
|
-
* @interface ICommand
|
|
12
|
-
*/
|
|
13
|
-
export interface ICommand {
|
|
14
|
-
id: string;
|
|
15
|
-
handler: ICommandHandler;
|
|
16
|
-
opts?: ICommandOption;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* 触发指令声明
|
|
21
|
-
*
|
|
22
|
-
* @author chitanda
|
|
23
|
-
* @date 2022-06-28 17:06:10
|
|
24
|
-
* @export
|
|
25
|
-
* @interface Command
|
|
26
|
-
*/
|
|
27
|
-
export interface Command {
|
|
28
|
-
/**
|
|
29
|
-
* Title of the command, like `save`.
|
|
30
|
-
*/
|
|
31
|
-
title: string;
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* The identifier of the actual command handler.
|
|
35
|
-
* @see {@link commands.registerCommand}
|
|
36
|
-
*/
|
|
37
|
-
command: string;
|
|
38
|
-
|
|
39
|
-
/**
|
|
40
|
-
* A tooltip for the command, when represented in the UI.
|
|
41
|
-
*/
|
|
42
|
-
tooltip?: string;
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Arguments that the command handler should be
|
|
46
|
-
* invoked with.
|
|
47
|
-
*/
|
|
48
|
-
arguments?: any[];
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
/**
|
|
52
|
-
* 指令处理回调
|
|
53
|
-
*
|
|
54
|
-
* @author chitanda
|
|
55
|
-
* @date 2022-06-27 13:06:33
|
|
56
|
-
* @export
|
|
57
|
-
* @interface ICommandHandler
|
|
58
|
-
*/
|
|
59
|
-
export interface ICommandHandler {
|
|
60
|
-
(...args: any[]): unknown | Promise<unknown>;
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
/**
|
|
64
|
-
* 指令控制器集
|
|
65
|
-
*/
|
|
66
|
-
export type ICommandsMap = Map<string, ICommand>;
|
|
67
|
-
|
|
68
|
-
/**
|
|
69
|
-
* 注册服务
|
|
70
|
-
*
|
|
71
|
-
* @author chitanda
|
|
72
|
-
* @date 2022-06-27 13:06:16
|
|
73
|
-
* @export
|
|
74
|
-
* @interface ICommandRegistry
|
|
75
|
-
*/
|
|
76
|
-
export interface ICommandRegistry {
|
|
77
|
-
registerCommand(
|
|
78
|
-
id: string,
|
|
79
|
-
command: ICommandHandler,
|
|
80
|
-
opts: ICommandOption,
|
|
81
|
-
): IDisposable;
|
|
82
|
-
registerCommand(id: string, command: ICommandHandler): IDisposable;
|
|
83
|
-
registerCommand(command: ICommand): IDisposable;
|
|
84
|
-
getCommand(id: string): ICommand | undefined;
|
|
85
|
-
getCommands(): ICommandsMap;
|
|
86
|
-
}
|
|
@@ -1,136 +0,0 @@
|
|
|
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
|
-
}
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
/* eslint-disable func-names */
|
|
2
|
-
/* eslint-disable prefer-rest-params */
|
|
3
|
-
/* eslint-disable no-underscore-dangle */
|
|
4
|
-
import { IDisposable } from '../interface';
|
|
5
|
-
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
7
|
-
export function once<T extends Function>(this: unknown, fn: T): T {
|
|
8
|
-
// eslint-disable-next-line @typescript-eslint/no-this-alias
|
|
9
|
-
const _this = this;
|
|
10
|
-
let didCall = false;
|
|
11
|
-
let result: unknown;
|
|
12
|
-
|
|
13
|
-
return function () {
|
|
14
|
-
if (didCall) {
|
|
15
|
-
return result;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
didCall = true;
|
|
19
|
-
result = fn.apply(_this, arguments);
|
|
20
|
-
|
|
21
|
-
return result;
|
|
22
|
-
} as unknown as T;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export function toDisposable(fn: () => void): IDisposable {
|
|
26
|
-
const self = {
|
|
27
|
-
dispose: once(() => {
|
|
28
|
-
fn();
|
|
29
|
-
}),
|
|
30
|
-
};
|
|
31
|
-
return self;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
/**
|
|
35
|
-
* 函数防抖---“立即执行版本” 和 “非立即执行版本” 的组合版本
|
|
36
|
-
*
|
|
37
|
-
* @author chitanda
|
|
38
|
-
* @date 2022-06-29 19:06:15
|
|
39
|
-
* @export
|
|
40
|
-
* @param {((...args: unknown[]) => void | Promise<void>)} func 处理函数
|
|
41
|
-
* @param {number} wait 延迟执行时间(毫秒)
|
|
42
|
-
* @param {boolean} [immediate] 是否立即执行
|
|
43
|
-
* @return {*} {(...args: unknown[]) => void}
|
|
44
|
-
*/
|
|
45
|
-
export function debounce(
|
|
46
|
-
func: (...args: unknown[]) => void | Promise<void>,
|
|
47
|
-
wait: number,
|
|
48
|
-
immediate?: boolean,
|
|
49
|
-
): (...args: unknown[]) => void {
|
|
50
|
-
let timer: unknown;
|
|
51
|
-
|
|
52
|
-
return function (this: unknown, ...args: unknown[]): void {
|
|
53
|
-
if (timer) {
|
|
54
|
-
clearTimeout(timer as number);
|
|
55
|
-
}
|
|
56
|
-
if (immediate) {
|
|
57
|
-
const callNow = !timer;
|
|
58
|
-
timer = setTimeout(() => {
|
|
59
|
-
timer = null;
|
|
60
|
-
}, wait);
|
|
61
|
-
if (callNow) {
|
|
62
|
-
func.apply(this, args);
|
|
63
|
-
}
|
|
64
|
-
} else {
|
|
65
|
-
timer = setTimeout(() => {
|
|
66
|
-
func.apply(this, args);
|
|
67
|
-
}, wait);
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* 节流函数
|
|
74
|
-
*
|
|
75
|
-
* @author chitanda
|
|
76
|
-
* @date 2022-06-29 20:06:38
|
|
77
|
-
* @export
|
|
78
|
-
* @param {((...args: unknown[]) => void | Promise<void>)} fn
|
|
79
|
-
* @param {number} wait
|
|
80
|
-
* @return {*} {(...args: unknown[]) => void}
|
|
81
|
-
*/
|
|
82
|
-
export function throttle(
|
|
83
|
-
fn: (...args: unknown[]) => void | Promise<void>,
|
|
84
|
-
wait: number,
|
|
85
|
-
): (...args: unknown[]) => void {
|
|
86
|
-
let timer: unknown = null;
|
|
87
|
-
return function (this: unknown, ...args: unknown[]): void {
|
|
88
|
-
if (!timer) {
|
|
89
|
-
timer = setTimeout(() => {
|
|
90
|
-
fn.apply(this, args);
|
|
91
|
-
timer = null;
|
|
92
|
-
}, wait);
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 核心全局静态变量
|
|
3
|
-
*
|
|
4
|
-
* @author chitanda
|
|
5
|
-
* @date 2022-07-14 17:07:25
|
|
6
|
-
* @export
|
|
7
|
-
* @enum {number}
|
|
8
|
-
*/
|
|
9
|
-
export class CoreConst {
|
|
10
|
-
/**
|
|
11
|
-
* 默认模型服务标识
|
|
12
|
-
*
|
|
13
|
-
* @author chitanda
|
|
14
|
-
* @date 2024-01-18 16:01:25
|
|
15
|
-
* @static
|
|
16
|
-
*/
|
|
17
|
-
static readonly DEFAULT_MODEL_SERVICE_TAG = 'default';
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* 访问令牌标识
|
|
21
|
-
*
|
|
22
|
-
* @author chitanda
|
|
23
|
-
* @date 2022-07-20 15:07:28
|
|
24
|
-
* @static
|
|
25
|
-
*/
|
|
26
|
-
static readonly TOKEN = 'ibzuaa-token';
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* 刷新令牌标识
|
|
30
|
-
*
|
|
31
|
-
* @author chitanda
|
|
32
|
-
* @date 2024-01-18 16:01:54
|
|
33
|
-
* @static
|
|
34
|
-
*/
|
|
35
|
-
static readonly REFRESH_TOKEN = 'ibzuaa-refresh-token';
|
|
36
|
-
|
|
37
|
-
/**
|
|
38
|
-
* 访问令牌标识过期时间
|
|
39
|
-
*
|
|
40
|
-
* @author lxm
|
|
41
|
-
* @date 2023-02-13 07:11:33
|
|
42
|
-
* @static
|
|
43
|
-
* @memberof CoreConst
|
|
44
|
-
*/
|
|
45
|
-
static readonly TOKEN_EXPIRES = 'ibzuaa-token-expires';
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* 认证信息是走记住我模式的 cookie 标识
|
|
49
|
-
*
|
|
50
|
-
* @author chitanda
|
|
51
|
-
* @date 2023-12-13 15:12:28
|
|
52
|
-
* @static
|
|
53
|
-
*/
|
|
54
|
-
static readonly TOKEN_REMEMBER = 'ibizuaa-token-remember';
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* 是否是匿名用户登录的 cookie 标识
|
|
58
|
-
* @author lxm
|
|
59
|
-
* @date 2024-01-03 05:35:40
|
|
60
|
-
* @static
|
|
61
|
-
*/
|
|
62
|
-
static readonly IS_ANONYMOUS = 'ibizuaa-is-anonymous';
|
|
63
|
-
}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 请求状态码文本
|
|
3
|
-
*/
|
|
4
|
-
export const HttpStatusMessageConst: Record<number, string> = {
|
|
5
|
-
200: '服务器成功返回请求的数据。',
|
|
6
|
-
201: '新建或修改数据成功。',
|
|
7
|
-
202: '一个请求已经进入后台排队(异步任务)。',
|
|
8
|
-
204: '删除数据成功。',
|
|
9
|
-
400: '发出的请求有错误,服务器没有进行新建或修改数据的操作。',
|
|
10
|
-
401: '用户没有权限(令牌、用户名、密码错误)。',
|
|
11
|
-
403: '用户得到授权,但是访问是被禁止的。',
|
|
12
|
-
404: '发出的请求针对的是不存在的记录,服务器没有进行操作。',
|
|
13
|
-
406: '请求的格式不可得。',
|
|
14
|
-
410: '请求的资源被永久删除,且不会再得到的。',
|
|
15
|
-
422: '当创建一个对象时,发生一个验证错误。',
|
|
16
|
-
500: '服务器发生错误,请检查服务器。',
|
|
17
|
-
502: '网关错误。',
|
|
18
|
-
503: '服务不可用,服务器暂时过载或维护。',
|
|
19
|
-
504: '网关超时。',
|
|
20
|
-
};
|
package/src/constant/index.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export { CoreConst } from './core/core';
|
|
2
|
-
export * from './util/util';
|
|
3
|
-
export { HttpStatusMessageConst } from './http-status-message/http-status-message';
|
|
4
|
-
export { LoginMode } from './login-mode/login-mode';
|
|
5
|
-
export { MenuPermissionMode } from './menu-permission-mode/menu-permission-mode';
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-shadow */
|
|
2
|
-
/**
|
|
3
|
-
* 登录模式
|
|
4
|
-
*
|
|
5
|
-
* @author lxm
|
|
6
|
-
* @date 2022-10-12 14:10:56
|
|
7
|
-
* @export
|
|
8
|
-
* @enum {number}
|
|
9
|
-
*/
|
|
10
|
-
export enum LoginMode {
|
|
11
|
-
/**
|
|
12
|
-
* 默认标准登录
|
|
13
|
-
*/
|
|
14
|
-
DEFAULT = 'DEFAULT',
|
|
15
|
-
/**
|
|
16
|
-
* 自定义登录
|
|
17
|
-
*/
|
|
18
|
-
CUSTOM = 'CUSTOM',
|
|
19
|
-
/**
|
|
20
|
-
* 中央认证登录
|
|
21
|
-
*/
|
|
22
|
-
CAS = 'CAS',
|
|
23
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/* eslint-disable no-shadow */
|
|
2
|
-
/**
|
|
3
|
-
* 菜单权限校验模式
|
|
4
|
-
*
|
|
5
|
-
* @author lxm
|
|
6
|
-
* @date 2022-10-12 14:10:56
|
|
7
|
-
* @export
|
|
8
|
-
* @enum {number}
|
|
9
|
-
*/
|
|
10
|
-
export enum MenuPermissionMode {
|
|
11
|
-
/**
|
|
12
|
-
* 混合模式(默认)
|
|
13
|
-
*/
|
|
14
|
-
MIXIN = 'MIXIN',
|
|
15
|
-
/**
|
|
16
|
-
* 统一资源模式
|
|
17
|
-
*/
|
|
18
|
-
RESOURCE = 'RESOURCE',
|
|
19
|
-
/**
|
|
20
|
-
* RT模式
|
|
21
|
-
*/
|
|
22
|
-
RT = 'RT',
|
|
23
|
-
}
|