swico 0.5.0-beta10 → 0.5.0-beta11

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-beta10",
3
+ "version": "0.5.0-beta11",
4
4
  "description": "Simple, efficient, and practical front-end framework",
5
5
  "main": "./src/index.js",
6
6
  "types": "./src/index.d.ts",
@@ -41,7 +41,6 @@ var getPathNameList = function (routes) {
41
41
  children.some(function (item) { return checkRouteItem(item, newAncPath); });
42
42
  }
43
43
  };
44
- console.log('rrr', routes);
45
44
  routes.forEach(function (item) { return checkRouteItem(item, ''); });
46
45
  return list;
47
46
  };
@@ -26,13 +26,19 @@ var compareURLPatterns = function (urlPatternWithValues, urlPatternWithParams) {
26
26
  }
27
27
  return true;
28
28
  };
29
+ console.log('routes1', routes_1.routes);
29
30
  var useLocation = function () {
30
31
  var _a, _b;
31
32
  var location = (0, react_router_dom_1.useLocation)();
32
33
  var params = (0, react_router_dom_1.useParams)();
33
34
  var search = location.search, hash = location.hash, pathname = location.pathname;
35
+ console.log('routes2', routes_1.routes);
34
36
  var pathNameList = (0, history_1.getPathNameList)(routes_1.routes);
35
- var name = (_a = pathNameList.find(function (item) { return (params && compareURLPatterns(pathname, item.path)) || item.path === pathname; })) === null || _a === void 0 ? void 0 : _a.name;
37
+ console.log('pathNameList', pathNameList);
38
+ var name = (_a = pathNameList.find(function (item) {
39
+ return (Object.keys(params).length > 0 && compareURLPatterns(pathname, item.path)) ||
40
+ item.path === pathname;
41
+ })) === null || _a === void 0 ? void 0 : _a.name;
36
42
  var query = search ? qs_1.default.parse(search.startsWith('?') ? search.slice(1) : search) : {};
37
43
  return {
38
44
  name: name,