@sapui5/sap.fe.templates 1.139.0 → 1.141.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.
Files changed (40) 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/ListComponent.js +4 -1
  5. package/src/sap/fe/templates/ListComponent.ts +4 -0
  6. package/src/sap/fe/templates/ListReport/ListReport.view.xml +1 -1
  7. package/src/sap/fe/templates/ListReport/ListReportController.controller.js +51 -10
  8. package/src/sap/fe/templates/ListReport/ListReportController.controller.ts +49 -8
  9. package/src/sap/fe/templates/ListReport/controls/MultipleModeControl.js +8 -3
  10. package/src/sap/fe/templates/ListReport/controls/MultipleModeControl.ts +7 -2
  11. package/src/sap/fe/templates/ListReport/manifest.json +1 -1
  12. package/src/sap/fe/templates/ListReport/overrides/ViewState.js +7 -23
  13. package/src/sap/fe/templates/ListReport/overrides/ViewState.ts +7 -26
  14. package/src/sap/fe/templates/ObjectPage/Component.js +4 -1
  15. package/src/sap/fe/templates/ObjectPage/Component.ts +4 -0
  16. package/src/sap/fe/templates/ObjectPage/ObjectPage.view.xml +1 -1
  17. package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.js +40 -34
  18. package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.ts +58 -42
  19. package/src/sap/fe/templates/ObjectPage/ObjectPageTemplating.js +14 -3
  20. package/src/sap/fe/templates/ObjectPage/ObjectPageTemplating.ts +11 -0
  21. package/src/sap/fe/templates/ObjectPage/card/BaseCardContentProvider.js +1 -2
  22. package/src/sap/fe/templates/ObjectPage/card/BaseCardContentProvider.ts +0 -1
  23. package/src/sap/fe/templates/ObjectPage/card/Generator.js +1 -2
  24. package/src/sap/fe/templates/ObjectPage/card/Generator.ts +0 -1
  25. package/src/sap/fe/templates/ObjectPage/card/facets/HeaderContent.js +1 -2
  26. package/src/sap/fe/templates/ObjectPage/card/facets/HeaderContent.ts +0 -1
  27. package/src/sap/fe/templates/ObjectPage/card/facets/HeaderTitle.js +1 -2
  28. package/src/sap/fe/templates/ObjectPage/card/facets/HeaderTitle.ts +0 -1
  29. package/src/sap/fe/templates/ObjectPage/manifest.json +1 -1
  30. package/src/sap/fe/templates/ObjectPage/overrides/CollaborationManager.js +4 -3
  31. package/src/sap/fe/templates/ObjectPage/overrides/CollaborationManager.ts +32 -29
  32. package/src/sap/fe/templates/ObjectPage/overrides/MessageHandler.js +15 -1
  33. package/src/sap/fe/templates/ObjectPage/overrides/MessageHandler.ts +16 -0
  34. package/src/sap/fe/templates/ObjectPage/overrides/Share.js +2 -2
  35. package/src/sap/fe/templates/ObjectPage/overrides/Share.ts +1 -1
  36. package/src/sap/fe/templates/ObjectPage/view/fragments/Actions.fragment.xml +8 -2
  37. package/src/sap/fe/templates/ObjectPage/view/fragments/SectionContent.fragment.xml +4 -1
  38. package/src/sap/fe/templates/library.js +1 -1
  39. package/src/sap/fe/templates/messagebundle_de.properties +2 -2
  40. package/src/sap/fe/templates/messagebundle_es.properties +1 -1
@@ -52,11 +52,11 @@ 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";
59
58
  import type UI5Event from "sap/ui/base/Event";
59
+ import type { CommandExecution$ExecuteEvent } from "sap/ui/core/CommandExecution";
60
60
  import type Control from "sap/ui/core/Control";
61
61
  import UI5Element from "sap/ui/core/Element";
62
62
  import type InvisibleText from "sap/ui/core/InvisibleText";
@@ -102,6 +102,7 @@ export type BindingParams = {
102
102
  };
103
103
 
104
104
  const ProgrammingModel = FELibrary.ProgrammingModel;
105
+
105
106
  @defineUI5Class("sap.fe.templates.ObjectPage.ObjectPageController")
106
107
  class ObjectPageController extends PageController {
107
108
  oView!: FEView;
@@ -442,14 +443,15 @@ class ObjectPageController extends PageController {
442
443
  // Due to the left alignment of the Draft switch and the collaborative draft avatar controls
443
444
  // there is a ToolbarSpacer in the actions aggregation which we need to exclude here!
444
445
  // Due to the ACC report, we also need not to check for the InvisibleText elements
445
- if (
446
- action.isA<ShareAPI>("sap.fe.macros.share.ShareAPI") ||
447
- 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") ||
448
450
  action.isA<EasyFillButton>("sap.fe.macros.ai.EasyFillButton") ||
449
451
  action.isA<CollaborationDraft>("sap.fe.templates.ObjectPage.components.CollaborationDraft")
450
452
  ) {
451
- // since ShareAPI, summarize and CollaborationDraft does not have a disable property
452
- // 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
453
455
  return action.getVisible();
454
456
  } else if (!action.isA<InvisibleText>("sap.ui.core.InvisibleText") && !action.isA<ToolbarSpacer>("sap.m.ToolbarSpacer")) {
455
457
  return action.getVisible() && (action as Button).getEnabled();
@@ -491,12 +493,13 @@ class ObjectPageController extends PageController {
491
493
  }
492
494
 
493
495
  _getFirstEmptyMandatoryFieldFromSubSection(aSubSections: ObjectPageSubSection[]): InputBase | undefined {
494
- if (aSubSections) {
495
- for (const subSection of aSubSections) {
496
- 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)[];
497
499
 
498
- if (aBlocks) {
499
- for (const blockControl of aBlocks) {
500
+ if (aBlocks) {
501
+ for (const blockControl of aBlocks) {
502
+ if (blockControl.getBindingContext?.()) {
500
503
  let aFormContainers;
501
504
 
502
505
  if (blockControl.isA<Form>("sap.ui.layout.form.Form")) {
@@ -522,6 +525,7 @@ class ObjectPageController extends PageController {
522
525
  }
523
526
  }
524
527
  }
528
+
525
529
  return undefined;
526
530
  }
527
531
 
@@ -608,7 +612,7 @@ class ObjectPageController extends PageController {
608
612
  if (document.URL === currentURL) {
609
613
  this._routing.navigateBackFromContext(oContext);
610
614
  }
611
- }, 100);
615
+ }, 500);
612
616
  };
613
617
 
614
618
  if (this.getAppComponent().getRouterProxy().checkIfBackHasSameContext()) {
@@ -624,13 +628,17 @@ class ObjectPageController extends PageController {
624
628
  Log.warning("Error while setting back navigation", e);
625
629
  });
626
630
  } else {
631
+ const hiddenDraftEnabled = (this.getAppComponent()?.getEnvironmentCapabilities()?.getCapabilities()?.HiddenDraft as HiddenDraft)
632
+ ?.enabled;
627
633
  draft.processDataLossOrDraftDiscardConfirmation(
628
634
  navBack,
629
635
  Function.prototype,
630
636
  oContext,
631
637
  this,
632
638
  true,
633
- draft.NavigationType.BackNavigation
639
+ draft.NavigationType.BackNavigation,
640
+ undefined,
641
+ hiddenDraftEnabled ? true : undefined
634
642
  );
635
643
  }
636
644
  }
@@ -795,7 +803,9 @@ class ObjectPageController extends PageController {
795
803
  if (cards.length > 0) {
796
804
  const cardObject = this.collaborationManager.updateCards(cards);
797
805
  const parentAppId = this.getAppComponent().getId();
798
- this.getAppComponent().getCollaborationManagerService().addCardsToCollaborationManager(cardObject, parentAppId);
806
+ this.getAppComponent()
807
+ .getCollaborationManagerService()
808
+ .addCardsToCollaborationManager(cardObject, parentAppId, this.getView().getId());
799
809
  this.getAppComponent().getCollaborationManagerService().shareAvailableCards();
800
810
  }
801
811
  }
@@ -949,12 +959,26 @@ class ObjectPageController extends PageController {
949
959
  return this.byId("fe::ObjectPage") as ObjectPageLayout;
950
960
  }
951
961
 
952
- _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 }> {
953
963
  const oObjectPage = this._getObjectPageLayoutControl();
954
964
  const oObjectPageSubtitle = oObjectPage.getCustomData().find(function (oCustomData) {
955
965
  return oCustomData.getKey() === "ObjectPageSubtitle";
956
966
  });
957
- 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];
958
982
  const appComponent = this.getAppComponent();
959
983
  const rootViewController = appComponent.getRootViewController();
960
984
  const fnClearCacheTitle = (): void => {
@@ -964,33 +988,20 @@ class ObjectPageController extends PageController {
964
988
  oObjectPageSubtitle.getBinding("value")?.attachChange(fnClearCacheTitle, this);
965
989
  this.clearTitleHierarchyCacheSetUp = true;
966
990
  }
967
- return {
968
- title: oObjectPage.data("ObjectPageTitle") || "",
969
- 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() ?? "",
970
995
  intent: "",
971
996
  icon: "",
972
- description: objectPageDescription
973
- };
974
- }
975
-
976
- _executeHeaderShortcut(sId: string): void {
977
- const sButtonId = `${this.getView().getId()}--${sId}`,
978
- oButton = (this._getObjectPageLayoutControl().getHeaderTitle() as ObjectPageDynamicHeaderTitle)
979
- .getActions()
980
- .find((oElement) => oElement.getId() === sButtonId);
981
- if (oButton) {
982
- 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());
983
1002
  }
984
- }
985
-
986
- _executeFooterShortcut(sId: string): void {
987
- const sButtonId = `${this.getView().getId()}--${sId}`,
988
- oButton = (this._getObjectPageLayoutControl().getFooter() as OverflowToolbar).getContent().find(function (
989
- oElement: UI5Element
990
- ) {
991
- return oElement.getMetadata().getName() === "sap.m.Button" && oElement.getId() === sButtonId;
992
- });
993
- CommonUtils.fireButtonPress(oButton);
1003
+ await Promise.all(pathsToResolve.map(async (p) => (oObjectPageContext as ODataV4Context).requestObject(p).catch(() => undefined)));
1004
+ return build();
994
1005
  }
995
1006
 
996
1007
  _executeTabShortCut(oExecution: UI5Event): void {
@@ -1211,6 +1222,9 @@ class ObjectPageController extends PageController {
1211
1222
  );
1212
1223
  }
1213
1224
  });
1225
+ const isSkipBindingToView = skipBindingToView as unknown as CommandExecution$ExecuteEvent;
1226
+ const isStandardSave =
1227
+ isSkipBindingToView && typeof isSkipBindingToView == "object" && isSkipBindingToView.getSource().getCommand() === "Save";
1214
1228
 
1215
1229
  const bindings = await Promise.all(awaitCreateDocuments);
1216
1230
  // We need to either reject or resolve a promise here and return it since this save
@@ -1223,7 +1237,8 @@ class ObjectPageController extends PageController {
1223
1237
  bExecuteSideEffectsOnError: executeSideEffectsOnError,
1224
1238
  bindings: bindings as unknown as ODataListBinding[],
1225
1239
  mergePatchDraft: this.mergePatchDraft,
1226
- skipBindingToView
1240
+ skipBindingToView,
1241
+ isStandardSave
1227
1242
  });
1228
1243
  } catch (error: unknown) {
1229
1244
  // If the saveDocument in editFlow returns errors we need
@@ -1269,7 +1284,8 @@ class ObjectPageController extends PageController {
1269
1284
  }
1270
1285
  }
1271
1286
  const isDocumentModified =
1272
- !!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);
1273
1289
  const afterCancel: Function = (promiseResult: ODataV4Context) => {
1274
1290
  // focus is retained on the last focused element
1275
1291
  if (lastFocusedControlId !== undefined) {