@sapui5/sap.fe.templates 1.102.0 → 1.103.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 (74) hide show
  1. package/package.json +1 -1
  2. package/src/sap/fe/templates/.library +1 -1
  3. package/src/sap/fe/templates/AnalyticalListPage/chart/FEChartDelegate.js +2 -2
  4. package/src/sap/fe/templates/AnalyticalListPage/chart/FEChartDelegate.ts +1 -1
  5. package/src/sap/fe/templates/Feedback.js +18 -18
  6. package/src/sap/fe/templates/Feedback.ts +12 -12
  7. package/src/sap/fe/templates/ListReport/ExtensionAPI.js +9 -12
  8. package/src/sap/fe/templates/ListReport/ExtensionAPI.ts +9 -12
  9. package/src/sap/fe/templates/ListReport/ListReport.view.xml +3 -1
  10. package/src/sap/fe/templates/ListReport/ListReportController.controller.js +80 -55
  11. package/src/sap/fe/templates/ListReport/ListReportController.controller.ts +95 -71
  12. package/src/sap/fe/templates/ListReport/overrides/IntentBasedNavigation.js +1 -1
  13. package/src/sap/fe/templates/ListReport/overrides/IntentBasedNavigation.ts +2 -2
  14. package/src/sap/fe/templates/ListReport/overrides/Share.js +3 -4
  15. package/src/sap/fe/templates/ListReport/overrides/Share.ts +6 -7
  16. package/src/sap/fe/templates/ListReport/overrides/ViewState.js +4 -5
  17. package/src/sap/fe/templates/ListReport/overrides/ViewState.ts +10 -10
  18. package/src/sap/fe/templates/ListReport/view/fragments/MultipleMode.fragment.js +1 -1
  19. package/src/sap/fe/templates/ListReport/view/fragments/MultipleMode.fragment.ts +1 -1
  20. package/src/sap/fe/templates/ObjectPage/ExtensionAPI.js +12 -16
  21. package/src/sap/fe/templates/ObjectPage/ExtensionAPI.ts +17 -20
  22. package/src/sap/fe/templates/ObjectPage/ObjectPage.view.xml +4 -3
  23. package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.js +148 -163
  24. package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.ts +138 -192
  25. package/src/sap/fe/templates/ObjectPage/ObjectPageTemplating.js +62 -73
  26. package/src/sap/fe/templates/ObjectPage/ObjectPageTemplating.ts +75 -90
  27. package/src/sap/fe/templates/ObjectPage/controls/SubSectionBlock.js +2 -3
  28. package/src/sap/fe/templates/ObjectPage/controls/SubSectionBlock.ts +4 -4
  29. package/src/sap/fe/templates/ObjectPage/designtime/StashableHBox.designtime.js +1 -1
  30. package/src/sap/fe/templates/ObjectPage/designtime/StashableHBox.designtime.ts +1 -1
  31. package/src/sap/fe/templates/ObjectPage/designtime/StashableVBox.designtime.js +1 -1
  32. package/src/sap/fe/templates/ObjectPage/designtime/StashableVBox.designtime.ts +1 -1
  33. package/src/sap/fe/templates/ObjectPage/handler/DraftHandler.js +103 -0
  34. package/src/sap/fe/templates/ObjectPage/handler/DraftHandler.ts +97 -0
  35. package/src/sap/fe/templates/ObjectPage/overrides/IntentBasedNavigation.js +1 -1
  36. package/src/sap/fe/templates/ObjectPage/overrides/IntentBasedNavigation.ts +5 -5
  37. package/src/sap/fe/templates/ObjectPage/overrides/InternalRouting.js +1 -1
  38. package/src/sap/fe/templates/ObjectPage/overrides/InternalRouting.ts +2 -2
  39. package/src/sap/fe/templates/ObjectPage/overrides/MessageHandler.js +1 -1
  40. package/src/sap/fe/templates/ObjectPage/overrides/MessageHandler.ts +2 -2
  41. package/src/sap/fe/templates/ObjectPage/overrides/Paginator.js +1 -1
  42. package/src/sap/fe/templates/ObjectPage/overrides/Paginator.ts +1 -1
  43. package/src/sap/fe/templates/ObjectPage/overrides/Share.js +15 -15
  44. package/src/sap/fe/templates/ObjectPage/overrides/Share.ts +17 -28
  45. package/src/sap/fe/templates/ObjectPage/overrides/ViewState.js +2 -2
  46. package/src/sap/fe/templates/ObjectPage/overrides/ViewState.ts +4 -4
  47. package/src/sap/fe/templates/ObjectPage/view/fragments/Actions.fragment.xml +6 -1
  48. package/src/sap/fe/templates/ObjectPage/view/fragments/EditableHeaderFacet.fragment.xml +10 -2
  49. package/src/sap/fe/templates/ObjectPage/view/fragments/FooterContent.fragment.xml +1 -1
  50. package/src/sap/fe/templates/ObjectPage/view/fragments/HeaderFacet.fragment.xml +1 -14
  51. package/src/sap/fe/templates/ObjectPage/view/fragments/HeadingTitle.fragment.xml +1 -0
  52. package/src/sap/fe/templates/ObjectPage/view/fragments/ObjectPageHeaderAddress.fragment.xml +7 -2
  53. package/src/sap/fe/templates/ObjectPage/view/fragments/ObjectPageHeaderContact.fragment.xml +26 -0
  54. package/src/sap/fe/templates/ObjectPage/view/fragments/ObjectPageHeaderForm.fragment.xml +1 -1
  55. package/src/sap/fe/templates/ObjectPage/view/fragments/Section.fragment.xml +4 -1
  56. package/src/sap/fe/templates/ObjectPage/view/fragments/SectionContent.fragment.xml +6 -2
  57. package/src/sap/fe/templates/ObjectPage/view/fragments/SectionFormContent.fragment.xml +1 -0
  58. package/src/sap/fe/templates/ObjectPage/view/fragments/SectionMoreFormContent.fragment.xml +1 -0
  59. package/src/sap/fe/templates/ObjectPage/view/fragments/SwitchDraftAndActiveObjectPopOver.fragment.xml +2 -2
  60. package/src/sap/fe/templates/RootContainer/controller/Fcl.controller.js +25 -28
  61. package/src/sap/fe/templates/RootContainer/controller/Fcl.controller.ts +30 -33
  62. package/src/sap/fe/templates/RootContainer/controller/NavContainer.controller.js +3 -4
  63. package/src/sap/fe/templates/RootContainer/controller/NavContainer.controller.ts +4 -5
  64. package/src/sap/fe/templates/RootContainer/controller/RootContainerBaseController.js +140 -52
  65. package/src/sap/fe/templates/RootContainer/controller/RootContainerBaseController.ts +108 -54
  66. package/src/sap/fe/templates/RootContainer/overrides/EditFlow.js +1 -1
  67. package/src/sap/fe/templates/RootContainer/overrides/EditFlow.ts +3 -3
  68. package/src/sap/fe/templates/TableScroller.js +3 -3
  69. package/src/sap/fe/templates/TableScroller.ts +2 -2
  70. package/src/sap/fe/templates/controls/Table.fragment.xml +1 -0
  71. package/src/sap/fe/templates/library.js +5 -2
  72. package/src/sap/fe/templates/library.ts +3 -0
  73. package/src/sap/fe/templates/messagebundle.properties +6 -18
  74. package/src/sap/fe/templates/messagebundle_pt.properties +1 -1
@@ -1,4 +1,4 @@
1
- import ResourceBundle from "sap/base/i18n/ResourceBundle";
1
+ import type ResourceBundle from "sap/base/i18n/ResourceBundle";
2
2
  import Log from "sap/base/Log";
3
3
  import merge from "sap/base/util/merge";
4
4
  import CommonUtils from "sap/fe/core/CommonUtils";
@@ -19,41 +19,37 @@ import Placeholder from "sap/fe/core/controllerextensions/Placeholder";
19
19
  import Share from "sap/fe/core/controllerextensions/Share";
20
20
  import ViewState from "sap/fe/core/controllerextensions/ViewState";
21
21
  import { defineUI5Class, extensible, finalExtension, publicExtension, usingExtension } from "sap/fe/core/helpers/ClassSupport";
22
- import ModelHelper, { InternalModelContext } from "sap/fe/core/helpers/ModelHelper";
22
+ import type { InternalModelContext } from "sap/fe/core/helpers/ModelHelper";
23
+ import ModelHelper from "sap/fe/core/helpers/ModelHelper";
23
24
  import PageController from "sap/fe/core/PageController";
24
25
  import ChartRuntime from "sap/fe/macros/chart/ChartRuntime";
25
26
  import CommonHelper from "sap/fe/macros/CommonHelper";
26
27
  import DelegateUtil from "sap/fe/macros/DelegateUtil";
27
28
  import TableUtils from "sap/fe/macros/table/Utils";
28
29
  import SelectionVariant from "sap/fe/navigation/SelectionVariant";
29
- import { default as ExtensionAPI, default as ObjectPageExtensionAPI } from "sap/fe/templates/ObjectPage/ExtensionAPI";
30
- import RootContainerBaseController from "sap/fe/templates/RootContainer/controller/RootContainerBaseController";
30
+ import type { default as ObjectPageExtensionAPI } from "sap/fe/templates/ObjectPage/ExtensionAPI";
31
+ import { default as ExtensionAPI } from "sap/fe/templates/ObjectPage/ExtensionAPI";
32
+ import type RootContainerBaseController from "sap/fe/templates/RootContainer/controller/RootContainerBaseController";
31
33
  import EditFlowOverrides from "sap/fe/templates/RootContainer/overrides/EditFlow";
32
34
  import TableScroller from "sap/fe/templates/TableScroller";
33
35
  import InstanceManager from "sap/m/InstanceManager";
34
36
  import Link from "sap/m/Link";
35
37
  import MessageBox from "sap/m/MessageBox";
36
- import Popover from "sap/m/Popover";
37
- import SelectList from "sap/m/SelectList";
38
- import Event from "sap/ui/base/Event";
39
- import Control from "sap/ui/core/Control";
38
+ import type Popover from "sap/m/Popover";
40
39
  import Core from "sap/ui/core/Core";
41
- import Fragment from "sap/ui/core/Fragment";
42
- import Item from "sap/ui/core/Item";
43
40
  import OverrideExecution from "sap/ui/core/mvc/OverrideExecution";
44
- import XMLPreprocessor from "sap/ui/core/util/XMLPreprocessor";
45
- import XMLTemplateProcessor from "sap/ui/core/XMLTemplateProcessor";
46
- import Binding from "sap/ui/model/Binding";
41
+ import type Binding from "sap/ui/model/Binding";
47
42
  import JSONModel from "sap/ui/model/json/JSONModel";
48
- import Context from "sap/ui/model/odata/v4/Context";
43
+ import type Context from "sap/ui/model/odata/v4/Context";
49
44
  import ODataListBinding from "sap/ui/model/odata/v4/ODataListBinding";
50
- import ODataMetaModel from "sap/ui/model/odata/v4/ODataMetaModel";
51
- import ODataModel from "sap/ui/model/odata/v4/ODataModel";
52
- import ResourceModel from "sap/ui/model/resource/ResourceModel";
53
- import ObjectPageDynamicHeaderTitle from "sap/uxap/ObjectPageDynamicHeaderTitle";
54
- import ObjectPageLayout from "sap/uxap/ObjectPageLayout";
55
- import ObjectPageSection from "sap/uxap/ObjectPageSection";
56
- import ObjectPageSubSection from "sap/uxap/ObjectPageSubSection";
45
+ import type ODataMetaModel from "sap/ui/model/odata/v4/ODataMetaModel";
46
+ import type ODataModel from "sap/ui/model/odata/v4/ODataModel";
47
+ import type ResourceModel from "sap/ui/model/resource/ResourceModel";
48
+ import type ObjectPageDynamicHeaderTitle from "sap/uxap/ObjectPageDynamicHeaderTitle";
49
+ import type ObjectPageLayout from "sap/uxap/ObjectPageLayout";
50
+ import type ObjectPageSection from "sap/uxap/ObjectPageSection";
51
+ import type ObjectPageSubSection from "sap/uxap/ObjectPageSubSection";
52
+ import DraftHandler from "./handler/DraftHandler";
57
53
  import IntentBasedNavigationOverride from "./overrides/IntentBasedNavigation";
58
54
  import InternalRoutingOverride from "./overrides/InternalRouting";
59
55
  import MessageHandlerOverride from "./overrides/MessageHandler";
@@ -151,11 +147,15 @@ class ObjectPageController extends PageController {
151
147
  onExit() {
152
148
  if (this.mCustomSectionExtensionAPIs) {
153
149
  for (const sId of Object.keys(this.mCustomSectionExtensionAPIs)) {
154
- this.mCustomSectionExtensionAPIs[sId] && this.mCustomSectionExtensionAPIs[sId].destroy();
150
+ if (this.mCustomSectionExtensionAPIs[sId]) {
151
+ this.mCustomSectionExtensionAPIs[sId].destroy();
152
+ }
155
153
  }
156
154
  delete this.mCustomSectionExtensionAPIs;
157
155
  }
158
- this.extensionAPI && this.extensionAPI.destroy();
156
+ if (this.extensionAPI) {
157
+ this.extensionAPI.destroy();
158
+ }
159
159
  delete this.extensionAPI;
160
160
 
161
161
  const oMessageButton = this.getView().byId("fe::FooterBar::MessageButton"),
@@ -177,7 +177,7 @@ class ObjectPageController extends PageController {
177
177
  onBeforeRendering() {
178
178
  PageController.prototype.onBeforeRendering.apply(this);
179
179
  // In the retrieveTextFromValueList scenario we need to ensure in case of reload/refresh that the meta model in the methode retrieveTextFromValueList of the FieldRuntime is available
180
- if (this.oView.oViewData.retrieveTextFromValueList && CommonHelper.getMetaModel() === undefined) {
180
+ if (this.oView.oViewData?.retrieveTextFromValueList && CommonHelper.getMetaModel() === undefined) {
181
181
  CommonHelper.setMetaModel(this.getAppComponent().getMetaModel());
182
182
  }
183
183
  }
@@ -195,7 +195,7 @@ class ObjectPageController extends PageController {
195
195
  _onBeforeBinding(oContext: any, mParameters: any) {
196
196
  // TODO: we should check how this comes together with the transaction helper, same to the change in the afterBinding
197
197
  const aTables = this._findTables(),
198
- oObjectPage = this._getObjectPageLayoutControl() as ObjectPageLayout,
198
+ oObjectPage = this._getObjectPageLayoutControl(),
199
199
  oInternalModelContext = this.getView().getBindingContext("internal") as InternalModelContext,
200
200
  oInternalModel = this.getView().getModel("internal") as JSONModel,
201
201
  aBatchGroups = oInternalModelContext.getProperty("batchGroups"),
@@ -309,7 +309,13 @@ class ObjectPageController extends PageController {
309
309
  oFirstClickableElement = aActions.find(function (oAction: any) {
310
310
  // Due to the left alignment of the Draft switch and the collaborative draft avatar controls
311
311
  // there is a ToolbarSpacer in the actions aggregation which we need to exclude here!
312
- return !oAction.isA("sap.m.ToolbarSpacer") && oAction.getVisible() && oAction.getEnabled();
312
+ // Due to the ACC report, we also need not to check for the InvisibleText elements
313
+ return (
314
+ !oAction.isA("sap.ui.core.InvisibleText") &&
315
+ !oAction.isA("sap.m.ToolbarSpacer") &&
316
+ oAction.getVisible() &&
317
+ oAction.getEnabled()
318
+ );
313
319
  });
314
320
  }
315
321
  return oFirstClickableElement;
@@ -348,7 +354,7 @@ class ObjectPageController extends PageController {
348
354
  return aFields[0];
349
355
  }
350
356
  } catch (error) {
351
- Log.debug("Error when searching for mandaotry empty field: " + error);
357
+ Log.debug(`Error when searching for mandaotry empty field: ${error}`);
352
358
  }
353
359
  }
354
360
  }
@@ -362,7 +368,7 @@ class ObjectPageController extends PageController {
362
368
  }
363
369
 
364
370
  _updateFocusInEditMode(aSubSections: any) {
365
- const oObjectPage = this._getObjectPageLayoutControl() as ObjectPageLayout;
371
+ const oObjectPage = this._getObjectPageLayoutControl();
366
372
 
367
373
  const oMandatoryField = this._getFirstEmptyMandatoryFieldFromSubSection(aSubSections);
368
374
  let oFieldToFocus: any;
@@ -405,7 +411,7 @@ class ObjectPageController extends PageController {
405
411
 
406
412
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
407
413
  _onAfterBinding(oBindingContext: any, mParameters: any) {
408
- const oObjectPage = this._getObjectPageLayoutControl() as ObjectPageLayout;
414
+ const oObjectPage = this._getObjectPageLayoutControl();
409
415
  const aTables = this._findTables();
410
416
 
411
417
  this._sideEffects.clearPropertiesStatus();
@@ -449,7 +455,7 @@ class ObjectPageController extends PageController {
449
455
  // Update 'enabled' property of DataFieldForAction buttons on table toolbar
450
456
  // The same is also performed on Table selectionChange event
451
457
  const oActionOperationAvailableMap = JSON.parse(
452
- CommonHelper.parseCustomData(DelegateUtil.getCustomData(oTable, "operationAvailableMap")) as any
458
+ CommonHelper.parseCustomData(DelegateUtil.getCustomData(oTable, "operationAvailableMap"))
453
459
  ),
454
460
  aSelectedContexts = oTable.getSelectedContexts();
455
461
 
@@ -519,7 +525,7 @@ class ObjectPageController extends PageController {
519
525
  };
520
526
 
521
527
  if (!oBinding) {
522
- Log.error("Expected binding missing for table: " + oTable.getId());
528
+ Log.error(`Expected binding missing for table: ${oTable.getId()}`);
523
529
  return;
524
530
  }
525
531
 
@@ -640,9 +646,7 @@ class ObjectPageController extends PageController {
640
646
  /**
641
647
  * Get the status of edit mode for sticky session.
642
648
  *
643
- * @returns {boolean} The status of edit mode for sticky session
644
- *
645
- *
649
+ * @returns The status of edit mode for sticky session
646
650
  */
647
651
  getStickyEditMode() {
648
652
  const oBindingContext = this.getView().getBindingContext && (this.getView().getBindingContext() as Context);
@@ -665,18 +669,16 @@ class ObjectPageController extends PageController {
665
669
  const oObjectPageSubtitle = oObjectPage.getCustomData().find(function (oCustomData: any) {
666
670
  return oCustomData.getKey() === "ObjectPageSubtitle";
667
671
  });
668
- const oTitleInfo = {
672
+ return {
669
673
  title: oObjectPage.data("ObjectPageTitle") || "",
670
674
  subtitle: oObjectPageSubtitle && oObjectPageSubtitle.getValue(),
671
675
  intent: "",
672
676
  icon: ""
673
677
  };
674
-
675
- return oTitleInfo;
676
678
  }
677
679
 
678
680
  _executeHeaderShortcut(sId: any) {
679
- const sButtonId = this.getView().getId() + "--" + sId,
681
+ const sButtonId = `${this.getView().getId()}--${sId}`,
680
682
  oButton = (this._getObjectPageLayoutControl().getHeaderTitle() as ObjectPageDynamicHeaderTitle)
681
683
  .getActions()
682
684
  .find(function (oElement: any) {
@@ -686,7 +688,7 @@ class ObjectPageController extends PageController {
686
688
  }
687
689
 
688
690
  _executeFooterShortcut(sId: any) {
689
- const sButtonId = this.getView().getId() + "--" + sId,
691
+ const sButtonId = `${this.getView().getId()}--${sId}`,
690
692
  oButton = (this._getObjectPageLayoutControl().getFooter() as any).getContent().find(function (oElement: any) {
691
693
  return oElement.getMetadata().getName() === "sap.m.Button" && oElement.getId() === sButtonId;
692
694
  });
@@ -705,12 +707,11 @@ class ObjectPageController extends PageController {
705
707
  if (iSelectedSectionIndex <= iSectionIndexMax - 1) {
706
708
  newSection = aSections[++iSelectedSectionIndex];
707
709
  }
708
- } else {
710
+ } else if (iSelectedSectionIndex !== 0) {
709
711
  // PreviousTab
710
- if (iSelectedSectionIndex !== 0) {
711
- newSection = aSections[--iSelectedSectionIndex];
712
- }
712
+ newSection = aSections[--iSelectedSectionIndex];
713
713
  }
714
+
714
715
  if (newSection) {
715
716
  oObjectPage.setSelectedSection(newSection);
716
717
  newSection.focus();
@@ -797,7 +798,19 @@ class ObjectPageController extends PageController {
797
798
  bExecuteSideEffectsOnError: bExecuteSideEffectsOnError,
798
799
  bindings: aBindings
799
800
  };
800
- return this.editFlow.saveDocument(oContext, mParameters).catch(() => this._showMessagePopover);
801
+ // We need to either reject or resolve a promise here and return it since this save
802
+ // function is not only called when pressing the save button in the footer, but also
803
+ // when the user selects create or save in a dataloss popup.
804
+ // The logic of the dataloss popup needs to detect if the save had errors or not in order
805
+ // to decide if the subsequent action - like a back navigation - has to be executed or not.
806
+ return this.editFlow.saveDocument(oContext, mParameters).catch((...args) => {
807
+ // If the saveDocument in editFlow returns errors we need
808
+ // to show the message popover here and ensure that the
809
+ // dataloss logic does not perform the follow up function
810
+ // like e.g. a back navigation hence we return a promise and reject it
811
+ this._showMessagePopover(...args);
812
+ return Promise.reject(...args);
813
+ });
801
814
  })
802
815
  .finally(function () {
803
816
  if (BusyLocker.isLocked(oModel)) {
@@ -823,72 +836,8 @@ class ObjectPageController extends PageController {
823
836
  return this.editFlow.applyDocument(oContext).catch(() => this._showMessagePopover());
824
837
  }
825
838
 
826
- _showSwitchDraftAndActivePopover(event: Event) {
827
- const view = this.getView(),
828
- source = event.getSource(),
829
- fragmentName = "sap.fe.templates.ObjectPage.view.fragments.SwitchDraftAndActiveObjectPopOver";
830
-
831
- if (this.switchDraftAndActivePopOver) {
832
- this.switchDraftAndActivePopOver.openBy(source, false);
833
- } else {
834
- const localThisModel = new JSONModel({}),
835
- preprocessorSettings = {
836
- bindingContexts: {
837
- "this": localThisModel.createBindingContext("/")
838
- },
839
- models: {
840
- "this": localThisModel
841
- }
842
- };
843
- const popoverFragment = XMLTemplateProcessor.loadTemplate(fragmentName, "fragment");
844
- Promise.resolve(XMLPreprocessor.process(popoverFragment, { name: fragmentName }, preprocessorSettings))
845
- .then((fragment) => {
846
- return Fragment.load({ definition: fragment, controller: this });
847
- })
848
- .then((popover: any) => {
849
- view.addDependent(popover);
850
- popover.setModel(view.getModel("sap.fe.i18n"), "i18n");
851
- popover.setPlacement("Bottom");
852
- this.switchDraftAndActivePopOver = popover;
853
- popover.attachAfterOpen(() => {
854
- // While the list entry corresponding to the currently displayed document version is emphasized with a blue
855
- // background, we need to pre-focus the other entry
856
- const context: any = this.getView().getBindingContext(),
857
- isActiveEntity = context.getObject().IsActiveEntity;
858
- const switchDraftAndActiveOptionsList: SelectList = (popover.getContent() as unknown as Control[]).find(
859
- (element) => element.data("listIdentifier") === "switchDraftAndActivePopoverList"
860
- ) as SelectList;
861
- const listItemToFocus: Item = isActiveEntity
862
- ? (switchDraftAndActiveOptionsList.getItems().find((element) => element.getKey() === "switchToDraft") as Item)
863
- : (switchDraftAndActiveOptionsList.getItems().find((element) => element.getKey() === "switchToActive") as Item);
864
- listItemToFocus.focus();
865
- });
866
- popover.openBy(source);
867
- // ensure to remove the reference to the draft popover as it would be destroyed on exit
868
- view.attachEventOnce("beforeExit", () => {
869
- delete this.switchDraftAndActivePopOver;
870
- });
871
- })
872
- .catch(function (Error) {
873
- Log.error("Error while opening the draft switch popup", Error);
874
- });
875
- }
876
- }
877
-
878
- _switchDraftAndActivePopoverListSelect(event: Event) {
879
- const context: any = this.getView().getBindingContext(),
880
- selectedItemKey = event.getParameter("item").getProperty("key"),
881
- isActiveEntity = context.getObject().IsActiveEntity;
882
- // It was decided that we should NOT set the entry in the list corresponding to the currently displayed document version to
883
- // disabled, hence the user can click entries which to not cause an action (clicking "Draft" when you already display the
884
- // draft version of the document)
885
- // Hence we check here which entry in the list was clicked and which document version we currently display and only do
886
- // the switch between draft / active version if it makes sense.
887
- if ((isActiveEntity && selectedItemKey === "switchToDraft") || (!isActiveEntity && selectedItemKey === "switchToActive")) {
888
- this.editFlow.toggleDraftActive(context);
889
- }
890
- ((event.getSource() as Control).getParent() as Popover).close();
891
- }
839
+ _showSwitchDraftAndActivePopover = DraftHandler.showSwitchDraftAndActivePopover;
840
+ _switchDraftAndActivePopoverListSelect = DraftHandler.switchDraftAndActivePopoverListSelect;
892
841
 
893
842
  _updateRelatedApps() {
894
843
  const oObjectPage = this._getObjectPageLayoutControl();
@@ -929,15 +878,13 @@ class ObjectPageController extends PageController {
929
878
  ) {
930
879
  //In case there is only a single table in a section we fit that to the whole page so that the scrollbar comes only on table and not on page
931
880
  aSubsection.addStyleClass("sapUxAPObjectPageSubSectionFitContainer");
932
- } else {
933
- if (aSubSectionTables && !aSubsection.hasStyleClass("sapUxAPObjectPageSubSectionFitContainer")) {
934
- aSubSectionTables.forEach(function (oTable: { table: any; gridTable: any }) {
935
- if (oTable.gridTable) {
936
- //Resetting the row count to default value in case we have a combination of forms and tables or multiple tables in a subsection
937
- oTable.table.getType().setRowCount(null);
938
- }
939
- });
940
- }
881
+ } else if (aSubSectionTables && !aSubsection.hasStyleClass("sapUxAPObjectPageSubSectionFitContainer")) {
882
+ aSubSectionTables.forEach(function (oTable: { table: any; gridTable: any }) {
883
+ if (oTable.gridTable) {
884
+ //Resetting the row count to default value in case we have a combination of forms and tables or multiple tables in a subsection
885
+ oTable.table.getType().setRowCount(null);
886
+ }
887
+ });
941
888
  }
942
889
  }
943
890
 
@@ -982,9 +929,9 @@ class ObjectPageController extends PageController {
982
929
  /**
983
930
  * Chart Context is resolved for 1:n microcharts.
984
931
  *
985
- * @param {sap.ui.model.Context} oChartContext The Context of the MicroChart
986
- * @param {string} sChartPath The collectionPath of the the chart
987
- * @returns {Array} Array of Attributes of the chart Context
932
+ * @param oChartContext The Context of the MicroChart
933
+ * @param sChartPath The collectionPath of the the chart
934
+ * @returns Array of Attributes of the chart Context
988
935
  */
989
936
  _getChartContextData(oChartContext: any, sChartPath: string) {
990
937
  const oContextData = oChartContext.getObject();
@@ -1005,7 +952,6 @@ class ObjectPageController extends PageController {
1005
952
  * @function
1006
953
  * @name sap.fe.templates.ObjectPage.ObjectPageController.controller#_scrollTablesToRow
1007
954
  * @param {string} sRowPath 'sPath of the table row'
1008
- *
1009
955
  */
1010
956
 
1011
957
  _scrollTablesToRow(sRowPath: string) {
@@ -1022,10 +968,10 @@ class ObjectPageController extends PageController {
1022
968
  *
1023
969
  * @function
1024
970
  * @name _mergeMultipleContexts
1025
- * @param {object} oPageContext Page context
1026
- * @param {object|Array} aLineContext Selected Contexts
1027
- * @param {string} sChartPath Collection name of the chart
1028
- * @returns {object} Selection Variant Object
971
+ * @param oPageContext Page context
972
+ * @param aLineContext Selected Contexts
973
+ * @param sChartPath Collection name of the chart
974
+ * @returns Selection Variant Object
1029
975
  */
1030
976
  _mergeMultipleContexts(oPageContext: Context, aLineContext: any[], sChartPath: string) {
1031
977
  let aAttributes: any[] = [],
@@ -1044,14 +990,14 @@ class ObjectPageController extends PageController {
1044
990
  sPathLine = oContext.getPath();
1045
991
  sMetaPathLine = oMetaModel && oMetaModel.getMetaPath(sPathLine).replace(/^\/*/, "");
1046
992
 
1047
- aLineContext.map((oSingleContext: any) => {
993
+ aLineContext.forEach((oSingleContext: any) => {
1048
994
  if (sChartPath) {
1049
995
  const oChartContextData = this._getChartContextData(oSingleContext, sChartPath);
1050
996
  if (oChartContextData) {
1051
- aAttributes = oChartContextData.map(function (oChartContextData: any) {
997
+ aAttributes = oChartContextData.map(function (oSubChartContextData: any) {
1052
998
  return {
1053
- contextData: oChartContextData,
1054
- entitySet: sMetaPathPage + "/" + sChartPath
999
+ contextData: oSubChartContextData,
1000
+ entitySet: `${sMetaPathPage}/${sChartPath}`
1055
1001
  };
1056
1002
  });
1057
1003
  }
@@ -1099,54 +1045,55 @@ class ObjectPageController extends PageController {
1099
1045
  *
1100
1046
  * @function
1101
1047
  * @param {sap.m.Breadcrumbs} [oSource] parent control
1102
- * @description Used when context of the objectpage changes.
1048
+ * @description Used when context of the object page changes.
1103
1049
  * This event callback is attached to modelContextChange
1104
1050
  * event of the Breadcrumb control to catch context change.
1105
- * Then element binding and hrefs are updated for each Link.
1051
+ * Then element binding and hrefs are updated for each link.
1106
1052
  *
1107
1053
  * @ui5-restricted
1108
1054
  * @experimental
1109
1055
  */
1110
- _setBreadcrumbLinks(oSource: any) {
1111
- const oContext = oSource.getBindingContext();
1112
- const oAppComponent = this.getAppComponent();
1113
- if (oContext) {
1114
- const sNewPath = oContext.getPath(),
1115
- aPathParts = sNewPath.split("/"),
1116
- oMetaModel = oAppComponent.getMetaModel();
1117
- let sPath = "",
1118
- iSkipParameterized = 0;
1119
-
1120
- aPathParts.shift();
1121
- aPathParts.splice(-1, 1);
1122
- aPathParts.forEach(function (sPathPart: any, i: any) {
1123
- sPath += "/" + sPathPart;
1124
- const oRootViewController = oAppComponent.getRootViewController() as RootContainerBaseController;
1125
- const sParameterPath = oMetaModel.getMetaPath(sPath);
1126
- const bResultContext = oMetaModel.getObject(sParameterPath + "/@com.sap.vocabularies.Common.v1.ResultContext");
1127
- if (bResultContext) {
1128
- // We dont need to create a breadcrumb for Parameter path
1129
- iSkipParameterized = 1;
1130
- return;
1056
+ async _setBreadcrumbLinks(oSource: any) {
1057
+ const oContext = oSource.getBindingContext(),
1058
+ oAppComponent = this.getAppComponent(),
1059
+ aPromises: Promise<void>[] = [],
1060
+ aSkipParameterized: any[] = [],
1061
+ sNewPath = oContext && oContext.getPath(),
1062
+ aPathParts = sNewPath && sNewPath.split("/"),
1063
+ oMetaModel = oAppComponent && oAppComponent.getMetaModel();
1064
+ let sPath = "";
1065
+ aPathParts.shift();
1066
+ aPathParts.splice(-1, 1);
1067
+ aPathParts.forEach(function (sPathPart: any) {
1068
+ sPath += `/${sPathPart}`;
1069
+ const oRootViewController = oAppComponent.getRootViewController() as RootContainerBaseController;
1070
+ const sParameterPath = oMetaModel.getMetaPath(sPath);
1071
+ const bResultContext = oMetaModel.getObject(`${sParameterPath}/@com.sap.vocabularies.Common.v1.ResultContext`);
1072
+ if (bResultContext) {
1073
+ // We dont need to create a breadcrumb for Parameter path
1074
+ aSkipParameterized.push(1);
1075
+ return;
1076
+ } else {
1077
+ aSkipParameterized.push(0);
1078
+ }
1079
+ aPromises.push(oRootViewController.getTitleInfoFromPath(sPath));
1080
+ });
1081
+ try {
1082
+ const titleHierarchyInfos: any[] = await Promise.all(aPromises);
1083
+ let idx, hierarchyPosition, oLink;
1084
+ for (const titleHierarchyInfo of titleHierarchyInfos) {
1085
+ hierarchyPosition = titleHierarchyInfos.indexOf(titleHierarchyInfo);
1086
+ idx = hierarchyPosition - aSkipParameterized[hierarchyPosition];
1087
+ oLink = oSource.getLinks()[idx] ? oSource.getLinks()[idx] : new Link();
1088
+ //sCurrentEntity is a fallback value in case of empty title
1089
+ oLink.setText(titleHierarchyInfo.subtitle || titleHierarchyInfo.title);
1090
+ oLink.setHref(titleHierarchyInfo.intent);
1091
+ if (!oSource.getLinks()[idx]) {
1092
+ oSource.addLink(oLink);
1131
1093
  }
1132
-
1133
- const pWaitForTitleHiearchyInfo = oRootViewController.getTitleInfoFromPath(sPath);
1134
-
1135
- pWaitForTitleHiearchyInfo
1136
- .then(function (oTitleHiearchyInfo: any) {
1137
- const idx = i - iSkipParameterized,
1138
- oLink = oSource.getLinks()[idx] ? oSource.getLinks()[idx] : new Link();
1139
- // sCurrentEntity is a fallback value in case of empty title
1140
- oLink.setText(oTitleHiearchyInfo.subtitle || oTitleHiearchyInfo.title);
1141
- oLink.setHref(oTitleHiearchyInfo.intent);
1142
- if (!oSource.getLinks()[idx]) {
1143
- oSource.addLink(oLink);
1144
- }
1145
- })
1146
- .catch(function (oError: any) {
1147
- Log.error("Error while computing the title hierarchy", oError);
1148
- });
1149
- });
1094
+ }
1095
+ } catch (error: any) {
1096
+ Log.error("Error while setting the breadcrumb links:" + error);
1150
1097
  }
1151
1098
  }
1152
1099
 
@@ -1182,17 +1129,17 @@ class ObjectPageController extends PageController {
1182
1129
  const sLinkId = id;
1183
1130
  // process viable links from getLinks for all datapoints having outbound
1184
1131
  if (aSupportedLinks && aSupportedLinks.length === 1 && aSupportedLinks[0].supported) {
1185
- oInternalModelContext.setProperty("isHeaderDPLinkVisible/" + sLinkId, true);
1132
+ oInternalModelContext.setProperty(`isHeaderDPLinkVisible/${sLinkId}`, true);
1186
1133
  }
1187
1134
  }
1188
1135
 
1189
1136
  /**
1190
- * @param oDataPoints
1137
+ * @param oSubDataPoints
1191
1138
  * @param oPageData
1192
1139
  */
1193
- function fnGetLinks(oDataPoints: any, oPageData: any) {
1194
- for (const sId in oDataPoints) {
1195
- const oDataPoint = oDataPoints[sId];
1140
+ function fnGetLinks(oSubDataPoints: any, oPageData: any) {
1141
+ for (const sId in oSubDataPoints) {
1142
+ const oDataPoint = oSubDataPoints[sId];
1196
1143
  const oParams: any = {};
1197
1144
  const oLink = oView.byId(sId);
1198
1145
  if (!oLink) {
@@ -1305,7 +1252,7 @@ class ObjectPageController extends PageController {
1305
1252
  }
1306
1253
  })
1307
1254
  .catch(function (err: any) {
1308
- Log.error("An error occurs while scrolling to the newly created Item: " + err);
1255
+ Log.error(`An error occurs while scrolling to the newly created Item: ${err}`);
1309
1256
  });
1310
1257
  }
1311
1258
  // fire ModelContextChange on the message button whenever the table context changes
@@ -1317,21 +1264,20 @@ class ObjectPageController extends PageController {
1317
1264
  * Invokes an action - bound/unbound and sets the page dirty.
1318
1265
  *
1319
1266
  * @param oView
1320
- * @param {string} sActionName The name of the action to be called
1321
- * @param {map} [mParameters] Contains the following attributes:
1322
- * @param {sap.ui.model.odata.v4.Context} [mParameters.contexts] Mandatory for a bound action, either one context or an array with contexts for which the action shall be called
1323
- * @param {sap.ui.model.odata.v4.ODataModel} [mParameters.model] Mandatory for an unbound action; an instance of an OData V4 model
1324
- * @returns {Promise}
1267
+ * @param sActionName The name of the action to be called
1268
+ * @param [mParameters] Contains the following attributes:
1269
+ * @param [mParameters.contexts] Mandatory for a bound action, either one context or an array with contexts for which the action shall be called
1270
+ * @param [mParameters.model] Mandatory for an unbound action; an instance of an OData V4 model
1271
+ * @returns The action promise
1325
1272
  * @ui5-restricted
1326
1273
  * @final
1327
1274
  */
1328
1275
  onCallAction(oView: any, sActionName: string, mParameters: any) {
1329
1276
  const oController = oView.getController();
1330
- const that = oController;
1331
1277
  return oController.editFlow
1332
1278
  .invokeAction(sActionName, mParameters)
1333
- .then(that._showMessagePopover.bind(that, undefined))
1334
- .catch(that._showMessagePopover.bind(that));
1279
+ .then(oController._showMessagePopover.bind(oController, undefined))
1280
+ .catch(oController._showMessagePopover.bind(oController));
1335
1281
  },
1336
1282
  onDataPointTitlePressed(oController: any, oSource: any, oManifestOutbound: any, sControlConfig: any, sCollectionPath: any) {
1337
1283
  oManifestOutbound = typeof oManifestOutbound === "string" ? JSON.parse(oManifestOutbound) : oManifestOutbound;
@@ -1348,7 +1294,7 @@ class ObjectPageController extends PageController {
1348
1294
  aNavigationData = aNavigationData.map(function (oNavigationData: any) {
1349
1295
  return {
1350
1296
  data: oNavigationData,
1351
- metaPath: sMetaPath + (sCollectionPath ? "/" + sCollectionPath : "")
1297
+ metaPath: sMetaPath + (sCollectionPath ? `/${sCollectionPath}` : "")
1352
1298
  };
1353
1299
  });
1354
1300
  if (oTargetInfo && oTargetInfo.parameters) {
@@ -1368,11 +1314,11 @@ class ObjectPageController extends PageController {
1368
1314
  /**
1369
1315
  * Triggers an outbound navigation when a user chooses the chevron.
1370
1316
  *
1371
- * @param {object} oController
1372
- * @param {string} sOutboundTarget Name of the outbound target (needs to be defined in the manifest)
1373
- * @param {sap.ui.model.odata.v4.Context} oContext The context that contains the data for the target app
1374
- * @param {string} sCreatePath Create path when the chevron is created.
1375
- * @returns {Promise} Promise which is resolved once the navigation is triggered (??? maybe only once finished?)
1317
+ * @param oController
1318
+ * @param sOutboundTarget Name of the outbound target (needs to be defined in the manifest)
1319
+ * @param oContext The context that contains the data for the target app
1320
+ * @param sCreatePath Create path when the chevron is created.
1321
+ * @returns Promise which is resolved once the navigation is triggered (??? maybe only once finished?)
1376
1322
  * @ui5-restricted
1377
1323
  * @final
1378
1324
  */