swico 0.5.0-beta16 → 0.5.0-beta18
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
package/src/index.react.d.ts
CHANGED
|
@@ -10,7 +10,7 @@ export declare const Link: FC<{
|
|
|
10
10
|
children: ReactNode;
|
|
11
11
|
}>;
|
|
12
12
|
export { Outlet } from 'react-router-dom';
|
|
13
|
-
export {
|
|
13
|
+
export { func } from './template/react/history';
|
|
14
14
|
export interface DefineSwicoConfigType {
|
|
15
15
|
(env: 'base', config: CustomConfigType['base']): any;
|
|
16
16
|
(env: 'dev', config: CustomConfigType['dev']): any;
|
package/src/index.react.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.defineGlobal = exports.defineConfig = exports.
|
|
6
|
+
exports.defineGlobal = exports.defineConfig = exports.func = exports.Outlet = exports.Link = void 0;
|
|
7
7
|
var react_router_dom_1 = require("react-router-dom");
|
|
8
8
|
var react_1 = __importDefault(require("react"));
|
|
9
9
|
var Link = function (_a) {
|
|
@@ -14,7 +14,7 @@ exports.Link = Link;
|
|
|
14
14
|
var react_router_dom_2 = require("react-router-dom");
|
|
15
15
|
Object.defineProperty(exports, "Outlet", { enumerable: true, get: function () { return react_router_dom_2.Outlet; } });
|
|
16
16
|
var history_1 = require("./template/react/history");
|
|
17
|
-
Object.defineProperty(exports, "
|
|
17
|
+
Object.defineProperty(exports, "func", { enumerable: true, get: function () { return history_1.func; } });
|
|
18
18
|
var defineConfig = function (env, config) { return config; };
|
|
19
19
|
exports.defineConfig = defineConfig;
|
|
20
20
|
var defineGlobal = function (config) {
|
|
@@ -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
|
}>;
|
|
@@ -10,7 +9,7 @@ export declare const getHistory: (routerBase: ConfigRouterType['base'], routerTy
|
|
|
10
9
|
history: SwicoHistoryType;
|
|
11
10
|
originalHistory: import("history").HashHistory;
|
|
12
11
|
};
|
|
13
|
-
export declare const
|
|
12
|
+
export declare const func: () => {
|
|
14
13
|
name: string;
|
|
15
14
|
path: string;
|
|
16
15
|
pathname: string;
|
|
@@ -3,15 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.func = 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 = {
|
|
@@ -146,11 +145,8 @@ var compareURLPatterns = function (urlPatternWithValues, urlPatternWithParams) {
|
|
|
146
145
|
}
|
|
147
146
|
return true;
|
|
148
147
|
};
|
|
149
|
-
var
|
|
148
|
+
var func = 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: '',
|
|
@@ -162,4 +158,4 @@ var useLocation = function () {
|
|
|
162
158
|
params: {}
|
|
163
159
|
};
|
|
164
160
|
};
|
|
165
|
-
exports.
|
|
161
|
+
exports.func = func;
|