@luigi-project/core-modular 0.0.12 → 0.0.13-dev.202608110030

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.
Files changed (3) hide show
  1. package/luigi.js +74 -63
  2. package/luigi.js.map +1 -1
  3. package/package.json +1 -1
package/luigi.js CHANGED
@@ -7953,75 +7953,79 @@ var fi = {
7953
7953
  }), n;
7954
7954
  }
7955
7955
  async buildNavItems(e, t, n) {
7956
- let r = {}, i = [], a = [];
7957
- for (let o of e) {
7958
- if (!H.isNodeAccessPermitted(o, this.getParentNode(n.selectedNode, n), n?.selectedNode?.context || {}, this.luigi)) continue;
7959
- let e = !!o.badgeCounter, s = o.externalLink ? { ...o.externalLink } : void 0, c = U.getNodeHref(o, n?.pathParams, this.luigi), l = 0;
7960
- if (o.badgeCounter && (l = await o.badgeCounter.count()), s?.url) {
7961
- let e = { ...o };
7956
+ let r = {}, i = [], a = [], o = [];
7957
+ for (let s of e) {
7958
+ if (!H.isNodeAccessPermitted(s, this.getParentNode(n.selectedNode, n), n?.selectedNode?.context || {}, this.luigi)) continue;
7959
+ let e = !!s.badgeCounter, c = s.externalLink ? { ...s.externalLink } : void 0, l = U.getNodeHref(s, n?.pathParams, this.luigi), u = 0;
7960
+ if (s.badgeCounter && (u = await s.badgeCounter.count()), c?.url) {
7961
+ let e = { ...s };
7962
7962
  t?.context && (e.context = {
7963
7963
  ...e.context,
7964
7964
  ...t.context
7965
7965
  });
7966
7966
  let r = {
7967
7967
  ...e,
7968
- viewUrl: s.url
7968
+ viewUrl: c.url
7969
7969
  }, i = n?.pathParams ? n.pathParams : {};
7970
- s.url = U.substituteViewUrl(r, i, void 0, this.luigi), c = s.url;
7970
+ c.url = U.substituteViewUrl(r, i, void 0, this.luigi), l = c.url;
7971
7971
  }
7972
- if (o.category) {
7973
- let n = o.category.id || o.category.label || o.category, a = this.luigi.i18n().getTranslation(o.category.label || o.category.id || o.category), u = r[n];
7974
- if (!u) u = {
7972
+ let d = s.category && (typeof s.category == "string" || s.category.id || s.category.label);
7973
+ if (d) {
7974
+ let n = s.category.id || s.category.label || s.category, a = this.luigi.i18n().getTranslation(s.category.label || s.category.id || s.category), o = r[n];
7975
+ if (!o) o = {
7975
7976
  badgeCounter: e ? {
7976
- count: () => Number(l),
7977
+ count: () => Number(u),
7977
7978
  label: ""
7978
7979
  } : void 0,
7979
7980
  category: {
7980
- altText: o.category.altText || "",
7981
- icon: o.category.icon,
7981
+ altText: s.category.altText || "",
7982
+ icon: s.category.icon,
7982
7983
  id: n,
7983
7984
  label: a,
7984
7985
  nodes: [],
7985
- tooltip: this.resolveTooltipText(o.category, a)
7986
+ tooltip: this.resolveTooltipText(s.category, a)
7986
7987
  }
7987
- }, r[n] = u, i.push(u);
7988
- else if (e) if (u.badgeCounter) {
7989
- let e = await u.badgeCounter.count();
7990
- u.badgeCounter.count = () => Number(e + l);
7991
- } else u.badgeCounter = {
7992
- count: () => Number(l),
7988
+ }, r[n] = o, i.push(o);
7989
+ else if (e) if (o.badgeCounter) {
7990
+ let e = await o.badgeCounter.count();
7991
+ o.badgeCounter.count = () => Number(e + u);
7992
+ } else o.badgeCounter = {
7993
+ count: () => Number(u),
7993
7994
  label: ""
7994
7995
  };
7995
- u.category?.nodes?.push({
7996
- altText: o.altText,
7997
- externalLink: s,
7998
- href: c,
7999
- icon: o.icon,
8000
- label: o.label ? U.resolveNodeLabel(o, this.luigi) : void 0,
8001
- node: o,
8002
- selected: o === t,
8003
- tooltip: o.label ? this.resolveTooltipText(o, o.label) : void 0
7996
+ o.category?.nodes?.push({
7997
+ altText: s.altText,
7998
+ externalLink: c,
7999
+ href: l,
8000
+ icon: s.icon,
8001
+ label: s.label ? U.resolveNodeLabel(s, this.luigi) : void 0,
8002
+ node: s,
8003
+ selected: s === t,
8004
+ tooltip: s.label ? this.resolveTooltipText(s, s.label) : void 0
8004
8005
  });
8005
- } else i.push({
8006
- altText: o.altText,
8007
- badgeCounter: o.badgeCounter,
8008
- externalLink: s,
8009
- href: c,
8010
- icon: o.icon,
8011
- label: o.label ? U.resolveNodeLabel(o, this.luigi) : void 0,
8012
- node: o,
8013
- selected: o === t,
8014
- tooltip: o.label ? this.resolveTooltipText(o, o.label) : void 0
8015
- });
8016
- l && a.push(l);
8006
+ } else {
8007
+ let e = {
8008
+ altText: s.altText,
8009
+ badgeCounter: s.badgeCounter,
8010
+ externalLink: c,
8011
+ href: l,
8012
+ icon: s.icon,
8013
+ label: s.label ? U.resolveNodeLabel(s, this.luigi) : void 0,
8014
+ node: s,
8015
+ selected: s === t,
8016
+ tooltip: s.label ? this.resolveTooltipText(s, s.label) : void 0
8017
+ };
8018
+ s.category && !d ? a.push(e) : i.push(e);
8019
+ }
8020
+ u && o.push(u);
8017
8021
  }
8018
- let o = a?.length ? a.reduce((e, t) => e + t) : 0;
8019
- return {
8022
+ let s = o?.length ? o.reduce((e, t) => e + t) : 0, c = {
8023
+ count: () => s,
8024
+ label: ""
8025
+ };
8026
+ return i.unshift(...a), {
8020
8027
  items: i,
8021
- totalBadgeNode: {
8022
- count: () => o,
8023
- label: ""
8024
- }
8028
+ totalBadgeNode: c
8025
8029
  };
8026
8030
  }
8027
8031
  async getCurrentNode(e) {
@@ -8380,12 +8384,14 @@ var fi = {
8380
8384
  return;
8381
8385
  }
8382
8386
  let n = this.luigi.getConfigValue("routing.disableBrowserHistory") ? "replaceState" : y;
8383
- if (p) if (!l && n !== "replaceState") location.hash = v;
8384
- else {
8385
- let t = new CustomEvent("hashchange", e);
8386
- window.history[n]({ path: "/#" + v }, "", "/#" + v), window.dispatchEvent(t);
8387
- }
8388
- else {
8387
+ if (p) {
8388
+ let t = a.addLeadingSlash(v);
8389
+ if (!l && n !== "replaceState") location.hash = t;
8390
+ else {
8391
+ let r = new CustomEvent("hashchange", e);
8392
+ window.history[n]({ path: "/#" + t }, "", "/#" + t), window.dispatchEvent(r);
8393
+ }
8394
+ } else {
8389
8395
  let t = new CustomEvent("popstate", e);
8390
8396
  window.history[n]({ path: v }, "", v), window.dispatchEvent(t);
8391
8397
  }
@@ -8904,16 +8910,21 @@ var fi = {
8904
8910
  t.getEngine()._connector?.hideLoadingIndicator(c);
8905
8911
  let l = n?.nodeParams || {}, u = n?.pathParams || {}, d = n?.searchParams || {};
8906
8912
  if (e && c) {
8907
- let o, f;
8908
- (e.virtualTree || e._virtualTree) && (f = H.findVirtualTreeRootNode(e));
8909
- let p = e.viewUrl ? W.get(Ci).applyDecorators(U.substituteViewUrl(e, u, l, t), e.decodeViewUrl ?? !1) : "";
8913
+ let o, f, p;
8914
+ (e.virtualTree || e._virtualTree) && (p = H.findVirtualTreeRootNode(e));
8915
+ let m = e.viewUrl ? W.get(Ci).applyDecorators(U.substituteViewUrl(e, u, l, t), e.decodeViewUrl ?? !1) : "";
8910
8916
  if ([...c.childNodes].forEach((n) => {
8911
- if (n.tagName?.indexOf("LUIGI-") === 0) if (n.viewGroup && e.viewGroup !== n.viewGroup) {
8912
- n.style.display = "none";
8913
- let e = t.getConfigValue("navigation.viewGroupSettings")?.[n.viewGroup];
8914
- e?.preloadUrl && (n.viewurl = e.preloadUrl, n.context = {}, n.nodeParams = {}, n.pathParams = {});
8915
- } else n.viewGroup || n.virtualTree && f === n.virtualTreeRootNode || !e.viewGroup && !e.isolateView && !e.webcomponent && n.viewurl && p && a.isSameUrl(n.viewurl, p) ? o = n : n.remove();
8916
- }), o && o._luigiPreloading && (o._luigiPreloading = !1, W.get(bi).viewGroupLoaded(o)), o) r || (o.style.display = "block", o.viewurl = p, o.nodeParams = l, o.pathParams = u, o.clientPermissions = e.clientPermissions, o.searchParams = d, o.locale = t.i18n().getCurrentLocale(), o.theme = t.theming().getCurrentTheme(), o.activeFeatureToggleList = t.featureToggles().getActiveFeatureToggleList(), o.userSettingsGroup = e.userSettingsGroup, o.userSettings = s, Ti(o, t), Ei(o, t)), i || o.updateContext(e.context || {}, { withoutSync: !1 });
8917
+ if (n.tagName?.indexOf("LUIGI-") === 0) if (r && (o = n), n.viewGroup && e.viewGroup !== n.viewGroup) {
8918
+ if (!r) {
8919
+ n.style.display = "none";
8920
+ let e = t.getConfigValue("navigation.viewGroupSettings")?.[n.viewGroup];
8921
+ e?.preloadUrl && (n.viewurl = e.preloadUrl, n.context = {}, n.nodeParams = {}, n.pathParams = {});
8922
+ }
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();
8924
+ }), f && f._luigiPreloading && (f._luigiPreloading = !1, W.get(bi).viewGroupLoaded(f)), f) {
8925
+ 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 }));
8927
+ } else if (r) !i && o && o.updateContext(e.context || {}, { withoutSync: r });
8917
8928
  else {
8918
8929
  let r = await wi(e, t, n, "main");
8919
8930
  c?.appendChild(r);