@ibiz-template/core 0.0.1-alpha.6 → 0.0.1-beta.130

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 (141) hide show
  1. package/dist/system/index.system.js +1 -0
  2. package/out/constant/core/core.d.ts +9 -0
  3. package/out/constant/core/core.d.ts.map +1 -1
  4. package/out/constant/core/core.js +9 -0
  5. package/out/constant/index.d.ts +3 -0
  6. package/out/constant/index.d.ts.map +1 -1
  7. package/out/constant/index.js +3 -0
  8. package/out/constant/login-mode/login-mode.d.ts +23 -0
  9. package/out/constant/login-mode/login-mode.d.ts.map +1 -0
  10. package/out/constant/login-mode/login-mode.js +24 -0
  11. package/out/constant/menu-permission-mode/menu-permission-mode.d.ts +23 -0
  12. package/out/constant/menu-permission-mode/menu-permission-mode.d.ts.map +1 -0
  13. package/out/constant/menu-permission-mode/menu-permission-mode.js +24 -0
  14. package/out/constant/util/util.d.ts +5 -0
  15. package/out/constant/util/util.d.ts.map +1 -0
  16. package/out/constant/util/util.js +5 -0
  17. package/out/context/index.d.ts +49 -27
  18. package/out/context/index.d.ts.map +1 -1
  19. package/out/context/index.js +94 -55
  20. package/out/environment/environment.d.ts.map +1 -1
  21. package/out/environment/environment.js +16 -2
  22. package/out/error/http-error/http-error.d.ts.map +1 -1
  23. package/out/error/http-error/http-error.js +0 -4
  24. package/out/factory-center.d.ts +11 -0
  25. package/out/factory-center.d.ts.map +1 -0
  26. package/out/factory-center.js +10 -0
  27. package/out/ibizsys.d.ts +8 -1
  28. package/out/ibizsys.d.ts.map +1 -1
  29. package/out/ibizsys.js +8 -1
  30. package/out/index.d.ts +2 -1
  31. package/out/index.d.ts.map +1 -1
  32. package/out/index.js +2 -1
  33. package/out/install.d.ts.map +1 -1
  34. package/out/install.js +4 -2
  35. package/out/interface/click-outside/click-outside.d.ts +70 -0
  36. package/out/interface/click-outside/click-outside.d.ts.map +1 -0
  37. package/out/interface/click-outside/click-outside.js +1 -0
  38. package/out/interface/i-environment/i-environment.d.ts +108 -4
  39. package/out/interface/i-environment/i-environment.d.ts.map +1 -1
  40. package/out/interface/index.d.ts +1 -0
  41. package/out/interface/index.d.ts.map +1 -1
  42. package/out/interface/index.js +1 -1
  43. package/out/types.d.ts +41 -0
  44. package/out/types.d.ts.map +1 -1
  45. package/out/utils/click-outside/click-outside.d.ts +14 -0
  46. package/out/utils/click-outside/click-outside.d.ts.map +1 -0
  47. package/out/utils/click-outside/click-outside.js +85 -0
  48. package/out/utils/color/color.d.ts +13 -0
  49. package/out/utils/color/color.d.ts.map +1 -0
  50. package/out/utils/color/color.js +76 -0
  51. package/out/utils/download-file/download-file.d.ts +31 -0
  52. package/out/utils/download-file/download-file.d.ts.map +1 -0
  53. package/out/utils/download-file/download-file.js +107 -0
  54. package/out/utils/event/event.d.ts +34 -0
  55. package/out/utils/event/event.d.ts.map +1 -0
  56. package/out/utils/event/event.js +60 -0
  57. package/out/utils/index.d.ts +11 -1
  58. package/out/utils/index.d.ts.map +1 -1
  59. package/out/utils/index.js +11 -1
  60. package/out/utils/interceptor/core-interceptor.d.ts +15 -0
  61. package/out/utils/interceptor/core-interceptor.d.ts.map +1 -0
  62. package/out/utils/interceptor/core-interceptor.js +30 -0
  63. package/out/utils/interceptor/index.d.ts +3 -0
  64. package/out/utils/interceptor/index.d.ts.map +1 -0
  65. package/out/utils/interceptor/index.js +2 -0
  66. package/out/utils/interceptor/interceptor.d.ts +74 -3
  67. package/out/utils/interceptor/interceptor.d.ts.map +1 -1
  68. package/out/utils/interceptor/interceptor.js +73 -22
  69. package/out/utils/logger/logger.d.ts +3 -0
  70. package/out/utils/logger/logger.d.ts.map +1 -0
  71. package/out/utils/logger/logger.js +2 -0
  72. package/out/utils/net/http-response.d.ts +4 -9
  73. package/out/utils/net/http-response.d.ts.map +1 -1
  74. package/out/utils/net/http-response.js +0 -7
  75. package/out/utils/net/net.d.ts +98 -30
  76. package/out/utils/net/net.d.ts.map +1 -1
  77. package/out/utils/net/net.js +133 -38
  78. package/out/utils/plural/plural.d.ts.map +1 -1
  79. package/out/utils/plural/plural.js +2 -0
  80. package/out/utils/string-util/string-util.d.ts +46 -0
  81. package/out/utils/string-util/string-util.d.ts.map +1 -0
  82. package/out/utils/string-util/string-util.js +71 -0
  83. package/out/utils/sync/await-timeout.d.ts +14 -0
  84. package/out/utils/sync/await-timeout.d.ts.map +1 -0
  85. package/out/utils/sync/await-timeout.js +23 -0
  86. package/out/utils/sync/count-latch.d.ts +60 -0
  87. package/out/utils/sync/count-latch.d.ts.map +1 -0
  88. package/out/utils/sync/count-latch.js +90 -0
  89. package/out/utils/sync/index.d.ts +3 -0
  90. package/out/utils/sync/index.d.ts.map +1 -0
  91. package/out/utils/sync/index.js +2 -0
  92. package/out/utils/upload/select-file.d.ts +53 -0
  93. package/out/utils/upload/select-file.d.ts.map +1 -0
  94. package/out/utils/upload/select-file.js +47 -0
  95. package/out/utils/upload/upload-file.d.ts +46 -0
  96. package/out/utils/upload/upload-file.d.ts.map +1 -0
  97. package/out/utils/upload/upload-file.js +150 -0
  98. package/out/utils/url-helper/url-helper.d.ts +51 -0
  99. package/out/utils/url-helper/url-helper.d.ts.map +1 -0
  100. package/out/utils/url-helper/url-helper.js +59 -0
  101. package/out/utils/util/util.d.ts +20 -4
  102. package/out/utils/util/util.d.ts.map +1 -1
  103. package/out/utils/util/util.js +59 -5
  104. package/package.json +21 -10
  105. package/src/constant/core/core.ts +10 -0
  106. package/src/constant/index.ts +3 -0
  107. package/src/constant/login-mode/login-mode.ts +23 -0
  108. package/src/constant/menu-permission-mode/menu-permission-mode.ts +23 -0
  109. package/src/constant/util/util.ts +5 -0
  110. package/src/context/index.ts +127 -51
  111. package/src/environment/environment.ts +16 -2
  112. package/src/error/http-error/http-error.ts +0 -4
  113. package/src/factory-center.ts +9 -0
  114. package/src/ibizsys.ts +9 -1
  115. package/src/index.ts +2 -1
  116. package/src/install.ts +4 -2
  117. package/src/interface/click-outside/click-outside.ts +71 -0
  118. package/src/interface/i-environment/i-environment.ts +122 -4
  119. package/src/interface/index.ts +1 -0
  120. package/src/types.ts +45 -0
  121. package/src/utils/click-outside/click-outside.ts +110 -0
  122. package/src/utils/color/color.ts +84 -0
  123. package/src/utils/download-file/download-file.ts +109 -0
  124. package/src/utils/event/event.ts +77 -0
  125. package/src/utils/index.ts +11 -1
  126. package/src/utils/interceptor/core-interceptor.ts +35 -0
  127. package/src/utils/interceptor/index.ts +2 -0
  128. package/src/utils/interceptor/interceptor.ts +109 -22
  129. package/src/utils/logger/logger.ts +3 -0
  130. package/src/utils/net/http-response.ts +6 -9
  131. package/src/utils/net/net.ts +171 -50
  132. package/src/utils/plural/plural.ts +3 -0
  133. package/src/utils/string-util/string-util.ts +75 -0
  134. package/src/utils/sync/await-timeout.ts +27 -0
  135. package/src/utils/sync/count-latch.ts +96 -0
  136. package/src/utils/sync/index.ts +2 -0
  137. package/src/utils/upload/select-file.ts +86 -0
  138. package/src/utils/upload/upload-file.ts +206 -0
  139. package/src/utils/url-helper/url-helper.ts +62 -0
  140. package/src/utils/util/util.ts +72 -14
  141. package/LICENSE +0 -21
package/out/ibizsys.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { Environment } from './environment/environment';
2
- import { Net } from './utils';
2
+ import { Logger, Net } from './utils';
3
3
  /**
4
4
  * 全局对象
5
5
  *
@@ -17,6 +17,13 @@ export class IBizSys {
17
17
  * @date 2022-07-19 18:07:04
18
18
  */
19
19
  this.env = Environment;
20
+ /**
21
+ * 日志对象
22
+ *
23
+ * @author chitanda
24
+ * @date 2022-10-25 20:10:22
25
+ */
26
+ this.log = Logger;
20
27
  /**
21
28
  * 网络请求工具类
22
29
  *
package/out/index.d.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import './types';
2
2
  export * from './constant';
3
- export { IBizContext, IBizContextProxyHandle } from './context';
3
+ export { IBizContext } from './context';
4
4
  export { Environment } from './environment/environment';
5
5
  export * from './error';
6
6
  export * from './interface';
7
7
  export * from './utils';
8
8
  export { IBizSys } from './ibizsys';
9
+ export { FactoryCenter } from './factory-center';
9
10
  export { install } from './install';
10
11
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
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,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
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,MAAM,WAAW,CAAC;AACxC,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,cAAc,SAAS,CAAC;AACxB,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
package/out/index.js CHANGED
@@ -1,9 +1,10 @@
1
1
  import './types';
2
2
  export * from './constant';
3
- export { IBizContext, IBizContextProxyHandle } from './context';
3
+ export { IBizContext } from './context';
4
4
  export { Environment } from './environment/environment';
5
5
  export * from './error';
6
6
  export * from './interface';
7
7
  export * from './utils';
8
8
  export { IBizSys } from './ibizsys';
9
+ export { FactoryCenter } from './factory-center';
9
10
  export { install } from './install';
@@ -1 +1 @@
1
- {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAGA;;;;;;GAMG;AACH,wBAAgB,OAAO,IAAI,IAAI,CAM9B"}
1
+ {"version":3,"file":"install.d.ts","sourceRoot":"","sources":["../src/install.ts"],"names":[],"mappings":"AAIA;;;;;;GAMG;AACH,wBAAgB,OAAO,IAAI,IAAI,CAO9B"}
package/out/install.js CHANGED
@@ -1,5 +1,6 @@
1
+ import { FactoryCenter } from './factory-center';
1
2
  import { IBizSys } from './ibizsys';
2
- import { Interceptor } from './utils';
3
+ import { CoreInterceptor } from './utils';
3
4
  /**
4
5
  * 初始化全局对象
5
6
  *
@@ -12,5 +13,6 @@ export function install() {
12
13
  throw new Error('ibiz 已经存在, 无需重复安装');
13
14
  }
14
15
  window.ibiz = new IBizSys();
15
- new Interceptor();
16
+ window.___fc = new FactoryCenter();
17
+ ibiz.net.addInterceptor('CoreInterceptor', new CoreInterceptor());
16
18
  }
@@ -0,0 +1,70 @@
1
+ /**
2
+ * 可选配置参数
3
+ *
4
+ * @author lxm
5
+ * @date 2022-10-28 16:10:48
6
+ * @export
7
+ * @interface OnClickOutsideOptions
8
+ * @extends {ConfigurableWindow}
9
+ * @template E
10
+ */
11
+ export interface OnClickOutsideOptions {
12
+ /**
13
+ * 指定使用的window,不给就用默认的window
14
+ * 一般是在iframe或测试环境中使用。
15
+ *
16
+ * @author lxm
17
+ * @date 2022-10-28 17:10:49
18
+ * @type {Window}
19
+ */
20
+ window?: Window;
21
+ /**
22
+ * 指定需要忽略的元素,用于排除某些外部的元素
23
+ *
24
+ * @author lxm
25
+ * @date 2022-10-28 17:10:50
26
+ * @type {HTMLElement[]}
27
+ */
28
+ ignore?: HTMLElement[];
29
+ /**
30
+ * 是否捕获内部元素。默认为是,内部元素不会触发回调。
31
+ * @default true
32
+ */
33
+ capture?: boolean;
34
+ }
35
+ /**
36
+ * 回调处理函数类型
37
+ */
38
+ export type OnClickOutsideHandler = (_evt: PointerEvent | MouseEvent) => void;
39
+ /**
40
+ * OnClickOutside返回对象类型
41
+ *
42
+ * @author lxm
43
+ * @date 2022-10-31 11:10:59
44
+ * @export
45
+ * @interface OnClickOutsideResult
46
+ */
47
+ export interface OnClickOutsideResult {
48
+ /**
49
+ * 停止监听,并移除相关监听事件
50
+ *
51
+ * @author lxm
52
+ * @date 2022-10-31 11:10:28
53
+ */
54
+ stop: () => void;
55
+ /**
56
+ * 暂停监听
57
+ *
58
+ * @author lxm
59
+ * @date 2022-10-31 11:10:30
60
+ */
61
+ pause: () => void;
62
+ /**
63
+ * 继续监听
64
+ *
65
+ * @author lxm
66
+ * @date 2022-10-31 11:10:32
67
+ */
68
+ proceed: () => void;
69
+ }
70
+ //# sourceMappingURL=click-outside.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"click-outside.d.ts","sourceRoot":"","sources":["../../../src/interface/click-outside/click-outside.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,MAAM,WAAW,qBAAqB;IACpC;;;;;;;OAOG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,WAAW,EAAE,CAAC;IACvB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,MAAM,qBAAqB,GAAG,CAAC,IAAI,EAAE,YAAY,GAAG,UAAU,KAAK,IAAI,CAAC;AAE9E;;;;;;;GAOG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;OAKG;IACH,IAAI,EAAE,MAAM,IAAI,CAAC;IACjB;;;;;OAKG;IACH,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB"}
@@ -0,0 +1 @@
1
+ export {};
@@ -1,3 +1,5 @@
1
+ import { LogLevelDesc } from 'loglevel';
2
+ import { LoginMode, MenuPermissionMode } from '../../constant';
1
3
  /**
2
4
  * 配置参数
3
5
  *
@@ -15,6 +17,32 @@ export interface IEnvironment {
15
17
  * @type {string}
16
18
  */
17
19
  namespace?: string;
20
+ /**
21
+ * 是否为开发模式
22
+ *
23
+ * @default false
24
+ * @author chitanda
25
+ * @date 2022-10-21 11:10:29
26
+ * @type {boolean}
27
+ */
28
+ dev: boolean;
29
+ /**
30
+ * 日志级别
31
+ *
32
+ * @author chitanda
33
+ * @date 2022-10-25 20:10:55
34
+ * @type {LogLevelDesc}
35
+ */
36
+ logLevel: LogLevelDesc;
37
+ /**
38
+ * js 静态文件 cdn 地址
39
+ *
40
+ * @default https://cdn.jsdelivr.net/
41
+ * @author chitanda
42
+ * @date 2022-10-24 11:10:14
43
+ * @type {string}
44
+ */
45
+ jsCdn: string;
18
46
  /**
19
47
  * 请求根路径
20
48
  *
@@ -23,6 +51,30 @@ export interface IEnvironment {
23
51
  * @type {string}
24
52
  */
25
53
  baseUrl: string;
54
+ /**
55
+ * 插件默认所在目录
56
+ *
57
+ * @author chitanda
58
+ * @date 2022-10-31 14:10:49
59
+ * @type {string}
60
+ */
61
+ pluginBaseUrl: string;
62
+ /**
63
+ * 登录模式
64
+ *
65
+ * @author lxm
66
+ * @date 2022-10-12 14:10:51
67
+ * @type {LoginMode}
68
+ */
69
+ loginMode: LoginMode;
70
+ /**
71
+ * 中央认证登录地址
72
+ *
73
+ * @author lxm
74
+ * @date 2022-10-11 12:10:21
75
+ * @type {string}
76
+ */
77
+ casLoginUrl: string;
26
78
  /**
27
79
  * 远程模型路径
28
80
  *
@@ -48,20 +100,72 @@ export interface IEnvironment {
48
100
  */
49
101
  dcSystem: string;
50
102
  /**
51
- * 文件导出
103
+ * 文件下载url
52
104
  *
53
105
  * @author chitanda
54
106
  * @date 2022-08-22 23:08:46
55
107
  * @type {string}
56
108
  */
57
- ExportFile: string;
109
+ downloadFileUrl: string;
58
110
  /**
59
- * 文件上传
111
+ * 文件上传url
60
112
  *
61
113
  * @author chitanda
62
114
  * @date 2022-08-22 23:08:46
63
115
  * @type {string}
64
116
  */
65
- UploadFile: string;
117
+ uploadFileUrl: string;
118
+ /**
119
+ * 是否启用权限校验(默认true)
120
+ *
121
+ * @author lxm
122
+ * @date 2022-10-12 18:10:25
123
+ * @type {boolean}
124
+ */
125
+ enablePermission: boolean;
126
+ /**
127
+ * 菜单权限校验模式(默认MIXIN)
128
+ *
129
+ * @author lxm
130
+ * @date 2022-10-12 18:10:27
131
+ * @type {MenuPermissionMode}
132
+ */
133
+ menuPermissionMode: MenuPermissionMode;
134
+ /**
135
+ * 是否让所有工作流history接口走all
136
+ *
137
+ * @type {boolean}
138
+ * @memberof IEnvironment
139
+ */
140
+ enableWfAllHistory: boolean;
141
+ /**
142
+ * 路由占位符
143
+ *
144
+ * @type {string}
145
+ * @memberof IEnvironment
146
+ */
147
+ routePlaceholder: string;
148
+ /**
149
+ * 登录页视图组件名称
150
+ *
151
+ * @type {string}
152
+ * @memberof IEnvironment
153
+ */
154
+ loginViewName: string;
155
+ /**
156
+ * 版本
157
+ *
158
+ * @type {string}
159
+ * @memberof IEnvironment
160
+ */
161
+ version: string;
162
+ /**
163
+ * 应用图标地址
164
+ *
165
+ * @author chitanda
166
+ * @date 2023-07-17 17:07:23
167
+ * @type {string}
168
+ */
169
+ favicon?: string;
66
170
  }
67
171
  //# 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;IAC3B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;OAMG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;;;;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"}
1
+ {"version":3,"file":"i-environment.d.ts","sourceRoot":"","sources":["../../../src/interface/i-environment/i-environment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAE/D;;;;;;;GAOG;AACH,MAAM,WAAW,YAAY;IAC3B;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;;;;OAOG;IACH,GAAG,EAAE,OAAO,CAAC;IAEb;;;;;;OAMG;IACH,QAAQ,EAAE,YAAY,CAAC;IAEvB;;;;;;;OAOG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;;;;;OAMG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;OAMG;IACH,SAAS,EAAE,SAAS,CAAC;IAErB;;;;;;OAMG;IACH,WAAW,EAAE,MAAM,CAAC;IAEpB;;;;;;OAMG;IACH,cAAc,EAAE,MAAM,CAAC;IAEvB;;;;;;OAMG;IACH,SAAS,EAAE,MAAM,CAAC;IAElB;;;;;;OAMG;IACH,QAAQ,EAAE,MAAM,CAAC;IAEjB;;;;;;OAMG;IACH,eAAe,EAAE,MAAM,CAAC;IAExB;;;;;;OAMG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;;OAMG;IACH,gBAAgB,EAAE,OAAO,CAAC;IAE1B;;;;;;OAMG;IACH,kBAAkB,EAAE,kBAAkB,CAAC;IAEvC;;;;;OAKG;IACH,kBAAkB,EAAE,OAAO,CAAC;IAE5B;;;;;OAKG;IACH,gBAAgB,EAAE,MAAM,CAAC;IAEzB;;;;;OAKG;IACH,aAAa,EAAE,MAAM,CAAC;IAEtB;;;;;OAKG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB;;;;;;OAMG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB"}
@@ -1,3 +1,4 @@
1
1
  export { IEnvironment } from './i-environment/i-environment';
2
2
  export { OrgData } from './org-data/org-data';
3
+ export * from './click-outside/click-outside';
3
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interface/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/interface/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,+BAA+B,CAAC;AAC7D,OAAO,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAC9C,cAAc,+BAA+B,CAAC"}
@@ -1 +1 @@
1
- export {};
1
+ export * from './click-outside/click-outside';
package/out/types.d.ts CHANGED
@@ -1,8 +1,18 @@
1
+ import { FactoryCenter } from './factory-center';
1
2
  import { IBizSys } from './ibizsys';
2
3
  declare global {
3
4
  const ibiz: IBizSys;
5
+ const ___fc: FactoryCenter;
4
6
  interface Window {
5
7
  ibiz: IBizSys;
8
+ /**
9
+ * 全局工厂中心
10
+ *
11
+ * @author lxm
12
+ * @date 2022-10-17 15:10:43
13
+ * @type {FactoryCenter}
14
+ */
15
+ ___fc: FactoryCenter;
6
16
  }
7
17
  /**
8
18
  * 上下文
@@ -13,6 +23,37 @@ declare global {
13
23
  */
14
24
  interface IContext {
15
25
  [key: string | symbol]: any;
26
+ /**
27
+ * 沙箱标识
28
+ *
29
+ * @author chitanda
30
+ * @date 2022-07-22 15:07:23
31
+ * @type {string}
32
+ */
33
+ srfsandbox?: string;
34
+ /**
35
+ * 返回自身的上下文,独有的和与父有差异的
36
+ *
37
+ * @author chitanda
38
+ * @date 2023-03-13 17:03:10
39
+ * @return {*} {IData}
40
+ */
41
+ getOwnContext(): IData;
42
+ /**
43
+ * 销毁当前上下文
44
+ *
45
+ * @author chitanda
46
+ * @date 2023-03-13 17:03:37
47
+ */
48
+ destroy(): void;
49
+ /**
50
+ * 克隆当前上下文
51
+ *
52
+ * @author chitanda
53
+ * @date 2023-03-13 17:03:45
54
+ * @return {*} {IContext}
55
+ */
56
+ clone(): IContext;
16
57
  }
17
58
  /**
18
59
  * 参数
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,CAAC,MAAM,CAAC;IACb,MAAM,IAAI,EAAE,OAAO,CAAC;IAEpB,UAAU,MAAM;QACd,IAAI,EAAE,OAAO,CAAC;KACf;IAED;;;;;;OAMG;IACH,UAAU,QAAQ;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;IAED;;;;;;OAMG;IACH,UAAU,OAAO;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;IAED;;;;;;OAMG;IACH,UAAU,KAAK;QACb,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;IAED;;;;;;OAMG;IACH,UAAU,OAAO;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;CACF"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,CAAC,MAAM,CAAC;IACb,MAAM,IAAI,EAAE,OAAO,CAAC;IACpB,MAAM,KAAK,EAAE,aAAa,CAAC;IAE3B,UAAU,MAAM;QACd,IAAI,EAAE,OAAO,CAAC;QACd;;;;;;WAMG;QACH,KAAK,EAAE,aAAa,CAAC;KACtB;IAED;;;;;;OAMG;IACH,UAAU,QAAQ;QAChB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;QAE5B;;;;;;WAMG;QACH,UAAU,CAAC,EAAE,MAAM,CAAC;QAEpB;;;;;;WAMG;QACH,aAAa,IAAI,KAAK,CAAC;QAEvB;;;;;WAKG;QACH,OAAO,IAAI,IAAI,CAAC;QAEhB;;;;;;WAMG;QACH,KAAK,IAAI,QAAQ,CAAC;KACnB;IAED;;;;;;OAMG;IACH,UAAU,OAAO;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;IAED;;;;;;OAMG;IACH,UAAU,KAAK;QACb,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;IAED;;;;;;OAMG;IACH,UAAU,OAAO;QACf,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,GAAG,GAAG,CAAC;KAC7B;CACF"}
@@ -0,0 +1,14 @@
1
+ import { OnClickOutsideHandler, OnClickOutsideOptions, OnClickOutsideResult } from '../../interface';
2
+ /**
3
+ * 监听目标元素之外的点击事件回调
4
+ *
5
+ * @author lxm
6
+ * @date 2022-10-28 18:10:25
7
+ * @export
8
+ * @param {HTMLElement} target 目标元素
9
+ * @param {OnClickOutsideHandler} handler 触发的时间回调
10
+ * @param {OnClickOutsideOptions} [options={}] 额外配置参数
11
+ * @returns {*} {OnClickOutsideResult}
12
+ */
13
+ export declare function onClickOutside(target: HTMLElement, handler: OnClickOutsideHandler, options?: OnClickOutsideOptions): OnClickOutsideResult;
14
+ //# sourceMappingURL=click-outside.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"click-outside.d.ts","sourceRoot":"","sources":["../../../src/utils/click-outside/click-outside.ts"],"names":[],"mappings":"AACA,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,oBAAoB,EACrB,MAAM,iBAAiB,CAAC;AAKzB;;;;;;;;;;GAUG;AACH,wBAAgB,cAAc,CAC5B,MAAM,EAAE,WAAW,EACnB,OAAO,EAAE,qBAAqB,EAC9B,OAAO,GAAE,qBAA0B,GAClC,oBAAoB,CAoFtB"}
@@ -0,0 +1,85 @@
1
+ import { RuntimeError } from '../../error';
2
+ import { eventPath, isEventInside, listenJSEvent } from '../event/event';
3
+ const defaultWindow = typeof window !== 'undefined' ? window : undefined;
4
+ /**
5
+ * 监听目标元素之外的点击事件回调
6
+ *
7
+ * @author lxm
8
+ * @date 2022-10-28 18:10:25
9
+ * @export
10
+ * @param {HTMLElement} target 目标元素
11
+ * @param {OnClickOutsideHandler} handler 触发的时间回调
12
+ * @param {OnClickOutsideOptions} [options={}] 额外配置参数
13
+ * @returns {*} {OnClickOutsideResult}
14
+ */
15
+ export function onClickOutside(target, handler, options = {}) {
16
+ const { window = defaultWindow, ignore = [], capture = true } = options;
17
+ if (!target)
18
+ throw new RuntimeError('target元素不存在');
19
+ if (!window)
20
+ throw new RuntimeError('找不到window');
21
+ /** 是否需要监听,为false时handler不会执行 */
22
+ let shouldListen = true;
23
+ /**
24
+ * 判断event的触发是否是在元素的外部(排除了ignore元素)
25
+ * @param event 事件对象
26
+ * @returns
27
+ */
28
+ const isOutside = (event) => {
29
+ // 有一个判断是在内部,则不算外部,返回false
30
+ return ![target, ...ignore].some(el => {
31
+ return isEventInside(event, el);
32
+ });
33
+ };
34
+ /** 暂停,所有监听的回调都不执行,用于增强某些ignore无法实现的场景 */
35
+ let isPaused = false;
36
+ const pause = () => {
37
+ isPaused = true;
38
+ };
39
+ const proceed = () => {
40
+ isPaused = false;
41
+ };
42
+ /** pointerup延时触发标识 */
43
+ let fallback;
44
+ /**
45
+ * 事件监听处理回调
46
+ * @param event 事件对象
47
+ * @returns
48
+ */
49
+ const listener = (event) => {
50
+ if (isPaused)
51
+ return;
52
+ window.clearTimeout(fallback);
53
+ // 当需要监听并且最终触发在外部时才需要执行回调
54
+ if (!(shouldListen && isOutside(event)))
55
+ return;
56
+ handler(event);
57
+ };
58
+ // 鼠标左键单击先后触发pointerdown,pointerup,click
59
+ // 鼠标右键单击先后触发pointerdown,pointerup
60
+ const cleanups = [
61
+ listenJSEvent(window, 'click', listener, { passive: true, capture }),
62
+ listenJSEvent(window, 'pointerdown', e => {
63
+ if (isPaused)
64
+ return;
65
+ // 当pointerdown是在内部触发则不需要后续监听
66
+ shouldListen = isOutside(e);
67
+ }, { passive: true }),
68
+ listenJSEvent(window, 'pointerup', e => {
69
+ if (isPaused)
70
+ return;
71
+ // 鼠标左键触发才执行
72
+ if (e.button === 0) {
73
+ // 锁死结果避免延时执行时变更
74
+ const path = eventPath(e);
75
+ e.composedPath = () => path;
76
+ fallback = window.setTimeout(() => listener(e), 50);
77
+ }
78
+ }, { passive: true }),
79
+ ].filter(Boolean);
80
+ /**
81
+ * 停止事件监听,移除监听
82
+ */
83
+ const stop = () => cleanups.forEach(fn => fn());
84
+ return { stop, pause, proceed };
85
+ }
@@ -0,0 +1,13 @@
1
+ /**
2
+ * 混合两种颜色,颜色格式支持hex和rgb
3
+ * 如:#46b5d555,#fff
4
+ * rgb(245 245 245 / 80%)
5
+ *
6
+ * @param {string} color1 颜色1
7
+ * @param {string} color2 颜色2
8
+ * @param {number} [p=0.5] 颜色1占多少百分比,小数格式
9
+ * @param {("hex" | "rgb")} [format="hex"] 输出的格式,hex或rgb
10
+ * @returns {*}
11
+ */
12
+ export declare function colorBlend(color1: string, color2: string, p?: number, format?: 'hex' | 'rgb'): string;
13
+ //# sourceMappingURL=color.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color.d.ts","sourceRoot":"","sources":["../../../src/utils/color/color.ts"],"names":[],"mappings":"AA8CA;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CACxB,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,CAAC,SAAM,EACP,MAAM,GAAE,KAAK,GAAG,KAAa,GAC5B,MAAM,CAqBR"}
@@ -0,0 +1,76 @@
1
+ /* eslint-disable no-bitwise */
2
+ /* eslint-disable no-nested-ternary */
3
+ const r = Math.round;
4
+ /**
5
+ * 把颜色字符串转成RGBA数组
6
+ *
7
+ * @param {string} color 颜色字符串
8
+ * @returns {*} {number[]}
9
+ */
10
+ function toRGBA(color) {
11
+ const l = color.length;
12
+ const rgba = [];
13
+ if (color.slice(0, 3).toLowerCase() === 'rgb') {
14
+ const d = color.match(/([\d|.%]{1,3})/g);
15
+ rgba[0] = parseInt(d[0], 10);
16
+ rgba[1] = parseInt(d[1], 10);
17
+ rgba[2] = parseInt(d[2], 10);
18
+ rgba[3] = d[3]
19
+ ? d[3].indexOf('%') !== -1
20
+ ? parseInt(d[3], 10) / 100
21
+ : parseFloat(d[3])
22
+ : 1;
23
+ }
24
+ else {
25
+ let d;
26
+ if (l < 6)
27
+ d = parseInt(String(color[1]) +
28
+ color[1] +
29
+ color[2] +
30
+ color[2] +
31
+ color[3] +
32
+ color[3] +
33
+ (l > 4 ? String(color[4]) + color[4] : ''), 16);
34
+ else
35
+ d = parseInt(color.slice(1), 16);
36
+ rgba[0] = (d >> 16) & 255;
37
+ rgba[1] = (d >> 8) & 255;
38
+ rgba[2] = d & 255;
39
+ rgba[3] =
40
+ l === 9 || l === 5 ? r((((d >> 24) & 255) / 255) * 10000) / 10000 : 1;
41
+ }
42
+ return rgba;
43
+ }
44
+ /**
45
+ * 混合两种颜色,颜色格式支持hex和rgb
46
+ * 如:#46b5d555,#fff
47
+ * rgb(245 245 245 / 80%)
48
+ *
49
+ * @param {string} color1 颜色1
50
+ * @param {string} color2 颜色2
51
+ * @param {number} [p=0.5] 颜色1占多少百分比,小数格式
52
+ * @param {("hex" | "rgb")} [format="hex"] 输出的格式,hex或rgb
53
+ * @returns {*}
54
+ */
55
+ export function colorBlend(color1, color2, p = 0.5, format = 'hex') {
56
+ color1 = color1.trim();
57
+ color2 = color2.trim();
58
+ const c1 = toRGBA(color1);
59
+ const c2 = toRGBA(color2);
60
+ const result = [
61
+ r((1 - p) * c1[0] + p * c2[0]),
62
+ r((1 - p) * c1[1] + p * c2[1]),
63
+ r((1 - p) * c1[2] + p * c2[2]),
64
+ (1 - p) * c1[3] + p * c2[3],
65
+ ];
66
+ if (format === 'hex') {
67
+ const hex = [
68
+ result[0].toString(16),
69
+ result[1].toString(16),
70
+ result[2].toString(16),
71
+ result[3] === 0 ? '00' : r(result[3] * 255).toString(16),
72
+ ];
73
+ return `#${hex[0]}${hex[1]}${hex[2]}${hex[3]}`;
74
+ }
75
+ return `rgb(${result[0]} ${result[1]} ${result[2]} / ${result[3]})`;
76
+ }
@@ -0,0 +1,31 @@
1
+ /**
2
+ * 根据文件名称计算Mime类型
3
+ *
4
+ * @author lxm
5
+ * @date 2022-11-16 22:11:02
6
+ * @export
7
+ * @param {string} fileName
8
+ * @returns {*}
9
+ */
10
+ export declare function calcMimeByFileName(fileName: string): string;
11
+ /**
12
+ * 判断是否是图片格式
13
+ *
14
+ * @author lxm
15
+ * @date 2022-11-21 13:11:23
16
+ * @export
17
+ * @param {string} fileName
18
+ * @returns {*} {boolean}
19
+ */
20
+ export declare function isImage(fileName: string): boolean;
21
+ /**
22
+ * 纯JS触发下载文件
23
+ *
24
+ * @author lxm
25
+ * @date 2022-11-16 22:11:24
26
+ * @export
27
+ * @param {Blob} file 文件流Blob
28
+ * @param {string} fileName 文件名称
29
+ */
30
+ export declare function downloadFileFromBlob(file: Blob, fileName: string): void;
31
+ //# sourceMappingURL=download-file.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download-file.d.ts","sourceRoot":"","sources":["../../../src/utils/download-file/download-file.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,UAmDlD;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAOjD;AAED;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,QAmBhE"}