@cloud-app-dev/vidc 2.0.0-alpha.14 → 2.0.0-alpha.15
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/es/AppRoute/index.d.ts +1 -2
- package/es/AppRoute/index.js +22 -17
- package/es/LoaderApp/index.js +0 -1
- package/package.json +1 -1
package/es/AppRoute/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IAppRouteProps } from './interface';
|
|
3
|
-
declare class AppRoute extends React.
|
|
3
|
+
declare class AppRoute extends React.Component<IAppRouteProps, any> {
|
|
4
4
|
static defaultProps: IAppRouteProps;
|
|
5
|
-
private isRender;
|
|
6
5
|
constructor(props: IAppRouteProps);
|
|
7
6
|
shouldComponentUpdate(props: IAppRouteProps): boolean;
|
|
8
7
|
componentWillUnmount(): void;
|
package/es/AppRoute/index.js
CHANGED
|
@@ -23,6 +23,7 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Re
|
|
|
23
23
|
|
|
24
24
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
25
25
|
|
|
26
|
+
import { __rest } from "tslib";
|
|
26
27
|
import React from 'react';
|
|
27
28
|
import { Route, Routes } from 'react-router-dom';
|
|
28
29
|
var _global = window;
|
|
@@ -37,8 +38,8 @@ function RenderSingleRoute(_ref) {
|
|
|
37
38
|
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
38
39
|
}
|
|
39
40
|
|
|
40
|
-
var AppRoute = /*#__PURE__*/function (_React$
|
|
41
|
-
_inherits(AppRoute, _React$
|
|
41
|
+
var AppRoute = /*#__PURE__*/function (_React$Component) {
|
|
42
|
+
_inherits(AppRoute, _React$Component);
|
|
42
43
|
|
|
43
44
|
var _super = _createSuper(AppRoute);
|
|
44
45
|
|
|
@@ -47,11 +48,9 @@ var AppRoute = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
47
48
|
|
|
48
49
|
_classCallCheck(this, AppRoute);
|
|
49
50
|
|
|
50
|
-
_this = _super.call(this, props);
|
|
51
|
-
|
|
52
|
-
_this.isRender = false;
|
|
51
|
+
_this = _super.call(this, props);
|
|
53
52
|
_this.state = {
|
|
54
|
-
|
|
53
|
+
matchIndex: -1
|
|
55
54
|
};
|
|
56
55
|
return _this;
|
|
57
56
|
}
|
|
@@ -59,11 +58,14 @@ var AppRoute = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
59
58
|
_createClass(AppRoute, [{
|
|
60
59
|
key: "shouldComponentUpdate",
|
|
61
60
|
value: function shouldComponentUpdate(props) {
|
|
62
|
-
|
|
63
|
-
|
|
61
|
+
var tabId = props.currentId || _cache.getCache('currentTabKey', 'session');
|
|
62
|
+
|
|
63
|
+
if (_global._IS_RUN_MICRO_BASIC && tabId !== props.tabId) {
|
|
64
|
+
// 页签变化拦截
|
|
65
|
+
return false;
|
|
64
66
|
}
|
|
65
67
|
|
|
66
|
-
return
|
|
68
|
+
return true;
|
|
67
69
|
}
|
|
68
70
|
}, {
|
|
69
71
|
key: "componentWillUnmount",
|
|
@@ -75,7 +77,14 @@ var AppRoute = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
75
77
|
value: function render() {
|
|
76
78
|
var _this2 = this;
|
|
77
79
|
|
|
78
|
-
var
|
|
80
|
+
var matchIndex = this.state.matchIndex;
|
|
81
|
+
|
|
82
|
+
var _a = this.props,
|
|
83
|
+
_a$routes = _a.routes,
|
|
84
|
+
routes = _a$routes === void 0 ? [] : _a$routes,
|
|
85
|
+
props = __rest(_a, ["routes"]);
|
|
86
|
+
|
|
87
|
+
var component = matchIndex > -1 ? routes[matchIndex].element : undefined;
|
|
79
88
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Routes, null, routes.map(function (item, index) {
|
|
80
89
|
return /*#__PURE__*/React.createElement(Route, {
|
|
81
90
|
path: item.path,
|
|
@@ -83,21 +92,17 @@ var AppRoute = /*#__PURE__*/function (_React$PureComponent) {
|
|
|
83
92
|
element: /*#__PURE__*/React.createElement(RenderSingleRoute, {
|
|
84
93
|
onMount: function onMount() {
|
|
85
94
|
return _this2.setState({
|
|
86
|
-
|
|
95
|
+
matchIndex: index
|
|
87
96
|
});
|
|
88
97
|
}
|
|
89
98
|
})
|
|
90
99
|
});
|
|
91
|
-
})),
|
|
92
|
-
onMount: function onMount() {
|
|
93
|
-
return _this2.isRender = true;
|
|
94
|
-
}
|
|
95
|
-
}));
|
|
100
|
+
})), component && /*#__PURE__*/React.cloneElement(component, props));
|
|
96
101
|
}
|
|
97
102
|
}]);
|
|
98
103
|
|
|
99
104
|
return AppRoute;
|
|
100
|
-
}(React.
|
|
105
|
+
}(React.Component);
|
|
101
106
|
|
|
102
107
|
AppRoute.defaultProps = {
|
|
103
108
|
routes: []
|
package/es/LoaderApp/index.js
CHANGED
|
@@ -108,7 +108,6 @@ function LoaderApp(_ref) {
|
|
|
108
108
|
var props = Object.assign(Object.assign({}, appProps), {
|
|
109
109
|
container: domRef.current
|
|
110
110
|
});
|
|
111
|
-
console.debug('执行更新!', appProps);
|
|
112
111
|
loadedAppRef.current.update && loadedAppRef.current.update(props);
|
|
113
112
|
}
|
|
114
113
|
}, [appProps.currentId, appProps.tabId, appProps.updateTime]);
|