@cloud-app-dev/vidc 2.0.0-alpha.30 → 2.0.0-alpha.33
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 +2 -0
- package/es/AppRoute/index.js +22 -4
- package/es/LoaderApp/index.d.ts +0 -1
- package/es/LoaderApp/index.js +0 -14
- package/package.json +1 -1
package/es/AppRoute/index.d.ts
CHANGED
|
@@ -3,8 +3,10 @@ import { IAppRouteProps } from './interface';
|
|
|
3
3
|
declare class AppRoute extends React.Component<IAppRouteProps, any> {
|
|
4
4
|
static defaultProps: IAppRouteProps;
|
|
5
5
|
constructor(props: IAppRouteProps);
|
|
6
|
+
componentDidMount(): void;
|
|
6
7
|
shouldComponentUpdate(props: IAppRouteProps): boolean;
|
|
7
8
|
componentWillUnmount(): void;
|
|
9
|
+
updateMatchIndex: (index: number) => void;
|
|
8
10
|
render(): JSX.Element;
|
|
9
11
|
}
|
|
10
12
|
export default AppRoute;
|
package/es/AppRoute/index.js
CHANGED
|
@@ -49,6 +49,22 @@ var AppRoute = /*#__PURE__*/function (_React$Component) {
|
|
|
49
49
|
_classCallCheck(this, AppRoute);
|
|
50
50
|
|
|
51
51
|
_this = _super.call(this, props);
|
|
52
|
+
|
|
53
|
+
_this.updateMatchIndex = function (index) {
|
|
54
|
+
if (!_global._IS_RUN_MICRO_BASIC) {
|
|
55
|
+
return _this.setState({
|
|
56
|
+
matchIndex: index
|
|
57
|
+
});
|
|
58
|
+
} // 基座下不更新索引,路由切换由基座控制
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
if (_this.state.index !== -1) {
|
|
62
|
+
return _this.setState({
|
|
63
|
+
matchIndex: index
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
|
|
52
68
|
_this.state = {
|
|
53
69
|
matchIndex: -1
|
|
54
70
|
};
|
|
@@ -56,6 +72,11 @@ var AppRoute = /*#__PURE__*/function (_React$Component) {
|
|
|
56
72
|
}
|
|
57
73
|
|
|
58
74
|
_createClass(AppRoute, [{
|
|
75
|
+
key: "componentDidMount",
|
|
76
|
+
value: function componentDidMount() {
|
|
77
|
+
console.debug("App Routes\uFF1A", this.props.routes);
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
59
80
|
key: "shouldComponentUpdate",
|
|
60
81
|
value: function shouldComponentUpdate(props) {
|
|
61
82
|
var tabId = _cache.getCache('currentTabKey', 'session');
|
|
@@ -86,16 +107,13 @@ var AppRoute = /*#__PURE__*/function (_React$Component) {
|
|
|
86
107
|
props = __rest(_a, ["routes"]);
|
|
87
108
|
|
|
88
109
|
var component = matchIndex > -1 ? routes[matchIndex].element : undefined;
|
|
89
|
-
console.debug('Route Match Index', matchIndex);
|
|
90
110
|
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Routes, null, routes.map(function (item, index) {
|
|
91
111
|
return /*#__PURE__*/React.createElement(Route, {
|
|
92
112
|
path: item.path,
|
|
93
113
|
key: item.path,
|
|
94
114
|
element: /*#__PURE__*/React.createElement(RenderSingleRoute, {
|
|
95
115
|
onMount: function onMount() {
|
|
96
|
-
return _this2.
|
|
97
|
-
matchIndex: index
|
|
98
|
-
});
|
|
116
|
+
return _this2.updateMatchIndex(index);
|
|
99
117
|
}
|
|
100
118
|
})
|
|
101
119
|
});
|
package/es/LoaderApp/index.d.ts
CHANGED
package/es/LoaderApp/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import _useUpdateEffect from "ahooks/es/useUpdateEffect";
|
|
2
1
|
import _uuid from "@cloud-app-dev/utils/es/uuid";
|
|
3
2
|
|
|
4
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
@@ -110,19 +109,6 @@ function LoaderApp(_ref) {
|
|
|
110
109
|
}
|
|
111
110
|
};
|
|
112
111
|
}, []);
|
|
113
|
-
|
|
114
|
-
_useUpdateEffect(function () {
|
|
115
|
-
var currentId = appProps.currentId,
|
|
116
|
-
tabId = appProps.tabId;
|
|
117
|
-
|
|
118
|
-
if (currentId === tabId && loadedAppRef.current) {
|
|
119
|
-
var props = Object.assign(Object.assign({}, appProps), {
|
|
120
|
-
container: domRef.current
|
|
121
|
-
});
|
|
122
|
-
loadedAppRef.current.update && loadedAppRef.current.update(props);
|
|
123
|
-
}
|
|
124
|
-
}, [appProps.currentId, appProps.tabId, appProps.updateTime]);
|
|
125
|
-
|
|
126
112
|
return /*#__PURE__*/React.createElement("main", {
|
|
127
113
|
ref: domRef,
|
|
128
114
|
className: "loaded-app-layout ".concat(appConfig.routerPrefix, "-").concat(id),
|