@sapui5/sap.fe.templates 1.140.0 → 1.141.1

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 (22) hide show
  1. package/package.json +1 -1
  2. package/src/sap/fe/templates/.library +1 -1
  3. package/src/sap/fe/templates/AnalyticalListPage/manifest.json +1 -1
  4. package/src/sap/fe/templates/ListReport/ListReportController.controller.js +6 -8
  5. package/src/sap/fe/templates/ListReport/ListReportController.controller.ts +6 -8
  6. package/src/sap/fe/templates/ListReport/controls/MultipleModeControl.js +8 -3
  7. package/src/sap/fe/templates/ListReport/controls/MultipleModeControl.ts +7 -2
  8. package/src/sap/fe/templates/ListReport/manifest.json +1 -1
  9. package/src/sap/fe/templates/ListReport/overrides/ViewState.js +7 -23
  10. package/src/sap/fe/templates/ListReport/overrides/ViewState.ts +7 -26
  11. package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.js +36 -33
  12. package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.ts +51 -41
  13. package/src/sap/fe/templates/ObjectPage/ObjectPageTemplating.js +14 -3
  14. package/src/sap/fe/templates/ObjectPage/ObjectPageTemplating.ts +11 -0
  15. package/src/sap/fe/templates/ObjectPage/manifest.json +1 -1
  16. package/src/sap/fe/templates/ObjectPage/overrides/CollaborationManager.js +4 -3
  17. package/src/sap/fe/templates/ObjectPage/overrides/CollaborationManager.ts +32 -29
  18. package/src/sap/fe/templates/ObjectPage/overrides/Share.js +2 -2
  19. package/src/sap/fe/templates/ObjectPage/overrides/Share.ts +1 -1
  20. package/src/sap/fe/templates/ObjectPage/view/fragments/Actions.fragment.xml +8 -2
  21. package/src/sap/fe/templates/ObjectPage/view/fragments/SectionContent.fragment.xml +4 -1
  22. package/src/sap/fe/templates/library.js +1 -1
@@ -52,7 +52,6 @@ import type InputBase from "sap/m/InputBase";
52
52
  import InstanceManager from "sap/m/InstanceManager";
53
53
  import MessageBox from "sap/m/MessageBox";
54
54
  import type NavContainer from "sap/m/NavContainer";
55
- import type OverflowToolbar from "sap/m/OverflowToolbar";
56
55
  import type Popover from "sap/m/Popover";
57
56
  import type ToolbarSpacer from "sap/m/ToolbarSpacer";
58
57
  import Device from "sap/ui/Device";
@@ -444,14 +443,15 @@ class ObjectPageController extends PageController {
444
443
  // Due to the left alignment of the Draft switch and the collaborative draft avatar controls
445
444
  // there is a ToolbarSpacer in the actions aggregation which we need to exclude here!
446
445
  // Due to the ACC report, we also need not to check for the InvisibleText elements
447
- if (
448
- action.isA<ShareAPI>("sap.fe.macros.share.ShareAPI") ||
449
- action.isA<SummarizationButton>("sap.fe.macros.ai.SummarizationButton") ||
446
+ if (action.isA<SummarizationButton>("sap.fe.macros.ai.SummarizationButton")) {
447
+ return action.getContent()?.getVisible() ?? false;
448
+ } else if (
449
+ action.isA<ShareAPI>("sap.fe.macros.Share") ||
450
450
  action.isA<EasyFillButton>("sap.fe.macros.ai.EasyFillButton") ||
451
451
  action.isA<CollaborationDraft>("sap.fe.templates.ObjectPage.components.CollaborationDraft")
452
452
  ) {
453
- // since ShareAPI, summarize and CollaborationDraft does not have a disable property
454
- // hence there is no need to check if it is disbaled or not
453
+ // since Share and CollaborationDraft does not have a disable property
454
+ // hence there is no need to check if it is disabled or not
455
455
  return action.getVisible();
456
456
  } else if (!action.isA<InvisibleText>("sap.ui.core.InvisibleText") && !action.isA<ToolbarSpacer>("sap.m.ToolbarSpacer")) {
457
457
  return action.getVisible() && (action as Button).getEnabled();
@@ -493,12 +493,13 @@ class ObjectPageController extends PageController {
493
493
  }
494
494
 
495
495
  _getFirstEmptyMandatoryFieldFromSubSection(aSubSections: ObjectPageSubSection[]): InputBase | undefined {
496
- if (aSubSections) {
497
- for (const subSection of aSubSections) {
498
- const aBlocks = subSection.getBlocks() as (Form | FormAPI)[];
496
+ if (aSubSections.length === 0) return undefined;
497
+ for (const subSection of aSubSections) {
498
+ const aBlocks = subSection.getBlocks() as (Form | FormAPI)[];
499
499
 
500
- if (aBlocks) {
501
- for (const blockControl of aBlocks) {
500
+ if (aBlocks) {
501
+ for (const blockControl of aBlocks) {
502
+ if (blockControl.getBindingContext?.()) {
502
503
  let aFormContainers;
503
504
 
504
505
  if (blockControl.isA<Form>("sap.ui.layout.form.Form")) {
@@ -524,6 +525,7 @@ class ObjectPageController extends PageController {
524
525
  }
525
526
  }
526
527
  }
528
+
527
529
  return undefined;
528
530
  }
529
531
 
@@ -610,7 +612,7 @@ class ObjectPageController extends PageController {
610
612
  if (document.URL === currentURL) {
611
613
  this._routing.navigateBackFromContext(oContext);
612
614
  }
613
- }, 100);
615
+ }, 500);
614
616
  };
615
617
 
616
618
  if (this.getAppComponent().getRouterProxy().checkIfBackHasSameContext()) {
@@ -626,13 +628,17 @@ class ObjectPageController extends PageController {
626
628
  Log.warning("Error while setting back navigation", e);
627
629
  });
628
630
  } else {
631
+ const hiddenDraftEnabled = (this.getAppComponent()?.getEnvironmentCapabilities()?.getCapabilities()?.HiddenDraft as HiddenDraft)
632
+ ?.enabled;
629
633
  draft.processDataLossOrDraftDiscardConfirmation(
630
634
  navBack,
631
635
  Function.prototype,
632
636
  oContext,
633
637
  this,
634
638
  true,
635
- draft.NavigationType.BackNavigation
639
+ draft.NavigationType.BackNavigation,
640
+ undefined,
641
+ hiddenDraftEnabled ? true : undefined
636
642
  );
637
643
  }
638
644
  }
@@ -797,7 +803,9 @@ class ObjectPageController extends PageController {
797
803
  if (cards.length > 0) {
798
804
  const cardObject = this.collaborationManager.updateCards(cards);
799
805
  const parentAppId = this.getAppComponent().getId();
800
- this.getAppComponent().getCollaborationManagerService().addCardsToCollaborationManager(cardObject, parentAppId);
806
+ this.getAppComponent()
807
+ .getCollaborationManagerService()
808
+ .addCardsToCollaborationManager(cardObject, parentAppId, this.getView().getId());
801
809
  this.getAppComponent().getCollaborationManagerService().shareAvailableCards();
802
810
  }
803
811
  }
@@ -951,12 +959,26 @@ class ObjectPageController extends PageController {
951
959
  return this.byId("fe::ObjectPage") as ObjectPageLayout;
952
960
  }
953
961
 
954
- _getPageTitleInformation(): { title: string; subtitle: string; intent: string; icon: string; description: string } {
962
+ async _getPageTitleInformation(): Promise<{ title: string; subtitle: string; intent: string; icon: string; description: string }> {
955
963
  const oObjectPage = this._getObjectPageLayoutControl();
956
964
  const oObjectPageSubtitle = oObjectPage.getCustomData().find(function (oCustomData) {
957
965
  return oCustomData.getKey() === "ObjectPageSubtitle";
958
966
  });
959
- const objectPageDescription = oObjectPage.data("ObjectPageDescription");
967
+ const oObjectPageDescription = oObjectPage.getCustomData().find(function (oCustomData) {
968
+ return oCustomData.getKey() === "ObjectPageDescription";
969
+ });
970
+ const extractPaths = (bindingInfo?: { parts?: { path?: string; model?: string }[] }): string[] =>
971
+ Array.from(
972
+ new Set(
973
+ (bindingInfo?.parts || [])
974
+ .filter((part) => !part.model)
975
+ .map((part) => part.path || "")
976
+ .filter(Boolean)
977
+ )
978
+ );
979
+ const subtitlePaths = extractPaths(oObjectPageSubtitle?.getBindingInfo("value"));
980
+ const descriptionPaths = extractPaths(oObjectPageDescription?.getBindingInfo("value"));
981
+ const pathsToResolve = [...subtitlePaths, ...descriptionPaths];
960
982
  const appComponent = this.getAppComponent();
961
983
  const rootViewController = appComponent.getRootViewController();
962
984
  const fnClearCacheTitle = (): void => {
@@ -966,33 +988,20 @@ class ObjectPageController extends PageController {
966
988
  oObjectPageSubtitle.getBinding("value")?.attachChange(fnClearCacheTitle, this);
967
989
  this.clearTitleHierarchyCacheSetUp = true;
968
990
  }
969
- return {
970
- title: oObjectPage.data("ObjectPageTitle") || "",
971
- subtitle: oObjectPageSubtitle && oObjectPageSubtitle.getValue(),
991
+ const oObjectPageContext = oObjectPage.getBindingContext();
992
+ const build = (): { title: string; subtitle: string; intent: string; icon: string; description: string } => ({
993
+ title: oObjectPage.data("ObjectPageTitle") ?? "",
994
+ subtitle: oObjectPageSubtitle?.getValue() ?? "",
972
995
  intent: "",
973
996
  icon: "",
974
- description: objectPageDescription
975
- };
976
- }
977
-
978
- _executeHeaderShortcut(sId: string): void {
979
- const sButtonId = `${this.getView().getId()}--${sId}`,
980
- oButton = (this._getObjectPageLayoutControl().getHeaderTitle() as ObjectPageDynamicHeaderTitle)
981
- .getActions()
982
- .find((oElement) => oElement.getId() === sButtonId);
983
- if (oButton) {
984
- CommonUtils.fireButtonPress(oButton);
997
+ description: oObjectPageDescription?.getValue() ?? ""
998
+ });
999
+ //if no context or nothing to resolve, direct return
1000
+ if (!oObjectPageContext || pathsToResolve.length === 0) {
1001
+ return Promise.resolve(build());
985
1002
  }
986
- }
987
-
988
- _executeFooterShortcut(sId: string): void {
989
- const sButtonId = `${this.getView().getId()}--${sId}`,
990
- oButton = (this._getObjectPageLayoutControl().getFooter() as OverflowToolbar).getContent().find(function (
991
- oElement: UI5Element
992
- ) {
993
- return oElement.getMetadata().getName() === "sap.m.Button" && oElement.getId() === sButtonId;
994
- });
995
- CommonUtils.fireButtonPress(oButton);
1003
+ await Promise.all(pathsToResolve.map(async (p) => (oObjectPageContext as ODataV4Context).requestObject(p).catch(() => undefined)));
1004
+ return build();
996
1005
  }
997
1006
 
998
1007
  _executeTabShortCut(oExecution: UI5Event): void {
@@ -1275,7 +1284,8 @@ class ObjectPageController extends PageController {
1275
1284
  }
1276
1285
  }
1277
1286
  const isDocumentModified =
1278
- !!this.getView().getModel("ui").getProperty(UiModelConstants.DocumentModified) || !context.getProperty("HasActiveEntity");
1287
+ !!this.getView().getModel("ui").getProperty(UiModelConstants.DocumentModified) ||
1288
+ (!this.getStickyEditMode() && context.getProperty("HasActiveEntity") === false);
1279
1289
  const afterCancel: Function = (promiseResult: ODataV4Context) => {
1280
1290
  // focus is retained on the last focused element
1281
1291
  if (lastFocusedControlId !== undefined) {