@singularsystems/neo-core 1.5.1 → 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
@@ -1,5 +1,9 @@
1
1
  # Neo core changelog
2
2
 
3
+ ## Version 1.6.1 (23 June 2026)
4
+
5
+ - Minor routing changes to support changes in neo-react.
6
+
3
7
  ## Version 1.5.1 (28 May 2026)
4
8
 
5
9
  - Moved `exact` from `IRoute` to `IMenuRoute`.
@@ -20,4 +20,5 @@ export interface IMenuRoute extends IRoute {
20
20
  * Set this to true if this is a parent menu item which has sub menu items.
21
21
  */
22
22
  exact?: boolean;
23
+ clone?: () => IMenuRoute;
23
24
  }
@@ -21,9 +21,9 @@ export interface IRoute {
21
21
  basePath?: string;
22
22
  /** Component to display in route view on master page */
23
23
  component?: any;
24
- /** True if this item should be displayed in it's childrens' breadcrumbs. Only applies if name, path and component are also specified. */
24
+ /** False if this item should *not* be displayed in its childrens' breadcrumbs. Only applies if name, path and component are also specified. */
25
25
  showInBreadCrumb?: boolean;
26
- /** Parent item to show in this item's breadcrumb. */
26
+ /** Parent item to show in this item's breadcrumb. Will be set automatically if `showInBreadCrumb` is not false. */
27
27
  breadCrumbParent?: IRoute;
28
28
  /** Child routes which must not show in a menu. The breadCrumbParent property of each child will be set to this route. */
29
29
  routeChildren?: IRoute[];
@@ -11,21 +11,22 @@ var MenuItemProvider = /** @class */ (function () {
11
11
  * @param defaults Defaults to apply to menu items.
12
12
  */
13
13
  MenuItemProvider.prototype.processRoutes = function (routeItems, defaults) {
14
+ var _a, _b;
14
15
  if (defaults === void 0) { defaults = { hideWhenEmpty: true, collapseSingle: true }; }
15
16
  var filtered = [];
16
17
  for (var _i = 0, routeItems_1 = routeItems; _i < routeItems_1.length; _i++) {
17
18
  var route = routeItems_1[_i];
18
- var menuItem = __assign(__assign({}, defaults), route);
19
+ var menuItem = (route.clone ? route.clone() : __assign({}, route));
19
20
  var canShow = this.canShowItem(menuItem);
20
21
  if (canShow) {
21
22
  if (menuItem.children) {
22
- menuItem.children = this.processRoutes(menuItem.children);
23
+ menuItem.children = this.processRoutes(menuItem.children, defaults);
23
24
  if (!menuItem.path) {
24
- if (menuItem.children.length === 0 && menuItem.hideWhenEmpty !== false) {
25
+ if (menuItem.children.length === 0 && ((_a = menuItem.hideWhenEmpty) !== null && _a !== void 0 ? _a : defaults.hideWhenEmpty) !== false) {
25
26
  // Hide empty nodes with no path of their own
26
27
  canShow = false;
27
28
  }
28
- else if (menuItem.children.length == 1 && menuItem.collapseSingle !== false) {
29
+ else if (menuItem.children.length == 1 && ((_b = menuItem.collapseSingle) !== null && _b !== void 0 ? _b : defaults.collapseSingle) !== false) {
29
30
  // Merge single node into parent if parent has no path of it's own.
30
31
  menuItem = menuItem.children[0];
31
32
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@singularsystems/neo-core",
3
- "version": "1.5.1",
3
+ "version": "1.6.1",
4
4
  "description": "Core functionality for the Neo client library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",