@sapui5/sap.fe.templates 1.100.0 → 1.102.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 (150) hide show
  1. package/package.json +4 -5
  2. package/src/sap/fe/templates/.library +1 -2
  3. package/src/sap/fe/templates/AnalyticalListPage/Component.js +24 -12
  4. package/src/sap/fe/templates/AnalyticalListPage/Component.ts +6 -0
  5. package/src/sap/fe/templates/AnalyticalListPage/chart/FEChartDelegate.js +30 -32
  6. package/src/sap/fe/templates/AnalyticalListPage/chart/FEChartDelegate.ts +25 -0
  7. package/src/sap/fe/templates/Feedback.js +80 -0
  8. package/src/sap/fe/templates/Feedback.ts +67 -0
  9. package/src/sap/fe/templates/ListComponent.js +156 -118
  10. package/src/sap/fe/templates/ListComponent.ts +105 -0
  11. package/src/sap/fe/templates/ListReport/Component.js +82 -53
  12. package/src/sap/fe/templates/ListReport/Component.ts +39 -0
  13. package/src/sap/fe/templates/ListReport/ExtensionAPI.js +126 -112
  14. package/src/sap/fe/templates/ListReport/ExtensionAPI.ts +106 -0
  15. package/src/sap/fe/templates/ListReport/ListReport.view.xml +106 -58
  16. package/src/sap/fe/templates/ListReport/ListReportController.controller.js +1196 -1081
  17. package/src/sap/fe/templates/ListReport/ListReportController.controller.ts +1088 -0
  18. package/src/sap/fe/templates/ListReport/ListReportTemplating.js +45 -0
  19. package/src/sap/fe/templates/ListReport/ListReportTemplating.ts +30 -0
  20. package/src/sap/fe/templates/ListReport/overrides/IntentBasedNavigation.js +54 -53
  21. package/src/sap/fe/templates/ListReport/overrides/IntentBasedNavigation.ts +55 -0
  22. package/src/sap/fe/templates/ListReport/overrides/Share.js +137 -137
  23. package/src/sap/fe/templates/ListReport/overrides/Share.ts +135 -0
  24. package/src/sap/fe/templates/ListReport/overrides/ViewState.js +451 -428
  25. package/src/sap/fe/templates/ListReport/overrides/ViewState.ts +419 -0
  26. package/src/sap/fe/templates/ListReport/view/fragments/CollectionVisualization.fragment.xml +25 -25
  27. package/src/sap/fe/templates/ListReport/view/fragments/MultipleMode.fragment.js +72 -0
  28. package/src/sap/fe/templates/ListReport/view/fragments/MultipleMode.fragment.ts +62 -0
  29. package/src/sap/fe/templates/ListReport/view/fragments/{MultipleMode.fragment.xml → MultipleModeOld.fragment.xml} +24 -23
  30. package/src/sap/fe/templates/ObjectPage/Component.js +169 -138
  31. package/src/sap/fe/templates/ObjectPage/Component.ts +131 -0
  32. package/src/sap/fe/templates/ObjectPage/ExtensionAPI.js +140 -142
  33. package/src/sap/fe/templates/ObjectPage/ExtensionAPI.ts +116 -0
  34. package/src/sap/fe/templates/ObjectPage/ObjectPage.view.xml +162 -22
  35. package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.js +1534 -1447
  36. package/src/sap/fe/templates/ObjectPage/ObjectPageController.controller.ts +1454 -0
  37. package/src/sap/fe/templates/ObjectPage/ObjectPageTemplating.js +872 -0
  38. package/src/sap/fe/templates/ObjectPage/ObjectPageTemplating.ts +837 -0
  39. package/src/sap/fe/templates/ObjectPage/controls/StashableHBox.js +136 -101
  40. package/src/sap/fe/templates/ObjectPage/controls/StashableHBox.ts +84 -0
  41. package/src/sap/fe/templates/ObjectPage/controls/StashableVBox.js +24 -21
  42. package/src/sap/fe/templates/ObjectPage/controls/StashableVBox.ts +10 -0
  43. package/src/sap/fe/templates/ObjectPage/controls/SubSectionBlock.js +98 -53
  44. package/src/sap/fe/templates/ObjectPage/controls/SubSectionBlock.ts +50 -0
  45. package/src/sap/fe/templates/ObjectPage/designtime/FlexBox.designtime.js +20 -19
  46. package/src/sap/fe/templates/ObjectPage/designtime/FlexBox.designtime.ts +15 -0
  47. package/src/sap/fe/templates/ObjectPage/designtime/StashableHBox.designtime.js +50 -47
  48. package/src/sap/fe/templates/ObjectPage/designtime/StashableHBox.designtime.ts +47 -0
  49. package/src/sap/fe/templates/ObjectPage/designtime/StashableVBox.designtime.js +34 -34
  50. package/src/sap/fe/templates/ObjectPage/designtime/StashableVBox.designtime.ts +34 -0
  51. package/src/sap/fe/templates/ObjectPage/flexibility/StashableHBox.flexibility.js +15 -15
  52. package/src/sap/fe/templates/ObjectPage/flexibility/StashableHBox.flexibility.ts +13 -0
  53. package/src/sap/fe/templates/ObjectPage/flexibility/StashableVBox.flexibility.js +11 -11
  54. package/src/sap/fe/templates/ObjectPage/flexibility/StashableVBox.flexibility.ts +7 -0
  55. package/src/sap/fe/templates/ObjectPage/overrides/IntentBasedNavigation.js +55 -52
  56. package/src/sap/fe/templates/ObjectPage/overrides/IntentBasedNavigation.ts +57 -0
  57. package/src/sap/fe/templates/ObjectPage/overrides/InternalRouting.js +15 -17
  58. package/src/sap/fe/templates/ObjectPage/overrides/InternalRouting.ts +13 -0
  59. package/src/sap/fe/templates/ObjectPage/overrides/MessageHandler.js +13 -17
  60. package/src/sap/fe/templates/ObjectPage/overrides/MessageHandler.ts +14 -0
  61. package/src/sap/fe/templates/ObjectPage/overrides/Paginator.js +23 -21
  62. package/src/sap/fe/templates/ObjectPage/overrides/Paginator.ts +21 -0
  63. package/src/sap/fe/templates/ObjectPage/overrides/Share.js +310 -317
  64. package/src/sap/fe/templates/ObjectPage/overrides/Share.ts +316 -0
  65. package/src/sap/fe/templates/ObjectPage/overrides/ViewState.js +66 -57
  66. package/src/sap/fe/templates/ObjectPage/overrides/ViewState.ts +65 -0
  67. package/src/sap/fe/templates/ObjectPage/view/fragments/Actions.fragment.xml +26 -33
  68. package/src/sap/fe/templates/ObjectPage/view/fragments/CollaborationDraft.fragment.xml +11 -10
  69. package/src/sap/fe/templates/ObjectPage/view/fragments/EditableHeaderFacet.fragment.xml +15 -15
  70. package/src/sap/fe/templates/ObjectPage/view/fragments/FooterContent.fragment.xml +31 -27
  71. package/src/sap/fe/templates/ObjectPage/view/fragments/FormActionButtons.fragment.xml +15 -16
  72. package/src/sap/fe/templates/ObjectPage/view/fragments/FormActions.fragment.xml +1 -5
  73. package/src/sap/fe/templates/ObjectPage/view/fragments/HeaderDataPoint.fragment.xml +1 -2
  74. package/src/sap/fe/templates/ObjectPage/view/fragments/HeaderDataPointTitle.fragment.xml +1 -3
  75. package/src/sap/fe/templates/ObjectPage/view/fragments/HeaderFacet.fragment.xml +3 -4
  76. package/src/sap/fe/templates/ObjectPage/view/fragments/Heading.fragment.xml +16 -17
  77. package/src/sap/fe/templates/ObjectPage/view/fragments/HeadingTitle.fragment.xml +3 -3
  78. package/src/sap/fe/templates/ObjectPage/view/fragments/ObjectPageHeaderForm.fragment.xml +3 -3
  79. package/src/sap/fe/templates/ObjectPage/view/fragments/RelatedApps.fragment.xml +7 -4
  80. package/src/sap/fe/templates/ObjectPage/view/fragments/Section.fragment.xml +71 -6
  81. package/src/sap/fe/templates/ObjectPage/view/fragments/SectionContent.fragment.xml +114 -94
  82. package/src/sap/fe/templates/ObjectPage/view/fragments/SectionContentLazyLoader.fragment.xml +127 -107
  83. package/src/sap/fe/templates/ObjectPage/view/fragments/SwitchDraftAndActiveObjectPopOver.fragment.xml +27 -0
  84. package/src/sap/fe/templates/RootContainer/controller/Fcl.controller.js +899 -817
  85. package/src/sap/fe/templates/RootContainer/controller/Fcl.controller.ts +833 -0
  86. package/src/sap/fe/templates/RootContainer/controller/NavContainer.controller.js +205 -189
  87. package/src/sap/fe/templates/RootContainer/controller/NavContainer.controller.ts +178 -0
  88. package/src/sap/fe/templates/RootContainer/controller/RootContainerBaseController.js +484 -459
  89. package/src/sap/fe/templates/RootContainer/controller/RootContainerBaseController.ts +438 -0
  90. package/src/sap/fe/templates/RootContainer/overrides/EditFlow.js +16 -14
  91. package/src/sap/fe/templates/RootContainer/overrides/EditFlow.ts +20 -0
  92. package/src/sap/fe/templates/TableScroller.js +45 -53
  93. package/src/sap/fe/templates/TableScroller.ts +48 -0
  94. package/src/sap/fe/templates/controls/Chart.fragment.xml +18 -17
  95. package/src/sap/fe/templates/controls/MacroChart.fragment.xml +23 -0
  96. package/src/sap/fe/templates/controls/Table.fragment.xml +3 -4
  97. package/src/sap/fe/templates/library.js +49 -63
  98. package/src/sap/fe/templates/library.ts +57 -0
  99. package/src/sap/fe/templates/messagebundle.properties +19 -7
  100. package/src/sap/fe/templates/messagebundle_ar.properties +12 -4
  101. package/src/sap/fe/templates/messagebundle_bg.properties +12 -4
  102. package/src/sap/fe/templates/messagebundle_ca.properties +12 -4
  103. package/src/sap/fe/templates/messagebundle_cs.properties +12 -4
  104. package/src/sap/fe/templates/messagebundle_cy.properties +12 -4
  105. package/src/sap/fe/templates/messagebundle_da.properties +12 -4
  106. package/src/sap/fe/templates/messagebundle_de.properties +12 -4
  107. package/src/sap/fe/templates/messagebundle_el.properties +12 -4
  108. package/src/sap/fe/templates/messagebundle_en.properties +12 -4
  109. package/src/sap/fe/templates/messagebundle_en_GB.properties +12 -4
  110. package/src/sap/fe/templates/messagebundle_en_US_sappsd.properties +13 -5
  111. package/src/sap/fe/templates/messagebundle_en_US_saprigi.properties +13 -5
  112. package/src/sap/fe/templates/messagebundle_en_US_saptrc.properties +13 -5
  113. package/src/sap/fe/templates/messagebundle_es.properties +12 -4
  114. package/src/sap/fe/templates/messagebundle_es_MX.properties +12 -4
  115. package/src/sap/fe/templates/messagebundle_et.properties +12 -4
  116. package/src/sap/fe/templates/messagebundle_fi.properties +12 -4
  117. package/src/sap/fe/templates/messagebundle_fr.properties +12 -4
  118. package/src/sap/fe/templates/messagebundle_fr_CA.properties +12 -4
  119. package/src/sap/fe/templates/messagebundle_hi.properties +12 -4
  120. package/src/sap/fe/templates/messagebundle_hr.properties +12 -4
  121. package/src/sap/fe/templates/messagebundle_hu.properties +12 -4
  122. package/src/sap/fe/templates/messagebundle_id.properties +12 -4
  123. package/src/sap/fe/templates/messagebundle_it.properties +12 -4
  124. package/src/sap/fe/templates/messagebundle_iw.properties +12 -4
  125. package/src/sap/fe/templates/messagebundle_ja.properties +12 -4
  126. package/src/sap/fe/templates/messagebundle_kk.properties +12 -4
  127. package/src/sap/fe/templates/messagebundle_ko.properties +12 -4
  128. package/src/sap/fe/templates/messagebundle_lt.properties +12 -4
  129. package/src/sap/fe/templates/messagebundle_lv.properties +12 -4
  130. package/src/sap/fe/templates/messagebundle_ms.properties +12 -4
  131. package/src/sap/fe/templates/messagebundle_nl.properties +12 -4
  132. package/src/sap/fe/templates/messagebundle_no.properties +12 -4
  133. package/src/sap/fe/templates/messagebundle_pl.properties +12 -4
  134. package/src/sap/fe/templates/messagebundle_pt.properties +13 -5
  135. package/src/sap/fe/templates/messagebundle_pt_PT.properties +12 -4
  136. package/src/sap/fe/templates/messagebundle_ro.properties +12 -4
  137. package/src/sap/fe/templates/messagebundle_ru.properties +12 -4
  138. package/src/sap/fe/templates/messagebundle_sh.properties +12 -4
  139. package/src/sap/fe/templates/messagebundle_sk.properties +12 -4
  140. package/src/sap/fe/templates/messagebundle_sl.properties +12 -4
  141. package/src/sap/fe/templates/messagebundle_sv.properties +12 -4
  142. package/src/sap/fe/templates/messagebundle_th.properties +12 -4
  143. package/src/sap/fe/templates/messagebundle_tr.properties +12 -4
  144. package/src/sap/fe/templates/messagebundle_uk.properties +12 -4
  145. package/src/sap/fe/templates/messagebundle_vi.properties +12 -4
  146. package/src/sap/fe/templates/messagebundle_zh_CN.properties +12 -4
  147. package/src/sap/fe/templates/messagebundle_zh_TW.properties +12 -4
  148. package/src/sap/fe/templates/ObjectPage/AnnotationHelper.js +0 -518
  149. package/src/sap/fe/templates/ObjectPage/templating/ObjectPageTemplating.js +0 -120
  150. package/src/sap/fe/templates/ObjectPage/templating/ObjectPageTemplating.ts +0 -138
@@ -0,0 +1,316 @@
1
+ import Log from "sap/base/Log";
2
+ import Share from "sap/fe/core/controllerextensions/Share";
3
+ import ModelHelper from "sap/fe/core/helpers/ModelHelper";
4
+ import SemanticKeyHelper from "sap/fe/core/helpers/SemanticKeyHelper";
5
+ import ObjectPageController from "sap/fe/templates/ObjectPage/ObjectPageController.controller";
6
+ import HashChanger from "sap/ui/core/routing/HashChanger";
7
+ import Filter from "sap/ui/model/Filter";
8
+ import FilterOperator from "sap/ui/model/FilterOperator";
9
+
10
+ let bIsStickySupported: boolean;
11
+
12
+ function createFilterToFetchActiveContext(mKeyValues: any, bIsActiveEntityDefined: any) {
13
+ const aKeys = Object.keys(mKeyValues);
14
+
15
+ const aFilters = aKeys.map(function (sKey: string) {
16
+ const sValue = mKeyValues[sKey];
17
+ if (sValue !== undefined) {
18
+ return new Filter(sKey, FilterOperator.EQ, sValue);
19
+ }
20
+ });
21
+
22
+ if (bIsActiveEntityDefined) {
23
+ const oActiveFilter = new Filter({
24
+ filters: [new Filter("SiblingEntity/IsActiveEntity", FilterOperator.EQ, true)],
25
+ and: false
26
+ });
27
+
28
+ aFilters.push(oActiveFilter);
29
+ }
30
+
31
+ const oCombinedFilter = new Filter(aFilters as any, true);
32
+ return oCombinedFilter;
33
+ }
34
+ function getActiveContextPath(oController: any, sPageEntityName: any, oFilter: any) {
35
+ const oListBinding = oController
36
+ .getView()
37
+ .getBindingContext()
38
+ .getModel()
39
+ .bindList("/" + sPageEntityName, undefined, undefined, oFilter, { "$$groupId": "$auto.Heroes" });
40
+ return oListBinding.requestContexts(0, 2).then(function (oContexts: any) {
41
+ if (oContexts && oContexts.length) {
42
+ return oContexts[0].getPath();
43
+ }
44
+ });
45
+ }
46
+ function getActiveContextInstances(oContext: any, oController: any, oEntitySet: any) {
47
+ const aActiveContextpromises: any[] = [];
48
+ const aPages: any[] = [];
49
+ let sMetaPath = oContext.getModel().getMetaModel().getMetaPath(oContext.getPath());
50
+ if (sMetaPath.indexOf("/") === 0) {
51
+ sMetaPath = sMetaPath.substring(1);
52
+ }
53
+ const aMetaPathArray = sMetaPath.split("/");
54
+ const sCurrentHashNoParams = HashChanger.getInstance().getHash().split("?")[0];
55
+ const aCurrentHashArray = sCurrentHashNoParams.split("/");
56
+
57
+ // oPageMap - creating an object that contains map of metapath name and it's technical details
58
+ // which is required to create a filter to fetch the relavant/correct active context
59
+ // Example: {SalesOrderManage:{technicalID:technicalIDValue}, _Item:{technicalID:technicalIDValue}} etc.,
60
+ const oPageMap: any = {};
61
+ const aPageHashArray: any[] = [];
62
+ aCurrentHashArray.forEach(function (sPageHash: any) {
63
+ const aKeyValues = sPageHash.substring(sPageHash.indexOf("(") + 1, sPageHash.length - 1).split(",");
64
+ const mKeyValues: any = {};
65
+ const sPageHashName = sPageHash.split("(")[0];
66
+ oPageMap[sPageHashName] = {};
67
+ aPageHashArray.push(sPageHashName);
68
+ oPageMap[sPageHashName]["bIsActiveEntityDefined"] = true;
69
+ for (let i = 0; i < aKeyValues.length; i++) {
70
+ const sKeyAssignment = aKeyValues[i];
71
+ const aParts = sKeyAssignment.split("=");
72
+ let sKeyValue = aParts[1];
73
+ let sKey = aParts[0];
74
+ // In case if only one technical key is defined then the url just contains the technicalIDValue but not the technicalID
75
+ // Example: SalesOrderManage(ID=11111129-aaaa-bbbb-cccc-ddddeeeeffff,IsActiveEntity=false)/_Item(11111129-aaaa-bbbb-cccc-ddddeeeeffff)
76
+ // In above example SalesOrderItem has only one technical key defined, hence technicalID info is not present in the url
77
+ // Hence in such cases we get technical key and use them to fetch active context
78
+ if (sKeyAssignment.indexOf("=") === -1) {
79
+ const oMetaModel = oContext.getModel().getMetaModel();
80
+ const aTechnicalKeys = oMetaModel.getObject("/" + aPageHashArray.join("/") + "/$Type/$Key");
81
+ sKeyValue = aParts[0];
82
+ sKey = aTechnicalKeys[0];
83
+ oPageMap[sPageHash.split("(")[0]]["bIsActiveEntityDefined"] = false;
84
+ }
85
+
86
+ if (sKey !== "IsActiveEntity") {
87
+ if (sKeyValue.indexOf("'") === 0 && sKeyValue.lastIndexOf("'") === sKeyValue.length - 1) {
88
+ // Remove the quotes from the value and decode special chars
89
+ sKeyValue = decodeURIComponent(sKeyValue.substring(1, sKeyValue.length - 1));
90
+ }
91
+ mKeyValues[sKey] = sKeyValue;
92
+ }
93
+ }
94
+ oPageMap[sPageHashName].mKeyValues = mKeyValues;
95
+ });
96
+
97
+ let oPageEntitySet = oEntitySet;
98
+ aMetaPathArray.forEach(function (sNavigationPath: any) {
99
+ const oPageInfo: any = {};
100
+ const sPageEntitySetName = oPageEntitySet.$NavigationPropertyBinding && oPageEntitySet.$NavigationPropertyBinding[sNavigationPath];
101
+ if (sPageEntitySetName) {
102
+ oPageInfo.pageEntityName = oPageEntitySet.$NavigationPropertyBinding[sNavigationPath];
103
+ oPageEntitySet =
104
+ oContext
105
+ .getModel()
106
+ .getMetaModel()
107
+ .getObject("/" + sPageEntitySetName) || oEntitySet;
108
+ } else {
109
+ oPageInfo.pageEntityName = sNavigationPath;
110
+ }
111
+ oPageInfo.mKeyValues = oPageMap[sNavigationPath].mKeyValues;
112
+ oPageInfo.bIsActiveEntityDefined = oPageMap[sNavigationPath].bIsActiveEntityDefined;
113
+ aPages.push(oPageInfo);
114
+ });
115
+
116
+ aPages.forEach(function (oPageInfo: any) {
117
+ const oFilter = createFilterToFetchActiveContext(oPageInfo.mKeyValues, oPageInfo.bIsActiveEntityDefined);
118
+ aActiveContextpromises.push(getActiveContextPath(oController, oPageInfo.pageEntityName, oFilter));
119
+ });
120
+
121
+ return aActiveContextpromises;
122
+ }
123
+
124
+ /**
125
+ * Method to fetch active context path's.
126
+ * @param {sap.ui.model.odata.v4.Context} oContext The Page Context
127
+ * @param oController
128
+ * @returns {Promise} Promise which is resolved once the active context's are fetched
129
+ */
130
+ function getActiveContextPaths(oContext: any, oController: any) {
131
+ const sCurrentHashNoParams = HashChanger.getInstance().getHash().split("?")[0];
132
+ let sRootEntityName = sCurrentHashNoParams && sCurrentHashNoParams.substr(0, sCurrentHashNoParams.indexOf("("));
133
+ if (sRootEntityName.indexOf("/") === 0) {
134
+ sRootEntityName = sRootEntityName.substring(1);
135
+ }
136
+ const oEntitySet = oContext
137
+ .getModel()
138
+ .getMetaModel()
139
+ .getObject("/" + sRootEntityName);
140
+ const oPageContext = oContext;
141
+ const aActiveContextpromises = getActiveContextInstances(oContext, oController, oEntitySet);
142
+ if (aActiveContextpromises.length > 0) {
143
+ return Promise.all(aActiveContextpromises)
144
+ .then(function (aData: any[]) {
145
+ const aActiveContextPaths = [];
146
+ let oPageEntitySet = oEntitySet;
147
+ if (aData[0].indexOf("/") === 0) {
148
+ aActiveContextPaths.push(aData[0].substring(1));
149
+ } else {
150
+ aActiveContextPaths.push(aData[0]);
151
+ }
152
+ // In the active context paths identify and replace the entitySet Name with corresponding navigation property name
153
+ // Required to form the url pointing to active context
154
+ // Example : SalesOrderItem --> _Item, MaterialDetails --> _MaterialDetails etc.,
155
+ for (let i = 1; i < aData.length; i++) {
156
+ let sActiveContextPath = aData[i];
157
+ let sNavigatioProperty = "";
158
+ let sEntitySetName = sActiveContextPath && sActiveContextPath.substr(0, sActiveContextPath.indexOf("("));
159
+ if (sEntitySetName.indexOf("/") === 0) {
160
+ sEntitySetName = sEntitySetName.substring(1);
161
+ }
162
+ if (sActiveContextPath.indexOf("/") === 0) {
163
+ sActiveContextPath = sActiveContextPath.substring(1);
164
+ }
165
+ sNavigatioProperty = Object.keys(oPageEntitySet.$NavigationPropertyBinding)[
166
+ Object.values(oPageEntitySet.$NavigationPropertyBinding).indexOf(sEntitySetName)
167
+ ];
168
+ if (sNavigatioProperty) {
169
+ aActiveContextPaths.push(sActiveContextPath.replace(sEntitySetName, sNavigatioProperty));
170
+ oPageEntitySet =
171
+ oPageContext
172
+ .getModel()
173
+ .getMetaModel()
174
+ .getObject("/" + sEntitySetName) || oEntitySet;
175
+ } else {
176
+ aActiveContextPaths.push(sActiveContextPath);
177
+ }
178
+ }
179
+ return aActiveContextPaths;
180
+ })
181
+ .catch(function (oError: any) {
182
+ Log.info("Failed to retrieve one or more active context path's", oError);
183
+ });
184
+ } else {
185
+ return Promise.resolve();
186
+ }
187
+ }
188
+ function fetchActiveContextPaths(oContext: any, oController: any) {
189
+ let oPromise, aSemanticKeys;
190
+ const sCurrentHashNoParams = HashChanger.getInstance().getHash().split("?")[0];
191
+ if (oContext) {
192
+ const oModel = oContext.getModel();
193
+ const oMetaModel = oModel.getMetaModel();
194
+ bIsStickySupported = ModelHelper.isStickySessionSupported(oMetaModel);
195
+ let sRootEntityName = sCurrentHashNoParams && sCurrentHashNoParams.substr(0, sCurrentHashNoParams.indexOf("("));
196
+ if (sRootEntityName.indexOf("/") === 0) {
197
+ sRootEntityName = sRootEntityName.substring(1);
198
+ }
199
+ aSemanticKeys = SemanticKeyHelper.getSemanticKeys(oMetaModel, sRootEntityName);
200
+ }
201
+ // Fetch active context details incase of below scenario's(where page is not sticky supported(we do not have draft instance))
202
+ // 1. In case of draft enabled Object page where semantic key based URL is not possible(like semantic keys are not modeled in the entity set)
203
+ // 2. In case of draft enabled Sub Object Pages (where semantic bookmarking is not supported)
204
+ const oViewData = oController.getView().getViewData();
205
+ if (oContext && !bIsStickySupported && ((oViewData.viewLevel === 1 && !aSemanticKeys) || oViewData.viewLevel >= 2)) {
206
+ oPromise = getActiveContextPaths(oContext, oController);
207
+ return oPromise;
208
+ } else {
209
+ return Promise.resolve();
210
+ }
211
+ }
212
+
213
+ // /**
214
+ // * Get share URL.
215
+ // * @param bIsEditable
216
+ // * @param bIsStickySupported
217
+ // * @param aActiveContextPaths
218
+ // * @returns {string} The share URL
219
+ // * @protected
220
+ // * @static
221
+ // */
222
+ function getShareUrl(bIsEditable: any, bIsStickySupported: any, aActiveContextPaths: any) {
223
+ let sShareUrl;
224
+ const sHash = HashChanger.getInstance().getHash();
225
+ const sBasePath = (HashChanger.getInstance() as any).hrefForAppSpecificHash
226
+ ? (HashChanger.getInstance() as any).hrefForAppSpecificHash("")
227
+ : "";
228
+ if (bIsEditable && !bIsStickySupported && aActiveContextPaths) {
229
+ sShareUrl = sBasePath + aActiveContextPaths.join("/");
230
+ } else {
231
+ sShareUrl = sHash ? sBasePath + sHash : window.location.hash;
232
+ }
233
+ return sShareUrl;
234
+ }
235
+ function getShareEmailUrl() {
236
+ const oUShellContainer = sap.ushell && sap.ushell.Container;
237
+ if (oUShellContainer) {
238
+ return oUShellContainer
239
+ .getFLPUrlAsync(true)
240
+ .then(function (sFLPUrl: any) {
241
+ return sFLPUrl;
242
+ })
243
+ .catch(function (sError: any) {
244
+ Log.error("Could not retrieve cFLP URL for the sharing dialog (dialog will not be opened)", sError);
245
+ });
246
+ } else {
247
+ return Promise.resolve(document.URL);
248
+ }
249
+ }
250
+
251
+ function getJamUrl(bIsEditMode: boolean, bIsStickySupported: any, aActiveContextPaths: any) {
252
+ let sJamUrl: string;
253
+ const sHash = HashChanger.getInstance().getHash();
254
+ const sBasePath = (HashChanger.getInstance() as any).hrefForAppSpecificHash
255
+ ? (HashChanger.getInstance() as any).hrefForAppSpecificHash("")
256
+ : "";
257
+ if (bIsEditMode && !bIsStickySupported && aActiveContextPaths) {
258
+ sJamUrl = sBasePath + aActiveContextPaths.join("/");
259
+ } else {
260
+ sJamUrl = sHash ? sBasePath + sHash : window.location.hash;
261
+ }
262
+ // in case we are in cFLP scenario, the application is running
263
+ // inside an iframe, and there for we need to get the cFLP URL
264
+ // and not 'document.URL' that represents the iframe URL
265
+ if (sap.ushell && sap.ushell.Container && sap.ushell.Container.runningInIframe && sap.ushell.Container.runningInIframe()) {
266
+ sap.ushell.Container.getFLPUrl(true)
267
+ .then(function (sUrl: any) {
268
+ return sUrl.substr(0, sUrl.indexOf("#")) + sJamUrl;
269
+ })
270
+ .catch(function (sError: any) {
271
+ Log.error("Could not retrieve cFLP URL for the sharing dialog (dialog will not be opened)", sError);
272
+ });
273
+ } else {
274
+ return Promise.resolve(window.location.origin + window.location.pathname + sJamUrl);
275
+ }
276
+ }
277
+
278
+ const ShareExtensionOverride = {
279
+ adaptShareMetadata: function (this: Share, oShareMetadata: any) {
280
+ const oContext = this.base.getView().getBindingContext(),
281
+ oUIModel = this.base.getView().getModel("ui"),
282
+ bIsEditable = oUIModel.getProperty("/isEditable");
283
+ return fetchActiveContextPaths(oContext, this.base.getView().getController()).then((aActiveContextPaths) => {
284
+ const oPageTitleInfo = (this.base.getView().getController() as ObjectPageController)._getPageTitleInformation();
285
+
286
+ return Promise.all([
287
+ getJamUrl(bIsEditable, bIsStickySupported, aActiveContextPaths),
288
+ getShareUrl(bIsEditable, bIsStickySupported, aActiveContextPaths),
289
+ getShareEmailUrl()
290
+ ])
291
+ .then(function (oData) {
292
+ let sTitle = oPageTitleInfo.title;
293
+ const sObjectSubtitle = oPageTitleInfo.subtitle ? oPageTitleInfo.subtitle.toString() : "";
294
+ if (sObjectSubtitle) {
295
+ sTitle = sTitle + " - " + sObjectSubtitle;
296
+ }
297
+ oShareMetadata.tile = {
298
+ title: oPageTitleInfo.title,
299
+ subtitle: sObjectSubtitle
300
+ };
301
+ oShareMetadata.email.title = sTitle;
302
+ oShareMetadata.title = sTitle;
303
+ oShareMetadata.jam.url = oData[0];
304
+ oShareMetadata.url = oData[1];
305
+ oShareMetadata.email.url = oData[2];
306
+
307
+ return oShareMetadata;
308
+ })
309
+ .catch(function (error: any) {
310
+ Log.error(error);
311
+ });
312
+ });
313
+ }
314
+ };
315
+
316
+ export default ShareExtensionOverride;
@@ -1,66 +1,75 @@
1
1
  /*!
2
2
  * SAP UI development toolkit for HTML5 (SAPUI5)
3
- (c) Copyright 2009-2021 SAP SE. All rights reserved
4
-
3
+ * (c) Copyright 2009-2021 SAP SE. All rights reserved
5
4
  */
6
- sap.ui.define(["sap/fe/core/library", "sap/fe/core/helpers/KeepAliveHelper"], function(CoreLibrary, KeepAliveHelper) {
7
- "use strict";
5
+ sap.ui.define(["sap/fe/core/helpers/KeepAliveHelper", "sap/fe/core/library"], function (KeepAliveHelper, CoreLibrary) {
6
+ "use strict";
8
7
 
9
- var VariantManagement = CoreLibrary.VariantManagement;
8
+ var VariantManagement = CoreLibrary.VariantManagement;
9
+ var ViewStateExtensionOverride = {
10
+ applyInitialStateOnly: function () {
11
+ return false;
12
+ },
13
+ adaptStateControls: function (aStateControls) {
14
+ var oView = this.getView(),
15
+ oController = oView.getController(),
16
+ oViewData = oView.getViewData();
17
+ var bControlVM = false;
10
18
 
11
- return {
12
- applyInitialStateOnly: function() {
13
- return false;
14
- },
15
- adaptStateControls: function(aStateControls) {
16
- var oView = this.getView(),
17
- oController = oView.getController(),
18
- oViewData = oView.getViewData(),
19
- bControlVM = false;
19
+ switch (oViewData.variantManagement) {
20
+ case VariantManagement.Control:
21
+ bControlVM = true;
22
+ break;
20
23
 
21
- switch (oViewData.variantManagement) {
22
- case VariantManagement.Control:
23
- bControlVM = true;
24
- break;
25
- case VariantManagement.Page:
26
- case VariantManagement.None:
27
- break;
28
- default:
29
- throw new Error("unhandled variant setting: " + oViewData.getVariantManagement());
30
- }
24
+ case VariantManagement.Page:
25
+ case VariantManagement.None:
26
+ break;
31
27
 
32
- oController._findTables().forEach(function(oTable) {
33
- var oQuickFilter = oTable.getQuickFilter();
34
- if (oQuickFilter) {
35
- aStateControls.push(oQuickFilter);
36
- }
37
- if (bControlVM) {
38
- aStateControls.push(oTable.getVariant());
39
- }
40
- });
28
+ default:
29
+ throw new Error("unhandled variant setting: " + oViewData.getVariantManagement());
30
+ }
41
31
 
42
- aStateControls.push(oView.byId("fe::ObjectPage"));
43
- },
44
- adaptBindingRefreshControls: function(aControls) {
45
- var oView = this.getView(),
46
- sRefreshStrategy = KeepAliveHelper.getViewRefreshInfo(oView),
47
- oController = oView.getController(),
48
- aControlsToRefresh = [];
32
+ oController._findTables().forEach(function (oTable) {
33
+ var oQuickFilter = oTable.getQuickFilter();
49
34
 
50
- if (sRefreshStrategy) {
51
- var oObjectPageControl = oController._getObjectPageLayoutControl();
52
- aControlsToRefresh.push(oObjectPageControl);
53
- }
54
- if (sRefreshStrategy !== "includingDependents") {
55
- var aViewControls = oController._findTables();
56
- aControlsToRefresh = aControlsToRefresh.concat(KeepAliveHelper.getControlsForRefresh(oView, aViewControls) || []);
57
- }
58
- return aControlsToRefresh.reduce(function(aPrevControls, oControl) {
59
- if (aPrevControls.indexOf(oControl) === -1) {
60
- aPrevControls.push(oControl);
61
- }
62
- return aPrevControls;
63
- }, aControls);
64
- }
65
- };
66
- });
35
+ if (oQuickFilter) {
36
+ aStateControls.push(oQuickFilter);
37
+ }
38
+
39
+ if (bControlVM) {
40
+ aStateControls.push(oTable.getVariant());
41
+ }
42
+ });
43
+
44
+ aStateControls.push(oView.byId("fe::ObjectPage"));
45
+ },
46
+ adaptBindingRefreshControls: function (aControls) {
47
+ var oView = this.getView(),
48
+ sRefreshStrategy = KeepAliveHelper.getViewRefreshInfo(oView),
49
+ oController = oView.getController();
50
+ var aControlsToRefresh = [];
51
+
52
+ if (sRefreshStrategy) {
53
+ var oObjectPageControl = oController._getObjectPageLayoutControl();
54
+
55
+ aControlsToRefresh.push(oObjectPageControl);
56
+ }
57
+
58
+ if (sRefreshStrategy !== "includingDependents") {
59
+ var aViewControls = oController._findTables();
60
+
61
+ aControlsToRefresh = aControlsToRefresh.concat(KeepAliveHelper.getControlsForRefresh(oView, aViewControls) || []);
62
+ }
63
+
64
+ return aControlsToRefresh.reduce(function (aPrevControls, oControl) {
65
+ if (aPrevControls.indexOf(oControl) === -1) {
66
+ aPrevControls.push(oControl);
67
+ }
68
+
69
+ return aPrevControls;
70
+ }, aControls);
71
+ }
72
+ };
73
+ return ViewStateExtensionOverride;
74
+ }, false);
75
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIlZpZXdTdGF0ZS50cyJdLCJuYW1lcyI6WyJWYXJpYW50TWFuYWdlbWVudCIsIkNvcmVMaWJyYXJ5IiwiVmlld1N0YXRlRXh0ZW5zaW9uT3ZlcnJpZGUiLCJhcHBseUluaXRpYWxTdGF0ZU9ubHkiLCJhZGFwdFN0YXRlQ29udHJvbHMiLCJhU3RhdGVDb250cm9scyIsIm9WaWV3IiwiZ2V0VmlldyIsIm9Db250cm9sbGVyIiwiZ2V0Q29udHJvbGxlciIsIm9WaWV3RGF0YSIsImdldFZpZXdEYXRhIiwiYkNvbnRyb2xWTSIsInZhcmlhbnRNYW5hZ2VtZW50IiwiQ29udHJvbCIsIlBhZ2UiLCJOb25lIiwiRXJyb3IiLCJ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ZWN0UGFnZUNvbnRyb2xsZXIpLl9nZXRPYmplY3RQYWdlTGF5b3V0Q29udHJvbCgpO1xuXHRcdFx0YUNvbnRyb2xzVG9SZWZyZXNoLnB1c2gob09iamVjdFBhZ2VDb250cm9sKTtcblx0XHR9XG5cdFx0aWYgKHNSZWZyZXNoU3RyYXRlZ3kgIT09IFwiaW5jbHVkaW5nRGVwZW5kZW50c1wiKSB7XG5cdFx0XHRjb25zdCBhVmlld0NvbnRyb2xzID0gKG9Db250cm9sbGVyIGFzIE9iamVjdFBhZ2VDb250cm9sbGVyKS5fZmluZFRhYmxlcygpO1xuXHRcdFx0YUNvbnRyb2xzVG9SZWZyZXNoID0gYUNvbnRyb2xzVG9SZWZyZXNoLmNvbmNhdChLZWVwQWxpdmVIZWxwZXIuZ2V0Q29udHJvbHNGb3JSZWZyZXNoKG9WaWV3LCBhVmlld0NvbnRyb2xzKSB8fCBbXSk7XG5cdFx0fVxuXHRcdHJldHVybiBhQ29udHJvbHNUb1JlZnJlc2gucmVkdWNlKGZ1bmN0aW9uIChhUHJldkNvbnRyb2xzOiBhbnksIG9Db250cm9sOiBhbnkpIHtcblx0XHRcdGlmIChhUHJldkNvbnRyb2xzLmluZGV4T2Yob0NvbnRyb2wpID09PSAtMSkge1xuXHRcdFx0XHRhUHJldkNvbnRyb2xzLnB1c2gob0NvbnRyb2wpO1xuXHRcdFx0fVxuXHRcdFx0cmV0dXJuIGFQcmV2Q29udHJvbHM7XG5cdFx0fSwgYUNvbnRyb2xzKTtcblx0fVxufTtcblxuZXhwb3J0IGRlZmF1bHQgVmlld1N0YXRlRXh0ZW5zaW9uT3ZlcnJpZGU7XG4iXX0=
@@ -0,0 +1,65 @@
1
+ import ViewState from "sap/fe/core/controllerextensions/ViewState";
2
+ import KeepAliveHelper from "sap/fe/core/helpers/KeepAliveHelper";
3
+ import CoreLibrary from "sap/fe/core/library";
4
+ import ObjectPageController from "sap/fe/templates/ObjectPage/ObjectPageController.controller";
5
+ import Control from "sap/ui/core/Control";
6
+
7
+ const VariantManagement = CoreLibrary.VariantManagement;
8
+
9
+ const ViewStateExtensionOverride = {
10
+ applyInitialStateOnly: function () {
11
+ return false;
12
+ },
13
+ adaptStateControls: function (this: ViewState, aStateControls: any) {
14
+ const oView = this.getView(),
15
+ oController = oView.getController(),
16
+ oViewData = oView.getViewData() as any;
17
+ let bControlVM = false;
18
+
19
+ switch (oViewData.variantManagement) {
20
+ case VariantManagement.Control:
21
+ bControlVM = true;
22
+ break;
23
+ case VariantManagement.Page:
24
+ case VariantManagement.None:
25
+ break;
26
+ default:
27
+ throw new Error("unhandled variant setting: " + oViewData.getVariantManagement());
28
+ }
29
+
30
+ (oController as ObjectPageController)._findTables().forEach(function (oTable: any) {
31
+ const oQuickFilter = oTable.getQuickFilter();
32
+ if (oQuickFilter) {
33
+ aStateControls.push(oQuickFilter);
34
+ }
35
+ if (bControlVM) {
36
+ aStateControls.push(oTable.getVariant());
37
+ }
38
+ });
39
+
40
+ aStateControls.push(oView.byId("fe::ObjectPage"));
41
+ },
42
+ adaptBindingRefreshControls: function (this: ViewState, aControls: any) {
43
+ const oView = this.getView(),
44
+ sRefreshStrategy = KeepAliveHelper.getViewRefreshInfo(oView),
45
+ oController = oView.getController();
46
+ let aControlsToRefresh: Control[] = [];
47
+
48
+ if (sRefreshStrategy) {
49
+ const oObjectPageControl = (oController as ObjectPageController)._getObjectPageLayoutControl();
50
+ aControlsToRefresh.push(oObjectPageControl);
51
+ }
52
+ if (sRefreshStrategy !== "includingDependents") {
53
+ const aViewControls = (oController as ObjectPageController)._findTables();
54
+ aControlsToRefresh = aControlsToRefresh.concat(KeepAliveHelper.getControlsForRefresh(oView, aViewControls) || []);
55
+ }
56
+ return aControlsToRefresh.reduce(function (aPrevControls: any, oControl: any) {
57
+ if (aPrevControls.indexOf(oControl) === -1) {
58
+ aPrevControls.push(oControl);
59
+ }
60
+ return aPrevControls;
61
+ }, aControls);
62
+ }
63
+ };
64
+
65
+ export default ViewStateExtensionOverride;
@@ -7,9 +7,8 @@
7
7
  xmlns:macro="sap.fe.macros.internal"
8
8
  template:require="{
9
9
  ID: 'sap/fe/core/helpers/StableIdHelper',
10
- OP: 'sap/fe/templates/ObjectPage/AnnotationHelper',
10
+ OP: 'sap/fe/templates/ObjectPage/ObjectPageTemplating',
11
11
  MODEL: 'sap/ui/model/odata/v4/AnnotationHelper',
12
- CORE: 'sap/fe/core/AnnotationHelper',
13
12
  UI: 'sap/fe/core/templating/UIFormatters',
14
13
  CRIT: 'sap/fe/core/templating/CriticalityFormatters',
15
14
  COMMON: 'sap/fe/macros/CommonHelper',
@@ -17,9 +16,22 @@
17
16
  }"
18
17
  >
19
18
  <template:if test="{converterContext>header/actions}">
20
- <template:repeat list="{converterContext>header/actions}" var="headerAction">
21
- <template:if test="{= CORE.isManifestAction(${headerAction>}) }">
19
+ <template:repeat list="{converterContext>header/actions}" var="headerAction">
20
+ <template:if test="{= ${headerAction>type} === 'DraftActions' &amp;&amp; OP.checkDraftState(${entitySet>@}) }">
22
21
  <template:then>
22
+ <Button
23
+ id="fe::StandardAction::SwitchDraftAndActiveObject"
24
+ text="{= ( !(${ui>/editMode} === 'Editable') &amp;&amp; !${ui>createMode} &amp;&amp; ${HasDraftEntity} ) ? ${sap.fe.i18n>C_COMMON_OBJECT_PAGE_SAVED_VERSION_BUT} : ${sap.fe.i18n>C_COMMON_OBJECT_PAGE_DRAFT_BUT} }"
25
+ visible="{= OP.getSwitchDraftAndActiveVisibility(${entitySet>@}) }"
26
+ icon="sap-icon://navigation-down-arrow"
27
+ iconFirst="false"
28
+ type="Transparent"
29
+ press="._showSwitchDraftAndActivePopover($event)"
30
+ />
31
+ <core:Fragment fragmentName="sap.fe.templates.ObjectPage.view.fragments.CollaborationDraft" type="XML" />
32
+ <ToolbarSpacer />
33
+ </template:then>
34
+ <template:elseif test="{= OP.isManifestAction(${headerAction>}) }">
23
35
  <template:if test="{= ${headerAction>type} === 'Menu'}">
24
36
  <template:then>
25
37
  <MenuButton
@@ -38,7 +50,7 @@
38
50
  <MenuItem
39
51
  id="{= ID.generate(['fe', ${dataField>}]) }"
40
52
  text="{dataField>Label}"
41
- press="{= OP.getPressExpressionForEdit(${dataField>}, ${entitySet>@sapui.name}, ${headerAction>}) }"
53
+ press="{= ${menuItemAction>command} ? ('cmd:' + ${menuItemAction>command}) : OP.getPressExpressionForEdit(${dataField>}, ${entitySet>@sapui.name}, ${headerAction>}) }"
42
54
  visible="{menuItemAction>visible}"
43
55
  enabled="{menuItemAction>enabled}"
44
56
  />
@@ -47,7 +59,7 @@
47
59
  <MenuItem
48
60
  id="{= ID.generate(['fe', ${dataField>}]) }"
49
61
  text="{dataField>Label}"
50
- press="{menuItemAction>press}"
62
+ press="{= ${menuItemAction>command} ? ('cmd:' + ${menuItemAction>command}) : ${menuItemAction>press}}"
51
63
  enabled="{menuItemAction>enabled}"
52
64
  visible="{menuItemAction>visible}"
53
65
  macrodata:IBNData="{menuItemAction>customData}"
@@ -58,7 +70,7 @@
58
70
  core:require="{FPM: 'sap/fe/core/helpers/FPMHelper'}"
59
71
  id="{= ID.generate(['fe',${menuItemAction>id}])}"
60
72
  text="{menuItemAction>text}"
61
- press="{= CORE.buildActionWrapper(${menuItemAction>}, ${headerAction>})}"
73
+ press="{= ${menuItemAction>command} ? ('cmd:' + ${menuItemAction>command}) : COMMON.buildActionWrapper(${menuItemAction>}, ${headerAction>})}"
62
74
  visible="{menuItemAction>visible}"
63
75
  enabled="{menuItemAction>enabled}"
64
76
  />
@@ -76,23 +88,22 @@
76
88
  core:require="{FPM: 'sap/fe/core/helpers/FPMHelper'}"
77
89
  id="{= ID.generate(['fe',${headerAction>id}])}"
78
90
  text="{headerAction>text}"
79
- press="{= CORE.buildActionWrapper(${headerAction>})}"
91
+ press="{= ${headerAction>command} ? ('cmd:' + ${headerAction>command}) : COMMON.buildActionWrapper(${headerAction>})}"
80
92
  type="Default"
81
93
  visible="{headerAction>visible}"
82
94
  enabled="{headerAction>enabled}"
83
95
  />
84
96
  </template:else>
85
97
  </template:if>
86
- </template:then>
87
-
98
+ </template:elseif>
88
99
  <template:elseif test="{= ${headerAction>type} === 'Primary'}">
89
100
  <template:with path="entitySet>" helper="OP.getEditAction" var="editAction">
90
101
  <template:with path="editAction>@Org.OData.Core.V1.OperationAvailable" var="operationAvailable">
91
102
  <template:if test="{= ${operationAvailable>} !== false }">
92
- <Button
103
+ <Button
93
104
  unittest:id="EditActionTest"
94
105
  id="fe::StandardAction::Edit"
95
- type="{path: 'entitySet>./@com.sap.vocabularies.UI.v1.Identification', formatter: 'CORE.buildEmphasizedButtonExpression'}"
106
+ type="{path: 'entitySet>./@com.sap.vocabularies.UI.v1.Identification', formatter: 'OP.buildEmphasizedButtonExpression'}"
96
107
  text="{sap.fe.i18n>C_COMMON_OBJECT_PAGE_EDIT}"
97
108
  enabled="{headerAction>enabled}"
98
109
  visible="{headerAction>visible}"
@@ -118,24 +129,6 @@
118
129
  ariaHasPopup="Dialog"
119
130
  />
120
131
  </template:elseif>
121
- <template:elseif test="{= ${headerAction>type} === 'SwitchToActiveObject' &amp;&amp; OP.checkDraftState(${entitySet>@}) }">
122
- <Button
123
- id="fe::StandardAction::SwitchToActiveObject"
124
- type="Default"
125
- text="{sap.fe.i18n>C_COMMON_OBJECT_PAGE_DISPLAY_SAVED_VERSION}"
126
- visible="{= OP.getSwitchToActiveVisibility(${entitySet>@}) }"
127
- press="cmd:SwitchToActiveObject"
128
- />
129
- </template:elseif>
130
- <template:elseif test="{= ${headerAction>type} === 'SwitchToDraftObject' &amp;&amp; OP.checkDraftState(${entitySet>@}) }">
131
- <Button
132
- id="fe::StandardAction::SwitchToDraftObject"
133
- type="Default"
134
- text="{sap.fe.i18n>C_COMMON_OBJECT_PAGE_RETURN_TO_DRAFT}"
135
- visible="{= OP.getSwitchToDraftVisibility(${entitySet>@}) }"
136
- press="cmd:SwitchToDraftObject"
137
- />
138
- </template:elseif>
139
132
  <template:elseif test="{= ${headerAction>type} === 'ForAction'}">
140
133
  <template:with path="headerAction>annotationPath" var="dataField">
141
134
  <template:if
@@ -150,7 +143,7 @@
150
143
  id="{= ID.generate(['fe', ${dataField>}]) }"
151
144
  unittest:id="AnnotationActionTest"
152
145
  text="{dataField>Label}"
153
- press="{= OP.getPressExpressionForEdit(${dataField>}, ${entitySet>@sapui.name}, ${headerAction>}) }"
146
+ press="{= ${headerAction>command} ? ('cmd:' + ${headerAction>command}) : OP.getPressExpressionForEdit(${dataField>}, ${entitySet>@sapui.name}, ${headerAction>}) }"
154
147
  visible="{headerAction>visible}"
155
148
  enabled="{headerAction>enabled}"
156
149
  type="{= CRIT.buildExpressionForCriticalityButtonType(${dataField>@@UI.getDataModelObjectPath}) }"
@@ -164,10 +157,10 @@
164
157
  </template:elseif>
165
158
  <template:elseif test="{= ${headerAction>type} === 'ForNavigation'}">
166
159
  <template:with path="headerAction>annotationPath" var="dataField">
167
- <Button
160
+ <Button
168
161
  id="{= ID.generate(['fe', ${dataField>}]) }"
169
162
  text="{headerAction>text}"
170
- press="{headerAction>press}"
163
+ press="{= ${headerAction>command} ? ('cmd:' + ${headerAction>command}) : ${headerAction>press}}"
171
164
  enabled="{headerAction>enabled}"
172
165
  type="{headerAction>buttonType}"
173
166
  visible="{headerAction>visible}"