@cloud-app-dev/vidc 2.0.0-alpha.31 → 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.
@@ -0,0 +1,4 @@
1
+ .ka-wrapper,
2
+ .ka-content {
3
+ height: inherit;
4
+ }
@@ -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;
@@ -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,21 +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
- if (_this.state.index !== -1) {
61
- return _this.setState({
62
- matchIndex: index
63
- });
64
- }
65
- };
66
-
67
43
  _this.state = {
68
44
  matchIndex: -1
69
45
  };
@@ -73,7 +49,7 @@ var AppRoute = /*#__PURE__*/function (_React$Component) {
73
49
  _createClass(AppRoute, [{
74
50
  key: "componentDidMount",
75
51
  value: function componentDidMount() {
76
- console.debug("App Routes\uFF1A".concat(JSON.stringify(this.props.routes)));
52
+ console.debug("App Routes\uFF1A", this.props.routes);
77
53
  }
78
54
  }, {
79
55
  key: "shouldComponentUpdate",
@@ -96,28 +72,18 @@ var AppRoute = /*#__PURE__*/function (_React$Component) {
96
72
  }, {
97
73
  key: "render",
98
74
  value: function render() {
99
- var _this2 = this;
100
-
101
- var matchIndex = this.state.matchIndex;
102
-
103
75
  var _a = this.props,
104
76
  _a$routes = _a.routes,
105
77
  routes = _a$routes === void 0 ? [] : _a$routes,
106
78
  props = __rest(_a, ["routes"]);
107
79
 
108
- var component = matchIndex > -1 ? routes[matchIndex].element : undefined;
109
- console.debug('Route Match Index', matchIndex);
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(RenderSingleRoute, {
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
- })), component && /*#__PURE__*/React.cloneElement(component, props));
86
+ })));
121
87
  }
122
88
  }]);
123
89
 
@@ -12,7 +12,6 @@ interface ILoaderAppProps {
12
12
  * @default {}
13
13
  */
14
14
  appProps: {
15
- updateTime?: number;
16
15
  [key: string]: any;
17
16
  };
18
17
  /**
@@ -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),
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.31",
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",