@singularsystems/neo-react 1.2.3 → 1.2.4

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.
@@ -21,7 +21,7 @@ var Link = /** @class */ (function (_super) {
21
21
  }
22
22
  if (!e.defaultPrevented) {
23
23
  e.preventDefault();
24
- if (this.props.to) {
24
+ if (this.props.to !== undefined) {
25
25
  Misc.Globals.appService.get(AppServices.NeoTypes.Routing.NavigationHelper).navigateInternal(this.props.to);
26
26
  }
27
27
  }
@@ -29,7 +29,7 @@ var Link = /** @class */ (function (_super) {
29
29
  Link.prototype.render = function () {
30
30
  var _a = this.props, to = _a.to, href = _a.href, isNav = _a.isNav, exact = _a.exact, rest = __rest(_a, ["to", "href", "isNav", "exact"]);
31
31
  href !== null && href !== void 0 ? href : (href = "/");
32
- if (to) {
32
+ if (to !== undefined) {
33
33
  if (to.startsWith("/") && !to.startsWith(this.basePath)) {
34
34
  to = this.basePath + to;
35
35
  }
@@ -22,6 +22,10 @@ var NavigationHelper = /** @class */ (function () {
22
22
  case 0:
23
23
  basePath = this.routingState.basePath;
24
24
  prevUrl = this.prevUrls.length === 0 ? undefined : this.prevUrls[this.prevUrls.length - 1];
25
+ // Special case for when the root url has parameters. E.g. instead of /home/dashboard it will be //dashboard.
26
+ while (url.startsWith("//")) {
27
+ url = url.substring(1);
28
+ }
25
29
  path = url;
26
30
  if (basePath) {
27
31
  if (path.startsWith(basePath)) {
@@ -73,7 +77,7 @@ var NavigationHelper = /** @class */ (function () {
73
77
  };
74
78
  NavigationHelper.prototype.getPathForView = function (view, paramValues) {
75
79
  var basePath = this.routingState.appRouteProvider.getPathForComponent(view);
76
- if (basePath) {
80
+ if (basePath !== undefined) {
77
81
  if (paramValues) {
78
82
  return ViewParameterList.getPathForValues(basePath, view.params, paramValues);
79
83
  }
@@ -58,6 +58,10 @@ var RouteProvider = /** @class */ (function () {
58
58
  for (var _i = 0, matches_1 = matches; _i < matches_1.length; _i++) {
59
59
  var match = matches_1[_i];
60
60
  var paramString = path.substring(match.path.length);
61
+ // Special case for root path which has its leading "/" removed by the navigation helper.
62
+ if (match.path === "/") {
63
+ paramString = "/" + paramString;
64
+ }
61
65
  var parts = paramString.split("/").slice(1);
62
66
  var partCount = parts.length;
63
67
  // Allow extra "/"
@@ -87,7 +91,7 @@ var RouteProvider = /** @class */ (function () {
87
91
  var _a, _b;
88
92
  for (var _i = 0, routes_1 = routes; _i < routes_1.length; _i++) {
89
93
  var route = routes_1[_i];
90
- var hasComponent = route.path && route.component;
94
+ var hasComponent = route.path !== undefined && route.component;
91
95
  if (hasComponent) {
92
96
  if (parent && !route.breadCrumbParent) {
93
97
  route.breadCrumbParent = parent;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-react",
3
- "version": "1.2.3",
3
+ "version": "1.2.4",
4
4
  "description": "React application logic and components for the Neo client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",