@luigi-project/core-modular 0.0.10-dev.202606290115 → 0.0.10-dev.202606300110
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/core-api/navigation.d.ts +6 -0
- package/luigi.js +75 -43
- package/luigi.js.map +1 -1
- package/package.json +1 -1
- package/services/navigation.service.d.ts +5 -2
- package/types/navigation.d.ts +11 -6
package/core-api/navigation.d.ts
CHANGED
|
@@ -62,4 +62,10 @@ export declare class Navigation {
|
|
|
62
62
|
*/
|
|
63
63
|
fromParent(): Navigation;
|
|
64
64
|
withParams(nodeParams: Record<string, any>): Navigation;
|
|
65
|
+
/**
|
|
66
|
+
* Refreshes top navigation badge counters by rendering the navigation again.
|
|
67
|
+
* @example
|
|
68
|
+
* Luigi.navigation().updateTopNavigation();
|
|
69
|
+
*/
|
|
70
|
+
updateTopNavigation(): Promise<void>;
|
|
65
71
|
}
|
package/luigi.js
CHANGED
|
@@ -7954,39 +7954,65 @@ var Ti = {
|
|
|
7954
7954
|
if (t.pathSegment === e || t.pathSegment && t.pathSegment.startsWith(":")) return n = t, !0;
|
|
7955
7955
|
}), n;
|
|
7956
7956
|
}
|
|
7957
|
-
buildNavItems(e, t, n) {
|
|
7958
|
-
let r = {}, i = [];
|
|
7959
|
-
|
|
7960
|
-
if (Ei.isNodeAccessPermitted(
|
|
7961
|
-
|
|
7962
|
-
|
|
7963
|
-
|
|
7964
|
-
|
|
7965
|
-
|
|
7966
|
-
|
|
7967
|
-
|
|
7968
|
-
|
|
7969
|
-
|
|
7970
|
-
|
|
7971
|
-
|
|
7972
|
-
|
|
7973
|
-
|
|
7974
|
-
|
|
7975
|
-
|
|
7976
|
-
|
|
7977
|
-
|
|
7957
|
+
async buildNavItems(e, t, n) {
|
|
7958
|
+
let r = {}, i = [], a = [];
|
|
7959
|
+
for (let o of e) {
|
|
7960
|
+
if (!Ei.isNodeAccessPermitted(o, this.getParentNode(n.selectedNode, n), n?.selectedNode?.context || {}, this.luigi)) continue;
|
|
7961
|
+
let e = !!o.badgeCounter, s = 0;
|
|
7962
|
+
if (o.badgeCounter && (s = await o.badgeCounter.count()), o.category) {
|
|
7963
|
+
let a = o.category.id || o.category.label || o.category, c = this.luigi.i18n().getTranslation(o.category.label || o.category.id || o.category), l = r[a];
|
|
7964
|
+
if (!l) l = {
|
|
7965
|
+
badgeCounter: e ? {
|
|
7966
|
+
count: () => Number(s),
|
|
7967
|
+
label: ""
|
|
7968
|
+
} : void 0,
|
|
7969
|
+
category: {
|
|
7970
|
+
altText: o.category.altText || "",
|
|
7971
|
+
icon: o.category.icon,
|
|
7972
|
+
id: a,
|
|
7973
|
+
label: c,
|
|
7974
|
+
nodes: [],
|
|
7975
|
+
tooltip: this.resolveTooltipText(o.category, c)
|
|
7976
|
+
}
|
|
7977
|
+
}, r[a] = l, i.push(l);
|
|
7978
|
+
else if (e) if (l.badgeCounter) {
|
|
7979
|
+
let e = await l.badgeCounter.count();
|
|
7980
|
+
l.badgeCounter.count = () => Number(e + s);
|
|
7981
|
+
} else l.badgeCounter = {
|
|
7982
|
+
count: () => Number(s),
|
|
7983
|
+
label: ""
|
|
7984
|
+
};
|
|
7985
|
+
l.category?.nodes?.push({
|
|
7986
|
+
altText: o.altText,
|
|
7987
|
+
externalLink: o.externalLink,
|
|
7988
|
+
href: o.externalLink?.url || H.getNodeHref(o, n.pathParams, this.luigi),
|
|
7989
|
+
icon: o.icon,
|
|
7990
|
+
label: o.label ? this.luigi.i18n().getTranslation(o.label) : void 0,
|
|
7991
|
+
node: o,
|
|
7992
|
+
selected: o === t,
|
|
7993
|
+
tooltip: o.label ? this.resolveTooltipText(o, o.label) : void 0
|
|
7978
7994
|
});
|
|
7979
7995
|
} else i.push({
|
|
7980
|
-
altText:
|
|
7981
|
-
|
|
7982
|
-
|
|
7983
|
-
|
|
7984
|
-
|
|
7985
|
-
|
|
7986
|
-
|
|
7987
|
-
|
|
7996
|
+
altText: o.altText,
|
|
7997
|
+
badgeCounter: o.badgeCounter,
|
|
7998
|
+
externalLink: o.externalLink,
|
|
7999
|
+
href: o.externalLink?.url || H.getNodeHref(o, n.pathParams, this.luigi),
|
|
8000
|
+
icon: o.icon,
|
|
8001
|
+
label: o.label ? this.luigi.i18n().getTranslation(o.label) : void 0,
|
|
8002
|
+
node: o,
|
|
8003
|
+
selected: o === t,
|
|
8004
|
+
tooltip: o.label ? this.resolveTooltipText(o, o.label) : void 0
|
|
7988
8005
|
});
|
|
7989
|
-
|
|
8006
|
+
s && a.push(s);
|
|
8007
|
+
}
|
|
8008
|
+
let o = a?.length ? a.reduce((e, t) => e + t) : 0;
|
|
8009
|
+
return {
|
|
8010
|
+
items: i,
|
|
8011
|
+
totalBadgeNode: {
|
|
8012
|
+
count: () => o,
|
|
8013
|
+
label: ""
|
|
8014
|
+
}
|
|
8015
|
+
};
|
|
7990
8016
|
}
|
|
7991
8017
|
async getCurrentNode(e) {
|
|
7992
8018
|
let t = await this.getPathData(e), n = t.selectedNode;
|
|
@@ -8039,12 +8065,13 @@ var Ti = {
|
|
|
8039
8065
|
(s?.keepSelectedForChildren || s?.tabNav) && (c = s, o.pop(), s = [...o].pop());
|
|
8040
8066
|
let l, u = c;
|
|
8041
8067
|
c ? n.rootNodes.includes(c) ? (l = c, u = void 0) : l = c.tabNav || c.keepSelectedForChildren ? s : [...i].pop() : (l = [...i].pop(), u = void 0);
|
|
8042
|
-
let d = await this.getChildren(l, l?.context || {}) || [];
|
|
8043
|
-
return r =
|
|
8068
|
+
let d = await this.getChildren(l, l?.context || {}) || [], f = await this.buildNavItems(d, u, n);
|
|
8069
|
+
return r = f.items, r = this.applyNavGroups(r), {
|
|
8044
8070
|
selectedNode: c || {},
|
|
8045
8071
|
items: r,
|
|
8046
8072
|
basePath: a.replace(/\/\/+/g, "/"),
|
|
8047
8073
|
sideNavFooterText: this.luigi.getConfig().settings?.sideNavFooterText,
|
|
8074
|
+
totalBadgeNode: f.totalBadgeNode,
|
|
8048
8075
|
navClick: (e) => e.node ? this.navItemClick(e.node, n) : Promise.resolve()
|
|
8049
8076
|
};
|
|
8050
8077
|
}
|
|
@@ -8111,21 +8138,22 @@ var Ti = {
|
|
|
8111
8138
|
productSwitcherItemClick: (e) => {
|
|
8112
8139
|
e.externalLink?.url ? Ei.openExternalLink(e.externalLink) : e.link && this.luigi.navigation().navigate(e.link);
|
|
8113
8140
|
}
|
|
8114
|
-
}, v = p;
|
|
8115
|
-
return p?.searchProvider?.inputPlaceholder && (
|
|
8116
|
-
...
|
|
8141
|
+
}, v = await this.buildNavItems(r.rootNodes, h, r), y = p;
|
|
8142
|
+
return p?.searchProvider?.inputPlaceholder && (y = {
|
|
8143
|
+
...y,
|
|
8117
8144
|
searchProvider: {
|
|
8118
|
-
...
|
|
8145
|
+
...y?.searchProvider,
|
|
8119
8146
|
inputPlaceholder: Oi.getSearchPlaceholder(this.luigi)
|
|
8120
8147
|
}
|
|
8121
|
-
}), p?.searchFieldCentered && (
|
|
8122
|
-
...
|
|
8148
|
+
}), p?.searchFieldCentered && (y = {
|
|
8149
|
+
...y,
|
|
8123
8150
|
searchFieldCentered: !!this.luigi.getConfigValue("settings.experimental.globalSearchCentered")
|
|
8124
8151
|
}), {
|
|
8125
8152
|
appTitle: o || n.settings?.header?.title,
|
|
8126
|
-
globalSearch:
|
|
8153
|
+
globalSearch: y,
|
|
8127
8154
|
logo: n.settings?.header?.logo,
|
|
8128
|
-
topNodes:
|
|
8155
|
+
topNodes: v.items,
|
|
8156
|
+
totalBadgeNode: v.totalBadgeNode,
|
|
8129
8157
|
contextSwitcher: g,
|
|
8130
8158
|
productSwitcher: _,
|
|
8131
8159
|
profile: this.luigi.auth().isAuthorizationEnabled() || n.navigation?.profile ? f : void 0,
|
|
@@ -8161,10 +8189,11 @@ var Ti = {
|
|
|
8161
8189
|
n.nodesInPath?.forEach((e) => {
|
|
8162
8190
|
e.children && (a += "/" + (e.pathSegment || ""));
|
|
8163
8191
|
});
|
|
8164
|
-
let o = i ? this.getTruncatedChildren(i.children ?? []) : this.getTruncatedChildren(r.children ?? []);
|
|
8192
|
+
let o = i ? this.getTruncatedChildren(i.children ?? []) : this.getTruncatedChildren(r.children ?? []), s = await this.buildNavItems(o, r, n);
|
|
8165
8193
|
return {
|
|
8166
8194
|
selectedNode: r,
|
|
8167
|
-
items:
|
|
8195
|
+
items: s.items,
|
|
8196
|
+
totalBadgeNode: s.totalBadgeNode,
|
|
8168
8197
|
basePath: a.replace(/\/\/+/g, "/"),
|
|
8169
8198
|
navClick: (e) => e.node ? this.navItemClick(e.node, n) : Promise.resolve()
|
|
8170
8199
|
};
|
|
@@ -8778,7 +8807,7 @@ var Ti = {
|
|
|
8778
8807
|
let t = W.routingService.getCurrentRoute();
|
|
8779
8808
|
if (!t) return;
|
|
8780
8809
|
let n = !e || e.length === 0;
|
|
8781
|
-
if ((n || e.includes("navigation") || e.includes("navigation.nodes") || e.includes("navigation.viewgroupdata")) && U.get(Mi).deleteCache(), (n || e.includes("settings.header") || e.includes("settings") || e.includes("navigation") || e.includes("navigation.profile") || e.includes("navigation.contextSwitcher") || e.includes("navigation.productSwitcher")) && W.luigi.getEngine()._connector?.renderTopNav(await W.navService.getTopNavData(t.path)), n || e.includes("navigation") || e.includes("navigation.nodes") || e.includes("navigation.viewgroupdata") || e.includes("settings") || e.includes("settings.footer")) {
|
|
8810
|
+
if ((n || e.includes("navigation") || e.includes("navigation.nodes") || e.includes("navigation.viewgroupdata")) && U.get(Mi).deleteCache(), (n || e.includes("settings.header") || e.includes("settings") || e.includes("navigation") || e.includes("navigation.badges") || e.includes("navigation.profile") || e.includes("navigation.contextSwitcher") || e.includes("navigation.productSwitcher")) && W.luigi.getEngine()._connector?.renderTopNav(await W.navService.getTopNavData(t.path)), n || e.includes("navigation") || e.includes("navigation.nodes") || e.includes("navigation.viewgroupdata") || e.includes("settings") || e.includes("settings.footer")) {
|
|
8782
8811
|
W.luigi.getEngine()._connector?.renderLeftNav(await W.navService.getLeftNavData(t.path)), W.luigi.getEngine()._connector?.renderTabNav(await W.navService.getTabNavData(t.path));
|
|
8783
8812
|
let e = W.luigi.getEngine()._connector;
|
|
8784
8813
|
e?.renderBreadcrumbs(await W.navService.getBreadcrumbData(t.path, void 0, (t) => {
|
|
@@ -9392,6 +9421,9 @@ var Ti = {
|
|
|
9392
9421
|
withParams(e) {
|
|
9393
9422
|
return e && Object.assign(this.options.nodeParams ?? {}, e), this;
|
|
9394
9423
|
}
|
|
9424
|
+
async updateTopNavigation() {
|
|
9425
|
+
this.luigi.configChanged("navigation");
|
|
9426
|
+
}
|
|
9395
9427
|
}, Zi = class {
|
|
9396
9428
|
luigi;
|
|
9397
9429
|
constructor(e) {
|