@luigi-project/core-modular 0.0.14 → 0.0.15-dev.202608150022

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/luigi.js CHANGED
@@ -8215,18 +8215,29 @@ var fi = {
8215
8215
  if (e === "" && n?.nodesInPath?.[0].viewUrl) return {};
8216
8216
  let r = n?.selectedNode, i;
8217
8217
  if (!r || !r.tabNav && (i = this.getParentNode(r, n), i && !i.tabNav)) return {};
8218
- let a = "";
8218
+ let a = i || r, o = this.getTabNavConfig(a);
8219
+ o && !("hideTabNavAutomatically" in o) && !o.showAsTabHeader && console.warn("tabNav:{hideTabNavAutomatically:true|false} is not configured correctly.");
8220
+ let s = "";
8219
8221
  n.nodesInPath?.forEach((e) => {
8220
- e.children && (a += "/" + (e.pathSegment || ""));
8222
+ e.children && (s += "/" + (e.pathSegment || ""));
8221
8223
  });
8222
- let o = i ? this.getTruncatedChildren(i.children ?? []) : this.getTruncatedChildren(r.children ?? []), s = await this.buildNavItems(o, r, n);
8223
- return {
8224
+ let c = i ? this.getTruncatedChildren(i.children ?? []) : this.getTruncatedChildren(r.children ?? []);
8225
+ if (o?.hideTabNavAutomatically && c.length <= 1) return {};
8226
+ let l = await this.buildNavItems(c, r, n), u = {
8224
8227
  selectedNode: r,
8225
- items: s.items,
8226
- totalBadgeNode: s.totalBadgeNode,
8227
- basePath: a.replace(/\/\/+/g, "/"),
8228
+ items: l.items,
8229
+ totalBadgeNode: l.totalBadgeNode,
8230
+ basePath: s.replace(/\/\/+/g, "/"),
8228
8231
  navClick: (e) => e.node ? this.navItemClick(e.node, n) : Promise.resolve()
8229
8232
  };
8233
+ return o?.showAsTabHeader && a.webcomponent && a.viewUrl && (u.headerNode = {
8234
+ viewUrl: a.viewUrl,
8235
+ context: n.context || a.context,
8236
+ webcomponent: a.webcomponent
8237
+ }), u;
8238
+ }
8239
+ getTabNavConfig(e) {
8240
+ if (e.tabNav && typeof e.tabNav == "object") return e.tabNav;
8230
8241
  }
8231
8242
  async getBreadcrumbData(e, t, n) {
8232
8243
  let r = this.luigi.getConfigValue("navigation.breadcrumbs"), i = t ?? await this.getPathData(e), a = i?.nodesInPath || [], o = [], s = !!r, c = "";
@@ -8386,7 +8397,7 @@ var fi = {
8386
8397
  let n = this.luigi.getConfigValue("routing.disableBrowserHistory") ? "replaceState" : y;
8387
8398
  if (p) {
8388
8399
  let t = a.addLeadingSlash(v);
8389
- if (!l && n !== "replaceState") location.hash = t;
8400
+ if (!l && !u && n !== "replaceState") location.hash = t;
8390
8401
  else {
8391
8402
  let r = new CustomEvent("hashchange", e);
8392
8403
  window.history[n]({ path: "/#" + t }, "", "/#" + t), window.dispatchEvent(r);
@@ -8920,10 +8931,10 @@ var fi = {
8920
8931
  let e = t.getConfigValue("navigation.viewGroupSettings")?.[n.viewGroup];
8921
8932
  e?.preloadUrl && (n.viewurl = e.preloadUrl, n.context = {}, n.nodeParams = {}, n.pathParams = {});
8922
8933
  }
8923
- } else n.viewGroup || n.virtualTree && p === n.virtualTreeRootNode || !e.viewGroup && !e.isolateView && !e.webcomponent && n.viewurl && m && a.isSameUrl(n.viewurl, m) ? f = n : r || n.remove();
8934
+ } else r || n.viewGroup || n.virtualTree && p === n.virtualTreeRootNode || !e.viewGroup && !e.isolateView && !e.webcomponent && n.viewurl && (i || m && a.isSameUrl(n.viewurl, m)) ? f = n : r || n.remove();
8924
8935
  }), f && f._luigiPreloading && (f._luigiPreloading = !1, W.get(bi).viewGroupLoaded(f)), f) {
8925
8936
  let n = f.viewurl;
8926
- r || (f.style.display = "block", f.viewurl = m, f.nodeParams = l, f.pathParams = u, f.clientPermissions = e.clientPermissions, f.searchParams = d, f.locale = t.i18n().getCurrentLocale(), f.theme = t.theming().getCurrentTheme(), f.activeFeatureToggleList = t.featureToggles().getActiveFeatureToggleList(), f.userSettingsGroup = e.userSettingsGroup, f.userSettings = s, Ti(f, t), Ei(f, t)), i || (a.isSameUrl(n, m) && n !== m && !f.virtualTree ? (f.context = e.context || {}, f.updateViewUrl(m)) : f.updateContext(e.context || {}, { withoutSync: !1 }));
8937
+ !r && !i && (f.style.display = "block", f.viewurl = m, f.nodeParams = l, f.pathParams = u, f.clientPermissions = e.clientPermissions, f.searchParams = d, f.locale = t.i18n().getCurrentLocale(), f.theme = t.theming().getCurrentTheme(), f.activeFeatureToggleList = t.featureToggles().getActiveFeatureToggleList(), f.userSettingsGroup = e.userSettingsGroup, f.userSettings = s, Ti(f, t), Ei(f, t)), r && !i && (f.nodeParams = l, f.pathParams = u, f.searchParams = d), i || (a.isSameUrl(n, m) && n !== m && !f.virtualTree && !r ? (f.context = e.context || {}, f.updateViewUrl(m)) : f.updateContext(e.context || {}, { withoutSync: !!r }));
8927
8938
  } else if (r) !i && o && o.updateContext(e.context || {}, { withoutSync: r });
8928
8939
  else {
8929
8940
  let r = await wi(e, t, n, "main");