@luigi-project/core-modular 0.0.19 → 0.0.20-dev.202610200049

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-engine.d.ts CHANGED
@@ -17,7 +17,7 @@ export declare class LuigiEngine {
17
17
  openModal: (luigi: import('./core-api/luigi').Luigi, node: import('./types/navigation').Node, modalSettings: import('./types/navigation').ModalSettings, onCloseCallback?: (goBackValue?: any) => void, luigiParams?: import('./types/routing').LuigiParams) => Promise<void>;
18
18
  updateModalSettings: (modalSettings: import('./types/navigation').ModalSettings, addHistoryEntry: boolean, luigi: import('./core-api/luigi').Luigi) => void;
19
19
  openDrawer: (luigi: import('./core-api/luigi').Luigi, node: import('./types/navigation').Node, drawerSettings: import('./types/navigation').DrawerSettings, onCloseCallback?: () => void, luigiParams?: import('./types/routing').LuigiParams) => Promise<void>;
20
- openUserSettings: (userSettingsDialogSettings: import('./types/navigation').UserSettingsDialogSettings, userSettingData: any, previousUserSettings: any, luigi: import('./core-api/luigi').Luigi) => Promise<void>;
20
+ openUserSettings: (userSettingsDialogSettings: import('./types/navigation').UserSettingsDialogSettings, userSettingData: any, previousUserSettings: any, initialUserSettings: any, luigi: import('./core-api/luigi').Luigi) => Promise<void>;
21
21
  };
22
22
  _comm: {
23
23
  luigi: import('./core-api/luigi').Luigi;
package/luigi.js CHANGED
@@ -7481,6 +7481,15 @@ var fi = {
7481
7481
  let t = this.getQueryParam(`${this.getModalViewParamName(e)}Params`, e);
7482
7482
  return t && JSON.parse(t);
7483
7483
  },
7484
+ getBookmarkableModalParams(e) {
7485
+ let t = {
7486
+ size: e.size,
7487
+ width: e.width,
7488
+ height: e.height,
7489
+ title: e.title
7490
+ };
7491
+ return e.keepPrevious && (t.keepPrevious = e.keepPrevious), t;
7492
+ },
7484
7493
  getHashQueryParamSeparator() {
7485
7494
  return this.defaultQueryParamSeparator;
7486
7495
  },
@@ -8708,7 +8717,9 @@ var fi = {
8708
8717
  l = e, u = U.getURLWithoutModalData(t, i), u && (l += "?" + u);
8709
8718
  } else l = o.pathname, u = U.getURLWithoutModalData(o.search, i), u && (l += "?" + U.getURLWithoutModalData(o.search, i));
8710
8719
  if (c = U.handleHistoryState(c, l), a !== e) {
8711
- if (r[i] = e, t && Object.keys(t).length && (r[`${i}Params`] = JSON.stringify(t)), s) {
8720
+ r[i] = e;
8721
+ let a = U.getBookmarkableModalParams(t);
8722
+ if (a && Object.keys(a).length && (r[`${i}Params`] = JSON.stringify(a)), s) {
8712
8723
  let e = location.hash.indexOf(n);
8713
8724
  e !== -1 && (o.hash = o.hash.slice(0, e)), o.hash = `${o.hash}${n}${U.encodeParams(r)}`;
8714
8725
  } else o.search = `?${U.encodeParams(r)}`;
@@ -8754,13 +8765,15 @@ var fi = {
8754
8765
  }
8755
8766
  updateModalDataInUrl(e, t, n) {
8756
8767
  let r = U.getHashQueryParamSeparator(), i = U.getQueryParams(this.luigi), a = U.getModalViewParamName(this.luigi);
8757
- i[a] = e, t && Object.keys(t).length && (i[`${a}Params`] = JSON.stringify(t));
8758
- let o = new URL(location.href);
8768
+ i[a] = e;
8769
+ let o = U.getBookmarkableModalParams(t);
8770
+ o && Object.keys(o).length && (i[`${a}Params`] = JSON.stringify(o));
8771
+ let s = new URL(location.href);
8759
8772
  if (this.luigi.getConfigValue("routing.useHashRouting")) {
8760
8773
  let e = location.hash.indexOf(r);
8761
- e !== -1 && (o.hash = o.hash.slice(0, e)), o.hash = `${o.hash}${r}${U.encodeParams(i)}`;
8762
- } else o.search = `?${U.encodeParams(i)}`;
8763
- n ? history.pushState(window.state, "", o.href) : history.replaceState(window.state, "", o.href);
8774
+ e !== -1 && (s.hash = s.hash.slice(0, e)), s.hash = `${s.hash}${r}${U.encodeParams(i)}`;
8775
+ } else s.search = `?${U.encodeParams(i)}`;
8776
+ n ? history.pushState(window.state, "", s.href) : history.replaceState(window.state, "", s.href);
8764
8777
  }
8765
8778
  checkInvalidateCache(e, t) {
8766
8779
  if (!e) return;
@@ -9059,29 +9072,29 @@ var fi = {
9059
9072
  let u = e.getEngine()._connector;
9060
9073
  t.loadingIndicator?.enabled !== !1 && u?.showLoadingIndicator(o.parentElement);
9061
9074
  },
9062
- openUserSettings: async (e, t, n, r) => {
9063
- let i = {};
9075
+ openUserSettings: async (e, t, n, r, i) => {
9076
+ let a = {};
9064
9077
  e.renderMicroFrontendContainer = async (e, t) => {
9065
- let a = e.viewUrl, o = e.webcomponent ?? !1, s = n?.[t] || {}, c = await wi({
9066
- viewUrl: a,
9078
+ let r = e.viewUrl, o = e.webcomponent ?? !1, s = n?.[t] || {}, c = await wi({
9079
+ viewUrl: r,
9067
9080
  userSettingsGroup: t,
9068
9081
  webcomponent: o,
9069
9082
  context: {
9070
9083
  ...e.context,
9071
9084
  userSettingsData: s
9072
9085
  }
9073
- }, r, void 0, "usersettings");
9086
+ }, i, void 0, "usersettings");
9074
9087
  return c.addEventListener(V.CUSTOM_MESSAGE, (e) => {
9075
9088
  let n = e.detail;
9076
- n?.id === "luigi.updateUserSettings" && (i[t] = n.data?.data ?? n.data);
9089
+ n?.id === "luigi.updateUserSettings" && (a[t] = n.data?.data ?? n.data);
9077
9090
  }), c;
9078
- }, e.onCloseCallback = async (e, t) => {
9079
- let n = {
9091
+ }, e.onCloseCallback = async (e) => {
9092
+ let t = {
9080
9093
  ...e,
9081
- ...i
9094
+ ...a
9082
9095
  };
9083
- await r.storeUserSettings(n, t);
9084
- }, r.getEngine()._connector?.openUserSettings(e, t, n);
9096
+ await i.storeUserSettings(t, n);
9097
+ }, i.getEngine()._connector?.openUserSettings(e, t, r);
9085
9098
  }
9086
9099
  }, Ai = new class {
9087
9100
  idpProviderInstance;
@@ -9537,8 +9550,7 @@ var fi = {
9537
9550
  let e = U.getContentViewParamPrefix(this.luigi), t = Object.entries(o).map(([t, n]) => e + encodeURIComponent(t) + "=" + encodeURIComponent(n)).join("&");
9538
9551
  s += (s.includes("?") ? "&" : "?") + t;
9539
9552
  }
9540
- let { nodeParams: c, ...l } = a;
9541
- this.luigi.getConfigValue("routing.showModalPathInUrl") && this.modalService.getModalStackLength() === 0 && this.routingService.appendModalDataToUrl(s, l), this.luigi.getEngine()._ui.openModal(this.luigi, i, a, n, {
9553
+ this.luigi.getConfigValue("routing.showModalPathInUrl") && this.modalService.getModalStackLength() === 0 && this.routingService.appendModalDataToUrl(s, a), this.luigi.getEngine()._ui.openModal(this.luigi, i, a, n, {
9542
9554
  nodeParams: o,
9543
9555
  pathParams: {},
9544
9556
  searchParams: {}
@@ -9715,6 +9727,20 @@ var fi = {
9715
9727
  }
9716
9728
  return n;
9717
9729
  }
9730
+ prepareUserSettingsObj(e, t) {
9731
+ let n = {}, r = t || {};
9732
+ return (Array.isArray(e) ? e : []).forEach((e) => {
9733
+ Object.keys(e || {}).forEach((t) => {
9734
+ let i = e[t] || {}, a = {};
9735
+ i.settings && Object.keys(i.settings).forEach((e) => {
9736
+ a[e] = "";
9737
+ }), n[t] = {
9738
+ ...a,
9739
+ ...r[t] || {}
9740
+ };
9741
+ });
9742
+ }), n;
9743
+ }
9718
9744
  getUserSettingsIframesInDom() {
9719
9745
  let e = document.querySelector(".iframeUserSettingsCtn");
9720
9746
  return e ? [...e.children] : [];
@@ -9779,12 +9805,12 @@ var fi = {
9779
9805
  openUserSettings = async () => {
9780
9806
  let e = this.luigi.getConfigValue("userSettings");
9781
9807
  if (!e) return;
9782
- let t = this.luigi.getConfigValue("settings"), n = await this.luigi.readUserSettings(), r = Hi.processUserSettingGroups(e, t), i = e.userSettingsDialog || {}, a = i.dialogHeader || hi.userSettingsDialog.dialogHeader, o = i.saveBtn || hi.userSettingsDialog.saveBtn, s = i.dismissBtn || hi.userSettingsDialog.dismissBtn, c = {
9783
- dialogHeader: this.luigi.i18n().getTranslation(a),
9784
- saveBtn: this.luigi.i18n().getTranslation(o),
9785
- dismissBtn: this.luigi.i18n().getTranslation(s)
9808
+ let t = this.luigi.getConfigValue("settings"), n = await this.luigi.readUserSettings(), r = Hi.processUserSettingGroups(e, t), i = Hi.prepareUserSettingsObj(r, n), a = e.userSettingsDialog || {}, o = a.dialogHeader || hi.userSettingsDialog.dialogHeader, s = a.saveBtn || hi.userSettingsDialog.saveBtn, c = a.dismissBtn || hi.userSettingsDialog.dismissBtn, l = {
9809
+ dialogHeader: this.luigi.i18n().getTranslation(o),
9810
+ saveBtn: this.luigi.i18n().getTranslation(s),
9811
+ dismissBtn: this.luigi.i18n().getTranslation(c)
9786
9812
  };
9787
- this.luigi.getEngine()._ui?.openUserSettings(c, r, n, this.luigi);
9813
+ this.luigi.getEngine()._ui?.openUserSettings(l, r, n, i, this.luigi);
9788
9814
  };
9789
9815
  closeUserSettings = () => {
9790
9816
  this.luigi.getEngine()._connector?.closeUserSettings();