@ibiz-template/core 0.0.1-alpha.1 → 0.0.1-alpha.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/out/context/index.js +3 -3
- package/out/environment/environment.d.ts.map +1 -1
- package/out/environment/environment.js +5 -1
- package/out/ibizsys.d.ts +0 -7
- package/out/ibizsys.d.ts.map +1 -1
- package/out/ibizsys.js +1 -9
- package/out/index.d.ts +0 -1
- package/out/index.d.ts.map +1 -1
- package/out/index.js +0 -1
- package/out/install.d.ts.map +1 -1
- package/out/install.js +3 -2
- package/out/interface/i-environment/i-environment.d.ts +40 -1
- package/out/interface/i-environment/i-environment.d.ts.map +1 -1
- package/out/utils/index.d.ts +5 -2
- package/out/utils/index.d.ts.map +1 -1
- package/out/utils/index.js +4 -1
- package/out/utils/namespace/namespace.d.ts +148 -0
- package/out/utils/namespace/namespace.d.ts.map +1 -0
- package/out/utils/namespace/namespace.js +216 -0
- package/out/utils/net/http-response.d.ts +94 -0
- package/out/utils/net/http-response.d.ts.map +1 -0
- package/out/utils/net/http-response.js +53 -0
- package/out/utils/net/net.d.ts +16 -34
- package/out/utils/net/net.d.ts.map +1 -1
- package/out/utils/net/net.js +16 -13
- package/out/utils/plural/plural.d.ts +21 -0
- package/out/utils/plural/plural.d.ts.map +1 -0
- package/out/utils/plural/plural.js +25 -0
- package/package.json +13 -9
- package/src/context/index.ts +3 -3
- package/src/environment/environment.ts +5 -1
- package/src/ibizsys.ts +1 -10
- package/src/index.ts +0 -2
- package/src/install.ts +3 -2
- package/src/interface/i-environment/i-environment.ts +45 -2
- package/src/utils/index.ts +5 -2
- package/src/utils/namespace/namespace.ts +244 -0
- package/src/utils/net/http-response.ts +113 -0
- package/src/utils/net/net.ts +26 -40
- package/src/utils/plural/plural.ts +27 -0
package/out/context/index.js
CHANGED
|
@@ -16,14 +16,14 @@ export class IBizContextProxyHandle {
|
|
|
16
16
|
return true;
|
|
17
17
|
}
|
|
18
18
|
get(target, p, _receiver) {
|
|
19
|
-
if (target[p]) {
|
|
19
|
+
if (target[p] !== undefined) {
|
|
20
20
|
return target[p];
|
|
21
21
|
}
|
|
22
|
-
if (target.context[p]) {
|
|
22
|
+
if (target.context[p] !== undefined) {
|
|
23
23
|
return target.context[p];
|
|
24
24
|
}
|
|
25
25
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
26
|
-
if (target._parent) {
|
|
26
|
+
if (target._parent && target._parent[p] !== undefined) {
|
|
27
27
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
28
28
|
return target._parent[p];
|
|
29
29
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/environment/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,
|
|
1
|
+
{"version":3,"file":"environment.d.ts","sourceRoot":"","sources":["../../src/environment/environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,cAAc,CAAC;AAE5C;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,YAMzB,CAAC"}
|
package/out/ibizsys.d.ts
CHANGED
|
@@ -16,13 +16,6 @@ export declare class IBizSys {
|
|
|
16
16
|
* @date 2022-07-19 18:07:04
|
|
17
17
|
*/
|
|
18
18
|
env: import("./interface").IEnvironment;
|
|
19
|
-
/**
|
|
20
|
-
* 指令控制器
|
|
21
|
-
*
|
|
22
|
-
* @author chitanda
|
|
23
|
-
* @date 2022-07-21 17:07:45
|
|
24
|
-
*/
|
|
25
|
-
commands: import("@ibiz-template/command/out/command").CommandController;
|
|
26
19
|
/**
|
|
27
20
|
* 网络请求工具类
|
|
28
21
|
*
|
package/out/ibizsys.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ibizsys.d.ts","sourceRoot":"","sources":["../src/ibizsys.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ibizsys.d.ts","sourceRoot":"","sources":["../src/ibizsys.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAC;AAE9B;;;;;;;GAOG;AACH,qBAAa,OAAO;IAClB;;;;;OAKG;IACH,GAAG,qCAAe;IAElB;;;;;;OAMG;IACH,GAAG,EAAE,GAAG,CAAa;IAErB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,KAAK,CAAC;CACjB"}
|
package/out/ibizsys.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { commands } from '@ibiz-template/command';
|
|
2
1
|
import { Environment } from './environment/environment';
|
|
3
2
|
import { Net } from './utils';
|
|
4
3
|
/**
|
|
@@ -18,13 +17,6 @@ export class IBizSys {
|
|
|
18
17
|
* @date 2022-07-19 18:07:04
|
|
19
18
|
*/
|
|
20
19
|
this.env = Environment;
|
|
21
|
-
/**
|
|
22
|
-
* 指令控制器
|
|
23
|
-
*
|
|
24
|
-
* @author chitanda
|
|
25
|
-
* @date 2022-07-21 17:07:45
|
|
26
|
-
*/
|
|
27
|
-
this.commands = commands;
|
|
28
20
|
/**
|
|
29
21
|
* 网络请求工具类
|
|
30
22
|
*
|
|
@@ -32,6 +24,6 @@ export class IBizSys {
|
|
|
32
24
|
* @date 2022-07-19 17:07:56
|
|
33
25
|
* @type {Net}
|
|
34
26
|
*/
|
|
35
|
-
this.net = new Net(
|
|
27
|
+
this.net = new Net();
|
|
36
28
|
}
|
|
37
29
|
}
|
package/out/index.d.ts
CHANGED
package/out/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAC;AAEjB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,CAAC;AAEjB,cAAc,YAAY,CAAC;AAC3B,OAAO,EAAE,WAAW,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
package/out/index.js
CHANGED
package/out/install.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,OAAO,IAAI,IAAI,
|
|
1
|
+
{"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,OAAO,IAAI,IAAI,CAM9B"}
|
package/out/install.js
CHANGED
|
@@ -8,8 +8,9 @@ import { Interceptor } from './utils';
|
|
|
8
8
|
* @export
|
|
9
9
|
*/
|
|
10
10
|
export function install() {
|
|
11
|
-
if (
|
|
12
|
-
|
|
11
|
+
if (window.ibiz) {
|
|
12
|
+
throw new Error('ibiz 已经存在, 无需重复安装');
|
|
13
13
|
}
|
|
14
|
+
window.ibiz = new IBizSys();
|
|
14
15
|
new Interceptor();
|
|
15
16
|
}
|
|
@@ -7,7 +7,14 @@
|
|
|
7
7
|
* @interface IEnvironment
|
|
8
8
|
*/
|
|
9
9
|
export interface IEnvironment {
|
|
10
|
-
|
|
10
|
+
/**
|
|
11
|
+
* 命名空间
|
|
12
|
+
*
|
|
13
|
+
* @author chitanda
|
|
14
|
+
* @date 2022-09-06 11:09:32
|
|
15
|
+
* @type {string}
|
|
16
|
+
*/
|
|
17
|
+
namespace?: string;
|
|
11
18
|
/**
|
|
12
19
|
* 请求根路径
|
|
13
20
|
*
|
|
@@ -16,5 +23,37 @@ export interface IEnvironment {
|
|
|
16
23
|
* @type {string}
|
|
17
24
|
*/
|
|
18
25
|
baseUrl: string;
|
|
26
|
+
/**
|
|
27
|
+
* 资源文件根路径
|
|
28
|
+
*
|
|
29
|
+
* @author lxm
|
|
30
|
+
* @date 2022-08-25 14:08:08
|
|
31
|
+
* @type {string}
|
|
32
|
+
*/
|
|
33
|
+
assetsUrl: string;
|
|
34
|
+
/**
|
|
35
|
+
* 中心系统标识
|
|
36
|
+
*
|
|
37
|
+
* @author chitanda
|
|
38
|
+
* @date 2022-08-22 23:08:46
|
|
39
|
+
* @type {string}
|
|
40
|
+
*/
|
|
41
|
+
dcSystem: string;
|
|
42
|
+
/**
|
|
43
|
+
* 文件导出
|
|
44
|
+
*
|
|
45
|
+
* @author chitanda
|
|
46
|
+
* @date 2022-08-22 23:08:46
|
|
47
|
+
* @type {string}
|
|
48
|
+
*/
|
|
49
|
+
ExportFile: string;
|
|
50
|
+
/**
|
|
51
|
+
* 文件上传
|
|
52
|
+
*
|
|
53
|
+
* @author chitanda
|
|
54
|
+
* @date 2022-08-22 23:08:46
|
|
55
|
+
* @type {string}
|
|
56
|
+
*/
|
|
57
|
+
UploadFile: string;
|
|
19
58
|
}
|
|
20
59
|
//# sourceMappingURL=i-environment.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"i-environment.d.ts","sourceRoot":"","sources":["../../../src/interface/i-environment/i-environment.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;
|
|
1
|
+
{"version":3,"file":"i-environment.d.ts","sourceRoot":"","sources":["../../../src/interface/i-environment/i-environment.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;OAMG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;OAMG;IACH,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
package/out/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
export { Interceptor } from './interceptor/interceptor';
|
|
2
|
-
export {
|
|
3
|
-
export {
|
|
2
|
+
export { Namespace } from './namespace/namespace';
|
|
3
|
+
export { IHttpResponse, HttpResponse } from './net/http-response';
|
|
4
|
+
export { Net } from './net/net';
|
|
5
|
+
export { plural, pluralLower } from './plural/plural';
|
|
6
|
+
export * from './util/util';
|
|
4
7
|
//# sourceMappingURL=index.d.ts.map
|
package/out/utils/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,aAAa,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAChC,OAAO,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AACtD,cAAc,aAAa,CAAC"}
|
package/out/utils/index.js
CHANGED
|
@@ -1,3 +1,6 @@
|
|
|
1
1
|
export { Interceptor } from './interceptor/interceptor';
|
|
2
|
+
export { Namespace } from './namespace/namespace';
|
|
3
|
+
export { HttpResponse } from './net/http-response';
|
|
2
4
|
export { Net } from './net/net';
|
|
3
|
-
export {
|
|
5
|
+
export { plural, pluralLower } from './plural/plural';
|
|
6
|
+
export * from './util/util';
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
export declare const defaultNamespace = "ibiz";
|
|
2
|
+
/**
|
|
3
|
+
* 全局样式处理命名空间
|
|
4
|
+
*
|
|
5
|
+
* @author chitanda
|
|
6
|
+
* @date 2022-09-06 11:09:50
|
|
7
|
+
* @export
|
|
8
|
+
* @class Namespace
|
|
9
|
+
*/
|
|
10
|
+
export declare class Namespace {
|
|
11
|
+
protected block: string;
|
|
12
|
+
/**
|
|
13
|
+
* 命名空间
|
|
14
|
+
*
|
|
15
|
+
* @author chitanda
|
|
16
|
+
* @date 2022-09-06 12:09:01
|
|
17
|
+
* @type {string}
|
|
18
|
+
*/
|
|
19
|
+
namespace: string;
|
|
20
|
+
/**
|
|
21
|
+
* Creates an instance of Namespace.
|
|
22
|
+
*
|
|
23
|
+
* @author chitanda
|
|
24
|
+
* @date 2022-09-06 12:09:12
|
|
25
|
+
* @param {string} block 当前命名空间的根模块,例如组件的名称
|
|
26
|
+
* @param {string} [namespace] 指定命名空间,未指定使用默认值 ibiz
|
|
27
|
+
*/
|
|
28
|
+
constructor(block: string, namespace?: string);
|
|
29
|
+
/**
|
|
30
|
+
* namespace-block
|
|
31
|
+
* namespace-block-blockSuffix
|
|
32
|
+
*
|
|
33
|
+
* @author chitanda
|
|
34
|
+
* @date 2022-09-06 12:09:08
|
|
35
|
+
* @param {string} [blockSuffix='']
|
|
36
|
+
* @return {*} {string}
|
|
37
|
+
*/
|
|
38
|
+
b(blockSuffix?: string): string;
|
|
39
|
+
/**
|
|
40
|
+
* namespace-block__element
|
|
41
|
+
*
|
|
42
|
+
* @author chitanda
|
|
43
|
+
* @date 2022-09-06 12:09:48
|
|
44
|
+
* @param {string} [element]
|
|
45
|
+
* @return {*} {string}
|
|
46
|
+
*/
|
|
47
|
+
e(element?: string): string;
|
|
48
|
+
/**
|
|
49
|
+
* namespace-block--modifier
|
|
50
|
+
*
|
|
51
|
+
* @author chitanda
|
|
52
|
+
* @date 2022-09-06 12:09:37
|
|
53
|
+
* @param {string} [modifier]
|
|
54
|
+
* @return {*} {string}
|
|
55
|
+
*/
|
|
56
|
+
m(modifier?: string): string;
|
|
57
|
+
/**
|
|
58
|
+
* namespace-block-blockSuffix__element
|
|
59
|
+
*
|
|
60
|
+
* @author chitanda
|
|
61
|
+
* @date 2022-09-06 12:09:52
|
|
62
|
+
* @param {string} [blockSuffix]
|
|
63
|
+
* @param {string} [element]
|
|
64
|
+
* @return {*} {string}
|
|
65
|
+
*/
|
|
66
|
+
be(blockSuffix?: string, element?: string): string;
|
|
67
|
+
/**
|
|
68
|
+
* namespace-block__element--modifier
|
|
69
|
+
*
|
|
70
|
+
* @author chitanda
|
|
71
|
+
* @date 2022-09-06 12:09:19
|
|
72
|
+
* @param {string} [element]
|
|
73
|
+
* @param {string} [modifier]
|
|
74
|
+
* @return {*} {string}
|
|
75
|
+
*/
|
|
76
|
+
em(element?: string, modifier?: string): string;
|
|
77
|
+
/**
|
|
78
|
+
* namespace-block-blockSuffix--modifier
|
|
79
|
+
*
|
|
80
|
+
* @author chitanda
|
|
81
|
+
* @date 2022-09-06 12:09:59
|
|
82
|
+
* @param {string} [blockSuffix]
|
|
83
|
+
* @param {string} [modifier]
|
|
84
|
+
* @return {*} {string}
|
|
85
|
+
*/
|
|
86
|
+
bm(blockSuffix?: string, modifier?: string): string;
|
|
87
|
+
/**
|
|
88
|
+
* namespace-block-blockSuffix__element--modifier
|
|
89
|
+
*
|
|
90
|
+
* @author chitanda
|
|
91
|
+
* @date 2022-09-06 12:09:37
|
|
92
|
+
* @param {string} [blockSuffix]
|
|
93
|
+
* @param {string} [element]
|
|
94
|
+
* @param {string} [modifier]
|
|
95
|
+
* @return {*} {string}
|
|
96
|
+
*/
|
|
97
|
+
bem(blockSuffix?: string, element?: string, modifier?: string): string;
|
|
98
|
+
/**
|
|
99
|
+
* 返回状态 class
|
|
100
|
+
*
|
|
101
|
+
* is('loading', false) => '';
|
|
102
|
+
* is('loading', true) => 'is-loading';
|
|
103
|
+
*
|
|
104
|
+
* @author chitanda
|
|
105
|
+
* @date 2022-09-06 12:09:57
|
|
106
|
+
* @param {string} name
|
|
107
|
+
* @param {boolean} [state]
|
|
108
|
+
* @return {*} {string}
|
|
109
|
+
*/
|
|
110
|
+
is(name: string, state?: boolean): string;
|
|
111
|
+
/**
|
|
112
|
+
* 生成使用到的 css 变量 style 对象
|
|
113
|
+
*
|
|
114
|
+
* @author chitanda
|
|
115
|
+
* @date 2022-09-06 15:09:41
|
|
116
|
+
* @param {Record<string, string>} object
|
|
117
|
+
* @return {*} {Record<string, string>}
|
|
118
|
+
*/
|
|
119
|
+
cssVar(object: Record<string, string>): Record<string, string>;
|
|
120
|
+
/**
|
|
121
|
+
* 生成使用到的 css block 变量 style 对象
|
|
122
|
+
*
|
|
123
|
+
* @author chitanda
|
|
124
|
+
* @date 2022-09-06 15:09:03
|
|
125
|
+
* @param {Record<string, string>} object
|
|
126
|
+
* @return {*} {Record<string, string>}
|
|
127
|
+
*/
|
|
128
|
+
cssVarBlock(object: Record<string, string>): Record<string, string>;
|
|
129
|
+
/**
|
|
130
|
+
* 生成 css var 变量名称
|
|
131
|
+
*
|
|
132
|
+
* @author chitanda
|
|
133
|
+
* @date 2022-09-06 15:09:21
|
|
134
|
+
* @param {string} name
|
|
135
|
+
* @return {*} {string}
|
|
136
|
+
*/
|
|
137
|
+
cssVarName(name: string): string;
|
|
138
|
+
/**
|
|
139
|
+
* 生成块 css var 变量名称
|
|
140
|
+
*
|
|
141
|
+
* @author chitanda
|
|
142
|
+
* @date 2022-09-06 15:09:35
|
|
143
|
+
* @param {string} name
|
|
144
|
+
* @return {*} {string}
|
|
145
|
+
*/
|
|
146
|
+
cssVarBlockName(name: string): string;
|
|
147
|
+
}
|
|
148
|
+
//# sourceMappingURL=namespace.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"namespace.d.ts","sourceRoot":"","sources":["../../../src/utils/namespace/namespace.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB,SAAS,CAAC;AAwCvC;;;;;;;GAOG;AACH,qBAAa,SAAS;IAkBR,SAAS,CAAC,KAAK,EAAE,MAAM;IAjBnC;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;;OAOG;gBACmB,KAAK,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM;IAIvD;;;;;;;;OAQG;IACH,CAAC,CAAC,WAAW,GAAE,MAAW,GAAG,MAAM;IAInC;;;;;;;OAOG;IACH,CAAC,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;IAI3B;;;;;;;OAOG;IACH,CAAC,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IAI5B;;;;;;;;OAQG;IACH,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM;IAMlD;;;;;;;;OAQG;IACH,EAAE,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IAM/C;;;;;;;;OAQG;IACH,EAAE,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IAMnD;;;;;;;;;OASG;IACH,GAAG,CAAC,WAAW,CAAC,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM;IAMtE;;;;;;;;;;;OAWG;IACH,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM;IAIzC;;;;;;;OAOG;IACH,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAU9D;;;;;;;OAOG;IACH,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC;IAUnE;;;;;;;OAOG;IACH,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;IAIhC;;;;;;;OAOG;IACH,eAAe,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM;CAGtC"}
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
export const defaultNamespace = 'ibiz';
|
|
2
|
+
const statePrefix = 'is-';
|
|
3
|
+
/**
|
|
4
|
+
* css bem 命名规则拼接
|
|
5
|
+
* _bem('ibiz', 'layout') => ibiz-layout
|
|
6
|
+
* _bem('ibiz', 'layout', '', 'title') => ibiz-layout__title
|
|
7
|
+
* _bem('ibiz', 'layout', '', '', 'right') => ibiz-layout--right
|
|
8
|
+
* _bem('ibiz', 'layout', '', 'title', 'right') => ibiz-layout__title--right
|
|
9
|
+
* _bem('ibiz', 'layout', 'header', 'title', 'right') => ibiz-layout-header__title--right
|
|
10
|
+
*
|
|
11
|
+
* @author chitanda
|
|
12
|
+
* @date 2022-09-06 11:09:42
|
|
13
|
+
* @param {string} namespace 命名空间
|
|
14
|
+
* @param {string} block 块
|
|
15
|
+
* @param {string} blockSuffix 块后缀
|
|
16
|
+
* @param {string} element 元素
|
|
17
|
+
* @param {string} modifier 修饰符
|
|
18
|
+
* @return {*} {string}
|
|
19
|
+
*/
|
|
20
|
+
function _bem(namespace, block, blockSuffix, element, modifier) {
|
|
21
|
+
let cls = `${namespace}-${block}`;
|
|
22
|
+
if (blockSuffix) {
|
|
23
|
+
cls += `-${blockSuffix}`;
|
|
24
|
+
}
|
|
25
|
+
if (element) {
|
|
26
|
+
cls += `__${element}`;
|
|
27
|
+
}
|
|
28
|
+
if (modifier) {
|
|
29
|
+
cls += `--${modifier}`;
|
|
30
|
+
}
|
|
31
|
+
return cls;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* 全局样式处理命名空间
|
|
35
|
+
*
|
|
36
|
+
* @author chitanda
|
|
37
|
+
* @date 2022-09-06 11:09:50
|
|
38
|
+
* @export
|
|
39
|
+
* @class Namespace
|
|
40
|
+
*/
|
|
41
|
+
export class Namespace {
|
|
42
|
+
/**
|
|
43
|
+
* Creates an instance of Namespace.
|
|
44
|
+
*
|
|
45
|
+
* @author chitanda
|
|
46
|
+
* @date 2022-09-06 12:09:12
|
|
47
|
+
* @param {string} block 当前命名空间的根模块,例如组件的名称
|
|
48
|
+
* @param {string} [namespace] 指定命名空间,未指定使用默认值 ibiz
|
|
49
|
+
*/
|
|
50
|
+
constructor(block, namespace) {
|
|
51
|
+
this.block = block;
|
|
52
|
+
this.namespace = namespace || defaultNamespace;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* namespace-block
|
|
56
|
+
* namespace-block-blockSuffix
|
|
57
|
+
*
|
|
58
|
+
* @author chitanda
|
|
59
|
+
* @date 2022-09-06 12:09:08
|
|
60
|
+
* @param {string} [blockSuffix='']
|
|
61
|
+
* @return {*} {string}
|
|
62
|
+
*/
|
|
63
|
+
b(blockSuffix = '') {
|
|
64
|
+
return _bem(this.namespace, this.block, blockSuffix, '', '');
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* namespace-block__element
|
|
68
|
+
*
|
|
69
|
+
* @author chitanda
|
|
70
|
+
* @date 2022-09-06 12:09:48
|
|
71
|
+
* @param {string} [element]
|
|
72
|
+
* @return {*} {string}
|
|
73
|
+
*/
|
|
74
|
+
e(element) {
|
|
75
|
+
return element ? _bem(this.namespace, this.block, '', element, '') : '';
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* namespace-block--modifier
|
|
79
|
+
*
|
|
80
|
+
* @author chitanda
|
|
81
|
+
* @date 2022-09-06 12:09:37
|
|
82
|
+
* @param {string} [modifier]
|
|
83
|
+
* @return {*} {string}
|
|
84
|
+
*/
|
|
85
|
+
m(modifier) {
|
|
86
|
+
return modifier ? _bem(this.namespace, this.block, '', '', modifier) : '';
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* namespace-block-blockSuffix__element
|
|
90
|
+
*
|
|
91
|
+
* @author chitanda
|
|
92
|
+
* @date 2022-09-06 12:09:52
|
|
93
|
+
* @param {string} [blockSuffix]
|
|
94
|
+
* @param {string} [element]
|
|
95
|
+
* @return {*} {string}
|
|
96
|
+
*/
|
|
97
|
+
be(blockSuffix, element) {
|
|
98
|
+
return blockSuffix && element
|
|
99
|
+
? _bem(this.namespace, this.block, blockSuffix, element, '')
|
|
100
|
+
: '';
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* namespace-block__element--modifier
|
|
104
|
+
*
|
|
105
|
+
* @author chitanda
|
|
106
|
+
* @date 2022-09-06 12:09:19
|
|
107
|
+
* @param {string} [element]
|
|
108
|
+
* @param {string} [modifier]
|
|
109
|
+
* @return {*} {string}
|
|
110
|
+
*/
|
|
111
|
+
em(element, modifier) {
|
|
112
|
+
return element && modifier
|
|
113
|
+
? _bem(this.namespace, this.block, '', element, modifier)
|
|
114
|
+
: '';
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* namespace-block-blockSuffix--modifier
|
|
118
|
+
*
|
|
119
|
+
* @author chitanda
|
|
120
|
+
* @date 2022-09-06 12:09:59
|
|
121
|
+
* @param {string} [blockSuffix]
|
|
122
|
+
* @param {string} [modifier]
|
|
123
|
+
* @return {*} {string}
|
|
124
|
+
*/
|
|
125
|
+
bm(blockSuffix, modifier) {
|
|
126
|
+
return blockSuffix && modifier
|
|
127
|
+
? _bem(this.namespace, this.block, blockSuffix, '', modifier)
|
|
128
|
+
: '';
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* namespace-block-blockSuffix__element--modifier
|
|
132
|
+
*
|
|
133
|
+
* @author chitanda
|
|
134
|
+
* @date 2022-09-06 12:09:37
|
|
135
|
+
* @param {string} [blockSuffix]
|
|
136
|
+
* @param {string} [element]
|
|
137
|
+
* @param {string} [modifier]
|
|
138
|
+
* @return {*} {string}
|
|
139
|
+
*/
|
|
140
|
+
bem(blockSuffix, element, modifier) {
|
|
141
|
+
return blockSuffix && element && modifier
|
|
142
|
+
? _bem(this.namespace, this.block, blockSuffix, element, modifier)
|
|
143
|
+
: '';
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* 返回状态 class
|
|
147
|
+
*
|
|
148
|
+
* is('loading', false) => '';
|
|
149
|
+
* is('loading', true) => 'is-loading';
|
|
150
|
+
*
|
|
151
|
+
* @author chitanda
|
|
152
|
+
* @date 2022-09-06 12:09:57
|
|
153
|
+
* @param {string} name
|
|
154
|
+
* @param {boolean} [state]
|
|
155
|
+
* @return {*} {string}
|
|
156
|
+
*/
|
|
157
|
+
is(name, state) {
|
|
158
|
+
return name && state ? `${statePrefix}${name}` : '';
|
|
159
|
+
}
|
|
160
|
+
/**
|
|
161
|
+
* 生成使用到的 css 变量 style 对象
|
|
162
|
+
*
|
|
163
|
+
* @author chitanda
|
|
164
|
+
* @date 2022-09-06 15:09:41
|
|
165
|
+
* @param {Record<string, string>} object
|
|
166
|
+
* @return {*} {Record<string, string>}
|
|
167
|
+
*/
|
|
168
|
+
cssVar(object) {
|
|
169
|
+
const styles = {};
|
|
170
|
+
for (const key in object) {
|
|
171
|
+
if (object[key]) {
|
|
172
|
+
styles[this.cssVarName(key)] = object[key];
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
return styles;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* 生成使用到的 css block 变量 style 对象
|
|
179
|
+
*
|
|
180
|
+
* @author chitanda
|
|
181
|
+
* @date 2022-09-06 15:09:03
|
|
182
|
+
* @param {Record<string, string>} object
|
|
183
|
+
* @return {*} {Record<string, string>}
|
|
184
|
+
*/
|
|
185
|
+
cssVarBlock(object) {
|
|
186
|
+
const styles = {};
|
|
187
|
+
for (const key in object) {
|
|
188
|
+
if (object[key]) {
|
|
189
|
+
styles[this.cssVarBlockName(key)] = object[key];
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
return styles;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* 生成 css var 变量名称
|
|
196
|
+
*
|
|
197
|
+
* @author chitanda
|
|
198
|
+
* @date 2022-09-06 15:09:21
|
|
199
|
+
* @param {string} name
|
|
200
|
+
* @return {*} {string}
|
|
201
|
+
*/
|
|
202
|
+
cssVarName(name) {
|
|
203
|
+
return `--${this.namespace}-${name}`;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* 生成块 css var 变量名称
|
|
207
|
+
*
|
|
208
|
+
* @author chitanda
|
|
209
|
+
* @date 2022-09-06 15:09:35
|
|
210
|
+
* @param {string} name
|
|
211
|
+
* @return {*} {string}
|
|
212
|
+
*/
|
|
213
|
+
cssVarBlockName(name) {
|
|
214
|
+
return `--${this.namespace}-${this.block}-${name}`;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import { AxiosRequestConfig, AxiosResponse, AxiosResponseHeaders } from 'axios';
|
|
2
|
+
/**
|
|
3
|
+
* Http请求返回接口
|
|
4
|
+
*
|
|
5
|
+
* @author chitanda
|
|
6
|
+
* @date 2022-08-21 17:08:06
|
|
7
|
+
* @export
|
|
8
|
+
* @interface IHttpResponse
|
|
9
|
+
* @extends {AxiosResponse}
|
|
10
|
+
* @template T
|
|
11
|
+
*/
|
|
12
|
+
export interface IHttpResponse<T = IData> extends AxiosResponse {
|
|
13
|
+
/**
|
|
14
|
+
* 是否请求成功
|
|
15
|
+
*
|
|
16
|
+
* @description 当状态码为 200-299 时认为成功
|
|
17
|
+
* @author chitanda
|
|
18
|
+
* @date 2022-07-14 16:07:59
|
|
19
|
+
* @type {boolean}
|
|
20
|
+
*/
|
|
21
|
+
ok: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* 是否为本地仿造响应
|
|
24
|
+
*
|
|
25
|
+
* @description 只有当值为 true 时, 才认为是本地仿造响应
|
|
26
|
+
* @author chitanda
|
|
27
|
+
* @date 2022-08-18 15:08:44
|
|
28
|
+
* @type {boolean}
|
|
29
|
+
*/
|
|
30
|
+
local?: boolean;
|
|
31
|
+
data: T;
|
|
32
|
+
/**
|
|
33
|
+
* 当前页
|
|
34
|
+
*/
|
|
35
|
+
page?: number;
|
|
36
|
+
/**
|
|
37
|
+
* 分页条数
|
|
38
|
+
*/
|
|
39
|
+
size?: number;
|
|
40
|
+
/**
|
|
41
|
+
* 总条数
|
|
42
|
+
*/
|
|
43
|
+
total?: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* 本地请求仿造响应
|
|
47
|
+
*
|
|
48
|
+
* @author chitanda
|
|
49
|
+
* @date 2022-08-21 17:08:00
|
|
50
|
+
* @export
|
|
51
|
+
* @class HttpResponse
|
|
52
|
+
* @implements {IHttpResponse<T>}
|
|
53
|
+
* @template T
|
|
54
|
+
*/
|
|
55
|
+
export declare class HttpResponse<T = IData> implements IHttpResponse<T> {
|
|
56
|
+
/**
|
|
57
|
+
* 本地仿造响应
|
|
58
|
+
*
|
|
59
|
+
* @author chitanda
|
|
60
|
+
* @date 2022-08-18 15:08:06
|
|
61
|
+
*/
|
|
62
|
+
local: boolean;
|
|
63
|
+
ok: boolean;
|
|
64
|
+
data: T;
|
|
65
|
+
status: number;
|
|
66
|
+
statusText: string;
|
|
67
|
+
/**
|
|
68
|
+
* header 本地仿造时值为空
|
|
69
|
+
*
|
|
70
|
+
* @author chitanda
|
|
71
|
+
* @date 2022-08-18 15:08:46
|
|
72
|
+
* @type {AxiosResponseHeaders}
|
|
73
|
+
*/
|
|
74
|
+
headers: AxiosResponseHeaders;
|
|
75
|
+
/**
|
|
76
|
+
* AxiosResponse 本地仿造时值为空
|
|
77
|
+
*
|
|
78
|
+
* @author chitanda
|
|
79
|
+
* @date 2022-08-18 15:08:22
|
|
80
|
+
* @type {AxiosRequestConfig<IData>}
|
|
81
|
+
*/
|
|
82
|
+
config: AxiosRequestConfig<IData>;
|
|
83
|
+
/**
|
|
84
|
+
* Creates an instance of HttpResponse.
|
|
85
|
+
*
|
|
86
|
+
* @author chitanda
|
|
87
|
+
* @date 2022-08-18 15:08:11
|
|
88
|
+
* @param {unknown} [data] 返回的数据
|
|
89
|
+
* @param {number} [status] 状态码 (默认为 200)
|
|
90
|
+
* @param {string} [statusText] 状态描述 (默认为空字符)
|
|
91
|
+
*/
|
|
92
|
+
constructor(data?: unknown, status?: number, statusText?: string);
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=http-response.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"http-response.d.ts","sourceRoot":"","sources":["../../../src/utils/net/http-response.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,aAAa,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAEhF;;;;;;;;;GASG;AACH,MAAM,WAAW,aAAa,CAAC,CAAC,GAAG,KAAK,CAAE,SAAQ,aAAa;IAC7D;;;;;;;OAOG;IACH,EAAE,EAAE,OAAO,CAAC;IACZ;;;;;;;OAOG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,IAAI,EAAE,CAAC,CAAC;IAER;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;GASG;AACH,qBAAa,YAAY,CAAC,CAAC,GAAG,KAAK,CAAE,YAAW,aAAa,CAAC,CAAC,CAAC;IAC9D;;;;;OAKG;IACH,KAAK,UAAQ;IAEb,EAAE,UAAS;IAEX,IAAI,EAAE,CAAC,CAAC;IAER,MAAM,EAAE,MAAM,CAAC;IAEf,UAAU,EAAE,MAAM,CAAC;IAEnB;;;;;;OAMG;IACH,OAAO,EAAE,oBAAoB,CAAM;IAEnC;;;;;;OAMG;IACH,MAAM,EAAE,kBAAkB,CAAC,KAAK,CAAC,CAAM;IAEvC;;;;;;;;OAQG;gBACS,IAAI,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,EAAE,MAAM,EAAE,UAAU,CAAC,EAAE,MAAM;CAQjE"}
|