@singularsystems/neo-core 1.5.1 → 1.6.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
package/dist/Routing/IRoute.d.ts
CHANGED
|
@@ -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
|
-
/**
|
|
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[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { __decorate, __metadata, __param } from "tslib";
|
|
2
2
|
import { injectable, inject } from 'inversify';
|
|
3
3
|
import NeoTypes from '../AppServices/NeoTypes';
|
|
4
4
|
var MenuItemProvider = /** @class */ (function () {
|
|
@@ -11,21 +11,21 @@ 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
|
-
var
|
|
18
|
-
var menuItem = __assign(__assign({}, defaults), route);
|
|
18
|
+
var menuItem = routeItems_1[_i];
|
|
19
19
|
var canShow = this.canShowItem(menuItem);
|
|
20
20
|
if (canShow) {
|
|
21
21
|
if (menuItem.children) {
|
|
22
|
-
menuItem.children = this.processRoutes(menuItem.children);
|
|
22
|
+
menuItem.children = this.processRoutes(menuItem.children, defaults);
|
|
23
23
|
if (!menuItem.path) {
|
|
24
|
-
if (menuItem.children.length === 0 && menuItem.hideWhenEmpty !== false) {
|
|
24
|
+
if (menuItem.children.length === 0 && ((_a = menuItem.hideWhenEmpty) !== null && _a !== void 0 ? _a : defaults.hideWhenEmpty) !== false) {
|
|
25
25
|
// Hide empty nodes with no path of their own
|
|
26
26
|
canShow = false;
|
|
27
27
|
}
|
|
28
|
-
else if (menuItem.children.length == 1 && menuItem.collapseSingle !== false) {
|
|
28
|
+
else if (menuItem.children.length == 1 && ((_b = menuItem.collapseSingle) !== null && _b !== void 0 ? _b : defaults.collapseSingle) !== false) {
|
|
29
29
|
// Merge single node into parent if parent has no path of it's own.
|
|
30
30
|
menuItem = menuItem.children[0];
|
|
31
31
|
}
|