@alicloud/alfa-react 1.4.30-alpha.6 → 1.4.30-alpha.8
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 +6 -6
- package/es/components/ErrorBoundary/ErrorPanel.js +2 -7
- package/es/createAlfaApp.js +2 -4
- package/es/createApplication.js +8 -10
- package/es/version.js +1 -1
- package/lib/components/ErrorBoundary/ErrorPanel.js +2 -7
- package/lib/createAlfaApp.js +2 -4
- package/lib/createApplication.js +8 -10
- package/lib/version.js +1 -1
- package/package.json +1 -1
- package/types/createAlfaApp.d.ts +1 -1
- package/types/createApplication.d.ts +3 -4
- package/types/version.d.ts +1 -1
|
@@ -6,6 +6,7 @@ var containerStyle = {
|
|
|
6
6
|
padding: padding
|
|
7
7
|
};
|
|
8
8
|
var commonErrorStyle = {
|
|
9
|
+
display: 'none',
|
|
9
10
|
lineHeight: '22px',
|
|
10
11
|
color: '#d93026',
|
|
11
12
|
fontSize: 14
|
|
@@ -14,10 +15,6 @@ var commonErrorStyle = {
|
|
|
14
15
|
var ErrorPanel = function ErrorPanel(props) {
|
|
15
16
|
var error = props.error;
|
|
16
17
|
return /*#__PURE__*/React.createElement("div", {
|
|
17
|
-
style: {
|
|
18
|
-
padding: padding
|
|
19
|
-
}
|
|
20
|
-
}, process.env.NODE_ENV === 'development' ? /*#__PURE__*/React.createElement("div", {
|
|
21
18
|
style: containerStyle
|
|
22
19
|
}, /*#__PURE__*/React.createElement("div", {
|
|
23
20
|
style: commonErrorStyle
|
|
@@ -25,9 +22,7 @@ var ErrorPanel = function ErrorPanel(props) {
|
|
|
25
22
|
style: {
|
|
26
23
|
overflow: 'scroll'
|
|
27
24
|
}
|
|
28
|
-
}, error === null || error === void 0 ? void 0 : error.stack))
|
|
29
|
-
style: commonErrorStyle
|
|
30
|
-
}, "Error"));
|
|
25
|
+
}, error === null || error === void 0 ? void 0 : error.stack));
|
|
31
26
|
};
|
|
32
27
|
|
|
33
28
|
export default ErrorPanel;
|
package/es/createAlfaApp.js
CHANGED
|
@@ -34,13 +34,11 @@ function createAlfaApp(option) {
|
|
|
34
34
|
}, [props]);
|
|
35
35
|
return /*#__PURE__*/React.createElement(ErrorBoundary, props, /*#__PURE__*/React.createElement(Application // 兼容历史逻辑,优先使用 option 中的 sandbox 参数
|
|
36
36
|
, _extends({}, passedInOption, {
|
|
37
|
-
|
|
37
|
+
syncHistory: props.syncHistory,
|
|
38
38
|
basename: props.basename,
|
|
39
39
|
sandbox: option.sandbox || props.sandbox,
|
|
40
40
|
deps: dependencies || {},
|
|
41
|
-
customProps: customProps
|
|
42
|
-
,
|
|
43
|
-
path: props.puppeteer ? window.location.toString() : props.path
|
|
41
|
+
customProps: customProps
|
|
44
42
|
})));
|
|
45
43
|
};
|
|
46
44
|
}
|
package/es/createApplication.js
CHANGED
|
@@ -52,7 +52,7 @@ var stripBasename = function stripBasename(path, basename) {
|
|
|
52
52
|
|
|
53
53
|
|
|
54
54
|
export default function createApplication(loader) {
|
|
55
|
-
function Application(props) {
|
|
55
|
+
return function Application(props) {
|
|
56
56
|
var name = props.name,
|
|
57
57
|
version = props.version,
|
|
58
58
|
manifest = props.manifest,
|
|
@@ -75,7 +75,7 @@ export default function createApplication(loader) {
|
|
|
75
75
|
locale = props.locale,
|
|
76
76
|
dynamicConfig = props.dynamicConfig,
|
|
77
77
|
noCache = props.noCache,
|
|
78
|
-
|
|
78
|
+
syncHistory = props.syncHistory,
|
|
79
79
|
basename = props.basename;
|
|
80
80
|
|
|
81
81
|
var _useState = useState(null),
|
|
@@ -88,13 +88,13 @@ export default function createApplication(loader) {
|
|
|
88
88
|
setError = _useState4[1];
|
|
89
89
|
|
|
90
90
|
var appRef = useRef(undefined);
|
|
91
|
-
var $
|
|
91
|
+
var $syncHistory = useRef(syncHistory);
|
|
92
92
|
var $basename = useRef(basename);
|
|
93
93
|
var tagName = normalizeName(props.name);
|
|
94
|
-
$
|
|
94
|
+
$syncHistory.current = syncHistory;
|
|
95
95
|
$basename.current = basename; // 受控模式锁定一些参数
|
|
96
96
|
|
|
97
|
-
if ($
|
|
97
|
+
if ($syncHistory.current) {
|
|
98
98
|
// 禁止子应用和 consoleBase 通信
|
|
99
99
|
customProps.consoleBase = null; // 覆写 path 参数,用于通知子应用更新路由
|
|
100
100
|
|
|
@@ -249,7 +249,7 @@ export default function createApplication(loader) {
|
|
|
249
249
|
|
|
250
250
|
if (frameWindow) {
|
|
251
251
|
frameWindow.history.pushState = function (data, unused, _url) {
|
|
252
|
-
if ($
|
|
252
|
+
if ($syncHistory.current) {
|
|
253
253
|
var nextPath = addBasename((_url === null || _url === void 0 ? void 0 : _url.toString()) || '', $basename.current);
|
|
254
254
|
|
|
255
255
|
if ("".concat(nextPath) !== peelPath(window.location)) {
|
|
@@ -265,7 +265,7 @@ export default function createApplication(loader) {
|
|
|
265
265
|
frameWindow.history.replaceState = function (data, unused, _url) {
|
|
266
266
|
var nextPath = addBasename((_url === null || _url === void 0 ? void 0 : _url.toString()) || '', $basename.current);
|
|
267
267
|
|
|
268
|
-
if ($
|
|
268
|
+
if ($syncHistory.current) {
|
|
269
269
|
window.history.replaceState(data, unused, nextPath);
|
|
270
270
|
}
|
|
271
271
|
|
|
@@ -345,7 +345,5 @@ export default function createApplication(loader) {
|
|
|
345
345
|
style: style,
|
|
346
346
|
className: className
|
|
347
347
|
})));
|
|
348
|
-
}
|
|
349
|
-
|
|
350
|
-
return /*#__PURE__*/React.memo(Application);
|
|
348
|
+
};
|
|
351
349
|
}
|
package/es/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export var version = '1.4.30-alpha.
|
|
1
|
+
export var version = '1.4.30-alpha.8';
|
|
@@ -16,6 +16,7 @@ var containerStyle = {
|
|
|
16
16
|
padding: padding
|
|
17
17
|
};
|
|
18
18
|
var commonErrorStyle = {
|
|
19
|
+
display: 'none',
|
|
19
20
|
lineHeight: '22px',
|
|
20
21
|
color: '#d93026',
|
|
21
22
|
fontSize: 14
|
|
@@ -24,10 +25,6 @@ var commonErrorStyle = {
|
|
|
24
25
|
var ErrorPanel = function ErrorPanel(props) {
|
|
25
26
|
var error = props.error;
|
|
26
27
|
return /*#__PURE__*/_react.default.createElement("div", {
|
|
27
|
-
style: {
|
|
28
|
-
padding: padding
|
|
29
|
-
}
|
|
30
|
-
}, process.env.NODE_ENV === 'development' ? /*#__PURE__*/_react.default.createElement("div", {
|
|
31
28
|
style: containerStyle
|
|
32
29
|
}, /*#__PURE__*/_react.default.createElement("div", {
|
|
33
30
|
style: commonErrorStyle
|
|
@@ -35,9 +32,7 @@ var ErrorPanel = function ErrorPanel(props) {
|
|
|
35
32
|
style: {
|
|
36
33
|
overflow: 'scroll'
|
|
37
34
|
}
|
|
38
|
-
}, error === null || error === void 0 ? void 0 : error.stack))
|
|
39
|
-
style: commonErrorStyle
|
|
40
|
-
}, "Error"));
|
|
35
|
+
}, error === null || error === void 0 ? void 0 : error.stack));
|
|
41
36
|
};
|
|
42
37
|
|
|
43
38
|
var _default = ErrorPanel;
|
package/lib/createAlfaApp.js
CHANGED
|
@@ -57,13 +57,11 @@ function createAlfaApp(option) {
|
|
|
57
57
|
}, [props]);
|
|
58
58
|
return /*#__PURE__*/_react.default.createElement(_ErrorBoundary.default, props, /*#__PURE__*/_react.default.createElement(Application // 兼容历史逻辑,优先使用 option 中的 sandbox 参数
|
|
59
59
|
, (0, _extends2.default)({}, passedInOption, {
|
|
60
|
-
|
|
60
|
+
syncHistory: props.syncHistory,
|
|
61
61
|
basename: props.basename,
|
|
62
62
|
sandbox: option.sandbox || props.sandbox,
|
|
63
63
|
deps: dependencies || {},
|
|
64
|
-
customProps: customProps
|
|
65
|
-
,
|
|
66
|
-
path: props.puppeteer ? window.location.toString() : props.path
|
|
64
|
+
customProps: customProps
|
|
67
65
|
})));
|
|
68
66
|
};
|
|
69
67
|
}
|
package/lib/createApplication.js
CHANGED
|
@@ -74,7 +74,7 @@ var stripBasename = function stripBasename(path, basename) {
|
|
|
74
74
|
|
|
75
75
|
|
|
76
76
|
function createApplication(loader) {
|
|
77
|
-
function Application(props) {
|
|
77
|
+
return function Application(props) {
|
|
78
78
|
var name = props.name,
|
|
79
79
|
version = props.version,
|
|
80
80
|
manifest = props.manifest,
|
|
@@ -97,7 +97,7 @@ function createApplication(loader) {
|
|
|
97
97
|
locale = props.locale,
|
|
98
98
|
dynamicConfig = props.dynamicConfig,
|
|
99
99
|
noCache = props.noCache,
|
|
100
|
-
|
|
100
|
+
syncHistory = props.syncHistory,
|
|
101
101
|
basename = props.basename;
|
|
102
102
|
|
|
103
103
|
var _useState = (0, _react.useState)(null),
|
|
@@ -110,13 +110,13 @@ function createApplication(loader) {
|
|
|
110
110
|
setError = _useState4[1];
|
|
111
111
|
|
|
112
112
|
var appRef = (0, _react.useRef)(undefined);
|
|
113
|
-
var $
|
|
113
|
+
var $syncHistory = (0, _react.useRef)(syncHistory);
|
|
114
114
|
var $basename = (0, _react.useRef)(basename);
|
|
115
115
|
var tagName = (0, _utils.normalizeName)(props.name);
|
|
116
|
-
$
|
|
116
|
+
$syncHistory.current = syncHistory;
|
|
117
117
|
$basename.current = basename; // 受控模式锁定一些参数
|
|
118
118
|
|
|
119
|
-
if ($
|
|
119
|
+
if ($syncHistory.current) {
|
|
120
120
|
// 禁止子应用和 consoleBase 通信
|
|
121
121
|
customProps.consoleBase = null; // 覆写 path 参数,用于通知子应用更新路由
|
|
122
122
|
|
|
@@ -270,7 +270,7 @@ function createApplication(loader) {
|
|
|
270
270
|
|
|
271
271
|
if (frameWindow) {
|
|
272
272
|
frameWindow.history.pushState = function (data, unused, _url) {
|
|
273
|
-
if ($
|
|
273
|
+
if ($syncHistory.current) {
|
|
274
274
|
var nextPath = addBasename((_url === null || _url === void 0 ? void 0 : _url.toString()) || '', $basename.current);
|
|
275
275
|
|
|
276
276
|
if ("".concat(nextPath) !== peelPath(window.location)) {
|
|
@@ -286,7 +286,7 @@ function createApplication(loader) {
|
|
|
286
286
|
frameWindow.history.replaceState = function (data, unused, _url) {
|
|
287
287
|
var nextPath = addBasename((_url === null || _url === void 0 ? void 0 : _url.toString()) || '', $basename.current);
|
|
288
288
|
|
|
289
|
-
if ($
|
|
289
|
+
if ($syncHistory.current) {
|
|
290
290
|
window.history.replaceState(data, unused, nextPath);
|
|
291
291
|
}
|
|
292
292
|
|
|
@@ -365,7 +365,5 @@ function createApplication(loader) {
|
|
|
365
365
|
style: style,
|
|
366
366
|
className: className
|
|
367
367
|
})));
|
|
368
|
-
}
|
|
369
|
-
|
|
370
|
-
return /*#__PURE__*/_react.default.memo(Application);
|
|
368
|
+
};
|
|
371
369
|
}
|
package/lib/version.js
CHANGED
package/package.json
CHANGED
package/types/createAlfaApp.d.ts
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
2
|
import { BaseLoader } from '@alicloud/alfa-core';
|
|
3
3
|
import { AlfaFactoryOption } from './types';
|
|
4
4
|
interface IProps<C = any> extends AlfaFactoryOption {
|
|
5
5
|
customProps: C;
|
|
6
|
-
|
|
6
|
+
syncHistory?: boolean;
|
|
7
7
|
basename?: string;
|
|
8
|
-
path?: string;
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
11
10
|
* container for microApp mount
|
|
12
11
|
* @param loader alfa-core loader
|
|
13
12
|
* @returns
|
|
14
13
|
*/
|
|
15
|
-
export default function createApplication(loader: BaseLoader):
|
|
14
|
+
export default function createApplication(loader: BaseLoader): <C = any>(props: IProps<C>) => JSX.Element;
|
|
16
15
|
export {};
|
package/types/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const version = "1.4.30-alpha.
|
|
1
|
+
export declare const version = "1.4.30-alpha.8";
|