swico 0.5.0-beta16 → 0.5.0-beta17
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/package.json
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { ConfigRouterType } from '../../utils/config';
|
|
2
|
-
import { RoutesItemType } from './index';
|
|
3
2
|
export { unstable_HistoryRouter as HistoryRouter } from 'react-router-dom';
|
|
4
3
|
export declare const formatAncPath: (ancPath: string) => string;
|
|
5
|
-
export declare const getPathNameList: (
|
|
4
|
+
export declare const getPathNameList: () => Array<{
|
|
6
5
|
path: string;
|
|
7
6
|
name: string;
|
|
8
7
|
}>;
|
|
@@ -6,12 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.useLocation = exports.getHistory = exports.getPathNameList = exports.formatAncPath = exports.HistoryRouter = void 0;
|
|
7
7
|
var qs_1 = __importDefault(require("qs"));
|
|
8
8
|
var history_1 = require("history");
|
|
9
|
-
var react_router_dom_1 = require("react-router-dom");
|
|
10
|
-
var react_router_dom_2 = require("react-router-dom");
|
|
11
9
|
var routes_1 = require("./routes");
|
|
12
|
-
var
|
|
13
|
-
Object.defineProperty(exports, "HistoryRouter", { enumerable: true, get: function () { return
|
|
14
|
-
console.log('
|
|
10
|
+
var react_router_dom_1 = require("react-router-dom");
|
|
11
|
+
Object.defineProperty(exports, "HistoryRouter", { enumerable: true, get: function () { return react_router_dom_1.unstable_HistoryRouter; } });
|
|
12
|
+
console.log('routes_public', routes_1.routes);
|
|
15
13
|
var interpolatePath = function (pathTemplate, params) {
|
|
16
14
|
var pathParts = pathTemplate.split('/');
|
|
17
15
|
var interpolatedParts = pathParts.map(function (part) {
|
|
@@ -35,7 +33,7 @@ var formatAncPath = function (ancPath) {
|
|
|
35
33
|
return newAncPath;
|
|
36
34
|
};
|
|
37
35
|
exports.formatAncPath = formatAncPath;
|
|
38
|
-
var getPathNameList = function (
|
|
36
|
+
var getPathNameList = function () {
|
|
39
37
|
var list = [];
|
|
40
38
|
var checkRouteItem = function (item, ancPath) {
|
|
41
39
|
var path = item.path, name = item.name, children = item.children;
|
|
@@ -45,7 +43,8 @@ var getPathNameList = function (routes) {
|
|
|
45
43
|
children.some(function (item) { return checkRouteItem(item, newAncPath); });
|
|
46
44
|
}
|
|
47
45
|
};
|
|
48
|
-
|
|
46
|
+
console.log('rrr', routes_1.routes);
|
|
47
|
+
routes_1.routes.forEach(function (item) { return checkRouteItem(item, ''); });
|
|
49
48
|
return list;
|
|
50
49
|
};
|
|
51
50
|
exports.getPathNameList = getPathNameList;
|
|
@@ -88,7 +87,7 @@ var getHistory = function (routerBase, routerType) {
|
|
|
88
87
|
var history;
|
|
89
88
|
var originalHistory = (_a = (routerType === 'hash' ? history_1.createHashHistory : history_1.createBrowserHistory)) === null || _a === void 0 ? void 0 : _a();
|
|
90
89
|
console.log('routes1', routes_1.routes);
|
|
91
|
-
var pathNameList = (0, exports.getPathNameList)(
|
|
90
|
+
var pathNameList = (0, exports.getPathNameList)();
|
|
92
91
|
var lastIndexBase = routerBase[routerBase.length - 1];
|
|
93
92
|
var formatRouterBase = lastIndexBase === '/' ? routerBase.slice(0, routerBase.length - 1) : routerBase;
|
|
94
93
|
history = {
|
|
@@ -148,9 +147,6 @@ var compareURLPatterns = function (urlPatternWithValues, urlPatternWithParams) {
|
|
|
148
147
|
};
|
|
149
148
|
var useLocation = function () {
|
|
150
149
|
var _a;
|
|
151
|
-
var location = (0, react_router_dom_1.useLocation)();
|
|
152
|
-
var params = (0, react_router_dom_2.useParams)();
|
|
153
|
-
var search = location.search, hash = location.hash, pathname = location.pathname;
|
|
154
150
|
console.log('routes2', routes_1.routes);
|
|
155
151
|
return {
|
|
156
152
|
name: '',
|