@alicloud/alfa-react 1.4.20 → 1.4.22-alpha.0
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/dist/index.js +1 -1
- package/es/createApplication.js +6 -3
- package/es/hooks/beforeLoadHook.js +25 -9
- package/es/version.js +1 -1
- package/lib/createApplication.js +6 -3
- package/lib/hooks/beforeLoadHook.js +23 -8
- package/lib/version.js +1 -1
- package/package.json +3 -3
- package/types/types/index.d.ts +1 -0
- package/types/version.d.ts +1 -1
- package/LICENSE +0 -21
package/es/createApplication.js
CHANGED
|
@@ -39,7 +39,8 @@ export default function createApplication(loader) {
|
|
|
39
39
|
afterUnmount = props.afterUnmount,
|
|
40
40
|
beforeUpdate = props.beforeUpdate,
|
|
41
41
|
customSandbox = props.sandbox,
|
|
42
|
-
locale = props.locale
|
|
42
|
+
locale = props.locale,
|
|
43
|
+
dynamicConfig = props.dynamicConfig;
|
|
43
44
|
|
|
44
45
|
var _useState = useState(null),
|
|
45
46
|
_useState2 = _slicedToArray(_useState, 2),
|
|
@@ -74,7 +75,8 @@ export default function createApplication(loader) {
|
|
|
74
75
|
externalsVars: [].concat(_toConsumableArray((customSandbox === null || customSandbox === void 0 ? void 0 : customSandbox.externalsVars) || []), [// global vars used in ConsoleBase.forApp
|
|
75
76
|
'_console_base_ready_'], aliyunExternalsVars)
|
|
76
77
|
});
|
|
77
|
-
}, [customSandbox]);
|
|
78
|
+
}, [customSandbox]); // 固化第一次的配置
|
|
79
|
+
|
|
78
80
|
var memoOptions = useMemo(function () {
|
|
79
81
|
return {
|
|
80
82
|
entry: entry,
|
|
@@ -95,7 +97,8 @@ export default function createApplication(loader) {
|
|
|
95
97
|
beforeUnmount: beforeUnmount,
|
|
96
98
|
afterUnmount: afterUnmount,
|
|
97
99
|
beforeUpdate: beforeUpdate,
|
|
98
|
-
locale: locale
|
|
100
|
+
locale: locale,
|
|
101
|
+
dynamicConfig: dynamicConfig
|
|
99
102
|
};
|
|
100
103
|
}, []);
|
|
101
104
|
useEffect(function () {
|
|
@@ -9,33 +9,48 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
|
|
|
9
9
|
|
|
10
10
|
import { getConfig, getI18nMessages } from '@alicloud/alfa-core';
|
|
11
11
|
import { getConsoleConfig } from '../utils/getConsoleConfig';
|
|
12
|
-
import { getConsoleGlobal } from '../utils/getConsoleGlobal';
|
|
12
|
+
import { getConsoleGlobal } from '../utils/getConsoleGlobal';
|
|
13
13
|
|
|
14
|
+
// inject consoleConfig & locales after load
|
|
14
15
|
function afterLoadHook(_x) {
|
|
15
16
|
return _afterLoadHook.apply(this, arguments);
|
|
16
17
|
}
|
|
17
18
|
|
|
18
19
|
function _afterLoadHook() {
|
|
19
20
|
_afterLoadHook = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(appConfig) {
|
|
20
|
-
var app, logger, sandbox, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, CONFIG_END_TIME, i18nMessages, END_TIME;
|
|
21
|
+
var app, logger, sandbox, dynamicConfig, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, CONFIG_END_TIME, i18nMessages, END_TIME;
|
|
21
22
|
|
|
22
23
|
return _regeneratorRuntime.wrap(function _callee$(_context) {
|
|
23
24
|
while (1) {
|
|
24
25
|
switch (_context.prev = _context.next) {
|
|
25
26
|
case 0:
|
|
26
|
-
app = appConfig.app, logger = appConfig.logger, sandbox = appConfig.sandbox;
|
|
27
|
+
app = appConfig.app, logger = appConfig.logger, sandbox = appConfig.sandbox, dynamicConfig = appConfig.dynamicConfig;
|
|
27
28
|
defaultConsoleConfig = window.ALIYUN_CONSOLE_CONFIG || {};
|
|
28
29
|
defaultConsoleGlobal = window.ALIYUN_CONSOLE_GLOBAL || {};
|
|
29
30
|
CONFIG_START_TIME = Date.now();
|
|
30
|
-
|
|
31
|
+
|
|
32
|
+
if (!dynamicConfig) {
|
|
33
|
+
_context.next = 10;
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
_context.next = 7;
|
|
31
38
|
return getConfig(appConfig);
|
|
32
39
|
|
|
33
|
-
case
|
|
34
|
-
|
|
35
|
-
_context.next =
|
|
40
|
+
case 7:
|
|
41
|
+
_context.t0 = _context.sent;
|
|
42
|
+
_context.next = 11;
|
|
43
|
+
break;
|
|
44
|
+
|
|
45
|
+
case 10:
|
|
46
|
+
_context.t0 = {};
|
|
47
|
+
|
|
48
|
+
case 11:
|
|
49
|
+
configData = _context.t0;
|
|
50
|
+
_context.next = 14;
|
|
36
51
|
return Promise.all([getConsoleConfig(configData, defaultConsoleConfig), getConsoleGlobal(configData, defaultConsoleGlobal), getI18nMessages(appConfig)]);
|
|
37
52
|
|
|
38
|
-
case
|
|
53
|
+
case 14:
|
|
39
54
|
_yield$Promise$all = _context.sent;
|
|
40
55
|
_yield$Promise$all2 = _slicedToArray(_yield$Promise$all, 3);
|
|
41
56
|
consoleConfig = _yield$Promise$all2[0];
|
|
@@ -48,6 +63,7 @@ function _afterLoadHook() {
|
|
|
48
63
|
app.context.window.ALIYUN_CONSOLE_CONFIG = consoleConfig;
|
|
49
64
|
app.context.window.ALIYUN_CONSOLE_GLOBAL = consoleGlobal;
|
|
50
65
|
app.context.window.ALIYUN_CONSOLE_I18N_MESSAGE = i18nMessages;
|
|
66
|
+
app.context.window.ALIYUN_WIND_MESSAGE = window.ALIYUN_WIND_MESSAGE;
|
|
51
67
|
}
|
|
52
68
|
|
|
53
69
|
END_TIME = Date.now();
|
|
@@ -59,7 +75,7 @@ function _afterLoadHook() {
|
|
|
59
75
|
(logger === null || logger === void 0 ? void 0 : logger.send) && logger.send();
|
|
60
76
|
return _context.abrupt("return", appConfig);
|
|
61
77
|
|
|
62
|
-
case
|
|
78
|
+
case 26:
|
|
63
79
|
case "end":
|
|
64
80
|
return _context.stop();
|
|
65
81
|
}
|
package/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var version = '1.4.
|
|
1
|
+
export var version = '1.4.22-alpha.0';
|
package/lib/createApplication.js
CHANGED
|
@@ -61,7 +61,8 @@ function createApplication(loader) {
|
|
|
61
61
|
afterUnmount = props.afterUnmount,
|
|
62
62
|
beforeUpdate = props.beforeUpdate,
|
|
63
63
|
customSandbox = props.sandbox,
|
|
64
|
-
locale = props.locale
|
|
64
|
+
locale = props.locale,
|
|
65
|
+
dynamicConfig = props.dynamicConfig;
|
|
65
66
|
|
|
66
67
|
var _useState = (0, _react.useState)(null),
|
|
67
68
|
_useState2 = (0, _slicedToArray2.default)(_useState, 2),
|
|
@@ -96,7 +97,8 @@ function createApplication(loader) {
|
|
|
96
97
|
externalsVars: [].concat((0, _toConsumableArray2.default)((customSandbox === null || customSandbox === void 0 ? void 0 : customSandbox.externalsVars) || []), [// global vars used in ConsoleBase.forApp
|
|
97
98
|
'_console_base_ready_'], aliyunExternalsVars)
|
|
98
99
|
});
|
|
99
|
-
}, [customSandbox]);
|
|
100
|
+
}, [customSandbox]); // 固化第一次的配置
|
|
101
|
+
|
|
100
102
|
var memoOptions = (0, _react.useMemo)(function () {
|
|
101
103
|
return {
|
|
102
104
|
entry: entry,
|
|
@@ -117,7 +119,8 @@ function createApplication(loader) {
|
|
|
117
119
|
beforeUnmount: beforeUnmount,
|
|
118
120
|
afterUnmount: afterUnmount,
|
|
119
121
|
beforeUpdate: beforeUpdate,
|
|
120
|
-
locale: locale
|
|
122
|
+
locale: locale,
|
|
123
|
+
dynamicConfig: dynamicConfig
|
|
121
124
|
};
|
|
122
125
|
}, []);
|
|
123
126
|
(0, _react.useEffect)(function () {
|
|
@@ -32,25 +32,39 @@ function afterLoadHook(_x) {
|
|
|
32
32
|
|
|
33
33
|
function _afterLoadHook() {
|
|
34
34
|
_afterLoadHook = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(appConfig) {
|
|
35
|
-
var app, logger, sandbox, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, CONFIG_END_TIME, i18nMessages, END_TIME;
|
|
35
|
+
var app, logger, sandbox, dynamicConfig, defaultConsoleConfig, defaultConsoleGlobal, CONFIG_START_TIME, configData, _yield$Promise$all, _yield$Promise$all2, consoleConfig, consoleGlobal, messages, CONFIG_END_TIME, i18nMessages, END_TIME;
|
|
36
36
|
|
|
37
37
|
return _regenerator.default.wrap(function _callee$(_context) {
|
|
38
38
|
while (1) {
|
|
39
39
|
switch (_context.prev = _context.next) {
|
|
40
40
|
case 0:
|
|
41
|
-
app = appConfig.app, logger = appConfig.logger, sandbox = appConfig.sandbox;
|
|
41
|
+
app = appConfig.app, logger = appConfig.logger, sandbox = appConfig.sandbox, dynamicConfig = appConfig.dynamicConfig;
|
|
42
42
|
defaultConsoleConfig = window.ALIYUN_CONSOLE_CONFIG || {};
|
|
43
43
|
defaultConsoleGlobal = window.ALIYUN_CONSOLE_GLOBAL || {};
|
|
44
44
|
CONFIG_START_TIME = Date.now();
|
|
45
|
-
|
|
45
|
+
|
|
46
|
+
if (!dynamicConfig) {
|
|
47
|
+
_context.next = 10;
|
|
48
|
+
break;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
_context.next = 7;
|
|
46
52
|
return (0, _alfaCore.getConfig)(appConfig);
|
|
47
53
|
|
|
48
|
-
case
|
|
49
|
-
|
|
50
|
-
_context.next =
|
|
54
|
+
case 7:
|
|
55
|
+
_context.t0 = _context.sent;
|
|
56
|
+
_context.next = 11;
|
|
57
|
+
break;
|
|
58
|
+
|
|
59
|
+
case 10:
|
|
60
|
+
_context.t0 = {};
|
|
61
|
+
|
|
62
|
+
case 11:
|
|
63
|
+
configData = _context.t0;
|
|
64
|
+
_context.next = 14;
|
|
51
65
|
return Promise.all([(0, _getConsoleConfig.getConsoleConfig)(configData, defaultConsoleConfig), (0, _getConsoleGlobal.getConsoleGlobal)(configData, defaultConsoleGlobal), (0, _alfaCore.getI18nMessages)(appConfig)]);
|
|
52
66
|
|
|
53
|
-
case
|
|
67
|
+
case 14:
|
|
54
68
|
_yield$Promise$all = _context.sent;
|
|
55
69
|
_yield$Promise$all2 = (0, _slicedToArray2.default)(_yield$Promise$all, 3);
|
|
56
70
|
consoleConfig = _yield$Promise$all2[0];
|
|
@@ -63,6 +77,7 @@ function _afterLoadHook() {
|
|
|
63
77
|
app.context.window.ALIYUN_CONSOLE_CONFIG = consoleConfig;
|
|
64
78
|
app.context.window.ALIYUN_CONSOLE_GLOBAL = consoleGlobal;
|
|
65
79
|
app.context.window.ALIYUN_CONSOLE_I18N_MESSAGE = i18nMessages;
|
|
80
|
+
app.context.window.ALIYUN_WIND_MESSAGE = window.ALIYUN_WIND_MESSAGE;
|
|
66
81
|
}
|
|
67
82
|
|
|
68
83
|
END_TIME = Date.now();
|
|
@@ -74,7 +89,7 @@ function _afterLoadHook() {
|
|
|
74
89
|
(logger === null || logger === void 0 ? void 0 : logger.send) && logger.send();
|
|
75
90
|
return _context.abrupt("return", appConfig);
|
|
76
91
|
|
|
77
|
-
case
|
|
92
|
+
case 26:
|
|
78
93
|
case "end":
|
|
79
94
|
return _context.stop();
|
|
80
95
|
}
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alicloud/alfa-react",
|
|
3
|
-
"version": "1.4.
|
|
3
|
+
"version": "1.4.22-alpha.0",
|
|
4
4
|
"description": "Alfa Framework (React Version)",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -42,7 +42,7 @@
|
|
|
42
42
|
"typescript": "^3.0.3"
|
|
43
43
|
},
|
|
44
44
|
"dependencies": {
|
|
45
|
-
"@alicloud/alfa-core": "^1.4.
|
|
45
|
+
"@alicloud/alfa-core": "^1.4.22-alpha.0",
|
|
46
46
|
"@alicloud/console-os-loader": "^1.4.14-alpha.1",
|
|
47
47
|
"@alicloud/widget-utils-console": "^0.1.6",
|
|
48
48
|
"classnames": "^2.2.6",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"peerDependencies": {
|
|
52
52
|
"react": "^16 | ^17"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "3d2c643b87f1c7557f2ccf12c53d80b5a8d8d0ee"
|
|
55
55
|
}
|
package/types/types/index.d.ts
CHANGED
package/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.4.
|
|
1
|
+
export declare const version = "1.4.22-alpha.0";
|
package/LICENSE
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2019 Alibaba Cloud
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|