swico 0.5.0-beta15 → 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,6 +1,6 @@
1
1
  {
2
2
  "name": "swico",
3
- "version": "0.5.0-beta15",
3
+ "version": "0.5.0-beta17",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -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: (routes: RoutesItemType[]) => Array<{
4
+ export declare const getPathNameList: () => Array<{
6
5
  path: string;
7
6
  name: string;
8
7
  }>;
@@ -15,7 +14,7 @@ export declare const useLocation: () => {
15
14
  path: string;
16
15
  pathname: string;
17
16
  search: string;
18
- query: {};
17
+ query: any;
19
18
  hash: string;
20
- params: {};
19
+ params: any;
21
20
  };
@@ -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 react_router_dom_3 = require("react-router-dom");
13
- Object.defineProperty(exports, "HistoryRouter", { enumerable: true, get: function () { return react_router_dom_3.unstable_HistoryRouter; } });
14
- console.log('routes', routes_1.routes);
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 (routes) {
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
- routes.forEach(function (item) { return checkRouteItem(item, ''); });
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)(routes_1.routes);
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: '',