@cloud-app-dev/vidc 2.0.0-alpha.9 → 2.1.0-alpha.10

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 (207) hide show
  1. package/.fatherrc.js +11 -4
  2. package/.umirc.ts +1 -1
  3. package/es/Api/index.js +7 -7
  4. package/es/AppRedirect/index.d.ts +1 -1
  5. package/es/AppRedirect/index.js +7 -12
  6. package/es/AppRouter/index.d.ts +8 -0
  7. package/es/AppRouter/index.js +17 -0
  8. package/es/Auth/index.js +1 -1
  9. package/es/AutoExit/index.js +12 -10
  10. package/es/{ContentBox → Box}/BetweenBox/index.css +0 -0
  11. package/es/{ContentBox → Box}/BetweenBox/index.d.ts +0 -0
  12. package/es/{ContentBox → Box}/BetweenBox/index.js +0 -0
  13. package/es/{ContentBox → Box}/InfoBox/index.css +0 -0
  14. package/es/{ContentBox → Box}/InfoBox/index.d.ts +0 -0
  15. package/es/{ContentBox → Box}/InfoBox/index.js +0 -0
  16. package/es/{ContentBox → Box}/TwoColumnBox/index.css +0 -0
  17. package/es/{ContentBox → Box}/TwoColumnBox/index.d.ts +0 -0
  18. package/es/{ContentBox → Box}/TwoColumnBox/index.js +0 -0
  19. package/es/{ContentBox → Box}/deps/content-grid.d.ts +0 -0
  20. package/es/{ContentBox → Box}/deps/content-grid.js +0 -0
  21. package/es/{ContentBox → Box}/deps/grid-factory.d.ts +0 -0
  22. package/es/{ContentBox → Box}/deps/grid-factory.js +0 -0
  23. package/es/{ContentBox → Box}/deps/simple-grid.d.ts +0 -0
  24. package/es/{ContentBox → Box}/deps/simple-grid.js +0 -0
  25. package/es/{ContentBox → Box}/index.css +0 -0
  26. package/es/{ContentBox → Box}/index.d.ts +3 -3
  27. package/es/{ContentBox → Box}/index.js +5 -5
  28. package/es/CheckGroupFixed/index.js +4 -2
  29. package/es/Config/index.js +12 -12
  30. package/es/Config/interface.d.ts +6 -4
  31. package/es/ConfigContext/index.d.ts +15 -2
  32. package/es/ConfigContext/index.js +25 -3
  33. package/es/DeviceSelect/TreeType.d.ts +6 -0
  34. package/es/DeviceSelect/TreeType.js +36 -0
  35. package/es/DeviceSelect/demo.js +2 -2
  36. package/es/DeviceSelect/index.css +6 -1
  37. package/es/DeviceSelect/index.d.ts +5 -0
  38. package/es/DeviceSelect/index.js +22 -54
  39. package/es/Dict/hook.d.ts +0 -1
  40. package/es/Dict/hook.js +5 -21
  41. package/es/Dict/index.d.ts +1 -5
  42. package/es/Dict/index.js +2 -6
  43. package/es/Dict/utils.d.ts +0 -1
  44. package/es/Dict/utils.js +2 -9
  45. package/es/HightLevel/index.js +1 -2
  46. package/es/IconFont/index.d.ts +0 -1
  47. package/es/IconFont/index.js +12 -13
  48. package/es/InitialConfig/index.js +7 -6
  49. package/es/InitialConfig/utils.d.ts +5 -0
  50. package/es/InitialConfig/utils.js +33 -6
  51. package/es/InitialRequest/index.d.ts +3 -1
  52. package/es/InitialRequest/index.js +20 -18
  53. package/es/InitialRequest/utils.d.ts +4 -3
  54. package/es/InitialRequest/utils.js +28 -29
  55. package/es/Input/index.js +3 -2
  56. package/es/InstanceHistory/index.d.ts +3 -0
  57. package/es/InstanceHistory/index.js +9 -0
  58. package/es/List/CheckExt.d.ts +3 -5
  59. package/es/List/CheckExt.js +21 -13
  60. package/es/{AppRoute → List/DeviceList}/index.css +0 -0
  61. package/es/List/DeviceList/index.d.ts +11 -0
  62. package/es/{DeviceList → List/DeviceList}/index.js +6 -18
  63. package/es/{DynamicDeviceList → List/DynamicDeviceList}/Demo.d.ts +0 -0
  64. package/es/{DynamicList/demo.js → List/DynamicDeviceList/Demo.js} +25 -42
  65. package/es/{DynamicDeviceList → List/DynamicDeviceList}/index.css +5 -17
  66. package/es/List/DynamicDeviceList/index.d.ts +11 -0
  67. package/es/List/DynamicDeviceList/index.js +205 -0
  68. package/es/List/DynamicDeviceList/interface.d.ts +37 -0
  69. package/es/List/DynamicDeviceList/utils.d.ts +16 -0
  70. package/es/List/DynamicDeviceList/utils.js +61 -0
  71. package/es/{DynamicList/demo.d.ts → List/DynamicGridList/Demo.d.ts} +0 -0
  72. package/es/List/DynamicGridList/Demo.js +70 -0
  73. package/es/List/DynamicGridList/index.d.ts +26 -0
  74. package/es/List/DynamicGridList/index.js +73 -0
  75. package/es/List/GridList/Demo.d.ts +2 -0
  76. package/es/List/GridList/Demo.js +91 -0
  77. package/es/List/GridList/hook.d.ts +13 -0
  78. package/es/List/GridList/hook.js +301 -0
  79. package/es/List/GridList/index.css +7 -0
  80. package/es/List/GridList/index.d.ts +15 -0
  81. package/es/List/GridList/index.js +47 -0
  82. package/es/List/GridList/interface.d.ts +59 -0
  83. package/es/List/GridList/utils.d.ts +9 -0
  84. package/es/List/GridList/utils.js +43 -0
  85. package/es/List/ListExt/index.css +3 -0
  86. package/es/{ListExt → List/ListExt}/index.d.ts +1 -1
  87. package/es/{ListExt → List/ListExt}/index.js +3 -3
  88. package/es/List/VList/index.css +6 -0
  89. package/es/List/VList/index.d.ts +18 -0
  90. package/es/List/VList/index.js +51 -0
  91. package/es/List/VList/utils.d.ts +14 -0
  92. package/es/{VList → List/VList}/utils.js +0 -0
  93. package/es/List/index.css +11 -12
  94. package/es/List/index.d.ts +5 -70
  95. package/es/List/index.js +32 -25
  96. package/es/List/interface.d.ts +87 -0
  97. package/es/List/renderItem.d.ts +1 -1
  98. package/es/List/renderItem.js +13 -10
  99. package/es/LoaderApp/index.d.ts +1 -1
  100. package/es/LoaderApp/index.js +39 -35
  101. package/es/LoaderApp/loader.js +2 -6
  102. package/es/LoaderApp/utils.d.ts +3 -1
  103. package/es/LoaderApp/utils.js +43 -3
  104. package/es/LoaderScript/index.js +7 -89
  105. package/es/LoaderScript/utils.d.ts +2 -0
  106. package/es/LoaderScript/utils.js +170 -33
  107. package/es/Picture/component/MoveContent/index.js +3 -3
  108. package/es/Picture/index.js +1 -1
  109. package/es/Picture/utils.js +1 -1
  110. package/es/RefDrawer/index.js +1 -1
  111. package/es/RefModal/index.js +1 -1
  112. package/es/Service/http.d.ts +6 -4
  113. package/es/Service/http.js +20 -22
  114. package/es/Service/index.d.ts +3 -3
  115. package/es/Service/index.js +7 -11
  116. package/es/Service/interface.d.ts +5 -11
  117. package/es/Service/middleware.d.ts +1 -1
  118. package/es/Service/middleware.js +1 -1
  119. package/es/TableLayout/index.d.ts +3 -0
  120. package/es/TableLayout/index.js +14 -45
  121. package/es/{TreeTitle → Title}/index.css +5 -5
  122. package/es/{TreeTitle → Title}/index.d.ts +2 -2
  123. package/es/{TreeTitle → Title}/index.js +7 -4
  124. package/es/{TreeMode → Tree/BaseTree}/demo.d.ts +0 -0
  125. package/es/Tree/BaseTree/demo.js +69 -0
  126. package/es/Tree/BaseTree/index.css +64 -0
  127. package/es/Tree/BaseTree/index.d.ts +24 -0
  128. package/es/Tree/BaseTree/index.js +83 -0
  129. package/es/Tree/demo.js +19 -56
  130. package/es/Tree/index.css +29 -55
  131. package/es/Tree/index.d.ts +19 -20
  132. package/es/Tree/index.js +185 -70
  133. package/es/UserSelect/index.js +7 -8
  134. package/es/WorkerFlow/Form/Condition.js +2 -4
  135. package/es/WorkerFlow/Form/EmptyUserSet.js +1 -1
  136. package/es/WorkerFlow/Form/FormAuth.js +3 -3
  137. package/es/WorkerFlow/Form/GroupList.js +2 -2
  138. package/es/WorkerFlow/Form/GroupSelect.js +1 -1
  139. package/es/WorkerFlow/Form/GroupSelectModalContent.js +2 -3
  140. package/es/WorkerFlow/Form/LevelGroupSelect.js +2 -2
  141. package/es/WorkerFlow/Form/UserAndGroupSelect.js +1 -1
  142. package/es/WorkerFlow/Form/UserSelect.js +1 -1
  143. package/es/WorkerFlow/Form/UserSelectModalContent.js +3 -6
  144. package/es/WorkerFlow/Form/UserSet.js +3 -3
  145. package/es/WorkerFlow/Nodes/TitleElement.js +71 -34
  146. package/es/WorkerFlow/index.css +9 -3
  147. package/es/WorkerFlow/index.js +14 -9
  148. package/es/WorkerFlow/utils.js +1 -1
  149. package/es/index.d.ts +4 -11
  150. package/es/index.js +4 -11
  151. package/es/useDrawer/index.d.ts +1 -1
  152. package/es/useDrawer/index.js +3 -2
  153. package/es/useHistory/index.d.ts +2 -2
  154. package/es/useHistory/index.js +3 -6
  155. package/es/useHttp/index.js +1 -1
  156. package/es/useModal/index.d.ts +1 -1
  157. package/es/useModal/index.js +3 -2
  158. package/es/utils.d.ts +9 -0
  159. package/es/utils.js +36 -1
  160. package/package.json +10 -12
  161. package/tsconfig.json +1 -1
  162. package/es/AppRoute/Render.d.ts +0 -23
  163. package/es/AppRoute/Render.js +0 -111
  164. package/es/AppRoute/Rendered.d.ts +0 -4
  165. package/es/AppRoute/Rendered.js +0 -11
  166. package/es/AppRoute/index.d.ts +0 -14
  167. package/es/AppRoute/index.js +0 -106
  168. package/es/AppRoute/interface.d.ts +0 -18
  169. package/es/AppRoute/utils.d.ts +0 -1
  170. package/es/AppRoute/utils.js +0 -28
  171. package/es/DeviceList/index.css +0 -32
  172. package/es/DeviceList/index.d.ts +0 -14
  173. package/es/Dict/desc.d.ts +0 -64
  174. package/es/Dict/desc.js +0 -162
  175. package/es/DynamicDeviceList/CheckExt.d.ts +0 -8
  176. package/es/DynamicDeviceList/CheckExt.js +0 -36
  177. package/es/DynamicDeviceList/Demo.js +0 -17
  178. package/es/DynamicDeviceList/index.d.ts +0 -35
  179. package/es/DynamicDeviceList/index.js +0 -224
  180. package/es/DynamicDeviceList/utils.d.ts +0 -2
  181. package/es/DynamicDeviceList/utils.js +0 -15
  182. package/es/DynamicList/index.css +0 -7
  183. package/es/DynamicList/index.d.ts +0 -31
  184. package/es/DynamicList/index.js +0 -132
  185. package/es/IconFont/index.css +0 -0
  186. package/es/List/utils.d.ts +0 -5
  187. package/es/List/utils.js +0 -18
  188. package/es/ListExt/index.css +0 -9
  189. package/es/ScrollList/index.css +0 -73
  190. package/es/ScrollList/index.d.ts +0 -24
  191. package/es/ScrollList/index.js +0 -262
  192. package/es/ScrollList/utils.js +0 -84
  193. package/es/Service/logger.d.ts +0 -3
  194. package/es/Service/logger.js +0 -13
  195. package/es/Service/utils.d.ts +0 -3
  196. package/es/Service/utils.js +0 -11
  197. package/es/TreeMode/demo.js +0 -32
  198. package/es/TreeMode/index.css +0 -38
  199. package/es/TreeMode/index.d.ts +0 -23
  200. package/es/TreeMode/index.js +0 -201
  201. package/es/VList/index.css +0 -4
  202. package/es/VList/index.d.ts +0 -16
  203. package/es/VList/index.js +0 -56
  204. package/es/VList/utils.d.ts +0 -10
  205. package/es/useChangeEffect/index.d.ts +0 -3
  206. package/es/useChangeEffect/index.js +0 -32
  207. package/es/useHistory/index.css +0 -0
@@ -1,3 +1,5 @@
1
+ import _useUnmount from "ahooks/es/useUnmount";
2
+ import _useMount from "ahooks/es/useMount";
1
3
  import _uuid from "@cloud-app-dev/utils/es/uuid";
2
4
 
3
5
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
@@ -13,7 +15,7 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
13
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
16
 
15
17
  import { __awaiter } from "tslib";
16
- import React, { useRef, useEffect, useState, useMemo } from 'react';
18
+ import React, { useRef, useState, useMemo } from 'react';
17
19
  import { getMicroConfig } from './utils';
18
20
  import LoaderModule from './loader';
19
21
  import "./index.css";
@@ -36,23 +38,33 @@ function LoaderApp(_ref) {
36
38
  status = _useState2[0],
37
39
  setStatus = _useState2[1];
38
40
 
39
- useEffect(function () {
40
- var app;
41
+ _useMount(function () {
41
42
  var config = getMicroConfig(appConfig, appProps, domRef.current);
42
43
 
43
44
  if (!config) {
44
- console.debug('微应用不存在', 'config ->', appConfig, 'appProps ->', appProps);
45
+ console.error('微应用不存在', 'config ->', appConfig, 'appProps ->', appProps);
46
+ return undefined;
47
+ }
48
+
49
+ if (!domRef.current || !styleRef.current) {
50
+ console.error('LoaderApp组件未正常初始化!', 'config ->', appConfig, 'appProps ->', appProps);
45
51
  return undefined;
46
52
  }
47
53
 
48
54
  var props = Object.assign(Object.assign({}, appProps), {
49
55
  container: domRef.current
50
56
  });
57
+ var routerPrefix = config.routerPrefix;
58
+
59
+ var _appConfig$resource = _slicedToArray(appConfig.resource, 2),
60
+ script = _appConfig$resource[0],
61
+ style = _appConfig$resource[1];
62
+
51
63
  var options = {
52
- script: appConfig.resource[0],
53
- style: appConfig.resource[1],
54
- name: config.name,
55
- prefix: ".".concat(appConfig.name, "-").concat(id),
64
+ script: script,
65
+ style: style,
66
+ name: routerPrefix,
67
+ prefix: ".".concat(routerPrefix, "-").concat(id),
56
68
  styleNode: styleRef.current
57
69
  };
58
70
  LoaderModule(options).then(function (mod) {
@@ -61,26 +73,25 @@ function LoaderApp(_ref) {
61
73
  while (1) {
62
74
  switch (_context.prev = _context.next) {
63
75
  case 0:
64
- app = mod;
65
76
  loadedAppRef.current = mod;
66
77
 
67
78
  if (!status) {
68
- _context.next = 5;
79
+ _context.next = 4;
69
80
  break;
70
81
  }
71
82
 
72
- _context.next = 5;
73
- return app.bootstrap(props);
83
+ _context.next = 4;
84
+ return mod.bootstrap(props);
74
85
 
75
- case 5:
86
+ case 4:
76
87
  setStatus('bootstrap');
77
- _context.next = 8;
78
- return app.mount(props);
88
+ _context.next = 7;
89
+ return mod.mount(props);
79
90
 
80
- case 8:
91
+ case 7:
81
92
  setStatus('mount');
82
93
 
83
- case 9:
94
+ case 8:
84
95
  case "end":
85
96
  return _context.stop();
86
97
  }
@@ -88,28 +99,20 @@ function LoaderApp(_ref) {
88
99
  }, _callee);
89
100
  }));
90
101
  });
91
- return function () {
92
- try {
93
- app.unmount(props);
94
- setStatus('unmount');
95
- app = null;
96
- } catch (error) {
97
- console.error(error);
98
- }
99
- };
100
- }, []);
101
- useEffect(function () {
102
- var currentId = appProps.currentId,
103
- tabId = appProps.tabId;
102
+ });
104
103
 
105
- if (currentId === tabId && loadedAppRef.current) {
104
+ _useUnmount(function () {
105
+ if (loadedAppRef.current) {
106
+ var app = loadedAppRef.current;
106
107
  var props = Object.assign(Object.assign({}, appProps), {
107
108
  container: domRef.current
108
109
  });
109
- console.debug('执行更新!', appProps);
110
- loadedAppRef.current.update && loadedAppRef.current.update(props);
110
+ app.unmount(props);
111
+ setStatus('unmount');
112
+ loadedAppRef.current = null;
111
113
  }
112
- }, [appProps.currentId, appProps.tabId, appProps.updateTime]);
114
+ });
115
+
113
116
  return /*#__PURE__*/React.createElement("main", {
114
117
  ref: domRef,
115
118
  className: "loaded-app-layout ".concat(appConfig.routerPrefix, "-").concat(id),
@@ -127,6 +130,7 @@ function LoaderApp(_ref) {
127
130
 
128
131
  LoaderApp.defaultProps = {
129
132
  appConfig: {},
130
- appProps: {}
133
+ appProps: {},
134
+ style: {}
131
135
  };
132
136
  export default LoaderApp;
@@ -1,5 +1,5 @@
1
1
  import { __awaiter } from "tslib";
2
- import { arrayify, rewrite } from './utils';
2
+ import { arrayify, fetchStyle, rewrite } from './utils';
3
3
  var _global = window;
4
4
  export function createScopedCssText(_ref) {
5
5
  var styleNode = _ref.styleNode,
@@ -27,11 +27,7 @@ export function LoaderStyle(_ref2) {
27
27
  }
28
28
 
29
29
  _context.next = 3;
30
- return fetch(style).then(function (r) {
31
- return r.text();
32
- }).catch(function () {
33
- return '';
34
- });
30
+ return fetchStyle(style);
35
31
 
36
32
  case 3:
37
33
  cssText = _context.sent;
@@ -1,6 +1,7 @@
1
1
  import { AppItemType } from '../Config/interface';
2
2
  export declare const getMicroConfig: (appConfig: AppItemType, appProps: any, container: HTMLDivElement) => {
3
- name: string;
3
+ title: string;
4
+ routerPrefix: string;
4
5
  container: HTMLDivElement;
5
6
  props: any;
6
7
  entry: {
@@ -9,5 +10,6 @@ export declare const getMicroConfig: (appConfig: AppItemType, appProps: any, con
9
10
  html: string;
10
11
  };
11
12
  };
13
+ export declare function fetchStyle(style: string): Promise<string>;
12
14
  export declare const arrayify: <T>(list: CSSRuleList | any[]) => T[];
13
15
  export declare function rewrite(rules: CSSRule[], prefix?: string): string;
@@ -1,21 +1,60 @@
1
+ import { __awaiter } from "tslib";
1
2
  export var getMicroConfig = function getMicroConfig() {
2
3
  var appConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
3
4
  var appProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
4
5
  var container = arguments.length > 2 ? arguments[2] : undefined;
5
6
  var routerPrefix = appConfig.routerPrefix,
6
- resource = appConfig.resource;
7
+ resource = appConfig.resource,
8
+ name = appConfig.name;
7
9
  var microAppEntry = {
8
10
  scripts: [resource[0]],
9
11
  styles: [resource[1]],
10
12
  html: "<div id=\"".concat(routerPrefix, "\" style=\"height:100%\"></div>")
11
13
  };
12
14
  return {
13
- name: routerPrefix,
15
+ title: name,
16
+ routerPrefix: routerPrefix,
14
17
  container: container,
15
18
  props: appProps,
16
19
  entry: microAppEntry
17
20
  };
18
21
  };
22
+ var styleCache = {};
23
+ export function fetchStyle(style) {
24
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
25
+ var cssText;
26
+ return regeneratorRuntime.wrap(function _callee$(_context) {
27
+ while (1) {
28
+ switch (_context.prev = _context.next) {
29
+ case 0:
30
+ if (!styleCache[style]) {
31
+ _context.next = 2;
32
+ break;
33
+ }
34
+
35
+ return _context.abrupt("return", styleCache[style]);
36
+
37
+ case 2:
38
+ _context.next = 4;
39
+ return fetch(style).then(function (r) {
40
+ return r.text();
41
+ }).catch(function () {
42
+ return '';
43
+ });
44
+
45
+ case 4:
46
+ cssText = _context.sent;
47
+ styleCache[style] = cssText;
48
+ return _context.abrupt("return", cssText);
49
+
50
+ case 7:
51
+ case "end":
52
+ return _context.stop();
53
+ }
54
+ }
55
+ }, _callee);
56
+ }));
57
+ }
19
58
  var RuleType = {
20
59
  // type: rule will be rewrote
21
60
  STYLE: 1,
@@ -68,7 +107,8 @@ function ruleStyle(rule, prefix) {
68
107
  // handle :root { ... }
69
108
 
70
109
  if (selector === 'html' || selector === 'body' || selector === ':root') {
71
- return cssText.replace(rootSelectorRE, prefix);
110
+ return ''; //微应用模式下清楚顶层样式
111
+ // return cssText.replace(rootSelectorRE, prefix);
72
112
  } // handle html body { ... }
73
113
  // handle html > body { ... }
74
114
 
@@ -10,14 +10,10 @@ function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Sy
10
10
 
11
11
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
12
 
13
- import { __asyncValues, __awaiter } from "tslib";
14
13
  import React, { useEffect, useState } from 'react';
15
- import { createAsyncIterable } from './utils';
16
- import { nextTick, tryCatch } from '../utils';
14
+ import { createAsyncIterable, runAsyncIterable } from './utils';
17
15
 
18
16
  function LoaderScripts(_ref) {
19
- var _this = this;
20
-
21
17
  var _ref$options = _ref.options,
22
18
  options = _ref$options === void 0 ? [] : _ref$options,
23
19
  children = _ref.children,
@@ -35,90 +31,12 @@ function LoaderScripts(_ref) {
35
31
  return setInitStatus(true);
36
32
  }
37
33
 
38
- var asyncIter = createAsyncIterable(options);
39
- tryCatch(function () {
40
- return __awaiter(_this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
41
- var e_1, _a, asyncIter_1, asyncIter_1_1, x;
42
-
43
- return regeneratorRuntime.wrap(function _callee$(_context) {
44
- while (1) {
45
- switch (_context.prev = _context.next) {
46
- case 0:
47
- _context.prev = 0;
48
- asyncIter_1 = __asyncValues(asyncIter);
49
-
50
- case 2:
51
- _context.next = 4;
52
- return asyncIter_1.next();
53
-
54
- case 4:
55
- asyncIter_1_1 = _context.sent;
56
-
57
- if (asyncIter_1_1.done) {
58
- _context.next = 10;
59
- break;
60
- }
61
-
62
- x = asyncIter_1_1.value;
63
- console.log('加载完成!', options[x]);
64
-
65
- case 8:
66
- _context.next = 2;
67
- break;
68
-
69
- case 10:
70
- _context.next = 15;
71
- break;
72
-
73
- case 12:
74
- _context.prev = 12;
75
- _context.t0 = _context["catch"](0);
76
- e_1 = {
77
- error: _context.t0
78
- };
79
-
80
- case 15:
81
- _context.prev = 15;
82
- _context.prev = 16;
83
-
84
- if (!(asyncIter_1_1 && !asyncIter_1_1.done && (_a = asyncIter_1.return))) {
85
- _context.next = 20;
86
- break;
87
- }
88
-
89
- _context.next = 20;
90
- return _a.call(asyncIter_1);
91
-
92
- case 20:
93
- _context.prev = 20;
94
-
95
- if (!e_1) {
96
- _context.next = 23;
97
- break;
98
- }
99
-
100
- throw e_1.error;
101
-
102
- case 23:
103
- return _context.finish(20);
104
-
105
- case 24:
106
- return _context.finish(15);
107
-
108
- case 25:
109
- nextTick(function () {
110
- return onLoadEnd ? onLoadEnd().then(function () {
111
- return setInitStatus(true);
112
- }) : setInitStatus(true);
113
- });
114
-
115
- case 26:
116
- case "end":
117
- return _context.stop();
118
- }
119
- }
120
- }, _callee, null, [[0, 12, 15, 25], [16,, 20, 24]]);
121
- }));
34
+ runAsyncIterable(createAsyncIterable(options), function (option) {
35
+ return console.debug('LoaderScript -> Iterable加载完成!', option);
36
+ }, function () {
37
+ return onLoadEnd ? onLoadEnd().then(function () {
38
+ return setInitStatus(true);
39
+ }) : setInitStatus(true);
122
40
  });
123
41
  }, [options]);
124
42
  return /*#__PURE__*/React.createElement(React.Fragment, null, !initStatus ? Spin : children);
@@ -10,3 +10,5 @@ export declare function createAsyncIterable(options: IOptionsLoader[]): {
10
10
  }>;
11
11
  };
12
12
  };
13
+ export declare function tryCatch(resolveFn: () => Promise<any>, rejectFn?: (e: unknown) => void): Promise<void>;
14
+ export declare function runAsyncIterable(Iterables: any, runtime?: (conf: any) => void, callback?: () => void): void;
@@ -1,3 +1,5 @@
1
+ import _nextTick from "@cloud-app-dev/utils/es/nextTick";
2
+
1
3
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
2
4
 
3
5
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
@@ -12,6 +14,7 @@ function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToAr
12
14
 
13
15
  function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
14
16
 
17
+ import { __asyncValues, __awaiter } from "tslib";
15
18
  var global = window;
16
19
 
17
20
  if (!global._LOADER_SCRIPT_URL) {
@@ -67,44 +70,178 @@ export function createAsyncIterable(options) {
67
70
  return {
68
71
  i: 0,
69
72
  next: function next() {
70
- var _this = this;
73
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
74
+ var param, arr;
75
+ return regeneratorRuntime.wrap(function _callee$(_context) {
76
+ while (1) {
77
+ switch (_context.prev = _context.next) {
78
+ case 0:
79
+ if (!(this.i < options.length)) {
80
+ _context.next = 12;
81
+ break;
82
+ }
83
+
84
+ param = options[this.i];
85
+ arr = [];
86
+
87
+ if (param.scripts && param.scripts.length > 0) {
88
+ arr.push.apply(arr, _toConsumableArray(param.scripts.map(function (v) {
89
+ return loadScript(v);
90
+ })));
91
+ }
92
+
93
+ if (param.styles && param.styles.length > 0) {
94
+ arr.push.apply(arr, _toConsumableArray(param.styles.map(function (v) {
95
+ return loaderCss(v);
96
+ })));
97
+ }
98
+
99
+ if (!(arr.length > 0)) {
100
+ _context.next = 11;
101
+ break;
102
+ }
103
+
104
+ _context.next = 8;
105
+ return Promise.all(arr);
106
+
107
+ case 8:
108
+ return _context.abrupt("return", {
109
+ value: this.i++,
110
+ done: false
111
+ });
112
+
113
+ case 11:
114
+ return _context.abrupt("return", Promise.resolve({
115
+ value: this.i++,
116
+ done: false
117
+ }));
118
+
119
+ case 12:
120
+ return _context.abrupt("return", Promise.resolve({
121
+ value: this.i,
122
+ done: true
123
+ }));
124
+
125
+ case 13:
126
+ case "end":
127
+ return _context.stop();
128
+ }
129
+ }
130
+ }, _callee, this);
131
+ }));
132
+ }
133
+ };
134
+ });
135
+ }
136
+ export function tryCatch(resolveFn) {
137
+ var rejectFn = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : console.error;
138
+ return __awaiter(this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
139
+ return regeneratorRuntime.wrap(function _callee2$(_context2) {
140
+ while (1) {
141
+ switch (_context2.prev = _context2.next) {
142
+ case 0:
143
+ _context2.prev = 0;
144
+ _context2.next = 3;
145
+ return resolveFn();
146
+
147
+ case 3:
148
+ _context2.next = 8;
149
+ break;
150
+
151
+ case 5:
152
+ _context2.prev = 5;
153
+ _context2.t0 = _context2["catch"](0);
154
+ rejectFn(_context2.t0);
155
+
156
+ case 8:
157
+ case "end":
158
+ return _context2.stop();
159
+ }
160
+ }
161
+ }, _callee2, null, [[0, 5]]);
162
+ }));
163
+ }
164
+ export function runAsyncIterable(Iterables, runtime, callback) {
165
+ var _this = this;
166
+
167
+ tryCatch(function () {
168
+ return __awaiter(_this, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {
169
+ var e_1, _a, Iterables_1, Iterables_1_1, x;
170
+
171
+ return regeneratorRuntime.wrap(function _callee3$(_context3) {
172
+ while (1) {
173
+ switch (_context3.prev = _context3.next) {
174
+ case 0:
175
+ _context3.prev = 0;
176
+ Iterables_1 = __asyncValues(Iterables);
177
+
178
+ case 2:
179
+ _context3.next = 4;
180
+ return Iterables_1.next();
181
+
182
+ case 4:
183
+ Iterables_1_1 = _context3.sent;
184
+
185
+ if (Iterables_1_1.done) {
186
+ _context3.next = 10;
187
+ break;
188
+ }
189
+
190
+ x = Iterables_1_1.value;
191
+ runtime && runtime(x);
192
+
193
+ case 8:
194
+ _context3.next = 2;
195
+ break;
196
+
197
+ case 10:
198
+ _context3.next = 15;
199
+ break;
200
+
201
+ case 12:
202
+ _context3.prev = 12;
203
+ _context3.t0 = _context3["catch"](0);
204
+ e_1 = {
205
+ error: _context3.t0
206
+ };
71
207
 
72
- if (this.i < options.length) {
73
- var param = options[this.i];
74
- var arr = [];
208
+ case 15:
209
+ _context3.prev = 15;
210
+ _context3.prev = 16;
75
211
 
76
- if (param.scripts && param.scripts.length > 0) {
77
- arr.push.apply(arr, _toConsumableArray(param.scripts.map(function (v) {
78
- return loadScript(v);
79
- })));
80
- }
212
+ if (!(Iterables_1_1 && !Iterables_1_1.done && (_a = Iterables_1.return))) {
213
+ _context3.next = 20;
214
+ break;
215
+ }
81
216
 
82
- if (param.styles && param.styles.length > 0) {
83
- arr.push.apply(arr, _toConsumableArray(param.styles.map(function (v) {
84
- return loaderCss(v);
85
- })));
86
- }
217
+ _context3.next = 20;
218
+ return _a.call(Iterables_1);
87
219
 
88
- if (arr.length > 0) {
89
- return Promise.all(arr).then(function () {
90
- return {
91
- value: _this.i++,
92
- done: false
93
- };
94
- });
95
- } else {
96
- return Promise.resolve({
97
- value: this.i++,
98
- done: false
99
- });
220
+ case 20:
221
+ _context3.prev = 20;
222
+
223
+ if (!e_1) {
224
+ _context3.next = 23;
225
+ break;
226
+ }
227
+
228
+ throw e_1.error;
229
+
230
+ case 23:
231
+ return _context3.finish(20);
232
+
233
+ case 24:
234
+ return _context3.finish(15);
235
+
236
+ case 25:
237
+ callback && _nextTick(callback);
238
+
239
+ case 26:
240
+ case "end":
241
+ return _context3.stop();
100
242
  }
101
243
  }
102
-
103
- return Promise.resolve({
104
- value: this.i,
105
- done: true
106
- });
107
- }
108
- };
244
+ }, _callee3, null, [[0, 12, 15, 25], [16,, 20, 24]]);
245
+ }));
109
246
  });
110
247
  }
@@ -1,12 +1,12 @@
1
- function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
1
+ function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
2
2
 
3
3
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
4
4
 
5
5
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
6
6
 
7
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
7
+ function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
8
8
 
9
- function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }
9
+ function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
10
10
 
11
11
  function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
12
12
 
@@ -23,7 +23,7 @@ import Tools from './component/Tools';
23
23
  import DrawRect from './component/DrawRect';
24
24
  import WheelScale from './component/WheelScale';
25
25
  import DefaultRects from './component/DefaultRects';
26
- import isFunction from 'lodash-es/isFunction';
26
+ import { isFunction } from 'lodash';
27
27
  import "./index.css";
28
28
 
29
29
  function Picture(_a) {
@@ -1,4 +1,4 @@
1
- import cloneDeep from 'lodash-es/cloneDeep';
1
+ import { cloneDeep } from 'lodash';
2
2
  export function customContextMenu(e) {
3
3
  e.preventDefault();
4
4
  return false;
@@ -15,7 +15,7 @@ import Drawer from '../Drawer';
15
15
  import ConfigContext from '../ConfigContext';
16
16
 
17
17
  function RefDrawer(_, ref) {
18
- var context = useContext(ConfigContext);
18
+ var context = useContext(ConfigContext.Context);
19
19
  var root = useMemo(function () {
20
20
  return (context === null || context === void 0 ? void 0 : context.root) || document.body;
21
21
  }, [context === null || context === void 0 ? void 0 : context.root]);
@@ -15,7 +15,7 @@ import Modal from '../Modal';
15
15
  import ConfigContext from '../ConfigContext';
16
16
 
17
17
  function RefModal(_, ref) {
18
- var context = useContext(ConfigContext);
18
+ var context = useContext(ConfigContext.Context);
19
19
  var root = useMemo(function () {
20
20
  return (context === null || context === void 0 ? void 0 : context.root) || document.body;
21
21
  }, [context === null || context === void 0 ? void 0 : context.root]);
@@ -1,4 +1,6 @@
1
- import { RsponseType, XHRResponse } from './interface';
2
- export declare function $http(options: RsponseType): import("fetch-like-axios").AxiosPromise<any>;
3
- export declare const $httpMultiPartInstance: import("fetch-like-axios").AxiosInstance;
4
- export declare const $httpXMLInstance: ({ url, method, data, headers, cancelHttp, isAsync, requestId }: XHRResponse) => Promise<unknown>;
1
+ import { AxiosInstance } from 'fetch-like-axios';
2
+ import type { RsponseType, XHRResponse } from './interface';
3
+ declare function http({ cancelHttp, ...newOptions }: RsponseType): Promise<any>;
4
+ declare const httpMultiPartInstance: AxiosInstance;
5
+ declare function httpXMLInstance({ url, method, data, headers, cancelHttp, isAsync }: XHRResponse): Promise<any>;
6
+ export { http as default, http, httpMultiPartInstance, httpXMLInstance };