@common-stack/client-react 0.5.29 → 0.5.31
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/lib/__tests__/fill-register-test.js +6 -31
- package/lib/__tests__/fill-register-test.js.map +1 -1
- package/lib/__tests__/helpers/sample-menu.js +1 -4
- package/lib/__tests__/helpers/sample-menu.js.map +1 -1
- package/lib/__tests__/integrated-routes.test.js +14 -42
- package/lib/__tests__/integrated-routes.test.js.map +1 -1
- package/lib/__tests__/router-render.test.js +13 -57
- package/lib/__tests__/router-render.test.js.map +1 -1
- package/lib/connector/base-connector.js +24 -48
- package/lib/connector/base-connector.js.map +1 -1
- package/lib/connector/connector.d.ts +3 -2
- package/lib/connector/connector.js +9 -13
- package/lib/connector/connector.js.map +1 -1
- package/lib/connector/connector.native.js +10 -17
- package/lib/connector/connector.native.js.map +1 -1
- package/lib/connector/connector.test.js +5 -30
- package/lib/connector/connector.test.js.map +1 -1
- package/lib/connector/index.js +1 -17
- package/lib/connector/index.js.map +1 -1
- package/lib/index.js +10 -28
- package/lib/index.js.map +1 -1
- package/lib/index.native.js +10 -28
- package/lib/index.native.js.map +1 -1
- package/lib/interfaces/extended-feature.js +1 -2
- package/lib/interfaces/feature.js +1 -2
- package/lib/interfaces/index.js +5 -21
- package/lib/interfaces/index.js.map +1 -1
- package/lib/interfaces/menu.js +2 -5
- package/lib/interfaces/menu.js.map +1 -1
- package/lib/interfaces/new-router.d.ts +9 -3
- package/lib/interfaces/new-router.js +1 -2
- package/lib/interfaces/router.js +1 -2
- package/lib/inversify/InversifyContext.js +6 -34
- package/lib/inversify/InversifyContext.js.map +1 -1
- package/lib/inversify/index.js +1 -17
- package/lib/inversify/index.js.map +1 -1
- package/lib/plugin-area/__tests__/higher-order-component-util.test.js +12 -37
- package/lib/plugin-area/__tests__/higher-order-component-util.test.js.map +1 -1
- package/lib/plugin-area/__tests__/plugin-api.test.js +11 -13
- package/lib/plugin-area/__tests__/plugin-api.test.js.map +1 -1
- package/lib/plugin-area/base-plugin-area.js +12 -39
- package/lib/plugin-area/base-plugin-area.js.map +1 -1
- package/lib/plugin-area/higher-order-component-util.js +3 -7
- package/lib/plugin-area/higher-order-component-util.js.map +1 -1
- package/lib/plugin-area/index.js +5 -35
- package/lib/plugin-area/index.js.map +1 -1
- package/lib/plugin-area/index.native.js +7 -37
- package/lib/plugin-area/index.native.js.map +1 -1
- package/lib/plugin-area/plugin-api.js +15 -18
- package/lib/plugin-area/plugin-api.js.map +1 -1
- package/lib/plugin-area/plugin-context.js +5 -32
- package/lib/plugin-area/plugin-context.js.map +1 -1
- package/lib/route/__tests__/admin-new-routes.test.js +11 -45
- package/lib/route/__tests__/admin-new-routes.test.js.map +1 -1
- package/lib/route/__tests__/getFlatMenus.test.js +4 -6
- package/lib/route/__tests__/getFlatMenus.test.js.map +1 -1
- package/lib/route/__tests__/render-routes-config.test.js +6 -18
- package/lib/route/__tests__/render-routes-config.test.js.map +1 -1
- package/lib/route/__tests__/route-type.test.js +1 -2
- package/lib/route/__tests__/route-type.test.js.map +1 -1
- package/lib/route/get-routes.js +24 -31
- package/lib/route/get-routes.js.map +1 -1
- package/lib/route/get-routes.test.js +8 -19
- package/lib/route/get-routes.test.js.map +1 -1
- package/lib/route/index.js +2 -18
- package/lib/route/index.js.map +1 -1
- package/lib/route/index.native.d.ts +1 -1
- package/lib/route/index.native.js +1 -17
- package/lib/route/index.native.js.map +1 -1
- package/lib/route/old/__tests__/config-sidebar-menu.test.js +17 -15
- package/lib/route/old/__tests__/config-sidebar-menu.test.js.map +1 -1
- package/lib/route/old/get-menus.js +14 -21
- package/lib/route/old/get-menus.js.map +1 -1
- package/lib/route/old/get-routes-notused.js +15 -13
- package/lib/route/old/get-routes-notused.js.map +1 -1
- package/lib/route/old/render.d.ts +1 -1
- package/lib/route/old/render.js +7 -31
- package/lib/route/old/render.js.map +1 -1
- package/lib/route/react-navigation/get-navigation-utils.d.ts +8 -0
- package/lib/route/react-navigation/get-navigation-utils.js +35 -40
- package/lib/route/react-navigation/get-navigation-utils.js.map +1 -1
- package/lib/route/react-navigation/get-navigation-utils.test.js +15 -17
- package/lib/route/react-navigation/get-navigation-utils.test.js.map +1 -1
- package/lib/route/react-navigation/index.js +2 -18
- package/lib/route/react-navigation/index.js.map +1 -1
- package/lib/route/react-navigation/react-native.sample.test.js +8 -22
- package/lib/route/react-navigation/react-native.sample.test.js.map +1 -1
- package/lib/route/react-navigation/react-native.sample1.test.js +14 -48
- package/lib/route/react-navigation/react-native.sample1.test.js.map +1 -1
- package/lib/route/react-navigation/react-navigation-render.js +16 -31
- package/lib/route/react-navigation/react-navigation-render.js.map +1 -1
- package/lib/route/react-navigation/react-navigation-render.test.js +23 -37
- package/lib/route/react-navigation/react-navigation-render.test.js.map +1 -1
- package/lib/route/react-navigation/root-navigation.js +5 -9
- package/lib/route/react-navigation/root-navigation.js.map +1 -1
- package/lib/route/react-navigation/routes.js +1 -2
- package/lib/route/react-navigation/types.js +1 -5
- package/lib/route/react-navigation/types.js.map +1 -1
- package/lib/route/render-routes-native.d.ts +3 -0
- package/lib/route/render-routes-native.js +126 -0
- package/lib/route/render-routes-native.js.map +1 -0
- package/lib/route/render-routes.d.ts +1 -2
- package/lib/route/render-routes.js +132 -74
- package/lib/route/render-routes.js.map +1 -1
- package/lib/route/render-routes.test.js +317 -127
- package/lib/route/render-routes.test.js.map +1 -1
- package/lib/route/root-navigation.js +3 -7
- package/lib/route/root-navigation.js.map +1 -1
- package/lib/route/test-routes.d.ts +411 -0
- package/lib/route/test-routes.js +578 -0
- package/lib/route/test-routes.js.map +1 -0
- package/lib/route-based-plugin-area/__tests__/higher-order-component-util.test.js +12 -37
- package/lib/route-based-plugin-area/__tests__/higher-order-component-util.test.js.map +1 -1
- package/lib/route-based-plugin-area/__tests__/plugin-api.test.js +11 -13
- package/lib/route-based-plugin-area/__tests__/plugin-api.test.js.map +1 -1
- package/lib/route-based-plugin-area/higher-order-component-util.js +3 -7
- package/lib/route-based-plugin-area/higher-order-component-util.js.map +1 -1
- package/lib/route-based-plugin-area/index.js +2 -18
- package/lib/route-based-plugin-area/index.js.map +1 -1
- package/lib/route-based-plugin-area/plugin-api.js +15 -18
- package/lib/route-based-plugin-area/plugin-api.js.map +1 -1
- package/lib/route-based-plugin-area/plugin-context.js +5 -32
- package/lib/route-based-plugin-area/plugin-context.js.map +1 -1
- package/lib/route-based-plugin-area/route-based-plugin-area.js +12 -39
- package/lib/route-based-plugin-area/route-based-plugin-area.js.map +1 -1
- package/lib/router-factory/index.js +5 -31
- package/lib/router-factory/index.js.map +1 -1
- package/lib/router-factory/index.native.js +5 -31
- package/lib/router-factory/index.native.js.map +1 -1
- package/lib/utils/before-ssr.js +6 -19
- package/lib/utils/before-ssr.js.map +1 -1
- package/lib/utils/combine.js +2 -6
- package/lib/utils/combine.js.map +1 -1
- package/lib/utils/hydrate.js +3 -7
- package/lib/utils/hydrate.js.map +1 -1
- package/lib/utils/index.js +5 -21
- package/lib/utils/index.js.map +1 -1
- package/lib/utils/sort-keys.d.ts +1 -0
- package/lib/utils/sort-keys.js +14 -10
- package/lib/utils/sort-keys.js.map +1 -1
- package/lib/utils/sort-keys.test.js +33 -7
- package/lib/utils/sort-keys.test.js.map +1 -1
- package/lib/utils/utils.js +1 -5
- package/lib/utils/utils.js.map +1 -1
- package/package.json +5 -4
- package/lib/route/render-routes.native.d.ts +0 -4
- package/lib/route/render-routes.native.js +0 -162
- package/lib/route/render-routes.native.js.map +0 -1
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { Route, Routes, Navigate } from 'react-router-native';
|
|
4
|
+
function wrapInitialPropsFetch(route, opts) {
|
|
5
|
+
const { component, ...restRouteParams } = route;
|
|
6
|
+
let Component = route.component;
|
|
7
|
+
function ComponentWithInitialPropsFetch(props) {
|
|
8
|
+
const [initialProps, setInitialProps] = useState(() => window.g_initialProps);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
/**
|
|
11
|
+
* 1. 首次渲染时,此时 window.g_initialProps 变量存在,不需要再走一次 getInitialProps,这样一次 SSR 就走了 2 次 getInitialProps
|
|
12
|
+
* 2. 但是路由切换时,window.getInitialProps 会被赋为 null,这时候就走 getInitialProps 逻辑
|
|
13
|
+
* 3. 如果任何时候都走 2 次,配置 forceInitial: true,这个场景用于静态站点的首屏加载希望走最新数据
|
|
14
|
+
* 4. 开启动态加载后,会在执行 getInitialProps 前预加载下
|
|
15
|
+
*/
|
|
16
|
+
const handleGetInitialProps = async () => {
|
|
17
|
+
// preload when enalbe dynamicImport
|
|
18
|
+
if (Component.preload) {
|
|
19
|
+
const preloadComponent = await Component.preload();
|
|
20
|
+
// for test case, really use .default
|
|
21
|
+
Component = preloadComponent.default || preloadComponent;
|
|
22
|
+
}
|
|
23
|
+
// @sri not suppported
|
|
24
|
+
// const defaultCtx = {
|
|
25
|
+
// isServer: false,
|
|
26
|
+
// match: props?.match,
|
|
27
|
+
// route,
|
|
28
|
+
// ...(opts.getInitialPropsCtx || {}),
|
|
29
|
+
// ...restRouteParams,
|
|
30
|
+
// };
|
|
31
|
+
// @sri not suppported
|
|
32
|
+
// if (Component?.getInitialProps) {
|
|
33
|
+
// const ctx = await opts.plugin.applyPlugins({
|
|
34
|
+
// key: 'ssr.modifyGetInitialPropsCtx',
|
|
35
|
+
// type: ApplyPluginsType.modify,
|
|
36
|
+
// initialValue: defaultCtx,
|
|
37
|
+
// async: true,
|
|
38
|
+
// });
|
|
39
|
+
// const initialProps = await Component!.getInitialProps!(
|
|
40
|
+
// ctx || defaultCtx,
|
|
41
|
+
// );
|
|
42
|
+
// setInitialProps(initialProps);
|
|
43
|
+
// }
|
|
44
|
+
};
|
|
45
|
+
// null 时,一定会触发 getInitialProps 执行
|
|
46
|
+
if (!window.g_initialProps) {
|
|
47
|
+
handleGetInitialProps();
|
|
48
|
+
}
|
|
49
|
+
}, [window.location.pathname, window.location.search]);
|
|
50
|
+
return React.createElement(Component, { ...props, ...initialProps });
|
|
51
|
+
}
|
|
52
|
+
// flag for having wrappered
|
|
53
|
+
ComponentWithInitialPropsFetch.wrapInitialPropsLoaded = true;
|
|
54
|
+
ComponentWithInitialPropsFetch.displayName = 'ComponentWithInitialPropsFetch';
|
|
55
|
+
return ComponentWithInitialPropsFetch;
|
|
56
|
+
}
|
|
57
|
+
function render({ route, opts, props }) {
|
|
58
|
+
const routes = renderRoutes({
|
|
59
|
+
...opts,
|
|
60
|
+
routes: route.routes || [],
|
|
61
|
+
rootRoutes: opts.rootRoutes,
|
|
62
|
+
});
|
|
63
|
+
const { component: Component, wrappers } = route;
|
|
64
|
+
if (Component) {
|
|
65
|
+
const defaultPageInitialProps = opts.isServer ? {} : window.g_initialProps;
|
|
66
|
+
const newProps = {
|
|
67
|
+
...props,
|
|
68
|
+
...opts.extraProps,
|
|
69
|
+
...(opts.pageInitialProps || defaultPageInitialProps),
|
|
70
|
+
route,
|
|
71
|
+
routes: opts.rootRoutes,
|
|
72
|
+
};
|
|
73
|
+
let element = React.createElement(Component, { ...newProps }, routes);
|
|
74
|
+
if (wrappers) {
|
|
75
|
+
element = wrappers.reduceRight((acc, Wrapper) => {
|
|
76
|
+
return React.createElement(Wrapper, { ...newProps }, acc);
|
|
77
|
+
}, element);
|
|
78
|
+
}
|
|
79
|
+
return element;
|
|
80
|
+
}
|
|
81
|
+
return routes;
|
|
82
|
+
}
|
|
83
|
+
function getRouteElement({ route, index, opts }) {
|
|
84
|
+
const routeProps = {
|
|
85
|
+
key: route.key || index,
|
|
86
|
+
exact: route.exact,
|
|
87
|
+
strict: route.strict,
|
|
88
|
+
sensitive: route.sensitive,
|
|
89
|
+
path: route.path,
|
|
90
|
+
};
|
|
91
|
+
if (route.redirect) {
|
|
92
|
+
return React.createElement(Route, { key: route.key || index, path: route.path, element: React.createElement(Navigate, { to: route.redirect, replace: true }) });
|
|
93
|
+
}
|
|
94
|
+
// avoid mount and unmount with url hash change
|
|
95
|
+
// @sri not supproted yet
|
|
96
|
+
// if (
|
|
97
|
+
// // only when SSR config enable
|
|
98
|
+
// opts.ssrProps &&
|
|
99
|
+
// !opts.isServer &&
|
|
100
|
+
// // make sure loaded once
|
|
101
|
+
// !(route.component as any)?.wrapInitialPropsLoaded &&
|
|
102
|
+
// (route.component?.getInitialProps || route.component?.preload)
|
|
103
|
+
// ) {
|
|
104
|
+
// // client Render for enable ssr, but not sure SSR success
|
|
105
|
+
// route.component = wrapInitialPropsFetch(route, opts);
|
|
106
|
+
// }
|
|
107
|
+
return (React.createElement(Route, { key: route.key || index, path: route.path, element: React.createElement(RouteElementWrapper, { route: route, render: render, opts: opts }) }));
|
|
108
|
+
}
|
|
109
|
+
function RouteElementWrapper({ route, render, opts }) {
|
|
110
|
+
const element = render({ route, opts, props: {} });
|
|
111
|
+
return React.createElement(React.Fragment, null, element);
|
|
112
|
+
}
|
|
113
|
+
function renderRoutes(opts) {
|
|
114
|
+
return opts.routes ? (React.createElement(Routes, null, opts.routes.map((route, index) => {
|
|
115
|
+
return getRouteElement({
|
|
116
|
+
route,
|
|
117
|
+
index,
|
|
118
|
+
opts: {
|
|
119
|
+
...opts,
|
|
120
|
+
rootRoutes: opts.rootRoutes || opts.routes,
|
|
121
|
+
},
|
|
122
|
+
});
|
|
123
|
+
}))) : null;
|
|
124
|
+
}
|
|
125
|
+
export { renderRoutes };
|
|
126
|
+
//# sourceMappingURL=render-routes-native.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-routes-native.js","sourceRoot":"","sources":["../../src/route/render-routes-native.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAiB,MAAM,OAAO,CAAC;AAG3D,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE9D,SAAS,qBAAqB,CAAC,KAAa,EAAE,IAAyB;IACr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ACL,IAAI,EAAE;gBACJ,GAAG,IAAI;gBACP,UAAU,EAAE,IAAI,CAAC,UAAU,IAAI,IAAI,CAAC,MAAM;aAC3C;SACF,CAAC,CAAC;IACL,CAAC,CAAC,CACK,CACV,CAAC,CAAC,CAAC,IAAI,CAAC;AACX,CAAC;AAED,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
1
|
import { IRouterRederOptions } from '../interfaces/new-router';
|
|
3
|
-
declare function renderRoutes(
|
|
2
|
+
declare function renderRoutes(options: IRouterRederOptions): any;
|
|
4
3
|
export { renderRoutes as renderRoutes2 };
|
|
@@ -1,68 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
26
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
27
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
28
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
29
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
30
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
31
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
32
|
-
});
|
|
33
|
-
};
|
|
34
|
-
var __rest = (this && this.__rest) || function (s, e) {
|
|
35
|
-
var t = {};
|
|
36
|
-
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
37
|
-
t[p] = s[p];
|
|
38
|
-
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
39
|
-
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
40
|
-
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
41
|
-
t[p[i]] = s[p[i]];
|
|
42
|
-
}
|
|
43
|
-
return t;
|
|
44
|
-
};
|
|
45
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
46
|
-
exports.renderRoutes2 = void 0;
|
|
47
|
-
const React = __importStar(require("react"));
|
|
48
|
-
const react_1 = require("react");
|
|
49
|
-
const react_router_1 = require("react-router");
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useEffect, useState, createElement, cloneElement } from 'react';
|
|
3
|
+
// import { Plugin, ApplyPluginsType } from '@umijs/runtime';
|
|
4
|
+
import { Routes, Route, Navigate, useLocation } from 'react-router-dom';
|
|
5
|
+
import { sortByPaths } from '../utils';
|
|
50
6
|
function wrapInitialPropsFetch(route, opts) {
|
|
51
|
-
const { component
|
|
7
|
+
const { component, ...restRouteParams } = route;
|
|
52
8
|
let Component = route.component;
|
|
53
9
|
function ComponentWithInitialPropsFetch(props) {
|
|
54
|
-
const [initialProps, setInitialProps] =
|
|
55
|
-
|
|
10
|
+
const [initialProps, setInitialProps] = useState(() => window.g_initialProps);
|
|
11
|
+
useEffect(() => {
|
|
56
12
|
/**
|
|
57
13
|
* 1. 首次渲染时,此时 window.g_initialProps 变量存在,不需要再走一次 getInitialProps,这样一次 SSR 就走了 2 次 getInitialProps
|
|
58
14
|
* 2. 但是路由切换时,window.getInitialProps 会被赋为 null,这时候就走 getInitialProps 逻辑
|
|
59
15
|
* 3. 如果任何时候都走 2 次,配置 forceInitial: true,这个场景用于静态站点的首屏加载希望走最新数据
|
|
60
16
|
* 4. 开启动态加载后,会在执行 getInitialProps 前预加载下
|
|
61
17
|
*/
|
|
62
|
-
const handleGetInitialProps = () =>
|
|
18
|
+
const handleGetInitialProps = async () => {
|
|
63
19
|
// preload when enalbe dynamicImport
|
|
64
20
|
if (Component.preload) {
|
|
65
|
-
const preloadComponent =
|
|
21
|
+
const preloadComponent = await Component.preload();
|
|
66
22
|
// for test case, really use .default
|
|
67
23
|
Component = preloadComponent.default || preloadComponent;
|
|
68
24
|
}
|
|
@@ -87,13 +43,13 @@ function wrapInitialPropsFetch(route, opts) {
|
|
|
87
43
|
// );
|
|
88
44
|
// setInitialProps(initialProps);
|
|
89
45
|
// }
|
|
90
|
-
}
|
|
46
|
+
};
|
|
91
47
|
// null 时,一定会触发 getInitialProps 执行
|
|
92
48
|
if (!window.g_initialProps) {
|
|
93
49
|
handleGetInitialProps();
|
|
94
50
|
}
|
|
95
51
|
}, [window.location.pathname, window.location.search]);
|
|
96
|
-
return React.createElement(Component,
|
|
52
|
+
return React.createElement(Component, { ...props, ...initialProps });
|
|
97
53
|
}
|
|
98
54
|
// flag for having wrappered
|
|
99
55
|
ComponentWithInitialPropsFetch.wrapInitialPropsLoaded = true;
|
|
@@ -101,20 +57,30 @@ function wrapInitialPropsFetch(route, opts) {
|
|
|
101
57
|
return ComponentWithInitialPropsFetch;
|
|
102
58
|
}
|
|
103
59
|
function render({ route, opts, props, }) {
|
|
104
|
-
const routes = renderRoutes(
|
|
105
|
-
|
|
60
|
+
const routes = renderRoutes({
|
|
61
|
+
...opts,
|
|
62
|
+
routes: route.routes || [],
|
|
63
|
+
rootRoutes: opts.rootRoutes,
|
|
64
|
+
});
|
|
65
|
+
const { component: Component, wrappers } = route;
|
|
106
66
|
if (Component) {
|
|
107
67
|
const defaultPageInitialProps = opts.isServer
|
|
108
68
|
? {}
|
|
109
69
|
: window.g_initialProps;
|
|
110
|
-
const newProps =
|
|
70
|
+
const newProps = {
|
|
71
|
+
...props,
|
|
72
|
+
...opts.extraProps,
|
|
73
|
+
...(opts.pageInitialProps || defaultPageInitialProps),
|
|
74
|
+
route,
|
|
75
|
+
routes: opts.rootRoutes,
|
|
76
|
+
};
|
|
111
77
|
// @ts-ignore
|
|
112
|
-
let ret = React.createElement(Component,
|
|
78
|
+
let ret = React.createElement(Component, { ...newProps }, routes);
|
|
113
79
|
// route.wrappers
|
|
114
80
|
if (wrappers) {
|
|
115
81
|
let len = wrappers.length - 1;
|
|
116
82
|
while (len >= 0) {
|
|
117
|
-
ret =
|
|
83
|
+
ret = createElement(wrappers[len], newProps, ret);
|
|
118
84
|
len -= 1;
|
|
119
85
|
}
|
|
120
86
|
}
|
|
@@ -133,7 +99,7 @@ function getRouteElement({ route, index, opts }) {
|
|
|
133
99
|
path: route.path,
|
|
134
100
|
};
|
|
135
101
|
if (route.redirect) {
|
|
136
|
-
return React.createElement(
|
|
102
|
+
return React.createElement(Route, { key: route.key || index, path: route.path, element: React.createElement(Navigate, { to: route.redirect, replace: true }) });
|
|
137
103
|
}
|
|
138
104
|
else {
|
|
139
105
|
// avoid mount and unmount with url hash change
|
|
@@ -149,20 +115,112 @@ function getRouteElement({ route, index, opts }) {
|
|
|
149
115
|
// // client Render for enable ssr, but not sure SSR success
|
|
150
116
|
// route.component = wrapInitialPropsFetch(route, opts);
|
|
151
117
|
// }
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
118
|
+
const routeProps = {
|
|
119
|
+
key: route.key || index,
|
|
120
|
+
path: route.path,
|
|
121
|
+
caseSensitive: route.sensitive,
|
|
122
|
+
};
|
|
123
|
+
const renderComponent = (props) => {
|
|
124
|
+
return render({ route, opts, props });
|
|
125
|
+
};
|
|
126
|
+
return (React.createElement(Route, { ...routeProps, element: createElement(renderComponent) }));
|
|
155
127
|
}
|
|
156
128
|
}
|
|
157
|
-
function
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
129
|
+
function createRouteElement(route, { isServer, withRoutesElement, ...options }, children) {
|
|
130
|
+
if (typeof route.redirect === "string") {
|
|
131
|
+
return React.createElement(Navigate, { to: route.redirect, replace: true });
|
|
132
|
+
}
|
|
133
|
+
if (!route.component) {
|
|
134
|
+
return null;
|
|
135
|
+
}
|
|
136
|
+
const Component = route.component;
|
|
137
|
+
const routeProps = { route, routes: options.routes };
|
|
138
|
+
function ComponentWithRoute(innerProps) {
|
|
139
|
+
const [initialProps, setInitialProps] = useState({});
|
|
140
|
+
const location = useLocation();
|
|
141
|
+
useEffect(() => {
|
|
142
|
+
handleInitialProps(routeProps);
|
|
143
|
+
}, []);
|
|
144
|
+
const handleInitialProps = async (param) => {
|
|
145
|
+
if (typeof Component.getInitialProps === "function") {
|
|
146
|
+
const initialProps = await Component.getInitialProps(param);
|
|
147
|
+
setInitialProps(initialProps);
|
|
148
|
+
}
|
|
149
|
+
};
|
|
150
|
+
const cloneChild = (ui, props) => {
|
|
151
|
+
if (ui) {
|
|
152
|
+
return cloneElement(ui, props);
|
|
153
|
+
}
|
|
154
|
+
else {
|
|
155
|
+
return createElement(React.Fragment, props);
|
|
156
|
+
}
|
|
157
|
+
};
|
|
158
|
+
if (isServer) {
|
|
159
|
+
// Since React.useEffect will not run in server side,
|
|
160
|
+
// this function will be called manually.
|
|
161
|
+
handleInitialProps(routeProps);
|
|
162
|
+
}
|
|
163
|
+
let childrenElement = null;
|
|
164
|
+
if (children) {
|
|
165
|
+
childrenElement = !!withRoutesElement ?
|
|
166
|
+
React.Children.map(children, (child, key) => cloneChild(child.props.element, { key })) :
|
|
167
|
+
children.map((child, key) => cloneChild(child.element, { key }));
|
|
168
|
+
}
|
|
169
|
+
return (React.createElement(Component, { ...routeProps, ...initialProps, ...innerProps, location: location }, childrenElement));
|
|
170
|
+
}
|
|
171
|
+
let routeElement = React.createElement(ComponentWithRoute, null);
|
|
172
|
+
const wrappers = route.wrappers || [];
|
|
173
|
+
let len = wrappers.length - 1;
|
|
174
|
+
while (len >= 0) {
|
|
175
|
+
const Wrapper = wrappers[len];
|
|
176
|
+
routeElement = React.createElement(Wrapper, { ...routeProps }, routeElement);
|
|
177
|
+
len -= 1;
|
|
178
|
+
}
|
|
179
|
+
return routeElement;
|
|
180
|
+
}
|
|
181
|
+
function getRoute({ key, options, route, }) {
|
|
182
|
+
const { index, path, sensitive, routes, ...routeOptions } = route;
|
|
183
|
+
const routeObject = {
|
|
184
|
+
path: !!index ? null : path,
|
|
185
|
+
index: !!index,
|
|
186
|
+
caseSensitive: !!sensitive,
|
|
187
|
+
children: getRoutes({ options, routes: routes }),
|
|
188
|
+
...routeOptions,
|
|
189
|
+
};
|
|
190
|
+
if (routeOptions?.loader) {
|
|
191
|
+
routeObject.loader = (loaderContext) => { return routeOptions?.loader({ ...loaderContext, ...options.loaderArgs }); };
|
|
192
|
+
}
|
|
193
|
+
routeObject.element = createRouteElement(route, { ...options, key }, routeObject.children);
|
|
194
|
+
return routeObject;
|
|
195
|
+
}
|
|
196
|
+
function renderRoute(params) {
|
|
197
|
+
const routeObject = getRoute(params);
|
|
198
|
+
return !!params.options.withRoutesElement ?
|
|
199
|
+
React.createElement(Route, { key: params.key, ...routeObject }) : routeObject;
|
|
200
|
+
}
|
|
201
|
+
function getRoutes({ routes, options }) {
|
|
202
|
+
if (routes) {
|
|
203
|
+
const sortedRoutes = sortByPaths(routes);
|
|
204
|
+
return (sortedRoutes.map((route, key) => {
|
|
205
|
+
return renderRoute({
|
|
206
|
+
key,
|
|
207
|
+
options,
|
|
208
|
+
route,
|
|
209
|
+
});
|
|
210
|
+
}));
|
|
211
|
+
}
|
|
212
|
+
return null;
|
|
213
|
+
}
|
|
214
|
+
function renderRoutes(options) {
|
|
215
|
+
if (options.routes) {
|
|
216
|
+
const routes = getRoutes({
|
|
217
|
+
options,
|
|
218
|
+
routes: options.routes,
|
|
163
219
|
});
|
|
164
|
-
return
|
|
165
|
-
|
|
220
|
+
return !!options.withRoutesElement ?
|
|
221
|
+
React.createElement(Routes, null, routes) : routes;
|
|
222
|
+
}
|
|
223
|
+
return null;
|
|
166
224
|
}
|
|
167
|
-
|
|
225
|
+
export { renderRoutes as renderRoutes2 };
|
|
168
226
|
//# sourceMappingURL=render-routes.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"render-routes.js","sourceRoot":"","sources":["../../src/route/render-routes.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"render-routes.js","sourceRoot":"","sources":["../../src/route/render-routes.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAa,MAAM,OAAO,CAAC;AACpF,6DAA6D;AAC7D,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,QAAQ,EAAe,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAErF,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,SAAS,qBAAqB,CAAC,KAAa,EAAE,IAAyB;IACrE,MAAM,EAAE,SAAS,EAAE,GAAG,eAAe,EAAE,GAAG,KAAK,CAAC;IAChD,IAAI,SAAS,GAAQ,KAAM,CAAC,SAAS,CAAC;IACtC,SAAS,8BAA8B,CAAC,KAAU;QAChD,MAAM,CAAC,YAAY,EAAE,eAAe,CAAC,GAAG,QAAQ,CAC9C,GAAG,EAAE,CAAE,MAAc,CAAC,cAAc,CACrC,CAAC;QAEF,SAAS,CAAC,GAAG,EA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