@cloud-app-dev/vidc 2.0.0-alpha.33 → 2.0.0-alpha.34
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.css +4 -0
- package/es/AppRoute/index.d.ts +1 -1
- package/es/AppRoute/index.js +5 -39
- package/package.json +4 -3
package/es/AppRoute/index.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { IAppRouteProps } from './interface';
|
|
3
|
+
import "./index.less";
|
|
3
4
|
declare class AppRoute extends React.Component<IAppRouteProps, any> {
|
|
4
5
|
static defaultProps: IAppRouteProps;
|
|
5
6
|
constructor(props: IAppRouteProps);
|
|
6
7
|
componentDidMount(): void;
|
|
7
8
|
shouldComponentUpdate(props: IAppRouteProps): boolean;
|
|
8
9
|
componentWillUnmount(): void;
|
|
9
|
-
updateMatchIndex: (index: number) => void;
|
|
10
10
|
render(): JSX.Element;
|
|
11
11
|
}
|
|
12
12
|
export default AppRoute;
|
package/es/AppRoute/index.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
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
|
import _cache from "@cloud-app-dev/utils/es/cache";
|
|
4
|
-
import _useMount from "ahooks/es/useMount";
|
|
5
4
|
|
|
6
5
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
7
6
|
|
|
@@ -26,18 +25,10 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
|
26
25
|
import { __rest } from "tslib";
|
|
27
26
|
import React from 'react';
|
|
28
27
|
import { Route, Routes } from 'react-router-dom';
|
|
28
|
+
import KeepAlive, { AliveScope } from 'react-activation';
|
|
29
|
+
import "./index.css";
|
|
29
30
|
var _global = window;
|
|
30
31
|
|
|
31
|
-
function RenderSingleRoute(_ref) {
|
|
32
|
-
var onMount = _ref.onMount;
|
|
33
|
-
|
|
34
|
-
_useMount(function () {
|
|
35
|
-
return onMount();
|
|
36
|
-
});
|
|
37
|
-
|
|
38
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
32
|
var AppRoute = /*#__PURE__*/function (_React$Component) {
|
|
42
33
|
_inherits(AppRoute, _React$Component);
|
|
43
34
|
|
|
@@ -49,22 +40,6 @@ var AppRoute = /*#__PURE__*/function (_React$Component) {
|
|
|
49
40
|
_classCallCheck(this, AppRoute);
|
|
50
41
|
|
|
51
42
|
_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
|
-
|
|
68
43
|
_this.state = {
|
|
69
44
|
matchIndex: -1
|
|
70
45
|
};
|
|
@@ -97,27 +72,18 @@ var AppRoute = /*#__PURE__*/function (_React$Component) {
|
|
|
97
72
|
}, {
|
|
98
73
|
key: "render",
|
|
99
74
|
value: function render() {
|
|
100
|
-
var _this2 = this;
|
|
101
|
-
|
|
102
|
-
var matchIndex = this.state.matchIndex;
|
|
103
|
-
|
|
104
75
|
var _a = this.props,
|
|
105
76
|
_a$routes = _a.routes,
|
|
106
77
|
routes = _a$routes === void 0 ? [] : _a$routes,
|
|
107
78
|
props = __rest(_a, ["routes"]);
|
|
108
79
|
|
|
109
|
-
|
|
110
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(Routes, null, routes.map(function (item, index) {
|
|
80
|
+
return /*#__PURE__*/React.createElement(AliveScope, null, /*#__PURE__*/React.createElement(Routes, null, routes.map(function (item) {
|
|
111
81
|
return /*#__PURE__*/React.createElement(Route, {
|
|
112
82
|
path: item.path,
|
|
113
83
|
key: item.path,
|
|
114
|
-
element: /*#__PURE__*/React.createElement(
|
|
115
|
-
onMount: function onMount() {
|
|
116
|
-
return _this2.updateMatchIndex(index);
|
|
117
|
-
}
|
|
118
|
-
})
|
|
84
|
+
element: /*#__PURE__*/React.createElement(KeepAlive, null, /*#__PURE__*/React.cloneElement(item.element, props))
|
|
119
85
|
});
|
|
120
|
-
}))
|
|
86
|
+
})));
|
|
121
87
|
}
|
|
122
88
|
}]);
|
|
123
89
|
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"private": false,
|
|
3
3
|
"name": "@cloud-app-dev/vidc",
|
|
4
4
|
"description": "Video Image Data Componennts",
|
|
5
|
-
"version": "2.0.0-alpha.
|
|
5
|
+
"version": "2.0.0-alpha.34",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"start": "dumi dev",
|
|
8
8
|
"docs:build": "dumi build",
|
|
@@ -36,14 +36,15 @@
|
|
|
36
36
|
"fetch-like-axios": "^0.0.5",
|
|
37
37
|
"immer": "^9.0.5",
|
|
38
38
|
"lodash": "^4.17.21",
|
|
39
|
-
"rc-queue-anim": "^2.0.0"
|
|
39
|
+
"rc-queue-anim": "^2.0.0",
|
|
40
|
+
"react-activation": "^0.9.12"
|
|
40
41
|
},
|
|
41
42
|
"devDependencies": {
|
|
42
43
|
"@cloud-app-dev/utils": "^3.0.3",
|
|
43
44
|
"@types/add-dom-event-listener": "^1.1.0",
|
|
44
45
|
"@types/chroma-js": "^2.1.3",
|
|
45
|
-
"@types/node": "^17.0.5",
|
|
46
46
|
"@types/lodash": "^4.14.178",
|
|
47
|
+
"@types/node": "^17.0.5",
|
|
47
48
|
"@umijs/test": "^3.0.5",
|
|
48
49
|
"antd": "^4.17.0",
|
|
49
50
|
"babel-plugin-import": "^1.13.3",
|