@sapui5/sap.fe.navigation 1.148.1 → 1.149.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.
@@ -1964,6 +1964,23 @@ export class NavigationHandler extends BaseObject {
1964
1964
  oAppData.selectionVariant = oNavHandler._ensureSelectionVariantFormatString(oAppDataLoaded.selectionVariant);
1965
1965
  oAppData.oSelectionVariant = new SelectionVariant(oAppData.selectionVariant);
1966
1966
  }
1967
+
1968
+ if (navType === NavType.iAppState) {
1969
+ const oComponentData = oNavHandler.oComponent.getComponentData() as Record<string, any>;
1970
+ const oStartupParameters = oComponentData?.startupParameters as Record<string, any>;
1971
+ const bHasDefaultedParams = oStartupParameters?.[DEFAULTED_PARAMETER_PROPERTY]?.length > 0;
1972
+ const bHasXAppState = oComponentData?.["sap-xapp-state"] !== undefined;
1973
+
1974
+ if (bHasDefaultedParams && bHasXAppState) {
1975
+ oNavHandler._enrichDefaultedSelectionVariant(
1976
+ oAppData,
1977
+ oStartupParameters[DEFAULTED_PARAMETER_PROPERTY][0],
1978
+ oDeferred,
1979
+ navType
1980
+ );
1981
+ return;
1982
+ }
1983
+ }
1967
1984
  }
1968
1985
 
1969
1986
  // resolve is called on passed Deferred object to trigger a call of the done method, if implemented
@@ -1979,6 +1996,47 @@ export class NavigationHandler extends BaseObject {
1979
1996
  return oDeferred;
1980
1997
  }
1981
1998
 
1999
+ /**
2000
+ * Fetches the original FLP default values from the xAppState and enriches oAppData with oDefaultedSelectionVariant.
2001
+ * @param oAppData The app data object to enrich.
2002
+ * @param sDefaultedParametersJson The raw JSON string of defaulted parameter names from FLP.
2003
+ * @param oDeferred The deferred to resolve after enrichment.
2004
+ * @param navType The navigation type.
2005
+ * @private
2006
+ */
2007
+ async _enrichDefaultedSelectionVariant(
2008
+ oAppData: any,
2009
+ sDefaultedParametersJson: string,
2010
+ oDeferred: JQuery.Deferred<unknown>,
2011
+ navType: string
2012
+ ): Promise<void> {
2013
+ try {
2014
+ const aDefaultedParameters: string[] = JSON.parse(sDefaultedParametersJson);
2015
+ const oCrossAppNavService: any = await this._getAppNavigationServiceAsync();
2016
+ const oXAppState: any = await oCrossAppNavService.getStartupAppState(this.oComponent);
2017
+ const oXAppStateData = oXAppState.getData();
2018
+ if (oXAppStateData?.selectionVariant) {
2019
+ const oXAppSelVar = new SelectionVariant(oXAppStateData.selectionVariant);
2020
+ const oDefaultedSelVar = new SelectionVariant();
2021
+ for (const sParamName of aDefaultedParameters) {
2022
+ if (this._isTechnicalParameter(sParamName)) {
2023
+ continue;
2024
+ }
2025
+ const aRanges = oXAppSelVar.getSelectOption(sParamName);
2026
+ if (aRanges) {
2027
+ oDefaultedSelVar.massAddSelectOption(sParamName, aRanges);
2028
+ }
2029
+ }
2030
+ if (!oDefaultedSelVar.isEmpty()) {
2031
+ oAppData.oDefaultedSelectionVariant = oDefaultedSelVar;
2032
+ }
2033
+ }
2034
+ } catch (oError) {
2035
+ Log.error("NavigationHandler: Failed to enrich defaulted selection variant.", oError as string);
2036
+ }
2037
+ oDeferred.resolve(oAppData, {}, navType);
2038
+ }
2039
+
1982
2040
  /**
1983
2041
  * Retrieves the parameter value of the sap-iapp-state (the internal apps) from the AppHash string. It automatically takes care about
1984
2042
  * compatibility between the old and the new approach of the sap-iapp-state. Precedence is that the new approach is favoured against the old
@@ -147,7 +147,7 @@ sap.ui.define(["sap/ui/core/Lib", "sap/ui/core/library"], function (Library, _li
147
147
  name: "sap.fe.navigation",
148
148
  apiVersion: 2,
149
149
  // eslint-disable-next-line no-template-curly-in-string
150
- version: "1.148.1",
150
+ version: "1.149.0",
151
151
  dependencies: ["sap.ui.core"],
152
152
  types: ["sap.fe.navigation.NavType", "sap.fe.navigation.ParamHandlingMode", "sap.fe.navigation.SuppressionBehavior"],
153
153
  interfaces: [],