@singularsystems/neo-react 1.4.3 → 1.5.0
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,6 +2,13 @@
|
|
|
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.5.0 (28 May 2026)
|
|
6
|
+
|
|
7
|
+
- Fixed routes with the same prefix, but different parameter counts not being registered.
|
|
8
|
+
- E.g. a products list view with path `/products`, and product item view with path `/products/{itemId}` were previously seen as a duplicate route.
|
|
9
|
+
- A url of `/products/123` would have matched against the first route.
|
|
10
|
+
- ViewBase - allow `viewParamsUpdated` to be called on initialise even if all the parameters have default values.
|
|
11
|
+
|
|
5
12
|
## Version 1.4.3 (22 April 2026)
|
|
6
13
|
|
|
7
14
|
- Fix variable usage in neo-react styles.
|
package/dist/Modules/Types.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ declare const NeoReactTypes: {
|
|
|
42
42
|
};
|
|
43
43
|
Core: {
|
|
44
44
|
AutoRunnerFactory: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Model/IAutoRunner").IAutoRunnerFactory>;
|
|
45
|
-
ConnectionManager: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/
|
|
45
|
+
ConnectionManager: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Network").IConnectionManager>;
|
|
46
46
|
DecimalService: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Numeric").IDecimalService<import("@singularsystems/neo-core/dist/Numeric").IDecimal>>;
|
|
47
47
|
ModelCreator: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Model/IModelCreatorBase").default>;
|
|
48
48
|
};
|
|
@@ -50,9 +50,13 @@ declare const NeoReactTypes: {
|
|
|
50
50
|
LocalisationService: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Localisation").ILocalisationService>;
|
|
51
51
|
};
|
|
52
52
|
Messaging: {
|
|
53
|
-
ConnectionManager: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/
|
|
53
|
+
ConnectionManager: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Network").IConnectionManager>;
|
|
54
54
|
ServerMessageSubscriber: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/SignalR").IServerMessageSubscriber>;
|
|
55
55
|
};
|
|
56
|
+
Network: {
|
|
57
|
+
AppConnectionMonitor: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Network/IAppConnectionMonitor").IAppConnectionMonitor>;
|
|
58
|
+
ConnectionManager: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Network").IConnectionManager>;
|
|
59
|
+
};
|
|
56
60
|
Security: {
|
|
57
61
|
AuthenticationService: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Security").IAuthenticationService>;
|
|
58
62
|
AuthorisationService: AppServices.ServiceIdentifier<import("@singularsystems/neo-core/dist/Security").IAuthorisationService>;
|
|
@@ -5,7 +5,6 @@ interface INamedRouteParameter extends IRouteParameter {
|
|
|
5
5
|
name: string;
|
|
6
6
|
}
|
|
7
7
|
export interface IProcessedRoute extends Routing.IRoute {
|
|
8
|
-
key: number;
|
|
9
8
|
/** Lower case base path without trailing / */
|
|
10
9
|
path: string;
|
|
11
10
|
/** Route params in order, excluding query parameters. */
|
|
@@ -29,8 +28,6 @@ export default class RouteProvider {
|
|
|
29
28
|
menuRoutes: Routing.IMenuRoute[];
|
|
30
29
|
pureRoutes?: Routing.IRoute[] | undefined;
|
|
31
30
|
notFoundComponent?: React.ComponentType | undefined;
|
|
32
|
-
private key;
|
|
33
|
-
private routeIndex;
|
|
34
31
|
private staticRoutes;
|
|
35
32
|
private parameterisedRoutes;
|
|
36
33
|
readonly allRoutes: IProcessedRoute[];
|
|
@@ -46,7 +43,7 @@ export default class RouteProvider {
|
|
|
46
43
|
private flatten;
|
|
47
44
|
/**
|
|
48
45
|
* Create a copy of the route info, and process it.
|
|
49
|
-
* Adds
|
|
46
|
+
* Adds route parameters extracted from the component static params object.
|
|
50
47
|
*/
|
|
51
48
|
private processRoute;
|
|
52
49
|
}
|
|
@@ -10,14 +10,12 @@ var RouteProvider = /** @class */ (function () {
|
|
|
10
10
|
this.menuRoutes = menuRoutes;
|
|
11
11
|
this.pureRoutes = pureRoutes;
|
|
12
12
|
this.notFoundComponent = notFoundComponent;
|
|
13
|
-
this.key = 1;
|
|
14
|
-
this.routeIndex = {};
|
|
15
13
|
this.staticRoutes = [];
|
|
16
14
|
this.parameterisedRoutes = [];
|
|
17
15
|
this.allRoutes = [];
|
|
18
|
-
this.flatten(
|
|
16
|
+
this.flatten(menuRoutes);
|
|
19
17
|
if (pureRoutes)
|
|
20
|
-
this.flatten(
|
|
18
|
+
this.flatten(pureRoutes);
|
|
21
19
|
this.staticRoutes = this.allRoutes.filter(function (c) { return c.params.length === 0; });
|
|
22
20
|
this.parameterisedRoutes = this.allRoutes
|
|
23
21
|
.filter(function (c) { return c.params.length > 0; })
|
|
@@ -84,7 +82,7 @@ var RouteProvider = /** @class */ (function () {
|
|
|
84
82
|
}
|
|
85
83
|
return null;
|
|
86
84
|
};
|
|
87
|
-
RouteProvider.prototype.flatten = function (
|
|
85
|
+
RouteProvider.prototype.flatten = function (routes, parent) {
|
|
88
86
|
var _a, _b;
|
|
89
87
|
for (var _i = 0, routes_1 = routes; _i < routes_1.length; _i++) {
|
|
90
88
|
var route = routes_1[_i];
|
|
@@ -93,20 +91,20 @@ var RouteProvider = /** @class */ (function () {
|
|
|
93
91
|
if (parent && !route.breadCrumbParent) {
|
|
94
92
|
route.breadCrumbParent = parent;
|
|
95
93
|
}
|
|
96
|
-
this.processRoute(
|
|
94
|
+
this.processRoute(route);
|
|
97
95
|
}
|
|
98
96
|
var menuRoute = route;
|
|
99
97
|
var children = __spreadArray(__spreadArray([], ((_a = route.routeChildren) !== null && _a !== void 0 ? _a : []), true), ((_b = menuRoute.children) !== null && _b !== void 0 ? _b : []), true);
|
|
100
|
-
this.flatten(
|
|
98
|
+
this.flatten(children, (hasComponent && menuRoute.showInBreadCrumb !== false) ? menuRoute : undefined);
|
|
101
99
|
}
|
|
102
100
|
};
|
|
103
101
|
/**
|
|
104
102
|
* Create a copy of the route info, and process it.
|
|
105
|
-
* Adds
|
|
103
|
+
* Adds route parameters extracted from the component static params object.
|
|
106
104
|
*/
|
|
107
|
-
RouteProvider.prototype.processRoute = function (
|
|
105
|
+
RouteProvider.prototype.processRoute = function (route) {
|
|
108
106
|
var _a;
|
|
109
|
-
var processed = __assign(__assign({}, route), { path: route.path, params: [],
|
|
107
|
+
var processed = __assign(__assign({}, route), { path: route.path, params: [], order: 0 });
|
|
110
108
|
processed.path = (_a = route.basePath) !== null && _a !== void 0 ? _a : route.path;
|
|
111
109
|
processed.path = processed.path.toLowerCase();
|
|
112
110
|
if (processed.path.length > 1 && processed.path.endsWith("/")) {
|
|
@@ -124,10 +122,7 @@ var RouteProvider = /** @class */ (function () {
|
|
|
124
122
|
}
|
|
125
123
|
}
|
|
126
124
|
}
|
|
127
|
-
|
|
128
|
-
this.routeIndex[processed.path] = true;
|
|
129
|
-
into.push(processed);
|
|
130
|
-
}
|
|
125
|
+
this.allRoutes.push(processed);
|
|
131
126
|
};
|
|
132
127
|
return RouteProvider;
|
|
133
128
|
}());
|
package/dist/Views/ViewBase.d.ts
CHANGED
|
@@ -32,6 +32,8 @@ export default abstract class ViewBase<TViewModel extends IViewModel = EmptyView
|
|
|
32
32
|
navigation: import("../Routing").INavigationHelper;
|
|
33
33
|
private breadCrumbStartItems?;
|
|
34
34
|
protected viewState: ViewState<TViewModel, TParams>;
|
|
35
|
+
/** If true, viewParamsUpdated() will be called on initialisation even if all parameters have default values. */
|
|
36
|
+
protected callViewParamsUpdatedOnInitialise: boolean;
|
|
35
37
|
/**
|
|
36
38
|
* Creates a view
|
|
37
39
|
* @param props React props.
|
package/dist/Views/ViewBase.js
CHANGED
|
@@ -24,6 +24,8 @@ var ViewBase = /** @class */ (function (_super) {
|
|
|
24
24
|
_this.hasInitialised = false;
|
|
25
25
|
_this.routingState = Misc.Globals.appService.get(NeoReactTypes.Routing.GlobalRoutingState);
|
|
26
26
|
_this.navigation = Misc.Globals.appService.get(NeoReactTypes.Routing.NavigationHelper);
|
|
27
|
+
/** If true, viewParamsUpdated() will be called on initialisation even if all parameters have default values. */
|
|
28
|
+
_this.callViewParamsUpdatedOnInitialise = false;
|
|
27
29
|
if (typeof viewName !== "string") {
|
|
28
30
|
throw "Error: When inheriting ViewBase, you must pass the view name into the base constructor.";
|
|
29
31
|
}
|
|
@@ -85,7 +87,7 @@ var ViewBase = /** @class */ (function (_super) {
|
|
|
85
87
|
_a.sent();
|
|
86
88
|
_a.label = 2;
|
|
87
89
|
case 2:
|
|
88
|
-
if (!paramsUpdated) return [3 /*break*/, 4];
|
|
90
|
+
if (!(paramsUpdated || this.callViewParamsUpdatedOnInitialise)) return [3 /*break*/, 4];
|
|
89
91
|
return [4 /*yield*/, this.viewParamsUpdated()];
|
|
90
92
|
case 3:
|
|
91
93
|
_a.sent();
|