@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
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { createUUID } from 'qx-util';
|
|
2
|
-
import { IPortalMessage } from '../../../interface';
|
|
3
|
-
import { MessageBase } from '../base/message-base';
|
|
4
|
-
import { CommandCreate } from './create/command-create';
|
|
5
|
-
import { CommandUpdate } from './update/command-update';
|
|
6
|
-
import { CommandRemove } from './remove/command-remove';
|
|
7
|
-
import { CommandChange } from './change/command-change';
|
|
8
|
-
import { CommandAsyncAction } from './async-action/command-async-action';
|
|
9
|
-
import { CommandInternalMessage } from './internal-message/command-internal-message';
|
|
10
|
-
import { CommandMarkOpenData } from './mark-open-data/command-mark-open-data';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* 指令消息
|
|
14
|
-
*
|
|
15
|
-
* @author chitanda
|
|
16
|
-
* @date 2023-09-05 16:09:41
|
|
17
|
-
* @export
|
|
18
|
-
* @class MessageCommand
|
|
19
|
-
* @extends {MessageBase}
|
|
20
|
-
*/
|
|
21
|
-
export class MessageCommand extends MessageBase {
|
|
22
|
-
/**
|
|
23
|
-
* 数据变更指令消息
|
|
24
|
-
*
|
|
25
|
-
* @author chitanda
|
|
26
|
-
* @date 2023-09-05 17:09:15
|
|
27
|
-
* @type {CommandChange}
|
|
28
|
-
*/
|
|
29
|
-
readonly change: CommandChange = new CommandChange();
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* 新建消息
|
|
33
|
-
*
|
|
34
|
-
* @author chitanda
|
|
35
|
-
* @date 2023-09-05 17:09:55
|
|
36
|
-
* @type {CommandCreate}
|
|
37
|
-
*/
|
|
38
|
-
readonly create: CommandCreate = new CommandCreate(this);
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* 更新消息
|
|
42
|
-
*
|
|
43
|
-
* @author chitanda
|
|
44
|
-
* @date 2023-09-05 17:09:01
|
|
45
|
-
* @type {CommandUpdate}
|
|
46
|
-
*/
|
|
47
|
-
readonly update: CommandUpdate = new CommandUpdate(this);
|
|
48
|
-
|
|
49
|
-
/**
|
|
50
|
-
* 删除消息
|
|
51
|
-
*
|
|
52
|
-
* @author chitanda
|
|
53
|
-
* @date 2023-09-05 17:09:05
|
|
54
|
-
* @type {CommandRemove}
|
|
55
|
-
*/
|
|
56
|
-
readonly remove: CommandRemove = new CommandRemove(this);
|
|
57
|
-
|
|
58
|
-
/**
|
|
59
|
-
* 异步作业指令消息
|
|
60
|
-
*
|
|
61
|
-
* @author chitanda
|
|
62
|
-
* @date 2023-10-23 17:10:56
|
|
63
|
-
* @type {CommandAsyncAction}
|
|
64
|
-
*/
|
|
65
|
-
readonly asyncAction: CommandAsyncAction = new CommandAsyncAction(this);
|
|
66
|
-
|
|
67
|
-
/**
|
|
68
|
-
* 站内信 指令消息
|
|
69
|
-
*
|
|
70
|
-
* @author chitanda
|
|
71
|
-
* @date 2023-10-23 17:10:56
|
|
72
|
-
* @type {CommandInternalMessage}
|
|
73
|
-
*/
|
|
74
|
-
readonly internalMessage: CommandInternalMessage = new CommandInternalMessage(
|
|
75
|
-
this,
|
|
76
|
-
);
|
|
77
|
-
|
|
78
|
-
/**
|
|
79
|
-
*
|
|
80
|
-
* @author lxm
|
|
81
|
-
* @date 2024-02-01 03:43:37
|
|
82
|
-
* @type {CommandMarkOpenData}
|
|
83
|
-
*/
|
|
84
|
-
readonly markOpenData: CommandMarkOpenData = new CommandMarkOpenData(this);
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* 推送指令消息
|
|
88
|
-
*
|
|
89
|
-
* @author chitanda
|
|
90
|
-
* @date 2023-09-05 17:09:50
|
|
91
|
-
* @param {IPortalMessage} msg
|
|
92
|
-
*/
|
|
93
|
-
next(msg: IPortalMessage): void {
|
|
94
|
-
// 消息分子类型,子类型发完消息后,会让父发消息
|
|
95
|
-
// 所以子类型有父时,会一级一级的往上发消息。不需要在此处发全局消息
|
|
96
|
-
// change 特殊处理,不给父发消息
|
|
97
|
-
switch (msg.subtype) {
|
|
98
|
-
case 'OBJECTCREATED':
|
|
99
|
-
this.create.next(msg);
|
|
100
|
-
this.change.next(msg);
|
|
101
|
-
break;
|
|
102
|
-
case 'OBJECTUPDATED':
|
|
103
|
-
this.update.next(msg);
|
|
104
|
-
this.change.next(msg);
|
|
105
|
-
break;
|
|
106
|
-
case 'OBJECTREMOVED':
|
|
107
|
-
this.remove.next(msg);
|
|
108
|
-
this.change.next(msg);
|
|
109
|
-
break;
|
|
110
|
-
case 'ASYNCACTION':
|
|
111
|
-
this.asyncAction.next(msg);
|
|
112
|
-
break;
|
|
113
|
-
case 'INTERNALMESSAGE':
|
|
114
|
-
this.internalMessage.next(msg);
|
|
115
|
-
break;
|
|
116
|
-
case 'MARKOPENDATA':
|
|
117
|
-
this.markOpenData.next(msg);
|
|
118
|
-
break;
|
|
119
|
-
default:
|
|
120
|
-
super.next(msg);
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
protected nextParent(msg: IPortalMessage): void {
|
|
125
|
-
switch (msg.subtype) {
|
|
126
|
-
case 'OBJECTCREATED':
|
|
127
|
-
this.change.next(msg);
|
|
128
|
-
break;
|
|
129
|
-
case 'OBJECTUPDATED':
|
|
130
|
-
this.change.next(msg);
|
|
131
|
-
break;
|
|
132
|
-
case 'OBJECTREMOVED':
|
|
133
|
-
this.change.next(msg);
|
|
134
|
-
break;
|
|
135
|
-
default:
|
|
136
|
-
}
|
|
137
|
-
super.nextParent(msg);
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* 发送指令消息
|
|
142
|
-
*
|
|
143
|
-
* @author chitanda
|
|
144
|
-
* @date 2023-09-05 17:09:35
|
|
145
|
-
* @param {IData} data
|
|
146
|
-
* @param {IPortalMessage['subtype']} subtype
|
|
147
|
-
*/
|
|
148
|
-
send(data: IData, subtype: IPortalMessage['subtype']): void {
|
|
149
|
-
const msg: IPortalMessage = {
|
|
150
|
-
messageid: createUUID(),
|
|
151
|
-
messagename: 'command',
|
|
152
|
-
type: 'COMMAND',
|
|
153
|
-
subtype,
|
|
154
|
-
data,
|
|
155
|
-
};
|
|
156
|
-
this.next(msg);
|
|
157
|
-
}
|
|
158
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { IAppDataEntity } from '../../interface';
|
|
2
|
-
import { CommandBase } from '../command-base/command-base';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 删除指令消息
|
|
6
|
-
*
|
|
7
|
-
* @author chitanda
|
|
8
|
-
* @date 2023-09-05 17:09:03
|
|
9
|
-
* @export
|
|
10
|
-
* @class CommandRemove
|
|
11
|
-
* @extends {CommandBase}
|
|
12
|
-
*/
|
|
13
|
-
export class CommandRemove extends CommandBase {
|
|
14
|
-
/**
|
|
15
|
-
* 发送删除的数据
|
|
16
|
-
*
|
|
17
|
-
* @author chitanda
|
|
18
|
-
* @date 2023-09-05 17:09:29
|
|
19
|
-
* @param {IAppDataEntity} data
|
|
20
|
-
*/
|
|
21
|
-
send(data: IAppDataEntity): void {
|
|
22
|
-
this.sendCommand(data, 'OBJECTREMOVED');
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { IAppDataEntity } from '../../interface';
|
|
2
|
-
import { CommandBase } from '../command-base/command-base';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* 更新指令消息
|
|
6
|
-
*
|
|
7
|
-
* @author chitanda
|
|
8
|
-
* @date 2023-09-05 17:09:54
|
|
9
|
-
* @export
|
|
10
|
-
* @class CommandUpdate
|
|
11
|
-
* @extends {CommandBase}
|
|
12
|
-
*/
|
|
13
|
-
export class CommandUpdate extends CommandBase {
|
|
14
|
-
/**
|
|
15
|
-
* 发送更新的数据
|
|
16
|
-
*
|
|
17
|
-
* @author chitanda
|
|
18
|
-
* @date 2023-09-05 17:09:37
|
|
19
|
-
* @param {IAppDataEntity} data
|
|
20
|
-
*/
|
|
21
|
-
send(data: IAppDataEntity): void {
|
|
22
|
-
this.sendCommand(data, 'OBJECTUPDATED');
|
|
23
|
-
}
|
|
24
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import { createUUID } from 'qx-util';
|
|
2
|
-
import { IPortalMessage } from '../../../interface';
|
|
3
|
-
import { MessageBase } from '../base/message-base';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* 日志消息
|
|
7
|
-
*
|
|
8
|
-
* @author chitanda
|
|
9
|
-
* @date 2023-09-05 16:09:33
|
|
10
|
-
* @export
|
|
11
|
-
* @class MessageConsole
|
|
12
|
-
* @extends {MessageBase}
|
|
13
|
-
*/
|
|
14
|
-
export class MessageConsole extends MessageBase {
|
|
15
|
-
/**
|
|
16
|
-
* 发送日志消息
|
|
17
|
-
*
|
|
18
|
-
* @author chitanda
|
|
19
|
-
* @date 2023-09-05 16:09:25
|
|
20
|
-
* @param {(IData | string)} data
|
|
21
|
-
*/
|
|
22
|
-
send(data: IData | string): void {
|
|
23
|
-
const msg: IPortalMessage = {
|
|
24
|
-
messageid: createUUID(),
|
|
25
|
-
messagename: 'console',
|
|
26
|
-
type: 'CONSOLE',
|
|
27
|
-
data,
|
|
28
|
-
};
|
|
29
|
-
this.next(msg);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { MessageCenter } from './message-center';
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* 应用实体数据对象
|
|
3
|
-
*
|
|
4
|
-
* @author chitanda
|
|
5
|
-
* @date 2023-09-05 17:09:39
|
|
6
|
-
* @export
|
|
7
|
-
* @interface IAppDataEntity
|
|
8
|
-
* @extends {IData}
|
|
9
|
-
*/
|
|
10
|
-
export interface IAppDataEntity extends IData {
|
|
11
|
-
/**
|
|
12
|
-
* 应用实体数据对象标识
|
|
13
|
-
*
|
|
14
|
-
* @author chitanda
|
|
15
|
-
* @date 2023-09-05 17:09:57
|
|
16
|
-
* @type {string}
|
|
17
|
-
*/
|
|
18
|
-
srfdecodename: string;
|
|
19
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export type { IAppDataEntity } from './i-app-data-entity';
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
import { IPortalMessage } from '../../interface';
|
|
2
|
-
import { MessageAll } from './base/message-all';
|
|
3
|
-
import { MessageCommand } from './command/message-command';
|
|
4
|
-
import { MessageConsole } from './console/message-console';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* 界面消息中心
|
|
8
|
-
*
|
|
9
|
-
* @author chitanda
|
|
10
|
-
* @date 2023-09-05 15:09:14
|
|
11
|
-
* @export
|
|
12
|
-
* @class MessageCenter
|
|
13
|
-
*/
|
|
14
|
-
export class MessageCenter {
|
|
15
|
-
/**
|
|
16
|
-
* 所有消息
|
|
17
|
-
*
|
|
18
|
-
* @author chitanda
|
|
19
|
-
* @date 2023-09-05 16:09:12
|
|
20
|
-
* @type {MessageAll}
|
|
21
|
-
*/
|
|
22
|
-
protected all: MessageAll = new MessageAll();
|
|
23
|
-
|
|
24
|
-
/**
|
|
25
|
-
* 指令消息
|
|
26
|
-
*
|
|
27
|
-
* @author chitanda
|
|
28
|
-
* @date 2023-09-05 16:09:28
|
|
29
|
-
* @type {MessageCommand}
|
|
30
|
-
*/
|
|
31
|
-
readonly command: MessageCommand = new MessageCommand(this.all);
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* 日志消息
|
|
35
|
-
*
|
|
36
|
-
* @author chitanda
|
|
37
|
-
* @date 2023-09-05 16:09:48
|
|
38
|
-
* @type {MessageConsole}
|
|
39
|
-
*/
|
|
40
|
-
readonly console: MessageConsole = new MessageConsole(this.all);
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* 发送消息
|
|
44
|
-
*
|
|
45
|
-
* @author chitanda
|
|
46
|
-
* @date 2023-09-05 15:09:49
|
|
47
|
-
* @param {IPortalMessage} msg
|
|
48
|
-
*/
|
|
49
|
-
next(msg: IPortalMessage): void {
|
|
50
|
-
// 消息分子类型,子类型发完消息后,会让父发消息
|
|
51
|
-
// 所以子类型有父时,会一级一级的往上发消息。不需要在此处发全局消息
|
|
52
|
-
if (msg.type === 'COMMAND') {
|
|
53
|
-
this.command.next(msg);
|
|
54
|
-
} else if (msg.type === 'CONSOLE') {
|
|
55
|
-
this.console.next(msg);
|
|
56
|
-
} else {
|
|
57
|
-
this.all.next(msg);
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
/**
|
|
62
|
-
* 订阅消息
|
|
63
|
-
*
|
|
64
|
-
* @author chitanda
|
|
65
|
-
* @date 2023-09-05 17:09:32
|
|
66
|
-
* @param {(msg: IPortalMessage) => void} callback
|
|
67
|
-
*/
|
|
68
|
-
on(callback: (msg: IPortalMessage) => void): void {
|
|
69
|
-
this.all.on(callback);
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* 取消订阅
|
|
74
|
-
*
|
|
75
|
-
* @author chitanda
|
|
76
|
-
* @date 2023-09-05 17:09:38
|
|
77
|
-
* @param {(msg: IPortalMessage) => void} callback
|
|
78
|
-
*/
|
|
79
|
-
off(callback: (msg: IPortalMessage) => void): void {
|
|
80
|
-
this.all.off(callback);
|
|
81
|
-
}
|
|
82
|
-
}
|
|
@@ -1,247 +0,0 @@
|
|
|
1
|
-
export const defaultNamespace = 'ibiz';
|
|
2
|
-
const statePrefix = 'is-';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* css bem 命名规则拼接
|
|
6
|
-
* _bem('ibiz', 'layout') => ibiz-layout
|
|
7
|
-
* _bem('ibiz', 'layout', '', 'title') => ibiz-layout__title
|
|
8
|
-
* _bem('ibiz', 'layout', '', '', 'right') => ibiz-layout--right
|
|
9
|
-
* _bem('ibiz', 'layout', '', 'title', 'right') => ibiz-layout__title--right
|
|
10
|
-
* _bem('ibiz', 'layout', 'header', 'title', 'right') => ibiz-layout-header__title--right
|
|
11
|
-
*
|
|
12
|
-
* @author chitanda
|
|
13
|
-
* @date 2022-09-06 11:09:42
|
|
14
|
-
* @param {string} namespace 命名空间
|
|
15
|
-
* @param {string} block 块
|
|
16
|
-
* @param {string} blockSuffix 块后缀
|
|
17
|
-
* @param {string} element 元素
|
|
18
|
-
* @param {string} modifier 修饰符
|
|
19
|
-
* @return {*} {string}
|
|
20
|
-
*/
|
|
21
|
-
function _bem(
|
|
22
|
-
namespace: string,
|
|
23
|
-
block: string,
|
|
24
|
-
blockSuffix?: string,
|
|
25
|
-
element?: string,
|
|
26
|
-
modifier?: string,
|
|
27
|
-
): string {
|
|
28
|
-
let cls = `${namespace}-${block}`;
|
|
29
|
-
if (blockSuffix) {
|
|
30
|
-
cls += `-${blockSuffix}`;
|
|
31
|
-
}
|
|
32
|
-
if (element) {
|
|
33
|
-
cls += `__${element}`;
|
|
34
|
-
}
|
|
35
|
-
if (modifier) {
|
|
36
|
-
cls += `--${modifier}`;
|
|
37
|
-
}
|
|
38
|
-
return cls;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/**
|
|
42
|
-
* 全局样式处理命名空间
|
|
43
|
-
*
|
|
44
|
-
* @author chitanda
|
|
45
|
-
* @date 2022-09-06 11:09:50
|
|
46
|
-
* @export
|
|
47
|
-
* @class Namespace
|
|
48
|
-
*/
|
|
49
|
-
export class Namespace {
|
|
50
|
-
/**
|
|
51
|
-
* 命名空间
|
|
52
|
-
*
|
|
53
|
-
* @author chitanda
|
|
54
|
-
* @date 2022-09-06 12:09:01
|
|
55
|
-
* @type {string}
|
|
56
|
-
*/
|
|
57
|
-
namespace: string;
|
|
58
|
-
|
|
59
|
-
/**
|
|
60
|
-
* Creates an instance of Namespace.
|
|
61
|
-
*
|
|
62
|
-
* @author chitanda
|
|
63
|
-
* @date 2022-09-06 12:09:12
|
|
64
|
-
* @param {string} block 当前命名空间的根模块,例如组件的名称
|
|
65
|
-
* @param {string} [namespace] 指定命名空间,未指定使用默认值 ibiz
|
|
66
|
-
*/
|
|
67
|
-
constructor(
|
|
68
|
-
protected block: string,
|
|
69
|
-
namespace?: string,
|
|
70
|
-
) {
|
|
71
|
-
this.namespace = namespace || defaultNamespace;
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* namespace-block
|
|
76
|
-
* namespace-block-blockSuffix
|
|
77
|
-
*
|
|
78
|
-
* @author chitanda
|
|
79
|
-
* @date 2022-09-06 12:09:08
|
|
80
|
-
* @param {string} [blockSuffix='']
|
|
81
|
-
* @return {*} {string}
|
|
82
|
-
*/
|
|
83
|
-
b(blockSuffix: string = ''): string {
|
|
84
|
-
return _bem(this.namespace, this.block, blockSuffix, '', '');
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* namespace-block__element
|
|
89
|
-
*
|
|
90
|
-
* @author chitanda
|
|
91
|
-
* @date 2022-09-06 12:09:48
|
|
92
|
-
* @param {string} [element]
|
|
93
|
-
* @return {*} {string}
|
|
94
|
-
*/
|
|
95
|
-
e(element?: string): string {
|
|
96
|
-
return element ? _bem(this.namespace, this.block, '', element, '') : '';
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* namespace-block--modifier
|
|
101
|
-
*
|
|
102
|
-
* @author chitanda
|
|
103
|
-
* @date 2022-09-06 12:09:37
|
|
104
|
-
* @param {string} [modifier]
|
|
105
|
-
* @return {*} {string}
|
|
106
|
-
*/
|
|
107
|
-
m(modifier?: string): string {
|
|
108
|
-
return modifier ? _bem(this.namespace, this.block, '', '', modifier) : '';
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
/**
|
|
112
|
-
* namespace-block-blockSuffix__element
|
|
113
|
-
*
|
|
114
|
-
* @author chitanda
|
|
115
|
-
* @date 2022-09-06 12:09:52
|
|
116
|
-
* @param {string} [blockSuffix]
|
|
117
|
-
* @param {string} [element]
|
|
118
|
-
* @return {*} {string}
|
|
119
|
-
*/
|
|
120
|
-
be(blockSuffix?: string, element?: string): string {
|
|
121
|
-
return blockSuffix && element
|
|
122
|
-
? _bem(this.namespace, this.block, blockSuffix, element, '')
|
|
123
|
-
: '';
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* namespace-block__element--modifier
|
|
128
|
-
*
|
|
129
|
-
* @author chitanda
|
|
130
|
-
* @date 2022-09-06 12:09:19
|
|
131
|
-
* @param {string} [element]
|
|
132
|
-
* @param {string} [modifier]
|
|
133
|
-
* @return {*} {string}
|
|
134
|
-
*/
|
|
135
|
-
em(element?: string, modifier?: string): string {
|
|
136
|
-
return element && modifier
|
|
137
|
-
? _bem(this.namespace, this.block, '', element, modifier)
|
|
138
|
-
: '';
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
/**
|
|
142
|
-
* namespace-block-blockSuffix--modifier
|
|
143
|
-
*
|
|
144
|
-
* @author chitanda
|
|
145
|
-
* @date 2022-09-06 12:09:59
|
|
146
|
-
* @param {string} [blockSuffix]
|
|
147
|
-
* @param {string} [modifier]
|
|
148
|
-
* @return {*} {string}
|
|
149
|
-
*/
|
|
150
|
-
bm(blockSuffix?: string, modifier?: string): string {
|
|
151
|
-
return blockSuffix && modifier
|
|
152
|
-
? _bem(this.namespace, this.block, blockSuffix, '', modifier)
|
|
153
|
-
: '';
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
/**
|
|
157
|
-
* namespace-block-blockSuffix__element--modifier
|
|
158
|
-
*
|
|
159
|
-
* @author chitanda
|
|
160
|
-
* @date 2022-09-06 12:09:37
|
|
161
|
-
* @param {string} [blockSuffix]
|
|
162
|
-
* @param {string} [element]
|
|
163
|
-
* @param {string} [modifier]
|
|
164
|
-
* @return {*} {string}
|
|
165
|
-
*/
|
|
166
|
-
bem(blockSuffix?: string, element?: string, modifier?: string): string {
|
|
167
|
-
return blockSuffix && element && modifier
|
|
168
|
-
? _bem(this.namespace, this.block, blockSuffix, element, modifier)
|
|
169
|
-
: '';
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
/**
|
|
173
|
-
* 返回状态 class
|
|
174
|
-
*
|
|
175
|
-
* is('loading', false) => '';
|
|
176
|
-
* is('loading', true) => 'is-loading';
|
|
177
|
-
*
|
|
178
|
-
* @author chitanda
|
|
179
|
-
* @date 2022-09-06 12:09:57
|
|
180
|
-
* @param {string} name
|
|
181
|
-
* @param {boolean} [state]
|
|
182
|
-
* @return {*} {string}
|
|
183
|
-
*/
|
|
184
|
-
is(name: string, state?: boolean): string {
|
|
185
|
-
return name && state ? `${statePrefix}${name}` : '';
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* 生成使用到的 css 变量 style 对象
|
|
190
|
-
*
|
|
191
|
-
* @author chitanda
|
|
192
|
-
* @date 2022-09-06 15:09:41
|
|
193
|
-
* @param {Record<string, string>} object
|
|
194
|
-
* @return {*} {Record<string, string>}
|
|
195
|
-
*/
|
|
196
|
-
cssVar(object: Record<string, string>): Record<string, string> {
|
|
197
|
-
const styles: Record<string, string> = {};
|
|
198
|
-
for (const key in object) {
|
|
199
|
-
if (object[key]) {
|
|
200
|
-
styles[this.cssVarName(key)] = object[key];
|
|
201
|
-
}
|
|
202
|
-
}
|
|
203
|
-
return styles;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
/**
|
|
207
|
-
* 生成使用到的 css block 变量 style 对象
|
|
208
|
-
*
|
|
209
|
-
* @author chitanda
|
|
210
|
-
* @date 2022-09-06 15:09:03
|
|
211
|
-
* @param {Record<string, string>} object
|
|
212
|
-
* @return {*} {Record<string, string>}
|
|
213
|
-
*/
|
|
214
|
-
cssVarBlock(object: Record<string, string>): Record<string, string> {
|
|
215
|
-
const styles: Record<string, string> = {};
|
|
216
|
-
for (const key in object) {
|
|
217
|
-
if (object[key]) {
|
|
218
|
-
styles[this.cssVarBlockName(key)] = object[key];
|
|
219
|
-
}
|
|
220
|
-
}
|
|
221
|
-
return styles;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
/**
|
|
225
|
-
* 生成 css var 变量名称
|
|
226
|
-
*
|
|
227
|
-
* @author chitanda
|
|
228
|
-
* @date 2022-09-06 15:09:21
|
|
229
|
-
* @param {string} name
|
|
230
|
-
* @return {*} {string}
|
|
231
|
-
*/
|
|
232
|
-
cssVarName(name: string): string {
|
|
233
|
-
return `--${this.namespace}-${name}`;
|
|
234
|
-
}
|
|
235
|
-
|
|
236
|
-
/**
|
|
237
|
-
* 生成块 css var 变量名称
|
|
238
|
-
*
|
|
239
|
-
* @author chitanda
|
|
240
|
-
* @date 2022-09-06 15:09:35
|
|
241
|
-
* @param {string} name
|
|
242
|
-
* @return {*} {string}
|
|
243
|
-
*/
|
|
244
|
-
cssVarBlockName(name: string): string {
|
|
245
|
-
return `--${this.namespace}-${this.block}-${name}`;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import axios, {
|
|
2
|
-
AxiosResponse,
|
|
3
|
-
AxiosResponseHeaders,
|
|
4
|
-
InternalAxiosRequestConfig,
|
|
5
|
-
RawAxiosResponseHeaders,
|
|
6
|
-
} from 'axios';
|
|
7
|
-
|
|
8
|
-
/**
|
|
9
|
-
* Http请求返回接口
|
|
10
|
-
*
|
|
11
|
-
* @author chitanda
|
|
12
|
-
* @date 2022-08-21 17:08:06
|
|
13
|
-
* @export
|
|
14
|
-
* @interface IHttpResponse
|
|
15
|
-
* @extends {AxiosResponse}
|
|
16
|
-
* @template T
|
|
17
|
-
*/
|
|
18
|
-
export interface IHttpResponse<T = IData> extends AxiosResponse {
|
|
19
|
-
/**
|
|
20
|
-
* 是否请求成功
|
|
21
|
-
*
|
|
22
|
-
* @description 当状态码为 200-299 时认为成功
|
|
23
|
-
* @author chitanda
|
|
24
|
-
* @date 2022-07-14 16:07:59
|
|
25
|
-
* @type {boolean}
|
|
26
|
-
*/
|
|
27
|
-
ok: boolean;
|
|
28
|
-
/**
|
|
29
|
-
* 是否为本地仿造响应
|
|
30
|
-
*
|
|
31
|
-
* @description 只有当值为 true 时, 才认为是本地仿造响应
|
|
32
|
-
* @author chitanda
|
|
33
|
-
* @date 2022-08-18 15:08:44
|
|
34
|
-
* @type {boolean}
|
|
35
|
-
*/
|
|
36
|
-
local: boolean;
|
|
37
|
-
|
|
38
|
-
data: T;
|
|
39
|
-
|
|
40
|
-
/**
|
|
41
|
-
* 当前页
|
|
42
|
-
*/
|
|
43
|
-
page?: number;
|
|
44
|
-
|
|
45
|
-
/**
|
|
46
|
-
* 分页条数
|
|
47
|
-
*/
|
|
48
|
-
size?: number;
|
|
49
|
-
|
|
50
|
-
/**
|
|
51
|
-
* 总条数
|
|
52
|
-
*/
|
|
53
|
-
total?: number;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
/**
|
|
57
|
-
* 本地请求仿造响应
|
|
58
|
-
*
|
|
59
|
-
* @author chitanda
|
|
60
|
-
* @date 2022-08-21 17:08:00
|
|
61
|
-
* @export
|
|
62
|
-
* @class HttpResponse
|
|
63
|
-
* @implements {IHttpResponse<T>}
|
|
64
|
-
* @template T
|
|
65
|
-
*/
|
|
66
|
-
export class HttpResponse<T = IData> implements IHttpResponse<T> {
|
|
67
|
-
/**
|
|
68
|
-
* 本地仿造响应
|
|
69
|
-
*
|
|
70
|
-
* @author chitanda
|
|
71
|
-
* @date 2022-08-18 15:08:06
|
|
72
|
-
*/
|
|
73
|
-
local = true;
|
|
74
|
-
|
|
75
|
-
ok = false;
|
|
76
|
-
|
|
77
|
-
data: T;
|
|
78
|
-
|
|
79
|
-
status: number;
|
|
80
|
-
|
|
81
|
-
statusText: string;
|
|
82
|
-
|
|
83
|
-
headers: RawAxiosResponseHeaders | AxiosResponseHeaders = {};
|
|
84
|
-
|
|
85
|
-
config: InternalAxiosRequestConfig<IData> = {
|
|
86
|
-
headers: new axios.AxiosHeaders(),
|
|
87
|
-
};
|
|
88
|
-
|
|
89
|
-
/**
|
|
90
|
-
* Creates an instance of HttpResponse.
|
|
91
|
-
*
|
|
92
|
-
* @author chitanda
|
|
93
|
-
* @date 2022-08-18 15:08:11
|
|
94
|
-
* @param {unknown} [data] 返回的数据
|
|
95
|
-
* @param {number} [status] 状态码 (默认为 200)
|
|
96
|
-
* @param {string} [statusText] 状态描述 (默认为空字符)
|
|
97
|
-
*/
|
|
98
|
-
constructor(data?: unknown, status?: number, statusText?: string) {
|
|
99
|
-
this.data = data as T;
|
|
100
|
-
this.status = status || 200;
|
|
101
|
-
this.statusText = statusText || '';
|
|
102
|
-
if (this.status >= 200 && this.status < 300) {
|
|
103
|
-
this.ok = true;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
}
|