@sapui5/sap.fe.templates 1.114.0 → 1.114.2

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 (70) 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-dbg.controller.js +18 -2
  5. package/src/sap/fe/templates/ListReport/ListReportController.controller.js +1 -1
  6. package/src/sap/fe/templates/ListReport/ListReportController.controller.js.map +1 -1
  7. package/src/sap/fe/templates/ListReport/ListReportController.controller.ts +18 -1
  8. package/src/sap/fe/templates/ListReport/manifest.json +1 -1
  9. package/src/sap/fe/templates/ListReport/overrides/ViewState-dbg.js +1 -14
  10. package/src/sap/fe/templates/ListReport/overrides/ViewState.js +1 -1
  11. package/src/sap/fe/templates/ListReport/overrides/ViewState.js.map +1 -1
  12. package/src/sap/fe/templates/ListReport/overrides/ViewState.ts +0 -13
  13. package/src/sap/fe/templates/ObjectPage/ObjectPageController-dbg.controller.js +89 -36
  14. package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.js +1 -1
  15. package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.js.map +1 -1
  16. package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.ts +94 -37
  17. package/src/sap/fe/templates/ObjectPage/manifest.json +1 -1
  18. package/src/sap/fe/templates/library-dbg.js +1 -1
  19. package/src/sap/fe/templates/library-preload.js +8 -8
  20. package/src/sap/fe/templates/library-preload.js.map +1 -1
  21. package/src/sap/fe/templates/library.js +1 -1
  22. package/src/sap/fe/templates/manifest.json +1 -1
  23. package/src/sap/fe/templates/messagebundle_ar.properties +3 -1
  24. package/src/sap/fe/templates/messagebundle_bg.properties +4 -2
  25. package/src/sap/fe/templates/messagebundle_ca.properties +3 -1
  26. package/src/sap/fe/templates/messagebundle_cs.properties +3 -1
  27. package/src/sap/fe/templates/messagebundle_cy.properties +3 -1
  28. package/src/sap/fe/templates/messagebundle_da.properties +3 -1
  29. package/src/sap/fe/templates/messagebundle_de.properties +3 -1
  30. package/src/sap/fe/templates/messagebundle_el.properties +3 -1
  31. package/src/sap/fe/templates/messagebundle_en.properties +3 -1
  32. package/src/sap/fe/templates/messagebundle_en_GB.properties +3 -1
  33. package/src/sap/fe/templates/messagebundle_en_US_sappsd.properties +3 -1
  34. package/src/sap/fe/templates/messagebundle_en_US_saprigi.properties +3 -1
  35. package/src/sap/fe/templates/messagebundle_en_US_saptrc.properties +3 -1
  36. package/src/sap/fe/templates/messagebundle_es.properties +3 -1
  37. package/src/sap/fe/templates/messagebundle_es_MX.properties +3 -1
  38. package/src/sap/fe/templates/messagebundle_et.properties +3 -1
  39. package/src/sap/fe/templates/messagebundle_fi.properties +6 -4
  40. package/src/sap/fe/templates/messagebundle_fr.properties +3 -1
  41. package/src/sap/fe/templates/messagebundle_fr_CA.properties +4 -2
  42. package/src/sap/fe/templates/messagebundle_hi.properties +3 -1
  43. package/src/sap/fe/templates/messagebundle_hr.properties +3 -1
  44. package/src/sap/fe/templates/messagebundle_hu.properties +3 -1
  45. package/src/sap/fe/templates/messagebundle_id.properties +3 -1
  46. package/src/sap/fe/templates/messagebundle_it.properties +6 -4
  47. package/src/sap/fe/templates/messagebundle_iw.properties +3 -1
  48. package/src/sap/fe/templates/messagebundle_ja.properties +5 -3
  49. package/src/sap/fe/templates/messagebundle_kk.properties +3 -1
  50. package/src/sap/fe/templates/messagebundle_ko.properties +3 -1
  51. package/src/sap/fe/templates/messagebundle_lt.properties +3 -1
  52. package/src/sap/fe/templates/messagebundle_lv.properties +3 -1
  53. package/src/sap/fe/templates/messagebundle_ms.properties +3 -1
  54. package/src/sap/fe/templates/messagebundle_nl.properties +3 -1
  55. package/src/sap/fe/templates/messagebundle_no.properties +3 -1
  56. package/src/sap/fe/templates/messagebundle_pl.properties +3 -1
  57. package/src/sap/fe/templates/messagebundle_pt.properties +3 -1
  58. package/src/sap/fe/templates/messagebundle_pt_PT.properties +3 -1
  59. package/src/sap/fe/templates/messagebundle_ro.properties +3 -1
  60. package/src/sap/fe/templates/messagebundle_ru.properties +3 -1
  61. package/src/sap/fe/templates/messagebundle_sh.properties +3 -1
  62. package/src/sap/fe/templates/messagebundle_sk.properties +3 -1
  63. package/src/sap/fe/templates/messagebundle_sl.properties +3 -1
  64. package/src/sap/fe/templates/messagebundle_sv.properties +3 -1
  65. package/src/sap/fe/templates/messagebundle_th.properties +3 -1
  66. package/src/sap/fe/templates/messagebundle_tr.properties +3 -1
  67. package/src/sap/fe/templates/messagebundle_uk.properties +3 -1
  68. package/src/sap/fe/templates/messagebundle_vi.properties +3 -1
  69. package/src/sap/fe/templates/messagebundle_zh_CN.properties +3 -1
  70. package/src/sap/fe/templates/messagebundle_zh_TW.properties +3 -1
@@ -19,9 +19,11 @@ import ViewState from "sap/fe/core/controllerextensions/ViewState";
19
19
  import { defineUI5Class, extensible, finalExtension, publicExtension, usingExtension } from "sap/fe/core/helpers/ClassSupport";
20
20
  import type { InternalModelContext } from "sap/fe/core/helpers/ModelHelper";
21
21
  import ModelHelper from "sap/fe/core/helpers/ModelHelper";
22
+ import { recommendationHelper } from "sap/fe/core/helpers/RecommendationHelper";
22
23
  import { getResourceModel } from "sap/fe/core/helpers/ResourceModelHelper";
23
24
  import FELibrary from "sap/fe/core/library";
24
25
  import PageController from "sap/fe/core/PageController";
26
+ import type { ViewData } from "sap/fe/core/services/TemplatedViewServiceFactory";
25
27
  import CommonHelper from "sap/fe/macros/CommonHelper";
26
28
  import DelegateUtil from "sap/fe/macros/DelegateUtil";
27
29
  import type TableAPI from "sap/fe/macros/table/TableAPI";
@@ -36,6 +38,7 @@ import InstanceManager from "sap/m/InstanceManager";
36
38
  import Link from "sap/m/Link";
37
39
  import MessageBox from "sap/m/MessageBox";
38
40
  import type Popover from "sap/m/Popover";
41
+ import Control from "sap/ui/core/Control";
39
42
  import Core from "sap/ui/core/Core";
40
43
  import Message from "sap/ui/core/message/Message";
41
44
  import OverrideExecution from "sap/ui/core/mvc/OverrideExecution";
@@ -59,6 +62,10 @@ import PaginatorOverride from "./overrides/Paginator";
59
62
  import ShareOverrides from "./overrides/Share";
60
63
  import ViewStateOverrides from "./overrides/ViewState";
61
64
 
65
+ type BindingParams = {
66
+ redirectedToNonDraft?: string | undefined;
67
+ };
68
+
62
69
  const ProgrammingModel = FELibrary.ProgrammingModel;
63
70
  @defineUI5Class("sap.fe.templates.ObjectPage.ObjectPageController")
64
71
  class ObjectPageController extends PageController {
@@ -121,6 +128,8 @@ class ObjectPageController extends PageController {
121
128
 
122
129
  private messageButton: any;
123
130
 
131
+ private collaborationMessage?: Message;
132
+
124
133
  @publicExtension()
125
134
  @finalExtension()
126
135
  getExtensionAPI(sId?: string): ExtensionAPI {
@@ -199,8 +208,6 @@ class ObjectPageController extends PageController {
199
208
  _fnShowOPMessage() {
200
209
  const extensionAPI = this.getExtensionAPI();
201
210
  const view = this.getView();
202
- const internalContext = view?.getBindingContext("internal");
203
- const stripVisible = internalContext?.getProperty("OPMessageStripVisibility");
204
211
  const messages = this.messageButton.oMessagePopover
205
212
  .getItems()
206
213
  .map((item: any) => item.getBindingContext("message").getObject())
@@ -208,7 +215,7 @@ class ObjectPageController extends PageController {
208
215
  return message.getTargets()[0] === view.getBindingContext()?.getPath();
209
216
  });
210
217
 
211
- if (extensionAPI && !(messages.length === 0 && stripVisible)) {
218
+ if (extensionAPI) {
212
219
  extensionAPI.showMessages(messages);
213
220
  }
214
221
  }
@@ -227,7 +234,11 @@ class ObjectPageController extends PageController {
227
234
  const changeClassForTables = (event: Event, lastVisibleSubSection: ObjectPageSubSection) => {
228
235
  const blocks = [...lastVisibleSubSection.getBlocks(), ...lastVisibleSubSection.getMoreBlocks()];
229
236
  const tableType = blocks.length === 1 && this.searchTableInBlock(blocks[0] as SubSectionBlock)?.getType();
230
- if (tableType && (tableType?.isA("sap.ui.mdc.table.GridTableType") || tableType?.isA("sap.ui.mdc.table.TreeTableType"))) {
237
+ if (
238
+ tableType &&
239
+ ((tableType as Control)?.isA("sap.ui.mdc.table.GridTableType") ||
240
+ (tableType as Control)?.isA("sap.ui.mdc.table.TreeTableType"))
241
+ ) {
231
242
  //In case there is only a single table in a subSection we fit that to the whole page so that the scrollbar comes only on table and not on page
232
243
  lastVisibleSubSection.addStyleClass("sapUxAPObjectPageSubSectionFitContainer");
233
244
  lastVisibleSubSection.detachEvent("modelContextChange", changeClassForTables, this);
@@ -381,7 +392,7 @@ class ObjectPageController extends PageController {
381
392
  const aSections = oObjectPage.getSections();
382
393
  const bUseIconTabBar = oObjectPage.getUseIconTabBar();
383
394
  let iSkip = 2;
384
- const bIsInEditMode = oObjectPage.getModel("ui").getProperty("/isEditable");
395
+ const bIsInEditMode = oObjectPage?.getModel("ui")?.getProperty("/isEditable");
385
396
  const bEditableHeader = (this.getView().getViewData() as any).editableHeaderContent;
386
397
  for (let iSection = 0; iSection < aSections.length; iSection++) {
387
398
  const oSection = aSections[iSection];
@@ -517,7 +528,9 @@ class ObjectPageController extends PageController {
517
528
  }
518
529
 
519
530
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
520
- _onAfterBinding(inputBindingContext: any, mParameters: any) {
531
+ _onAfterBinding(inputBindingContext: Context | undefined, mParameters: BindingParams | undefined): void {
532
+ const view = this.getView();
533
+ const viewLevel = (view?.getViewData() as ViewData)?.viewLevel;
521
534
  const oObjectPage = this._getObjectPageLayoutControl();
522
535
  const aTables = this._findTables();
523
536
 
@@ -625,7 +638,7 @@ class ObjectPageController extends PageController {
625
638
  if (ModelHelper.isCollaborationDraftSupported(oModel.getMetaModel())) {
626
639
  oFinalUIState
627
640
  .then(() => {
628
- if (this.getView().getModel("ui").getProperty("/isEditable")) {
641
+ if (this.getView()?.getModel("ui")?.getProperty("/isEditable")) {
629
642
  connect(this.getView());
630
643
  } else if (isConnected(this.getView())) {
631
644
  disconnect(this.getView()); // Cleanup collaboration connection in case we switch to another element (e.g. in FCL)
@@ -662,6 +675,14 @@ class ObjectPageController extends PageController {
662
675
  //To Compute the Edit Binding of the subObject page using root object page, create a context for draft root and update the edit button in sub OP using the context
663
676
  ActionRuntime.updateEditButtonVisibilityAndEnablement(this.getView());
664
677
  }
678
+ // we are clearing any previous data from recommendations every time we come to new OP
679
+ // so that cached recommendations are not shown to user
680
+ if (viewLevel && viewLevel === 1) {
681
+ oFinalUIState?.then(() => {
682
+ recommendationHelper.clearRecommendations(view, inputBindingContext);
683
+ return;
684
+ });
685
+ }
665
686
  this.displayCollaborationMessage(mParameters?.redirectedToNonDraft);
666
687
  }
667
688
 
@@ -673,23 +694,20 @@ class ObjectPageController extends PageController {
673
694
  * @private
674
695
  */
675
696
  displayCollaborationMessage(entityName: string | undefined) {
676
- const internalBindingContext = this.getView()?.getBindingContext("internal");
677
697
  const resourceBundle = Core.getLibraryResourceBundle("sap.fe.core");
698
+
699
+ if (this.collaborationMessage) {
700
+ Core.getMessageManager().removeMessages([this.collaborationMessage]);
701
+ delete this.collaborationMessage;
702
+ }
703
+
678
704
  if (entityName) {
679
- const message = new Message({
705
+ this.collaborationMessage = new Message({
680
706
  message: resourceBundle.getText("REROUTED_NAVIGATION_TO_SAVED_VERSION", [entityName]),
681
- type: "Information"
707
+ type: "Information",
708
+ target: this.getView()?.getBindingContext()?.getPath()
682
709
  });
683
- this.getExtensionAPI().showMessages([message]);
684
- } else {
685
- const messageToCompare = resourceBundle.getText("REROUTED_NAVIGATION_TO_SAVED_VERSION", ["{0}"]);
686
- const lengthUntilVariable = messageToCompare.search("{");
687
- if (
688
- internalBindingContext?.getProperty("OPMessageStripText")?.substring(0, lengthUntilVariable) ===
689
- messageToCompare.substring(0, lengthUntilVariable)
690
- ) {
691
- this.getExtensionAPI().showMessages([]);
692
- }
710
+ sap.ui.getCore().getMessageManager().addMessages([this.collaborationMessage]);
693
711
  }
694
712
  }
695
713
 
@@ -699,7 +717,7 @@ class ObjectPageController extends PageController {
699
717
  const setFocus = () => {
700
718
  // Set the focus to the first action button, or to the first editable input if in editable mode
701
719
  const oObjectPage = this._getObjectPageLayoutControl();
702
- const isInDisplayMode = !oObjectPage.getModel("ui").getProperty("/isEditable");
720
+ const isInDisplayMode = !oObjectPage?.getModel("ui")?.getProperty("/isEditable");
703
721
 
704
722
  if (isInDisplayMode) {
705
723
  const oFirstClickableElement = this._getFirstClickableElement(oObjectPage);
@@ -713,6 +731,10 @@ class ObjectPageController extends PageController {
713
731
  }
714
732
  }
715
733
  };
734
+ const ctxt = this.getView().getBindingContext();
735
+ // setting this model data to be used for recommendations binding
736
+ (this.getView().getModel("internal") as JSONModel).setProperty("/currentCtxt", ctxt);
737
+
716
738
  // Apply app state only after the page is ready with the first section selected
717
739
  const oView = this.getView();
718
740
  const oInternalModelContext = oView.getBindingContext("internal") as InternalModelContext;
@@ -753,7 +775,7 @@ class ObjectPageController extends PageController {
753
775
  if (oBindingContext) {
754
776
  const bIsStickyMode = ModelHelper.isStickySessionSupported(oBindingContext.getModel().getMetaModel());
755
777
  if (bIsStickyMode) {
756
- bIsStickyEditMode = this.getView().getModel("ui").getProperty("/isEditable");
778
+ bIsStickyEditMode = this.getView()?.getModel("ui")?.getProperty("/isEditable");
757
779
  }
758
780
  }
759
781
  return bIsStickyEditMode;
@@ -868,11 +890,46 @@ class ObjectPageController extends PageController {
868
890
  });
869
891
  }
870
892
 
871
- async _validateDocument(): Promise<void | any[] | ODataContextBinding> {
872
- const appComponent = this.getAppComponent();
893
+ /**
894
+ * Executes the validation of the document
895
+ * One of the following actions is triggered on the draft version of the document:
896
+ * - on a transient context:
897
+ * - if the context gets data, wait for the creation of the context and execute the global validation
898
+ * - if no data is found on this context, only the prepareAction is requested
899
+ * - on a regular context, the global validation is requested.
900
+ *
901
+ * @returns Promise of the global validation or undefined if not executed
902
+ */
903
+ async _validateDocument(): Promise<void | unknown[] | ODataContextBinding> {
873
904
  const control = Core.byId(Core.getCurrentFocusedControlId());
874
905
  const context = control?.getBindingContext() as Context | undefined;
875
- if (context && !context.isTransient()) {
906
+
907
+ if (!context) {
908
+ return undefined;
909
+ }
910
+ if (context.isTransient()) {
911
+ if (context.hasPendingChanges()) {
912
+ await context.created();
913
+ return this.executeGlobalValidation(context);
914
+ }
915
+ return this.executeGlobalValidation(context, true);
916
+ }
917
+ return this.executeGlobalValidation(context);
918
+ }
919
+
920
+ /**
921
+ * Executes the global validation of the draft
922
+ * One of the following actions is triggered on the draft version of the document:
923
+ * - the global side effects are executed if these side effects are defined in the context
924
+ * - the draft Validation on the DraftRoot context.
925
+ *
926
+ * @param context The Context
927
+ * @param byPassSideEffects Only the draft Validation step is executed
928
+ * @returns Promise of the global validation
929
+ */
930
+ async executeGlobalValidation(context: Context, byPassSideEffects = false): Promise<void | unknown[] | ODataContextBinding> {
931
+ const appComponent = this.getAppComponent();
932
+ if (!byPassSideEffects) {
876
933
  const sideEffectsService = appComponent.getSideEffectsService();
877
934
  const entityType = sideEffectsService.getEntityTypeFromContext(context);
878
935
  const globalSideEffects = entityType ? sideEffectsService.getGlobalODataEntitySideEffects(entityType) : [];
@@ -881,14 +938,14 @@ class ObjectPageController extends PageController {
881
938
  await this.editFlow.syncTask();
882
939
  return Promise.all(globalSideEffects.map((sideEffects) => this._sideEffects.requestSideEffects(sideEffects, context)));
883
940
  }
884
- const draftRootContext = (await CommonUtils.createRootContext(ProgrammingModel.Draft, this.getView(), appComponent)) as Context;
885
- //Execute the draftValidation if there is no globalSideEffects (ignore ETags in collaboration draft)
886
- if (draftRootContext) {
887
- await this.editFlow.syncTask();
888
- return draft.executeDraftValidation(draftRootContext, appComponent, isConnected(this.getView()));
889
- }
890
941
  }
891
- return undefined;
942
+
943
+ const draftRootContext = (await CommonUtils.createRootContext(ProgrammingModel.Draft, this.getView(), appComponent)) as Context;
944
+ //Execute the draftValidation if there is no globalSideEffects (ignore ETags in collaboration draft)
945
+ if (draftRootContext) {
946
+ await this.editFlow.syncTask();
947
+ return draft.executeDraftValidation(draftRootContext, appComponent, isConnected(this.getView()));
948
+ }
892
949
  }
893
950
 
894
951
  async _saveDocument(oContext: any) {
@@ -1089,7 +1146,7 @@ class ObjectPageController extends PageController {
1089
1146
  }
1090
1147
 
1091
1148
  /**
1092
- * Scroll the tables to the row with the sPath
1149
+ * Scroll the tables to the row with the sPath.
1093
1150
  *
1094
1151
  * @function
1095
1152
  * @name sap.fe.templates.ObjectPage.ObjectPageController.controller#_scrollTablesToRow
@@ -1312,7 +1369,7 @@ class ObjectPageController extends PageController {
1312
1369
 
1313
1370
  if (oMixedContext) {
1314
1371
  for (const sKey in oMixedContext) {
1315
- if (sKey.indexOf("_") !== 0 && sKey.indexOf("odata.context") === -1) {
1372
+ if (!sKey.startsWith("_") && !sKey.includes("odata.context")) {
1316
1373
  oParams[sKey] = oMixedContext[sKey];
1317
1374
  }
1318
1375
  }
@@ -1378,9 +1435,9 @@ class ObjectPageController extends PageController {
1378
1435
  if (mConditions.editActionEnabled) {
1379
1436
  oController._editDocument(oContext);
1380
1437
  }
1381
- } else if (iViewLevel === 1 && oObjectPage.getModel("ui").getProperty("/isEditable")) {
1438
+ } else if (iViewLevel === 1 && oObjectPage?.getModel("ui")?.getProperty("/isEditable")) {
1382
1439
  oController._saveDocument(oContext);
1383
- } else if (oObjectPage.getModel("ui").getProperty("/isEditable")) {
1440
+ } else if (oObjectPage?.getModel("ui")?.getProperty("/isEditable")) {
1384
1441
  oController._applyDocument(oContext);
1385
1442
  }
1386
1443
  },
@@ -1551,7 +1608,7 @@ class ObjectPageController extends PageController {
1551
1608
  const oInternalModelContext = this.getView().getBindingContext("internal") as InternalModelContext;
1552
1609
  const oObjectPage = this._getObjectPageLayoutControl();
1553
1610
  if (
1554
- oObjectPage.getModel("ui").getProperty("/isEditable") &&
1611
+ oObjectPage?.getModel("ui")?.getProperty("/isEditable") &&
1555
1612
  (this.getView().getViewData() as any).sectionLayout === "Tabs" &&
1556
1613
  oInternalModelContext.getProperty("errorNavigationSectionFlag") === false
1557
1614
  ) {
@@ -4,7 +4,7 @@
4
4
  "id": "sap.fe.templates.ObjectPage",
5
5
  "type": "component",
6
6
  "applicationVersion": {
7
- "version": "1.114.0"
7
+ "version": "1.114.2"
8
8
  },
9
9
  "title": "Object Page",
10
10
  "tags": {
@@ -39,7 +39,7 @@ sap.ui.define(["sap/f/library", "sap/fe/core/library", "sap/fe/macros/library",
39
39
  controls: [],
40
40
  elements: [],
41
41
  // eslint-disable-next-line no-template-curly-in-string
42
- version: "1.114.0",
42
+ version: "1.114.2",
43
43
  noLibraryCSS: true
44
44
  });
45
45
  if (!thisLib.ObjectPage) {