@singularsystems/neo-react 1.6.0 → 1.6.1
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/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
This file details all new features and changes to functionality. If you only need to see changes that require updates to your project, see the [breaking changes](./Breaking.md) readme.
|
|
4
4
|
|
|
5
|
-
## Version 1.6.
|
|
5
|
+
## Version 1.6.1 (23 June 2026)
|
|
6
6
|
|
|
7
7
|
- Routing changes
|
|
8
8
|
- Routes parameters can now be defined in the route path. E.g. `/products/:id/sales`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { NeoReactTypes } from "../Modules/Types";
|
|
1
|
+
import { __assign } from "tslib";
|
|
3
2
|
import { RouteHelper } from "./RouteHelper";
|
|
3
|
+
import RouteProvider from "./RouteProvider";
|
|
4
4
|
var MenuRoute = /** @class */ (function () {
|
|
5
5
|
/**
|
|
6
6
|
* Creates a menu route with view parameters specified.
|
|
@@ -29,8 +29,7 @@ var MenuRoute = /** @class */ (function () {
|
|
|
29
29
|
/** Path including view param values. */
|
|
30
30
|
get: function () {
|
|
31
31
|
if (!this._path) {
|
|
32
|
-
var
|
|
33
|
-
var processedRoute = routeProvider.getProcessedRoute(this.baseRoute);
|
|
32
|
+
var processedRoute = RouteProvider.getProcessedRoute(this.baseRoute);
|
|
34
33
|
this._path = RouteHelper.hydrateRoute(processedRoute, this.viewParamValues);
|
|
35
34
|
}
|
|
36
35
|
return this._path;
|
|
@@ -38,6 +37,11 @@ var MenuRoute = /** @class */ (function () {
|
|
|
38
37
|
enumerable: false,
|
|
39
38
|
configurable: true
|
|
40
39
|
});
|
|
40
|
+
MenuRoute.prototype.clone = function () {
|
|
41
|
+
var clone = __assign({}, this);
|
|
42
|
+
clone.path = this.path;
|
|
43
|
+
return clone;
|
|
44
|
+
};
|
|
41
45
|
return MenuRoute;
|
|
42
46
|
}());
|
|
43
47
|
export { MenuRoute };
|
|
@@ -37,7 +37,6 @@ export default class RouteProvider {
|
|
|
37
37
|
pureRoutes?: Routing.IRoute[] | undefined;
|
|
38
38
|
notFoundComponent?: React.ComponentType | undefined;
|
|
39
39
|
private basePaths;
|
|
40
|
-
private rawRoutes;
|
|
41
40
|
readonly allRoutes: IProcessedRoute[];
|
|
42
41
|
/**
|
|
43
42
|
* Creates a route provider which provides a list of flattened routes.
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { __assign, __spreadArray } from "tslib";
|
|
2
2
|
import { RouteHelper } from "./RouteHelper";
|
|
3
|
+
var processedRouteSymbol = Symbol("processedRoute");
|
|
3
4
|
var RouteProvider = /** @class */ (function () {
|
|
4
5
|
/**
|
|
5
6
|
* Creates a route provider which provides a list of flattened routes.
|
|
@@ -12,7 +13,6 @@ var RouteProvider = /** @class */ (function () {
|
|
|
12
13
|
this.pureRoutes = pureRoutes;
|
|
13
14
|
this.notFoundComponent = notFoundComponent;
|
|
14
15
|
this.basePaths = new Set();
|
|
15
|
-
this.rawRoutes = new Map();
|
|
16
16
|
this.allRoutes = [];
|
|
17
17
|
if (pureRoutes)
|
|
18
18
|
this.flatten(pureRoutes);
|
|
@@ -28,11 +28,12 @@ var RouteProvider = /** @class */ (function () {
|
|
|
28
28
|
return this.allRoutes.find(function (c) { return c.component === component; });
|
|
29
29
|
};
|
|
30
30
|
/** @internal */
|
|
31
|
-
RouteProvider.
|
|
31
|
+
RouteProvider.getProcessedRoute = function (route) {
|
|
32
32
|
var _a;
|
|
33
|
-
|
|
33
|
+
// @ts-ignore
|
|
34
|
+
var processed = route[processedRouteSymbol];
|
|
34
35
|
if (!processed) {
|
|
35
|
-
throw new Error("Route not
|
|
36
|
+
throw new Error("Route has not been processed: ".concat((_a = route.basePath) !== null && _a !== void 0 ? _a : route.path));
|
|
36
37
|
}
|
|
37
38
|
return processed;
|
|
38
39
|
};
|
|
@@ -105,11 +106,13 @@ var RouteProvider = /** @class */ (function () {
|
|
|
105
106
|
*/
|
|
106
107
|
RouteProvider.prototype.processRoute = function (route) {
|
|
107
108
|
var _a;
|
|
108
|
-
|
|
109
|
-
if (
|
|
109
|
+
// @ts-ignore
|
|
110
|
+
if (route[processedRouteSymbol]) {
|
|
110
111
|
return;
|
|
111
112
|
}
|
|
112
|
-
processed = __assign(__assign({}, route), { defaultPath: ((_a = route.basePath) !== null && _a !== void 0 ? _a : route.path), routeParams: [], queryParams: [], segments: [], requiredSegments: 0 });
|
|
113
|
+
var processed = __assign(__assign({}, route), { defaultPath: ((_a = route.basePath) !== null && _a !== void 0 ? _a : route.path), routeParams: [], queryParams: [], segments: [], requiredSegments: 0 });
|
|
114
|
+
// @ts-ignore
|
|
115
|
+
route[processedRouteSymbol] = processed;
|
|
113
116
|
var normalizedPath = processed.defaultPath.toLowerCase();
|
|
114
117
|
var fullPath = normalizedPath;
|
|
115
118
|
var hasParamIdentifier = false;
|
|
@@ -166,7 +169,6 @@ var RouteProvider = /** @class */ (function () {
|
|
|
166
169
|
if (hasParamIdentifier) {
|
|
167
170
|
processed.defaultPath = RouteHelper.hydrateRoute(processed, {});
|
|
168
171
|
}
|
|
169
|
-
this.rawRoutes.set(route, processed);
|
|
170
172
|
if (!this.basePaths.has(fullPath)) {
|
|
171
173
|
this.basePaths.add(fullPath);
|
|
172
174
|
this.allRoutes.push(processed);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@singularsystems/neo-react",
|
|
3
|
-
"version": "1.6.
|
|
3
|
+
"version": "1.6.1",
|
|
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",
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"typescript": "5.9.3"
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"@singularsystems/neo-core": "1.6.
|
|
30
|
+
"@singularsystems/neo-core": "1.6.1",
|
|
31
31
|
"@types/react-color": "3.0.13",
|
|
32
32
|
"axios": "1.13.5",
|
|
33
33
|
"inversify": "6.0.2",
|