@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.
- package/.fatherrc.js +11 -4
- package/.umirc.ts +1 -1
- package/es/Api/index.js +7 -7
- package/es/AppRedirect/index.d.ts +1 -1
- package/es/AppRedirect/index.js +7 -12
- package/es/AppRouter/index.d.ts +8 -0
- package/es/AppRouter/index.js +17 -0
- package/es/Auth/index.js +1 -1
- package/es/AutoExit/index.js +12 -10
- package/es/{ContentBox → Box}/BetweenBox/index.css +0 -0
- package/es/{ContentBox → Box}/BetweenBox/index.d.ts +0 -0
- package/es/{ContentBox → Box}/BetweenBox/index.js +0 -0
- package/es/{ContentBox → Box}/InfoBox/index.css +0 -0
- package/es/{ContentBox → Box}/InfoBox/index.d.ts +0 -0
- package/es/{ContentBox → Box}/InfoBox/index.js +0 -0
- package/es/{ContentBox → Box}/TwoColumnBox/index.css +0 -0
- package/es/{ContentBox → Box}/TwoColumnBox/index.d.ts +0 -0
- package/es/{ContentBox → Box}/TwoColumnBox/index.js +0 -0
- package/es/{ContentBox → Box}/deps/content-grid.d.ts +0 -0
- package/es/{ContentBox → Box}/deps/content-grid.js +0 -0
- package/es/{ContentBox → Box}/deps/grid-factory.d.ts +0 -0
- package/es/{ContentBox → Box}/deps/grid-factory.js +0 -0
- package/es/{ContentBox → Box}/deps/simple-grid.d.ts +0 -0
- package/es/{ContentBox → Box}/deps/simple-grid.js +0 -0
- package/es/{ContentBox → Box}/index.css +0 -0
- package/es/{ContentBox → Box}/index.d.ts +3 -3
- package/es/{ContentBox → Box}/index.js +5 -5
- package/es/CheckGroupFixed/index.js +4 -2
- package/es/Config/index.js +12 -12
- package/es/Config/interface.d.ts +6 -4
- package/es/ConfigContext/index.d.ts +15 -2
- package/es/ConfigContext/index.js +25 -3
- package/es/DeviceSelect/TreeType.d.ts +6 -0
- package/es/DeviceSelect/TreeType.js +36 -0
- package/es/DeviceSelect/demo.js +2 -2
- package/es/DeviceSelect/index.css +6 -1
- package/es/DeviceSelect/index.d.ts +5 -0
- package/es/DeviceSelect/index.js +22 -54
- package/es/Dict/hook.d.ts +0 -1
- package/es/Dict/hook.js +5 -21
- package/es/Dict/index.d.ts +1 -5
- package/es/Dict/index.js +2 -6
- package/es/Dict/utils.d.ts +0 -1
- package/es/Dict/utils.js +2 -9
- package/es/HightLevel/index.js +1 -2
- package/es/IconFont/index.d.ts +0 -1
- package/es/IconFont/index.js +12 -13
- package/es/InitialConfig/index.js +7 -6
- package/es/InitialConfig/utils.d.ts +5 -0
- package/es/InitialConfig/utils.js +33 -6
- package/es/InitialRequest/index.d.ts +3 -1
- package/es/InitialRequest/index.js +20 -18
- package/es/InitialRequest/utils.d.ts +4 -3
- package/es/InitialRequest/utils.js +28 -29
- package/es/Input/index.js +3 -2
- package/es/InstanceHistory/index.d.ts +3 -0
- package/es/InstanceHistory/index.js +9 -0
- package/es/List/CheckExt.d.ts +3 -5
- package/es/List/CheckExt.js +21 -13
- package/es/{AppRoute → List/DeviceList}/index.css +0 -0
- package/es/List/DeviceList/index.d.ts +11 -0
- package/es/{DeviceList → List/DeviceList}/index.js +6 -18
- package/es/{DynamicDeviceList → List/DynamicDeviceList}/Demo.d.ts +0 -0
- package/es/{DynamicList/demo.js → List/DynamicDeviceList/Demo.js} +25 -42
- package/es/{DynamicDeviceList → List/DynamicDeviceList}/index.css +5 -17
- package/es/List/DynamicDeviceList/index.d.ts +11 -0
- package/es/List/DynamicDeviceList/index.js +205 -0
- package/es/List/DynamicDeviceList/interface.d.ts +37 -0
- package/es/List/DynamicDeviceList/utils.d.ts +16 -0
- package/es/List/DynamicDeviceList/utils.js +61 -0
- package/es/{DynamicList/demo.d.ts → List/DynamicGridList/Demo.d.ts} +0 -0
- package/es/List/DynamicGridList/Demo.js +70 -0
- package/es/List/DynamicGridList/index.d.ts +26 -0
- package/es/List/DynamicGridList/index.js +73 -0
- package/es/List/GridList/Demo.d.ts +2 -0
- package/es/List/GridList/Demo.js +91 -0
- package/es/List/GridList/hook.d.ts +13 -0
- package/es/List/GridList/hook.js +301 -0
- package/es/List/GridList/index.css +7 -0
- package/es/List/GridList/index.d.ts +15 -0
- package/es/List/GridList/index.js +47 -0
- package/es/List/GridList/interface.d.ts +59 -0
- package/es/List/GridList/utils.d.ts +9 -0
- package/es/List/GridList/utils.js +43 -0
- package/es/List/ListExt/index.css +3 -0
- package/es/{ListExt → List/ListExt}/index.d.ts +1 -1
- package/es/{ListExt → List/ListExt}/index.js +3 -3
- package/es/List/VList/index.css +6 -0
- package/es/List/VList/index.d.ts +18 -0
- package/es/List/VList/index.js +51 -0
- package/es/List/VList/utils.d.ts +14 -0
- package/es/{VList → List/VList}/utils.js +0 -0
- package/es/List/index.css +11 -12
- package/es/List/index.d.ts +5 -70
- package/es/List/index.js +32 -25
- package/es/List/interface.d.ts +87 -0
- package/es/List/renderItem.d.ts +1 -1
- package/es/List/renderItem.js +13 -10
- package/es/LoaderApp/index.d.ts +1 -1
- package/es/LoaderApp/index.js +39 -35
- package/es/LoaderApp/loader.js +2 -6
- package/es/LoaderApp/utils.d.ts +3 -1
- package/es/LoaderApp/utils.js +43 -3
- package/es/LoaderScript/index.js +7 -89
- package/es/LoaderScript/utils.d.ts +2 -0
- package/es/LoaderScript/utils.js +170 -33
- package/es/Picture/component/MoveContent/index.js +3 -3
- package/es/Picture/index.js +1 -1
- package/es/Picture/utils.js +1 -1
- package/es/RefDrawer/index.js +1 -1
- package/es/RefModal/index.js +1 -1
- package/es/Service/http.d.ts +6 -4
- package/es/Service/http.js +20 -22
- package/es/Service/index.d.ts +3 -3
- package/es/Service/index.js +7 -11
- package/es/Service/interface.d.ts +5 -11
- package/es/Service/middleware.d.ts +1 -1
- package/es/Service/middleware.js +1 -1
- package/es/TableLayout/index.d.ts +3 -0
- package/es/TableLayout/index.js +14 -45
- package/es/{TreeTitle → Title}/index.css +5 -5
- package/es/{TreeTitle → Title}/index.d.ts +2 -2
- package/es/{TreeTitle → Title}/index.js +7 -4
- package/es/{TreeMode → Tree/BaseTree}/demo.d.ts +0 -0
- package/es/Tree/BaseTree/demo.js +69 -0
- package/es/Tree/BaseTree/index.css +64 -0
- package/es/Tree/BaseTree/index.d.ts +24 -0
- package/es/Tree/BaseTree/index.js +83 -0
- package/es/Tree/demo.js +19 -56
- package/es/Tree/index.css +29 -55
- package/es/Tree/index.d.ts +19 -20
- package/es/Tree/index.js +185 -70
- package/es/UserSelect/index.js +7 -8
- package/es/WorkerFlow/Form/Condition.js +2 -4
- package/es/WorkerFlow/Form/EmptyUserSet.js +1 -1
- package/es/WorkerFlow/Form/FormAuth.js +3 -3
- package/es/WorkerFlow/Form/GroupList.js +2 -2
- package/es/WorkerFlow/Form/GroupSelect.js +1 -1
- package/es/WorkerFlow/Form/GroupSelectModalContent.js +2 -3
- package/es/WorkerFlow/Form/LevelGroupSelect.js +2 -2
- package/es/WorkerFlow/Form/UserAndGroupSelect.js +1 -1
- package/es/WorkerFlow/Form/UserSelect.js +1 -1
- package/es/WorkerFlow/Form/UserSelectModalContent.js +3 -6
- package/es/WorkerFlow/Form/UserSet.js +3 -3
- package/es/WorkerFlow/Nodes/TitleElement.js +71 -34
- package/es/WorkerFlow/index.css +9 -3
- package/es/WorkerFlow/index.js +14 -9
- package/es/WorkerFlow/utils.js +1 -1
- package/es/index.d.ts +4 -11
- package/es/index.js +4 -11
- package/es/useDrawer/index.d.ts +1 -1
- package/es/useDrawer/index.js +3 -2
- package/es/useHistory/index.d.ts +2 -2
- package/es/useHistory/index.js +3 -6
- package/es/useHttp/index.js +1 -1
- package/es/useModal/index.d.ts +1 -1
- package/es/useModal/index.js +3 -2
- package/es/utils.d.ts +9 -0
- package/es/utils.js +36 -1
- package/package.json +10 -12
- package/tsconfig.json +1 -1
- package/es/AppRoute/Render.d.ts +0 -23
- package/es/AppRoute/Render.js +0 -111
- package/es/AppRoute/Rendered.d.ts +0 -4
- package/es/AppRoute/Rendered.js +0 -11
- package/es/AppRoute/index.d.ts +0 -14
- package/es/AppRoute/index.js +0 -106
- package/es/AppRoute/interface.d.ts +0 -18
- package/es/AppRoute/utils.d.ts +0 -1
- package/es/AppRoute/utils.js +0 -28
- package/es/DeviceList/index.css +0 -32
- package/es/DeviceList/index.d.ts +0 -14
- package/es/Dict/desc.d.ts +0 -64
- package/es/Dict/desc.js +0 -162
- package/es/DynamicDeviceList/CheckExt.d.ts +0 -8
- package/es/DynamicDeviceList/CheckExt.js +0 -36
- package/es/DynamicDeviceList/Demo.js +0 -17
- package/es/DynamicDeviceList/index.d.ts +0 -35
- package/es/DynamicDeviceList/index.js +0 -224
- package/es/DynamicDeviceList/utils.d.ts +0 -2
- package/es/DynamicDeviceList/utils.js +0 -15
- package/es/DynamicList/index.css +0 -7
- package/es/DynamicList/index.d.ts +0 -31
- package/es/DynamicList/index.js +0 -132
- package/es/IconFont/index.css +0 -0
- package/es/List/utils.d.ts +0 -5
- package/es/List/utils.js +0 -18
- package/es/ListExt/index.css +0 -9
- package/es/ScrollList/index.css +0 -73
- package/es/ScrollList/index.d.ts +0 -24
- package/es/ScrollList/index.js +0 -262
- package/es/ScrollList/utils.js +0 -84
- package/es/Service/logger.d.ts +0 -3
- package/es/Service/logger.js +0 -13
- package/es/Service/utils.d.ts +0 -3
- package/es/Service/utils.js +0 -11
- package/es/TreeMode/demo.js +0 -32
- package/es/TreeMode/index.css +0 -38
- package/es/TreeMode/index.d.ts +0 -23
- package/es/TreeMode/index.js +0 -201
- package/es/VList/index.css +0 -4
- package/es/VList/index.d.ts +0 -16
- package/es/VList/index.js +0 -56
- package/es/VList/utils.d.ts +0 -10
- package/es/useChangeEffect/index.d.ts +0 -3
- package/es/useChangeEffect/index.js +0 -32
- package/es/useHistory/index.css +0 -0
package/es/LoaderApp/index.js
CHANGED
|
@@ -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,
|
|
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
|
-
|
|
40
|
-
var app;
|
|
41
|
+
_useMount(function () {
|
|
41
42
|
var config = getMicroConfig(appConfig, appProps, domRef.current);
|
|
42
43
|
|
|
43
44
|
if (!config) {
|
|
44
|
-
console.
|
|
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:
|
|
53
|
-
style:
|
|
54
|
-
name:
|
|
55
|
-
prefix: ".".concat(
|
|
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 =
|
|
79
|
+
_context.next = 4;
|
|
69
80
|
break;
|
|
70
81
|
}
|
|
71
82
|
|
|
72
|
-
_context.next =
|
|
73
|
-
return
|
|
83
|
+
_context.next = 4;
|
|
84
|
+
return mod.bootstrap(props);
|
|
74
85
|
|
|
75
|
-
case
|
|
86
|
+
case 4:
|
|
76
87
|
setStatus('bootstrap');
|
|
77
|
-
_context.next =
|
|
78
|
-
return
|
|
88
|
+
_context.next = 7;
|
|
89
|
+
return mod.mount(props);
|
|
79
90
|
|
|
80
|
-
case
|
|
91
|
+
case 7:
|
|
81
92
|
setStatus('mount');
|
|
82
93
|
|
|
83
|
-
case
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
110
|
-
|
|
110
|
+
app.unmount(props);
|
|
111
|
+
setStatus('unmount');
|
|
112
|
+
loadedAppRef.current = null;
|
|
111
113
|
}
|
|
112
|
-
}
|
|
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;
|
package/es/LoaderApp/loader.js
CHANGED
|
@@ -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
|
|
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;
|
package/es/LoaderApp/utils.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AppItemType } from '../Config/interface';
|
|
2
2
|
export declare const getMicroConfig: (appConfig: AppItemType, appProps: any, container: HTMLDivElement) => {
|
|
3
|
-
|
|
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;
|
package/es/LoaderApp/utils.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
110
|
+
return ''; //微应用模式下清楚顶层样式
|
|
111
|
+
// return cssText.replace(rootSelectorRE, prefix);
|
|
72
112
|
} // handle html body { ... }
|
|
73
113
|
// handle html > body { ... }
|
|
74
114
|
|
package/es/LoaderScript/index.js
CHANGED
|
@@ -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
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
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;
|
package/es/LoaderScript/utils.js
CHANGED
|
@@ -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
|
-
|
|
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
|
-
|
|
73
|
-
|
|
74
|
-
|
|
208
|
+
case 15:
|
|
209
|
+
_context3.prev = 15;
|
|
210
|
+
_context3.prev = 16;
|
|
75
211
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
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
|
-
|
|
83
|
-
|
|
84
|
-
return loaderCss(v);
|
|
85
|
-
})));
|
|
86
|
-
}
|
|
217
|
+
_context3.next = 20;
|
|
218
|
+
return _a.call(Iterables_1);
|
|
87
219
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
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
|
-
|
|
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";
|
|
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
|
|
package/es/Picture/index.js
CHANGED
|
@@ -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
|
|
26
|
+
import { isFunction } from 'lodash';
|
|
27
27
|
import "./index.css";
|
|
28
28
|
|
|
29
29
|
function Picture(_a) {
|
package/es/Picture/utils.js
CHANGED
package/es/RefDrawer/index.js
CHANGED
|
@@ -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]);
|
package/es/RefModal/index.js
CHANGED
|
@@ -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]);
|
package/es/Service/http.d.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
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 };
|