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

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 (165) hide show
  1. package/dist/system/index.system.js +1 -0
  2. package/out/command/command-register.d.ts +66 -0
  3. package/out/command/command-register.d.ts.map +1 -0
  4. package/out/command/command-register.js +113 -0
  5. package/out/command/command.d.ts +54 -0
  6. package/out/command/command.d.ts.map +1 -0
  7. package/out/command/command.js +71 -0
  8. package/out/command/index.d.ts +10 -0
  9. package/out/command/index.d.ts.map +1 -0
  10. package/out/command/index.js +9 -0
  11. package/out/command/interface/command/command-option.d.ts +23 -0
  12. package/out/command/interface/command/command-option.d.ts.map +1 -0
  13. package/out/command/interface/command/command-option.js +1 -0
  14. package/out/command/interface/command/command.d.ts +74 -0
  15. package/out/command/interface/command/command.d.ts.map +1 -0
  16. package/out/command/interface/command/command.js +1 -0
  17. package/out/command/interface/disposable/disposable.d.ts +4 -0
  18. package/out/command/interface/disposable/disposable.d.ts.map +1 -0
  19. package/out/command/interface/disposable/disposable.js +1 -0
  20. package/out/command/interface/index.d.ts +4 -0
  21. package/out/command/interface/index.d.ts.map +1 -0
  22. package/out/command/interface/index.js +1 -0
  23. package/out/command/utils/index.d.ts +3 -0
  24. package/out/command/utils/index.d.ts.map +1 -0
  25. package/out/command/utils/index.js +2 -0
  26. package/out/command/utils/linked-list.d.ts +16 -0
  27. package/out/command/utils/linked-list.d.ts.map +1 -0
  28. package/out/command/utils/linked-list.js +120 -0
  29. package/out/command/utils/util.d.ts +27 -0
  30. package/out/command/utils/util.d.ts.map +1 -0
  31. package/out/command/utils/util.js +77 -0
  32. package/out/constant/index.d.ts +3 -0
  33. package/out/constant/index.d.ts.map +1 -1
  34. package/out/constant/index.js +3 -0
  35. package/out/constant/login-mode/login-mode.d.ts +23 -0
  36. package/out/constant/login-mode/login-mode.d.ts.map +1 -0
  37. package/out/constant/login-mode/login-mode.js +24 -0
  38. package/out/constant/menu-permission-mode/menu-permission-mode.d.ts +23 -0
  39. package/out/constant/menu-permission-mode/menu-permission-mode.d.ts.map +1 -0
  40. package/out/constant/menu-permission-mode/menu-permission-mode.js +24 -0
  41. package/out/constant/util/util.d.ts +5 -0
  42. package/out/constant/util/util.d.ts.map +1 -0
  43. package/out/constant/util/util.js +5 -0
  44. package/out/context/index.d.ts +19 -32
  45. package/out/context/index.d.ts.map +1 -1
  46. package/out/context/index.js +52 -60
  47. package/out/environment/environment.d.ts.map +1 -1
  48. package/out/environment/environment.js +11 -2
  49. package/out/error/http-error/http-error.d.ts.map +1 -1
  50. package/out/error/http-error/http-error.js +0 -4
  51. package/out/factory-center.d.ts +11 -0
  52. package/out/factory-center.d.ts.map +1 -0
  53. package/out/factory-center.js +10 -0
  54. package/out/ibizsys.d.ts +17 -1
  55. package/out/ibizsys.d.ts.map +1 -1
  56. package/out/ibizsys.js +17 -1
  57. package/out/index.d.ts +3 -1
  58. package/out/index.d.ts.map +1 -1
  59. package/out/index.js +3 -1
  60. package/out/install.d.ts.map +1 -1
  61. package/out/install.js +4 -2
  62. package/out/interface/click-outside/click-outside.d.ts +70 -0
  63. package/out/interface/click-outside/click-outside.d.ts.map +1 -0
  64. package/out/interface/click-outside/click-outside.js +1 -0
  65. package/out/interface/i-environment/i-environment.d.ts +72 -4
  66. package/out/interface/i-environment/i-environment.d.ts.map +1 -1
  67. package/out/interface/index.d.ts +1 -0
  68. package/out/interface/index.d.ts.map +1 -1
  69. package/out/interface/index.js +1 -1
  70. package/out/types.d.ts +10 -0
  71. package/out/types.d.ts.map +1 -1
  72. package/out/utils/click-outside/click-outside.d.ts +14 -0
  73. package/out/utils/click-outside/click-outside.d.ts.map +1 -0
  74. package/out/utils/click-outside/click-outside.js +85 -0
  75. package/out/utils/color/color.d.ts +13 -0
  76. package/out/utils/color/color.d.ts.map +1 -0
  77. package/out/utils/color/color.js +76 -0
  78. package/out/utils/download-file/download-file.d.ts +31 -0
  79. package/out/utils/download-file/download-file.d.ts.map +1 -0
  80. package/out/utils/download-file/download-file.js +107 -0
  81. package/out/utils/event/event.d.ts +34 -0
  82. package/out/utils/event/event.d.ts.map +1 -0
  83. package/out/utils/event/event.js +60 -0
  84. package/out/utils/index.d.ts +10 -1
  85. package/out/utils/index.d.ts.map +1 -1
  86. package/out/utils/index.js +10 -1
  87. package/out/utils/interceptor/core-interceptor.d.ts +15 -0
  88. package/out/utils/interceptor/core-interceptor.d.ts.map +1 -0
  89. package/out/utils/interceptor/core-interceptor.js +30 -0
  90. package/out/utils/interceptor/index.d.ts +3 -0
  91. package/out/utils/interceptor/index.d.ts.map +1 -0
  92. package/out/utils/interceptor/index.js +2 -0
  93. package/out/utils/interceptor/interceptor.d.ts +74 -3
  94. package/out/utils/interceptor/interceptor.d.ts.map +1 -1
  95. package/out/utils/interceptor/interceptor.js +73 -22
  96. package/out/utils/logger/logger.d.ts +3 -0
  97. package/out/utils/logger/logger.d.ts.map +1 -0
  98. package/out/utils/logger/logger.js +2 -0
  99. package/out/utils/net/http-response.d.ts +4 -9
  100. package/out/utils/net/http-response.d.ts.map +1 -1
  101. package/out/utils/net/http-response.js +0 -7
  102. package/out/utils/net/net.d.ts +82 -31
  103. package/out/utils/net/net.d.ts.map +1 -1
  104. package/out/utils/net/net.js +109 -40
  105. package/out/utils/sync/count-latch.d.ts +60 -0
  106. package/out/utils/sync/count-latch.d.ts.map +1 -0
  107. package/out/utils/sync/count-latch.js +93 -0
  108. package/out/utils/sync/index.d.ts +2 -0
  109. package/out/utils/sync/index.d.ts.map +1 -0
  110. package/out/utils/sync/index.js +1 -0
  111. package/out/utils/upload/select-file.d.ts +53 -0
  112. package/out/utils/upload/select-file.d.ts.map +1 -0
  113. package/out/utils/upload/select-file.js +47 -0
  114. package/out/utils/upload/upload-file.d.ts +46 -0
  115. package/out/utils/upload/upload-file.d.ts.map +1 -0
  116. package/out/utils/upload/upload-file.js +150 -0
  117. package/out/utils/url-helper/url-helper.d.ts +51 -0
  118. package/out/utils/url-helper/url-helper.d.ts.map +1 -0
  119. package/out/utils/url-helper/url-helper.js +59 -0
  120. package/out/utils/util/util.d.ts +20 -4
  121. package/out/utils/util/util.d.ts.map +1 -1
  122. package/out/utils/util/util.js +59 -5
  123. package/package.json +19 -9
  124. package/src/command/command-register.ts +135 -0
  125. package/src/command/command.ts +79 -0
  126. package/src/command/index.ts +11 -0
  127. package/src/command/interface/command/command-option.ts +22 -0
  128. package/src/command/interface/command/command.ts +86 -0
  129. package/src/command/interface/disposable/disposable.ts +3 -0
  130. package/src/command/interface/index.ts +9 -0
  131. package/src/command/utils/index.ts +2 -0
  132. package/src/command/utils/linked-list.ts +136 -0
  133. package/src/command/utils/util.ts +95 -0
  134. package/src/constant/index.ts +3 -0
  135. package/src/constant/login-mode/login-mode.ts +23 -0
  136. package/src/constant/menu-permission-mode/menu-permission-mode.ts +23 -0
  137. package/src/constant/util/util.ts +5 -0
  138. package/src/context/index.ts +69 -59
  139. package/src/environment/environment.ts +11 -2
  140. package/src/error/http-error/http-error.ts +0 -4
  141. package/src/factory-center.ts +9 -0
  142. package/src/ibizsys.ts +19 -1
  143. package/src/index.ts +3 -1
  144. package/src/install.ts +4 -2
  145. package/src/interface/click-outside/click-outside.ts +71 -0
  146. package/src/interface/i-environment/i-environment.ts +81 -4
  147. package/src/interface/index.ts +1 -0
  148. package/src/types.ts +10 -0
  149. package/src/utils/click-outside/click-outside.ts +110 -0
  150. package/src/utils/color/color.ts +84 -0
  151. package/src/utils/download-file/download-file.ts +109 -0
  152. package/src/utils/event/event.ts +77 -0
  153. package/src/utils/index.ts +10 -1
  154. package/src/utils/interceptor/core-interceptor.ts +35 -0
  155. package/src/utils/interceptor/index.ts +2 -0
  156. package/src/utils/interceptor/interceptor.ts +109 -22
  157. package/src/utils/logger/logger.ts +3 -0
  158. package/src/utils/net/http-response.ts +6 -9
  159. package/src/utils/net/net.ts +144 -51
  160. package/src/utils/sync/count-latch.ts +99 -0
  161. package/src/utils/sync/index.ts +1 -0
  162. package/src/utils/upload/select-file.ts +86 -0
  163. package/src/utils/upload/upload-file.ts +206 -0
  164. package/src/utils/url-helper/url-helper.ts +62 -0
  165. package/src/utils/util/util.ts +72 -14
@@ -0,0 +1,62 @@
1
+ /**
2
+ * 路径解析助手
3
+ *
4
+ * @author lxm
5
+ * @date 2022-10-11 14:10:12
6
+ * @export
7
+ * @class UrlHelper
8
+ */
9
+ export class UrlHelper {
10
+ /**
11
+ * 路由路径前面的基础路径
12
+ * 如:http://172.16.103.120:30061/portalwebapp/#/index/appportalview?params=123
13
+ * 返回:http://172.16.103.120:30061/portalwebapp/#
14
+ *
15
+ * @author lxm
16
+ * @date 2022-10-11 20:10:29
17
+ * @returns {*}
18
+ */
19
+ static get routeBase() {
20
+ return `${this.appBase}/#`;
21
+ }
22
+
23
+ /**
24
+ * 应用的的基础路径
25
+ * 如:http://172.16.103.120:30061/portalwebapp/#/index/appportalview?params=123
26
+ * 返回:http://172.16.103.120:30061/portalwebapp
27
+ *
28
+ * @author lxm
29
+ * @date 2022-10-11 20:10:29
30
+ * @returns {*}
31
+ */
32
+ static get appBase() {
33
+ const { origin, pathname } = window.location;
34
+ return `${origin}${pathname}`.replace(/\/$/, '');
35
+ }
36
+
37
+ /**
38
+ * #开始到末尾,即路由地址
39
+ * 如:http://172.16.103.120:30061/portalwebapp/#/index/appportalview?params=123
40
+ * 返回:/index/appportalview?params=123
41
+ *
42
+ * @author lxm
43
+ * @date 2022-10-11 16:10:40
44
+ * @returns {*}
45
+ */
46
+ static get routePath() {
47
+ return window.location.hash.replace('#', '');
48
+ }
49
+
50
+ /**
51
+ * 当前地址的全路径,包含域名和参数
52
+ * 如:http://172.16.103.120:30061/portalwebapp/#/index/appportalview?params=123
53
+ *
54
+ * @author lxm
55
+ * @date 2022-10-11 21:10:39
56
+ * @readonly
57
+ * @static
58
+ */
59
+ static get fullPath() {
60
+ return window.location.href;
61
+ }
62
+ }
@@ -1,5 +1,5 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
- import { debounce, DebounceSettings } from 'lodash-es';
2
+ import { debounce } from 'lodash-es';
3
3
  import { getCookie } from 'qx-util';
4
4
  import { CoreConst } from '../../constant';
5
5
 
@@ -27,11 +27,12 @@ export function getToken(): string | null {
27
27
  */
28
28
  export function isOverlap(arr1: any[], arr2: any[]): boolean {
29
29
  const newArr = Array.from(new Set([...arr1, ...arr2]));
30
- return newArr.length === arr1.length + arr2.length;
30
+ return newArr.length !== arr1.length + arr2.length;
31
31
  }
32
32
 
33
33
  /**
34
- * 防抖并合并每次的参数
34
+ * 防抖并合并每次的参数,
35
+ * 最后一次才会执行
35
36
  *
36
37
  * @author lxm
37
38
  * @date 2022-09-20 21:09:53
@@ -43,7 +44,6 @@ export function isOverlap(arr1: any[], arr2: any[]): boolean {
43
44
  * newParams: Parameters<T>,
44
45
  * ) => Parameters<T>} mergeFunc 合并的回调函数
45
46
  * @param {number} [wait] 防抖的延迟毫秒数
46
- * @param {DebounceSettings} [options] 防抖函数的额外参数
47
47
  * @returns {*}
48
48
  */
49
49
  export function debounceAndMerge<T extends (...args: any[]) => any>(
@@ -53,19 +53,14 @@ export function debounceAndMerge<T extends (...args: any[]) => any>(
53
53
  newParams: Parameters<T>,
54
54
  ) => Parameters<T>,
55
55
  wait?: number,
56
- options?: DebounceSettings,
57
56
  ) {
58
57
  // 缓存上一次的函数参数
59
58
  let oldParams: Parameters<T> | undefined;
60
- const debounceFunc = debounce(
61
- (...params: Parameters<T>) => {
62
- // 防抖函数执行的时候清空缓存参数
63
- oldParams = undefined;
64
- return func(...params);
65
- },
66
- wait,
67
- options,
68
- );
59
+ const debounceFunc = debounce((...params: Parameters<T>) => {
60
+ // 防抖函数执行的时候清空缓存参数
61
+ oldParams = undefined;
62
+ return func(...params);
63
+ }, wait);
69
64
  return (...args: Parameters<T>) => {
70
65
  // 合并参数,并把参数缓存到oldParams里,用新参数调用防抖函数
71
66
  let newParams = args;
@@ -76,3 +71,66 @@ export function debounceAndMerge<T extends (...args: any[]) => any>(
76
71
  return debounceFunc(...newParams);
77
72
  };
78
73
  }
74
+
75
+ /**
76
+ * 防抖并合并每次的参数,最后一次才会执行
77
+ * 绑定方法为异步方法,给每次调用返回最终执行那次的结果
78
+ *
79
+ * @author lxm
80
+ * @date 2022-09-20 21:09:53
81
+ * @export
82
+ * @template T
83
+ * @param {T} func 要防抖的函数
84
+ * @param {(
85
+ * oldParams: Parameters<T>,
86
+ * newParams: Parameters<T>,
87
+ * ) => Parameters<T>} mergeFunc 合并的回调函数
88
+ * @param {number} [wait] 防抖的延迟毫秒数
89
+ * @returns {*}
90
+ */
91
+ export function debounceAndAsyncMerge<
92
+ T extends (...args: any[]) => Promise<any>,
93
+ >(
94
+ func: T,
95
+ mergeFunc: (
96
+ oldParams: Parameters<T>,
97
+ newParams: Parameters<T>,
98
+ ) => Parameters<T>,
99
+ wait?: number,
100
+ ): T {
101
+ // 缓存上一次的函数参数
102
+ let oldParams: Parameters<T> | undefined;
103
+ let promises: Array<{ resolve: any; reject: any }> = [];
104
+ const debounceFunc = debounce(async (...params: Parameters<T>) => {
105
+ // 防抖函数执行的时候清空缓存参数
106
+ oldParams = undefined;
107
+ try {
108
+ const result = await func(...params);
109
+ promises.forEach(promise => {
110
+ promise.resolve(result);
111
+ });
112
+ promises = [];
113
+ return result;
114
+ } catch (error) {
115
+ promises.forEach(promise => {
116
+ promise.reject(error);
117
+ });
118
+ promises = [];
119
+ }
120
+ }, wait);
121
+ const fun = async (...args: Parameters<T>) => {
122
+ // 合并参数,并把参数缓存到oldParams里,用新参数调用防抖函数
123
+ let newParams = args;
124
+ if (oldParams) {
125
+ newParams = mergeFunc(oldParams, newParams);
126
+ }
127
+ oldParams = newParams;
128
+ // 执行防抖函数
129
+ debounceFunc(...newParams);
130
+ return new Promise((resolve, reject) => {
131
+ // 阻塞当前调用,当防抖函数被执行后返回
132
+ promises.push({ resolve, reject });
133
+ });
134
+ };
135
+ return fun as T;
136
+ }