@singularsystems/neo-react 1.6.0 → 1.6.2

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,14 @@
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.0 (23 June 2026)
5
+ ## Version 1.6.2 (10 July 2026)
6
+
7
+ - Routing fix
8
+ - Fixed static routes not being preferred to parameterised routes.
9
+ - Grid Column
10
+ - Added `invertSortIcon` prop to allow the sort icon to be inverted. Can be used on a computed property that is the inverse value of the underlying sort column.
11
+
12
+ ## Version 1.6.1 (23 June 2026)
6
13
 
7
14
  - Routing changes
8
15
  - Routes parameters can now be defined in the route path. E.g. `/products/:id/sales`.
@@ -13,6 +13,8 @@ export interface INeoColumnProps<TData> extends INeoCommonColumnProps, IEditorCo
13
13
  cellTooltip?: string;
14
14
  /** Allows you to override the default allow sorting setting of the datasource, or make clicking a column heading sort a specific property. */
15
15
  sort?: Model.IPropertyInstance | boolean;
16
+ /** If true, will invert the sort icon. May be necessary when a different property is used as the sort value. */
17
+ invertSortIcon?: boolean;
16
18
  /** True if this column must have a total cell. */
17
19
  sum?: boolean;
18
20
  /** Content callback to show in the footer. The filtered list of the grid is passed into the callback. */
@@ -143,7 +143,8 @@ var Column = /** @class */ (function (_super) {
143
143
  if (sortProperty && !this.suppressSort) {
144
144
  var sortInfo = this.context.dataView.sortInfo.find(function (c) { return c.column === sortProperty.propertyInfo; });
145
145
  if (sortInfo) {
146
- sortIcon = sortInfo.sortAscending ? Misc.Settings.icons.sortAsc : Misc.Settings.icons.sortDesc;
146
+ var sortAscending = this.props.invertSortIcon ? !sortInfo.sortAscending : sortInfo.sortAscending;
147
+ sortIcon = sortAscending ? Misc.Settings.icons.sortAsc : Misc.Settings.icons.sortDesc;
147
148
  domProps.className = Utils.joinWithSpaces(domProps.className, "column-is-sorted");
148
149
  }
149
150
  domProps.className = Utils.joinWithSpaces(domProps.className, "column-sortable");
@@ -26,4 +26,5 @@ export declare class MenuRoute<TParams extends RouteParameterObject<TParams>> im
26
26
  get path(): string;
27
27
  /** Name to show in the menu item. */
28
28
  name: string;
29
+ clone(): IMenuRoute;
29
30
  }
@@ -1,6 +1,6 @@
1
- import { Misc } from '@singularsystems/neo-core';
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 routeProvider = Misc.Globals.appService.get(NeoReactTypes.Routing.GlobalRoutingState).appRouteProvider;
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.prototype.getProcessedRoute = function (route) {
31
+ RouteProvider.getProcessedRoute = function (route) {
32
32
  var _a;
33
- var processed = this.rawRoutes.get(route);
33
+ // @ts-ignore
34
+ var processed = route[processedRouteSymbol];
34
35
  if (!processed) {
35
- throw new Error("Route not found: ".concat((_a = route.basePath) !== null && _a !== void 0 ? _a : route.path));
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
  };
@@ -48,21 +49,22 @@ var RouteProvider = /** @class */ (function () {
48
49
  var params = [];
49
50
  for (var i = 0; i < providedSegments.length; i++) {
50
51
  var segmentValue = providedSegments[i];
51
- var matchedRoutes = [];
52
+ var staticMatches = [];
53
+ var paramMatches = [];
52
54
  for (var _i = 0, currentRoutes_1 = currentRoutes; _i < currentRoutes_1.length; _i++) {
53
55
  var route = currentRoutes_1[_i];
54
56
  var routeSegment = route.segments.length > i ? route.segments[i] : undefined;
55
57
  if (segmentValue.toLowerCase() === ((_a = routeSegment === null || routeSegment === void 0 ? void 0 : routeSegment.value) !== null && _a !== void 0 ? _a : "")) {
56
- matchedRoutes.push(route);
58
+ staticMatches.push(route);
57
59
  }
58
60
  else if (routeSegment && routeSegment.param) {
59
61
  params.push({ param: routeSegment.param, value: segmentValue, index: i });
60
62
  if (!routeSegment.param.required || segmentValue) {
61
- matchedRoutes.push(route);
63
+ paramMatches.push(route);
62
64
  }
63
65
  }
64
66
  }
65
- currentRoutes = matchedRoutes;
67
+ currentRoutes = __spreadArray(__spreadArray([], staticMatches, true), paramMatches, true);
66
68
  }
67
69
  if (currentRoutes.length > 0) {
68
70
  var route = currentRoutes[0];
@@ -105,11 +107,13 @@ var RouteProvider = /** @class */ (function () {
105
107
  */
106
108
  RouteProvider.prototype.processRoute = function (route) {
107
109
  var _a;
108
- var processed = this.rawRoutes.get(route);
109
- if (processed) {
110
+ // @ts-ignore
111
+ if (route[processedRouteSymbol]) {
110
112
  return;
111
113
  }
112
- processed = __assign(__assign({}, route), { defaultPath: ((_a = route.basePath) !== null && _a !== void 0 ? _a : route.path), routeParams: [], queryParams: [], segments: [], requiredSegments: 0 });
114
+ var processed = __assign(__assign({}, route), { defaultPath: ((_a = route.basePath) !== null && _a !== void 0 ? _a : route.path), routeParams: [], queryParams: [], segments: [], requiredSegments: 0 });
115
+ // @ts-ignore
116
+ route[processedRouteSymbol] = processed;
113
117
  var normalizedPath = processed.defaultPath.toLowerCase();
114
118
  var fullPath = normalizedPath;
115
119
  var hasParamIdentifier = false;
@@ -166,7 +170,6 @@ var RouteProvider = /** @class */ (function () {
166
170
  if (hasParamIdentifier) {
167
171
  processed.defaultPath = RouteHelper.hydrateRoute(processed, {});
168
172
  }
169
- this.rawRoutes.set(route, processed);
170
173
  if (!this.basePaths.has(fullPath)) {
171
174
  this.basePaths.add(fullPath);
172
175
  this.allRoutes.push(processed);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-react",
3
- "version": "1.6.0",
3
+ "version": "1.6.2",
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.0",
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",