@sapui5/sap.fe.core 1.102.2 → 1.104.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (324) hide show
  1. package/package.json +6 -6
  2. package/src/sap/fe/core/.library +1 -1
  3. package/src/sap/fe/core/AppComponent.js +73 -30
  4. package/src/sap/fe/core/AppComponent.ts +65 -43
  5. package/src/sap/fe/core/AppStateHandler.js +82 -70
  6. package/src/sap/fe/core/AppStateHandler.ts +32 -37
  7. package/src/sap/fe/core/BaseController.js +11 -9
  8. package/src/sap/fe/core/BaseController.ts +15 -13
  9. package/src/sap/fe/core/CommonUtils.js +227 -126
  10. package/src/sap/fe/core/CommonUtils.ts +240 -163
  11. package/src/sap/fe/core/ExtensionAPI.js +24 -27
  12. package/src/sap/fe/core/ExtensionAPI.ts +36 -38
  13. package/src/sap/fe/core/PageController.js +4 -4
  14. package/src/sap/fe/core/PageController.ts +4 -5
  15. package/src/sap/fe/core/TemplateComponent.js +1 -1
  16. package/src/sap/fe/core/TemplateComponent.ts +6 -6
  17. package/src/sap/fe/core/TemplateModel.js +1 -1
  18. package/src/sap/fe/core/TemplateModel.ts +1 -1
  19. package/src/sap/fe/core/buildingBlocks/AttributeModel.js +1 -1
  20. package/src/sap/fe/core/buildingBlocks/AttributeModel.ts +1 -1
  21. package/src/sap/fe/core/buildingBlocks/BuildingBlock.js +181 -43
  22. package/src/sap/fe/core/buildingBlocks/BuildingBlock.ts +150 -24
  23. package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.js +585 -210
  24. package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.ts +246 -96
  25. package/src/sap/fe/core/buildingBlocks/TraceInfo.js +30 -30
  26. package/src/sap/fe/core/buildingBlocks/TraceInfo.ts +32 -29
  27. package/src/sap/fe/core/controllerextensions/EditFlow.js +379 -330
  28. package/src/sap/fe/core/controllerextensions/EditFlow.ts +253 -245
  29. package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +9 -9
  30. package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.ts +10 -10
  31. package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +101 -74
  32. package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +69 -79
  33. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +67 -67
  34. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +76 -76
  35. package/src/sap/fe/core/controllerextensions/InternalRouting.js +85 -77
  36. package/src/sap/fe/core/controllerextensions/InternalRouting.ts +103 -99
  37. package/src/sap/fe/core/controllerextensions/KPIManagement.js +66 -68
  38. package/src/sap/fe/core/controllerextensions/KPIManagement.ts +106 -123
  39. package/src/sap/fe/core/controllerextensions/MassEdit.js +9 -9
  40. package/src/sap/fe/core/controllerextensions/MassEdit.ts +20 -27
  41. package/src/sap/fe/core/controllerextensions/MessageHandler.js +20 -12
  42. package/src/sap/fe/core/controllerextensions/MessageHandler.ts +21 -14
  43. package/src/sap/fe/core/controllerextensions/PageReady.js +97 -25
  44. package/src/sap/fe/core/controllerextensions/PageReady.ts +98 -34
  45. package/src/sap/fe/core/controllerextensions/Paginator.js +21 -22
  46. package/src/sap/fe/core/controllerextensions/Paginator.ts +24 -25
  47. package/src/sap/fe/core/controllerextensions/Placeholder.js +4 -6
  48. package/src/sap/fe/core/controllerextensions/Placeholder.ts +12 -14
  49. package/src/sap/fe/core/controllerextensions/Routing.js +10 -11
  50. package/src/sap/fe/core/controllerextensions/Routing.ts +12 -13
  51. package/src/sap/fe/core/controllerextensions/Share.js +170 -139
  52. package/src/sap/fe/core/controllerextensions/Share.ts +117 -118
  53. package/src/sap/fe/core/controllerextensions/SideEffects.js +46 -50
  54. package/src/sap/fe/core/controllerextensions/SideEffects.ts +56 -60
  55. package/src/sap/fe/core/controllerextensions/ViewState.js +200 -131
  56. package/src/sap/fe/core/controllerextensions/ViewState.ts +141 -148
  57. package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.js +5 -5
  58. package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.ts +8 -7
  59. package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.js +11 -10
  60. package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.ts +17 -20
  61. package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.js +2 -2
  62. package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.ts +4 -4
  63. package/src/sap/fe/core/controllerextensions/collaboration/Manage.js +7 -9
  64. package/src/sap/fe/core/controllerextensions/collaboration/Manage.ts +18 -19
  65. package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.js +190 -141
  66. package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.ts +258 -210
  67. package/src/sap/fe/core/controllerextensions/editFlow/draft.js +183 -125
  68. package/src/sap/fe/core/controllerextensions/editFlow/draft.ts +213 -156
  69. package/src/sap/fe/core/controllerextensions/editFlow/operations.js +164 -140
  70. package/src/sap/fe/core/controllerextensions/editFlow/operations.ts +180 -150
  71. package/src/sap/fe/core/controllerextensions/editFlow/sticky.js +24 -26
  72. package/src/sap/fe/core/controllerextensions/editFlow/sticky.ts +35 -33
  73. package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.js +71 -41
  74. package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.ts +102 -82
  75. package/src/sap/fe/core/controllerextensions/routing/RouterProxy.js +61 -71
  76. package/src/sap/fe/core/controllerextensions/routing/RouterProxy.ts +56 -64
  77. package/src/sap/fe/core/controls/Any.js +9 -5
  78. package/src/sap/fe/core/controls/Any.ts +10 -4
  79. package/src/sap/fe/core/controls/CommandExecution.js +11 -25
  80. package/src/sap/fe/core/controls/CommandExecution.ts +11 -25
  81. package/src/sap/fe/core/controls/ConditionalWrapper.js +2 -2
  82. package/src/sap/fe/core/controls/ConditionalWrapper.ts +3 -3
  83. package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.js +22 -22
  84. package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.ts +25 -24
  85. package/src/sap/fe/core/controls/CustomQuickViewPage.js +2 -2
  86. package/src/sap/fe/core/controls/CustomQuickViewPage.ts +2 -2
  87. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +3 -3
  88. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +5 -5
  89. package/src/sap/fe/core/controls/FieldWrapper.js +2 -2
  90. package/src/sap/fe/core/controls/FieldWrapper.ts +3 -3
  91. package/src/sap/fe/core/controls/FileWrapper.js +7 -2
  92. package/src/sap/fe/core/controls/FileWrapper.ts +15 -11
  93. package/src/sap/fe/core/controls/FilterBar.js +6 -2
  94. package/src/sap/fe/core/controls/FilterBar.ts +13 -9
  95. package/src/sap/fe/core/controls/FormElementWrapper.js +1 -1
  96. package/src/sap/fe/core/controls/FormElementWrapper.ts +2 -2
  97. package/src/sap/fe/core/controls/MassEditSelect.js +1 -1
  98. package/src/sap/fe/core/controls/MassEditSelect.ts +0 -4
  99. package/src/sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog.fragment.xml +3 -3
  100. package/src/sap/fe/core/controls/filterbar/VisualFilter.js +16 -12
  101. package/src/sap/fe/core/controls/filterbar/VisualFilter.ts +20 -22
  102. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +3 -3
  103. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.ts +8 -8
  104. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +49 -49
  105. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +54 -54
  106. package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +8 -2
  107. package/src/sap/fe/core/controls/massEdit/MassEditField.fragment.xml +22 -35
  108. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +89 -88
  109. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +107 -106
  110. package/src/sap/fe/core/converters/ConverterContext.js +26 -33
  111. package/src/sap/fe/core/converters/ConverterContext.ts +52 -61
  112. package/src/sap/fe/core/converters/ManifestSettings.js +1 -1
  113. package/src/sap/fe/core/converters/ManifestSettings.ts +17 -15
  114. package/src/sap/fe/core/converters/ManifestWrapper.js +59 -45
  115. package/src/sap/fe/core/converters/ManifestWrapper.ts +55 -45
  116. package/src/sap/fe/core/converters/MetaModelConverter.js +64 -35
  117. package/src/sap/fe/core/converters/MetaModelConverter.ts +154 -129
  118. package/src/sap/fe/core/converters/TemplateConverter.js +21 -20
  119. package/src/sap/fe/core/converters/TemplateConverter.ts +27 -24
  120. package/src/sap/fe/core/converters/annotations/DataField.js +58 -35
  121. package/src/sap/fe/core/converters/annotations/DataField.ts +102 -76
  122. package/src/sap/fe/core/converters/common/AnnotationConverter.js +1911 -1495
  123. package/src/sap/fe/core/converters/controls/Common/Action.js +50 -41
  124. package/src/sap/fe/core/converters/controls/Common/Action.ts +56 -46
  125. package/src/sap/fe/core/converters/controls/Common/Chart.js +14 -14
  126. package/src/sap/fe/core/converters/controls/Common/Chart.ts +26 -33
  127. package/src/sap/fe/core/converters/controls/Common/Criticality.js +3 -3
  128. package/src/sap/fe/core/converters/controls/Common/Criticality.ts +4 -4
  129. package/src/sap/fe/core/converters/controls/Common/DataVisualization.js +30 -28
  130. package/src/sap/fe/core/converters/controls/Common/DataVisualization.ts +60 -61
  131. package/src/sap/fe/core/converters/controls/Common/Form.js +27 -28
  132. package/src/sap/fe/core/converters/controls/Common/Form.ts +44 -57
  133. package/src/sap/fe/core/converters/controls/Common/KPI.js +11 -11
  134. package/src/sap/fe/core/converters/controls/Common/KPI.ts +49 -52
  135. package/src/sap/fe/core/converters/controls/Common/Table.js +181 -197
  136. package/src/sap/fe/core/converters/controls/Common/Table.ts +251 -280
  137. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +119 -119
  138. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +144 -141
  139. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +45 -41
  140. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +65 -59
  141. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +28 -26
  142. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +46 -43
  143. package/src/sap/fe/core/converters/controls/ObjectPage/Avatar.js +9 -9
  144. package/src/sap/fe/core/converters/controls/ObjectPage/Avatar.ts +14 -13
  145. package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.js +67 -64
  146. package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.ts +69 -66
  147. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +77 -73
  148. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +101 -97
  149. package/src/sap/fe/core/converters/helpers/Aggregation.js +2 -4
  150. package/src/sap/fe/core/converters/helpers/Aggregation.ts +12 -15
  151. package/src/sap/fe/core/converters/helpers/BindingHelper.js +31 -31
  152. package/src/sap/fe/core/converters/helpers/BindingHelper.ts +30 -29
  153. package/src/sap/fe/core/converters/helpers/ConfigurableObject.js +4 -4
  154. package/src/sap/fe/core/converters/helpers/ConfigurableObject.ts +9 -9
  155. package/src/sap/fe/core/converters/helpers/ID.js +48 -46
  156. package/src/sap/fe/core/converters/helpers/ID.ts +26 -25
  157. package/src/sap/fe/core/converters/helpers/Key.js +7 -7
  158. package/src/sap/fe/core/converters/helpers/Key.ts +7 -7
  159. package/src/sap/fe/core/converters/helpers/SelectionVariantHelper.js +1 -1
  160. package/src/sap/fe/core/converters/helpers/SelectionVariantHelper.ts +4 -5
  161. package/src/sap/fe/core/converters/objectPage/FormMenuActions.js +6 -6
  162. package/src/sap/fe/core/converters/objectPage/FormMenuActions.ts +10 -10
  163. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +46 -62
  164. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +54 -82
  165. package/src/sap/fe/core/converters/templates/ListReportConverter.js +55 -42
  166. package/src/sap/fe/core/converters/templates/ListReportConverter.ts +81 -66
  167. package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +39 -38
  168. package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +52 -61
  169. package/src/sap/fe/core/designtime/AppComponent.designtime.js +4 -4
  170. package/src/sap/fe/core/designtime/AppComponent.designtime.ts +4 -4
  171. package/src/sap/fe/core/formatters/CollaborationFormatter.js +2 -2
  172. package/src/sap/fe/core/formatters/CollaborationFormatter.ts +3 -3
  173. package/src/sap/fe/core/formatters/FPMFormatter.js +5 -5
  174. package/src/sap/fe/core/formatters/FPMFormatter.ts +10 -10
  175. package/src/sap/fe/core/formatters/KPIFormatter.js +7 -7
  176. package/src/sap/fe/core/formatters/KPIFormatter.ts +10 -10
  177. package/src/sap/fe/core/formatters/StandardFormatter.js +96 -0
  178. package/src/sap/fe/core/formatters/StandardFormatter.ts +70 -0
  179. package/src/sap/fe/core/formatters/TableFormatter.js +11 -11
  180. package/src/sap/fe/core/formatters/TableFormatter.ts +12 -12
  181. package/src/sap/fe/core/formatters/ValueFormatter.js +8 -8
  182. package/src/sap/fe/core/formatters/ValueFormatter.ts +9 -9
  183. package/src/sap/fe/core/helpers/AppStartupHelper.js +15 -15
  184. package/src/sap/fe/core/helpers/AppStartupHelper.ts +37 -40
  185. package/src/sap/fe/core/helpers/BindingToolkit.js +1832 -0
  186. package/src/sap/fe/core/helpers/{BindingExpression.ts → BindingToolkit.ts} +396 -269
  187. package/src/sap/fe/core/helpers/ClassSupport.js +49 -12
  188. package/src/sap/fe/core/helpers/ClassSupport.ts +37 -10
  189. package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +2 -2
  190. package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.ts +1 -1
  191. package/src/sap/fe/core/helpers/EditState.js +1 -6
  192. package/src/sap/fe/core/helpers/EditState.ts +5 -10
  193. package/src/sap/fe/core/helpers/ExcelFormatHelper.js +2 -2
  194. package/src/sap/fe/core/helpers/ExcelFormatHelper.ts +4 -4
  195. package/src/sap/fe/core/helpers/FPMHelper.js +1 -1
  196. package/src/sap/fe/core/helpers/FPMHelper.ts +2 -2
  197. package/src/sap/fe/core/helpers/KeepAliveHelper.js +31 -31
  198. package/src/sap/fe/core/helpers/KeepAliveHelper.ts +52 -56
  199. package/src/sap/fe/core/helpers/MassEditHelper.js +306 -280
  200. package/src/sap/fe/core/helpers/MassEditHelper.ts +380 -360
  201. package/src/sap/fe/core/helpers/MessageStrip.js +81 -0
  202. package/src/sap/fe/core/helpers/MessageStrip.ts +79 -0
  203. package/src/sap/fe/core/helpers/ModelHelper.js +25 -25
  204. package/src/sap/fe/core/helpers/ModelHelper.ts +34 -32
  205. package/src/sap/fe/core/helpers/PasteHelper.js +3 -10
  206. package/src/sap/fe/core/helpers/PasteHelper.ts +20 -25
  207. package/src/sap/fe/core/helpers/SemanticDateOperators.js +1 -1
  208. package/src/sap/fe/core/helpers/SemanticDateOperators.ts +11 -11
  209. package/src/sap/fe/core/helpers/SemanticKeyHelper.js +3 -3
  210. package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +8 -8
  211. package/src/sap/fe/core/helpers/StableIdHelper.js +12 -12
  212. package/src/sap/fe/core/helpers/StableIdHelper.ts +12 -12
  213. package/src/sap/fe/core/helpers/ToES6Promise.js +32 -0
  214. package/src/sap/fe/core/helpers/ToES6Promise.ts +19 -0
  215. package/src/sap/fe/core/jsx-runtime/Fragment.js +16 -0
  216. package/src/sap/fe/core/jsx-runtime/Fragment.ts +3 -0
  217. package/src/sap/fe/core/jsx-runtime/jsx-control.js +99 -0
  218. package/src/sap/fe/core/jsx-runtime/jsx-control.ts +82 -0
  219. package/src/sap/fe/core/jsx-runtime/jsx-xml.js +105 -0
  220. package/src/sap/fe/core/jsx-runtime/jsx-xml.ts +89 -0
  221. package/src/sap/fe/core/jsx-runtime/jsx.js +12 -90
  222. package/src/sap/fe/core/jsx-runtime/jsx.ts +24 -85
  223. package/src/sap/fe/core/library.js +42 -3
  224. package/src/sap/fe/core/library.ts +38 -0
  225. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +3 -3
  226. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +2 -2
  227. package/src/sap/fe/core/messagebundle.properties +39 -63
  228. package/src/sap/fe/core/messagebundle_ar.properties +25 -39
  229. package/src/sap/fe/core/messagebundle_bg.properties +25 -39
  230. package/src/sap/fe/core/messagebundle_ca.properties +25 -39
  231. package/src/sap/fe/core/messagebundle_cs.properties +25 -39
  232. package/src/sap/fe/core/messagebundle_cy.properties +25 -39
  233. package/src/sap/fe/core/messagebundle_da.properties +25 -39
  234. package/src/sap/fe/core/messagebundle_de.properties +25 -39
  235. package/src/sap/fe/core/messagebundle_el.properties +26 -40
  236. package/src/sap/fe/core/messagebundle_en.properties +25 -39
  237. package/src/sap/fe/core/messagebundle_en_GB.properties +25 -39
  238. package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +25 -39
  239. package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +25 -39
  240. package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +26 -18
  241. package/src/sap/fe/core/messagebundle_es.properties +27 -41
  242. package/src/sap/fe/core/messagebundle_es_MX.properties +25 -39
  243. package/src/sap/fe/core/messagebundle_et.properties +25 -39
  244. package/src/sap/fe/core/messagebundle_fi.properties +25 -39
  245. package/src/sap/fe/core/messagebundle_fr.properties +26 -40
  246. package/src/sap/fe/core/messagebundle_fr_CA.properties +25 -39
  247. package/src/sap/fe/core/messagebundle_hi.properties +25 -39
  248. package/src/sap/fe/core/messagebundle_hr.properties +25 -39
  249. package/src/sap/fe/core/messagebundle_hu.properties +25 -39
  250. package/src/sap/fe/core/messagebundle_id.properties +25 -39
  251. package/src/sap/fe/core/messagebundle_it.properties +41 -55
  252. package/src/sap/fe/core/messagebundle_iw.properties +25 -39
  253. package/src/sap/fe/core/messagebundle_ja.properties +25 -39
  254. package/src/sap/fe/core/messagebundle_kk.properties +25 -39
  255. package/src/sap/fe/core/messagebundle_ko.properties +30 -44
  256. package/src/sap/fe/core/messagebundle_lt.properties +25 -39
  257. package/src/sap/fe/core/messagebundle_lv.properties +25 -39
  258. package/src/sap/fe/core/messagebundle_ms.properties +25 -39
  259. package/src/sap/fe/core/messagebundle_nl.properties +27 -41
  260. package/src/sap/fe/core/messagebundle_no.properties +25 -39
  261. package/src/sap/fe/core/messagebundle_pl.properties +26 -40
  262. package/src/sap/fe/core/messagebundle_pt.properties +26 -40
  263. package/src/sap/fe/core/messagebundle_pt_PT.properties +25 -39
  264. package/src/sap/fe/core/messagebundle_ro.properties +25 -39
  265. package/src/sap/fe/core/messagebundle_ru.properties +25 -39
  266. package/src/sap/fe/core/messagebundle_sh.properties +25 -39
  267. package/src/sap/fe/core/messagebundle_sk.properties +25 -39
  268. package/src/sap/fe/core/messagebundle_sl.properties +25 -39
  269. package/src/sap/fe/core/messagebundle_sv.properties +25 -39
  270. package/src/sap/fe/core/messagebundle_th.properties +25 -39
  271. package/src/sap/fe/core/messagebundle_tr.properties +25 -39
  272. package/src/sap/fe/core/messagebundle_uk.properties +25 -39
  273. package/src/sap/fe/core/messagebundle_vi.properties +25 -39
  274. package/src/sap/fe/core/messagebundle_zh_CN.properties +25 -39
  275. package/src/sap/fe/core/messagebundle_zh_TW.properties +25 -39
  276. package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +2 -2
  277. package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +5 -5
  278. package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +97 -69
  279. package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +68 -69
  280. package/src/sap/fe/core/services/EnvironmentServiceFactory.js +1 -1
  281. package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +3 -2
  282. package/src/sap/fe/core/services/NavigationServiceFactory.js +61 -49
  283. package/src/sap/fe/core/services/NavigationServiceFactory.ts +63 -52
  284. package/src/sap/fe/core/services/ResourceModelServiceFactory.js +2 -2
  285. package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +4 -4
  286. package/src/sap/fe/core/services/RoutingServiceFactory.js +55 -55
  287. package/src/sap/fe/core/services/RoutingServiceFactory.ts +67 -65
  288. package/src/sap/fe/core/services/ShellServicesFactory.js +92 -76
  289. package/src/sap/fe/core/services/ShellServicesFactory.ts +95 -82
  290. package/src/sap/fe/core/services/SideEffectsServiceFactory.js +61 -61
  291. package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +102 -92
  292. package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +224 -198
  293. package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +138 -139
  294. package/src/sap/fe/core/support/CommonHelper.js +3 -2
  295. package/src/sap/fe/core/support/CommonHelper.ts +9 -13
  296. package/src/sap/fe/core/support/Diagnostics.js +1 -1
  297. package/src/sap/fe/core/support/Diagnostics.ts +5 -5
  298. package/src/sap/fe/core/templating/CommonFormatters.js +84 -0
  299. package/src/sap/fe/core/templating/CommonFormatters.ts +86 -0
  300. package/src/sap/fe/core/templating/CriticalityFormatters.js +31 -31
  301. package/src/sap/fe/core/templating/CriticalityFormatters.ts +42 -40
  302. package/src/sap/fe/core/templating/DataFieldFormatters.js +8 -8
  303. package/src/sap/fe/core/templating/DataFieldFormatters.ts +13 -10
  304. package/src/sap/fe/core/templating/DataModelPathHelper.js +16 -15
  305. package/src/sap/fe/core/templating/DataModelPathHelper.ts +42 -32
  306. package/src/sap/fe/core/templating/DisplayModeFormatter.js +1 -1
  307. package/src/sap/fe/core/templating/DisplayModeFormatter.ts +2 -3
  308. package/src/sap/fe/core/templating/EntitySetHelper.js +7 -7
  309. package/src/sap/fe/core/templating/EntitySetHelper.ts +6 -8
  310. package/src/sap/fe/core/templating/FieldControlHelper.js +35 -34
  311. package/src/sap/fe/core/templating/FieldControlHelper.ts +29 -46
  312. package/src/sap/fe/core/templating/FilterHelper.js +16 -15
  313. package/src/sap/fe/core/templating/FilterHelper.ts +18 -18
  314. package/src/sap/fe/core/templating/FilterTemplating.js +1 -1
  315. package/src/sap/fe/core/templating/FilterTemplating.ts +3 -3
  316. package/src/sap/fe/core/templating/PropertyFormatters.js +7 -7
  317. package/src/sap/fe/core/templating/PropertyFormatters.ts +21 -19
  318. package/src/sap/fe/core/templating/PropertyHelper.js +25 -25
  319. package/src/sap/fe/core/templating/PropertyHelper.ts +25 -26
  320. package/src/sap/fe/core/templating/UIFormatters.js +152 -95
  321. package/src/sap/fe/core/templating/UIFormatters.ts +202 -128
  322. package/src/sap/fe/core/type/Email.js +2 -2
  323. package/src/sap/fe/core/type/Email.ts +2 -2
  324. package/src/sap/fe/core/helpers/BindingExpression.js +0 -1732
@@ -1,25 +1,25 @@
1
- import ResourceBundle from "sap/base/i18n/ResourceBundle";
1
+ import { CommonAnnotationTerms } from "@sap-ux/vocabularies-types/vocabularies/Common";
2
+ import type ResourceBundle from "sap/base/i18n/ResourceBundle";
2
3
  import Log from "sap/base/Log";
3
- import AppComponent from "sap/fe/core/AppComponent";
4
+ import type AppComponent from "sap/fe/core/AppComponent";
4
5
  import CommonUtils from "sap/fe/core/CommonUtils";
5
6
  import ActivitySync from "sap/fe/core/controllerextensions/collaboration/ActivitySync";
6
7
  import messageHandling from "sap/fe/core/controllerextensions/messageHandler/messageHandling";
7
8
  import DataLossOrDraftDiscardHandler from "sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler";
8
9
  import EditState from "sap/fe/core/helpers/EditState";
9
- import { SideEffectsService } from "sap/fe/core/services/SideEffectsServiceFactory";
10
+ import type { SideEffectsService } from "sap/fe/core/services/SideEffectsServiceFactory";
10
11
  import Button from "sap/m/Button";
11
12
  import Dialog from "sap/m/Dialog";
12
13
  import MessageBox from "sap/m/MessageBox";
13
14
  import Text from "sap/m/Text";
14
15
  import Core from "sap/ui/core/Core";
15
- import View from "sap/ui/core/mvc/View";
16
- import Context from "sap/ui/model/odata/v4/Context";
17
- import ODataMetaModel from "sap/ui/model/odata/v4/ODataMetaModel";
18
- import ResourceModel from "sap/ui/model/resource/ResourceModel";
19
- import { CoreEx } from "types/extension_types";
16
+ import type View from "sap/ui/core/mvc/View";
17
+ import type ResourceModel from "sap/ui/model/resource/ResourceModel";
18
+ import type { CoreEx, V4Context } from "types/extension_types";
19
+ import PageController from "../../PageController";
20
20
 
21
21
  export type SiblingInformation = {
22
- targetContext: Context;
22
+ targetContext: V4Context;
23
23
  pathMapping: { oldPath: string; newPath: string }[];
24
24
  };
25
25
 
@@ -36,18 +36,19 @@ export type SiblingInformation = {
36
36
 
37
37
  /**
38
38
  * Callback to approve or reject the creation of a draft
39
+ *
39
40
  * @name sap.fe.core.actions.draft.ICallback.beforeCreateDraftFromActiveDocument
40
41
  * @function
41
42
  * @static
42
43
  * @abstract
43
44
  * @param {sap.ui.model.odata.v4.Context} oContext Context of the active document for the new draft
44
45
  * @returns {(boolean|Promise)} Approval of draft creation [true|false] or Promise that resolves with the boolean value
45
- *
46
46
  * @private
47
47
  */
48
48
 
49
49
  /**
50
50
  * Callback after a draft was successully created
51
+ *
51
52
  * @name sap.fe.core.actions.draft.ICallback.afterCreateDraftFromActiveDocument
52
53
  * @function
53
54
  * @static
@@ -55,21 +56,19 @@ export type SiblingInformation = {
55
56
  * @param {sap.ui.model.odata.v4.Context} oContext Context of the new draft
56
57
  * @param {sap.ui.model.odata.v4.Context} oActiveDocumentContext Context of the active document for the new draft
57
58
  * @returns {sap.ui.model.odata.v4.Context} oActiveDocumentContext
58
- *
59
59
  * @private
60
60
  */
61
61
 
62
62
  /**
63
63
  * Callback to approve or reject overwriting an unsaved draft of another user
64
+ *
64
65
  * @name sap.fe.core.actions.draft.ICallback.whenDecisionToOverwriteDocumentIsRequired
65
66
  * @function
66
67
  * @public
67
68
  * @static
68
69
  * @abstract
69
- *
70
70
  * @param {sap.ui.model.odata.v4.Context} oContext Context of the active document for the new draft
71
71
  * @returns {(boolean|Promise)} Approval to overwrite unsaved draft [true|false] or Promise that resolves with the boolean value
72
- *
73
72
  * @ui5-restricted
74
73
  */
75
74
  /* Constants for draft operations */
@@ -97,50 +96,64 @@ enum NavigationType {
97
96
  /**
98
97
  * Determines action name for a draft operation.
99
98
  *
100
- * @param {sap.ui.model.odata.v4.Context} oContext The context that should be bound to the operation
101
- * @param {string} sOperation The operation name
102
- * @returns {string} The name of the draft operation
99
+ * @param oContext The context that should be bound to the operation
100
+ * @param sOperation The operation name
101
+ * @returns The name of the draft operation
103
102
  */
104
- function getActionName(oContext: any, sOperation: string) {
103
+ function getActionName(oContext: V4Context, sOperation: string) {
105
104
  const oModel = oContext.getModel(),
106
105
  oMetaModel = oModel.getMetaModel(),
107
106
  sEntitySetPath = oMetaModel.getMetaPath(oContext.getPath());
108
107
 
109
- return oMetaModel.getObject(sEntitySetPath + "@com.sap.vocabularies.Common.v1.DraftRoot/" + sOperation);
108
+ return oMetaModel.getObject(`${sEntitySetPath}@com.sap.vocabularies.Common.v1.DraftRoot/${sOperation}`);
110
109
  }
111
110
  /**
112
111
  * Creates an operation context binding for the given context and operation.
113
112
  *
114
- * @param {sap.ui.model.odata.v4.Context} oContext The context that should be bound to the operation
115
- * @param {string} sOperation The operation (action or function import)
113
+ * @param oContext The context that should be bound to the operation
114
+ * @param sOperation The operation (action or function import)
116
115
  * @param oOptions Options to create the operation context
117
- * @returns {sap.ui.model.odata.v4.ODataContextBinding} The context binding of the bound operation
116
+ * @returns The context binding of the bound operation
118
117
  */
119
- function createOperation(oContext: any, sOperation: string, oOptions?: any) {
118
+ function createOperation(oContext: V4Context, sOperation: string, oOptions?: any) {
120
119
  const sOperationName = getActionName(oContext, sOperation);
121
120
 
122
- return oContext.getModel().bindContext(sOperationName + "(...)", oContext, oOptions);
121
+ return oContext.getModel().bindContext(`${sOperationName}(...)`, oContext, oOptions);
122
+ }
123
+ /**
124
+ * Determines the return type for a draft operation.
125
+ *
126
+ * @param oContext The context that should be bound to the operation
127
+ * @param sOperation The operation name
128
+ * @returns The return type of the draft operation
129
+ */
130
+ function getReturnType(oContext: V4Context, sOperation: string) {
131
+ const oModel = oContext.getModel(),
132
+ oMetaModel = oModel.getMetaModel(),
133
+ sEntitySetPath = oMetaModel.getMetaPath(oContext.getPath());
134
+
135
+ return oMetaModel.getObject(`${sEntitySetPath}@com.sap.vocabularies.Common.v1.DraftRoot/${sOperation}/$ReturnType`);
123
136
  }
124
137
  /**
125
138
  * Check if optional draft prepare action exists.
126
139
  *
127
- * @param {sap.ui.model.odata.v4.Context} oContext The context that should be bound to the operation
128
- * @returns {boolean} True if a a prepare action exists
140
+ * @param oContext The context that should be bound to the operation
141
+ * @returns True if a a prepare action exists
129
142
  */
130
- function hasPrepareAction(oContext: any) {
143
+ function hasPrepareAction(oContext: V4Context) {
131
144
  return !!getActionName(oContext, draftOperations.PREPARE);
132
145
  }
133
146
  /**
134
147
  * Creates a new draft from an active document.
135
148
  *
136
149
  * @function
137
- * @param {sap.ui.model.odata.v4.Context} oContext Context for which the action should be performed
138
- * @param {boolean} bPreserveChanges If true - existing changes from another user that are not locked are preserved and an error message (http status 409) is send from the backend, otherwise false - existing changes from another user that are not locked are overwritten</li>
139
- * @returns {Promise.<sap.ui.model.odata.v4.Context>} Resolve function returns the context of the operation
150
+ * @param oContext Context for which the action should be performed
151
+ * @param bPreserveChanges If true - existing changes from another user that are not locked are preserved and an error message (http status 409) is send from the backend, otherwise false - existing changes from another user that are not locked are overwritten</li>
152
+ * @returns Resolve function returns the context of the operation
140
153
  * @private
141
154
  * @ui5-restricted
142
155
  */
143
- function executeDraftEditAction(oContext: any, bPreserveChanges: boolean) {
156
+ function executeDraftEditAction(oContext: V4Context, bPreserveChanges: boolean): Promise<V4Context> {
144
157
  if (oContext.getProperty("IsActiveEntity")) {
145
158
  const oOptions = { $$inheritExpandSelect: true };
146
159
  const oOperation = createOperation(oContext, draftOperations.EDIT, oOptions);
@@ -170,14 +183,14 @@ function executeDraftEditAction(oContext: any, bPreserveChanges: boolean) {
170
183
  * Activates a draft document. The draft will replace the sibling entity and will be deleted by the back end.
171
184
  *
172
185
  * @function
173
- * @param {sap.ui.model.odata.v4.Context} oContext Context for which the action should be performed
174
- * @param {object} oAppComponent The AppComponent
175
- * @param {string} [sGroupId] The optional batch group in which the operation is to be executed
176
- * @returns {Promise.<sap.ui.model.odata.v4.Context>} Resolve function returns the context of the operation
186
+ * @param oContext Context for which the action should be performed
187
+ * @param oAppComponent The AppComponent
188
+ * @param [sGroupId] The optional batch group in which the operation is to be executed
189
+ * @returns Resolve function returns the context of the operation
177
190
  * @private
178
191
  * @ui5-restricted
179
192
  */
180
- function executeDraftActivationAction(oContext: any, oAppComponent: AppComponent, sGroupId?: string) {
193
+ function executeDraftActivationAction(oContext: V4Context, oAppComponent: AppComponent, sGroupId?: string): Promise<V4Context> {
181
194
  const bHasPrepareAction = hasPrepareAction(oContext);
182
195
 
183
196
  // According to the draft spec if the service contains a prepare action and we trigger both prepare and
@@ -202,9 +215,9 @@ function executeDraftActivationAction(oContext: any, oAppComponent: AppComponent
202
215
  //if ACTIVATE action fails then we request either the sideEffects against PREPARE action (if annotated) or the messages as fallback:
203
216
  function () {
204
217
  if (bHasPrepareAction) {
205
- const sActionName = getActionName(oContext, draftOperations.PREPARE),
218
+ const actionName = getActionName(oContext, draftOperations.PREPARE),
206
219
  oSideEffectsService = oAppComponent.getSideEffectsService(),
207
- oBindingParameters = oSideEffectsService.getODataActionSideEffects(sActionName, oContext),
220
+ oBindingParameters = oSideEffectsService.getODataActionSideEffects(actionName, oContext),
208
221
  aTargetPaths = oBindingParameters && oBindingParameters.pathExpressions;
209
222
  if (aTargetPaths && aTargetPaths.length > 0) {
210
223
  oSideEffectsService.requestSideEffects(aTargetPaths, oContext).catch(function (oError: any) {
@@ -227,15 +240,24 @@ function executeDraftActivationAction(oContext: any, oAppComponent: AppComponent
227
240
  * Execute a preparation action.
228
241
  *
229
242
  * @function
230
- * @param {sap.ui.model.odata.v4.Context} oContext Context for which the action should be performed
231
- * @param {string} groupId The optional batch group in which we want to execute the operation
232
- * @returns {Promise.<sap.ui.model.odata.v4.Context>} Resolve function returns the context of the operation
243
+ * @param oContext Context for which the action should be performed
244
+ * @param groupId The optional batch group in which we want to execute the operation
245
+ * @returns Resolve function returns the context of the operation
233
246
  * @private
234
247
  * @ui5-restricted
235
248
  */
236
- function executeDraftPreparationAction(oContext: Context, groupId?: string) {
249
+ function executeDraftPreparationAction(oContext: V4Context, groupId?: string) {
237
250
  if (!oContext.getProperty("IsActiveEntity")) {
238
- const oOperation = createOperation(oContext, draftOperations.PREPARE);
251
+ const oMetaModel = oContext.getModel().getMetaModel();
252
+ const sContextPath = oMetaModel.getMetaPath(oContext.getPath());
253
+ const oReturnType = getReturnType(oContext, draftOperations.PREPARE);
254
+ let sMessagesPath;
255
+ // If there is no return parameter, it is not possible to request Messages.
256
+ // RAP draft prepare has no return parameter
257
+ if (!!oReturnType) {
258
+ sMessagesPath = oMetaModel.getObject(`${sContextPath}/@${CommonAnnotationTerms.Messages}/$Path`);
259
+ }
260
+ const oOperation = createOperation(oContext, draftOperations.PREPARE, sMessagesPath ? { $select: sMessagesPath } : null);
239
261
 
240
262
  // TODO: side effects qualifier shall be even deprecated to be checked
241
263
  oOperation.setParameter("SideEffectsQualifier", "");
@@ -257,28 +279,28 @@ function executeDraftPreparationAction(oContext: Context, groupId?: string) {
257
279
  * Determines the message path for a context.
258
280
  *
259
281
  * @function
260
- * @param {sap.ui.model.odata.v4.Context} oContext Context for which the path shall be determined
261
- * @returns {string} Message path, empty if not annotated
282
+ * @param oContext Context for which the path shall be determined
283
+ * @returns Message path, empty if not annotated
262
284
  * @private
263
285
  * @ui5-restricted
264
286
  */
265
- function getMessagesPath(oContext: Context): string {
287
+ function getMessagesPath(oContext: V4Context): string {
266
288
  const oModel = oContext.getModel(),
267
- oMetaModel = oModel.getMetaModel() as ODataMetaModel,
289
+ oMetaModel = oModel.getMetaModel(),
268
290
  sEntitySetPath = oMetaModel.getMetaPath(oContext.getPath());
269
- return oMetaModel.getObject(sEntitySetPath + "/@com.sap.vocabularies.Common.v1.Messages/$Path");
291
+ return oMetaModel.getObject(`${sEntitySetPath}/@com.sap.vocabularies.Common.v1.Messages/$Path`);
270
292
  }
271
293
  /**
272
294
  * Requests the messages if annotated for a given context.
273
295
  *
274
296
  * @function
275
- * @param {sap.ui.model.odata.v4.Context} oContext Context for which the messages shall be requested
276
- * @param {object} oSideEffectsService Service for the SideEffects on SAP Fiori elements
277
- * @returns {Promise} Promise which is resolved once messages were requested
297
+ * @param oContext Context for which the messages shall be requested
298
+ * @param oSideEffectsService Service for the SideEffects on SAP Fiori elements
299
+ * @returns Promise which is resolved once messages were requested
278
300
  * @private
279
301
  * @ui5-restricted
280
302
  */
281
- function requestMessages(oContext: any, oSideEffectsService: SideEffectsService) {
303
+ function requestMessages(oContext: V4Context, oSideEffectsService: SideEffectsService) {
282
304
  const sMessagesPath = getMessagesPath(oContext);
283
305
  if (sMessagesPath) {
284
306
  return oSideEffectsService.requestSideEffects([{ $PropertyPath: sMessagesPath }] as any, oContext);
@@ -286,16 +308,16 @@ function requestMessages(oContext: any, oSideEffectsService: SideEffectsService)
286
308
  return Promise.resolve();
287
309
  }
288
310
  /**
289
- * Executes the discard of a draft function using HTTP POST.
311
+ * Executes discard of a draft function using HTTP Post.
290
312
  *
291
313
  * @function
292
- * @param {sap.ui.model.odata.v4.Context} oContext Context for which the action should be performed
293
- * @param {boolean} bEnableStrictHandling
294
- * @returns {Promise.<sap.ui.model.odata.v4.Context>} Resolve function returns the context of the operation
314
+ * @param oContext Context for which the action should be performed
315
+ * @param bEnableStrictHandling
316
+ * @returns Resolve function returns the context of the operation
295
317
  * @private
296
318
  * @ui5-restricted
297
319
  */
298
- function executeDraftDiscardAction(oContext: any, bEnableStrictHandling?: boolean): Promise<boolean> {
320
+ function executeDraftDiscardAction(oContext: V4Context, bEnableStrictHandling?: boolean): Promise<boolean> {
299
321
  if (!oContext.getProperty("IsActiveEntity")) {
300
322
  const oDiscardOperation = draft.createOperation(oContext, draftOperations.DISCARD);
301
323
  const localI18nRef = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core");
@@ -321,13 +343,13 @@ function executeDraftDiscardAction(oContext: any, bEnableStrictHandling?: boolea
321
343
  * This method creates a sibling context for a subobject page and calculates a sibling path for all intermediate paths
322
344
  * between the object page and the subobject page.
323
345
  *
324
- * @param {object} rootCurrentContext The context for the root of the draft
325
- * @param {object} rightmostCurrentContext The context of the subobject page
326
- * @returns {Promise} returns the siblingInformation object
346
+ * @param rootCurrentContext The context for the root of the draft
347
+ * @param rightmostCurrentContext The context of the subobject page
348
+ * @returns The siblingInformation object
327
349
  */
328
350
  async function computeSiblingInformation(
329
- rootCurrentContext: Context,
330
- rightmostCurrentContext: Context
351
+ rootCurrentContext: V4Context,
352
+ rightmostCurrentContext: V4Context
331
353
  ): Promise<SiblingInformation | undefined> {
332
354
  if (!rightmostCurrentContext.getPath().startsWith(rootCurrentContext.getPath())) {
333
355
  // Wrong usage !!
@@ -358,7 +380,7 @@ async function computeSiblingInformation(
358
380
  const canonicalPathPromises = segments.map((segment) => {
359
381
  currentPath += `/${segment}`;
360
382
  oldPaths.unshift(currentPath);
361
- const siblingContext = model.bindContext(currentPath + "/SiblingEntity").getBoundContext() as Context;
383
+ const siblingContext = model.bindContext(`${currentPath}/SiblingEntity`).getBoundContext();
362
384
  return siblingContext.requestCanonicalPath();
363
385
  });
364
386
 
@@ -380,7 +402,7 @@ async function computeSiblingInformation(
380
402
  });
381
403
 
382
404
  return {
383
- targetContext: model.bindContext(siblingPath).getBoundContext() as Context, // Create the rightmost sibling context from its path
405
+ targetContext: model.bindContext(siblingPath).getBoundContext(), // Create the rightmost sibling context from its path
384
406
  pathMapping: oldPaths.map((oldPath, index) => {
385
407
  return {
386
408
  oldPath,
@@ -403,15 +425,15 @@ async function computeSiblingInformation(
403
425
  * @name sap.fe.core.actions.draft#createDraftFromActiveDocument
404
426
  * @memberof sap.fe.core.actions.draft
405
427
  * @static
406
- * @param {sap.ui.model.odata.v4.Context} oContext Context of the active document for the new draft
407
- * @param {AppComponent} oAppComponent The AppComponent
408
- * @param {object} mParameters The parameters
409
- * @param {boolean} [mParameters.oView] The view
410
- * @param {boolean} [mParameters.bPreserveChanges] Preserve changes of an existing draft of another user
411
- * @param {sap.fe.core.actions.draft.ICallback.beforeCreateDraftFromActiveDocument} [mParameters.fnBeforeCreateDraftFromActiveDocument] Callback that allows veto before create request is executed
412
- * @param {sap.fe.core.actions.draft.ICallback.afterCreateDraftFromActiveDocument} [mParameters.fnAfterCreateDraftFromActiveDocument] Callback for postprocessiong after draft document was created
413
- * @param {sap.fe.core.actions.draft.ICallback.whenDecisionToOverwriteDocumentIsRequired} [mParameters.fnWhenDecisionToOverwriteDocumentIsRequired] Callback for deciding on overwriting an unsaved change by another user
414
- * @returns {Promise} Promise resolves with the {@link sap.ui.model.odata.v4.Context context} of the new draft document
428
+ * @param oContext Context of the active document for the new draft
429
+ * @param oAppComponent The AppComponent
430
+ * @param mParameters The parameters
431
+ * @param [mParameters.oView] The view
432
+ * @param [mParameters.bPreserveChanges] Preserve changes of an existing draft of another user
433
+ * @param [mParameters.fnBeforeCreateDraftFromActiveDocument] Callback that allows veto before create request is executed
434
+ * @param [mParameters.fnAfterCreateDraftFromActiveDocument] Callback for postprocessiong after draft document was created
435
+ * @param [mParameters.fnWhenDecisionToOverwriteDocumentIsRequired] Callback for deciding on overwriting an unsaved change by another user
436
+ * @returns Promise resolves with the {@link sap.ui.model.odata.v4.Context context} of the new draft document
415
437
  * @private
416
438
  * @ui5-restricted
417
439
  */
@@ -434,14 +456,14 @@ async function createDraftFromActiveDocument(
434
456
  /**
435
457
  * Overwrite or reject based on fnWhenDecisionToOverwriteDocumentIsRequired.
436
458
  *
437
- * @param {*} bOverwrite Overwrite the change or not
438
- * @returns {Promise} Resolves with result of {@link sap.fe.core.actions#executeDraftEditAction}
459
+ * @param bOverwrite Overwrite the change or not
460
+ * @returns Resolves with result of {@link sap.fe.core.actions#executeDraftEditAction}
439
461
  */
440
- function overwriteOnDemand(bOverwrite: any) {
462
+ function overwriteOnDemand(bOverwrite: boolean) {
441
463
  if (bOverwrite) {
442
464
  //Overwrite existing changes
443
465
  const oModel = oContext.getModel();
444
- const draftDataContext = oModel.bindContext(oContext.getPath() + "/DraftAdministrativeData").getBoundContext();
466
+ const draftDataContext = oModel.bindContext(`${oContext.getPath()}/DraftAdministrativeData`).getBoundContext();
445
467
  let oResourceBundle: ResourceBundle;
446
468
 
447
469
  return ((mParameters.oView.getModel("sap.fe.i18n") as ResourceModel).getResourceBundle() as Promise<ResourceBundle>)
@@ -479,13 +501,13 @@ async function createDraftFromActiveDocument(
479
501
  }
480
502
  });
481
503
  }
482
- return Promise.reject(new Error("Draft creation aborted for document: " + oContext.getPath()));
504
+ return Promise.reject(new Error(`Draft creation aborted for document: ${oContext.getPath()}`));
483
505
  }
484
506
 
485
507
  function showMessageBox(sUnsavedChangesMsg: any) {
486
508
  return new Promise(function (resolve: (value: any) => void, reject: (reason?: any) => void) {
487
509
  const oDialog = new Dialog({
488
- title: localI18nRef.getText("C_DRAFT_OBJECT_PAGE_WARNING"),
510
+ title: localI18nRef.getText("C_MESSAGE_HANDLING_SAPFE_ERROR_MESSAGES_PAGE_TITLE_WARNING"),
489
511
  state: "Warning",
490
512
  content: new Text({
491
513
  text: sUnsavedChangesMsg
@@ -502,7 +524,7 @@ async function createDraftFromActiveDocument(
502
524
  text: localI18nRef.getText("C_COMMON_OBJECT_PAGE_CANCEL"),
503
525
  press: function () {
504
526
  oDialog.close();
505
- reject("Draft creation aborted for document: " + oContext.getPath());
527
+ reject(`Draft creation aborted for document: ${oContext.getPath()}`);
506
528
  }
507
529
  }),
508
530
  afterClose: function () {
@@ -523,11 +545,11 @@ async function createDraftFromActiveDocument(
523
545
  : true;
524
546
 
525
547
  if (!bExecute) {
526
- throw new Error("Draft creation was aborted by extension for document: " + oContext.getPath());
548
+ throw new Error(`Draft creation was aborted by extension for document: ${oContext.getPath()}`);
527
549
  }
528
550
  let openingSiblingContext = false;
529
551
  try {
530
- let oDraftContext: Context | null = null;
552
+ let oDraftContext: V4Context | undefined;
531
553
  try {
532
554
  oDraftContext = await draft.executeDraftEditAction(oContext, bRunPreserveChangesFlow);
533
555
  } catch (oResponse: any) {
@@ -548,10 +570,8 @@ async function createDraftFromActiveDocument(
548
570
  mParam.fnWhenDecisionToOverwriteDocumentIsRequired ? mParam.fnWhenDecisionToOverwriteDocumentIsRequired() : true
549
571
  );
550
572
  }
551
- } else {
552
- if (!(oResponse && oResponse.canceled)) {
553
- throw new Error(oResponse);
554
- }
573
+ } else if (!(oResponse && oResponse.canceled)) {
574
+ throw new Error(oResponse);
555
575
  }
556
576
  }
557
577
  if (openingSiblingContext) {
@@ -587,17 +607,17 @@ async function createDraftFromActiveDocument(
587
607
  * @name sap.fe.core.actions.draft#activateDocument
588
608
  * @memberof sap.fe.core.actions.draft
589
609
  * @static
590
- * @param {sap.ui.model.odata.v4.Context} oContext Context of the active document for the new draft
591
- * @param {object} oAppComponent The AppComponent
592
- * @param {object} mParameters The parameters
593
- * @param {sap.fe.core.actions.draft.ICallback.fnBeforeActivateDocument} [mParameters.fnBeforeActivateDocument] Callback that allows veto before create request is executed
594
- * @param {sap.fe.core.actions.draft.ICallback.fnAfterActivateDocument} [mParameters.fnAfterActivateDocument] Callback for postprocessiong after document was activated.
595
- * @returns {Promise} Promise resolves with the {@link sap.ui.model.odata.v4.Context context} of the new draft document
610
+ * @param oContext Context of the active document for the new draft
611
+ * @param oAppComponent The AppComponent
612
+ * @param mParameters The parameters
613
+ * @param [mParameters.fnBeforeActivateDocument] Callback that allows veto before create request is executed
614
+ * @param [mParameters.fnAfterActivateDocument] Callback for postprocessiong after document was activated.
615
+ * @returns Promise resolves with the {@link sap.ui.model.odata.v4.Context context} of the new draft document
596
616
  * @private
597
617
  * @ui5-restricted
598
618
  */
599
619
  function activateDocument(
600
- oContext: any,
620
+ oContext: V4Context,
601
621
  oAppComponent: AppComponent,
602
622
  mParameters: { fnBeforeActivateDocument?: any; fnAfterActivateDocument?: any }
603
623
  ) {
@@ -609,7 +629,7 @@ function activateDocument(
609
629
  return Promise.resolve(mParam.fnBeforeActivateDocument ? mParam.fnBeforeActivateDocument(oContext) : true)
610
630
  .then(function (bExecute: any) {
611
631
  if (!bExecute) {
612
- return Promise.reject(new Error("Activation of the document was aborted by extension for document: " + oContext.getPath()));
632
+ return Promise.reject(new Error(`Activation of the document was aborted by extension for document: ${oContext.getPath()}`));
613
633
  }
614
634
 
615
635
  if (!hasPrepareAction(oContext)) {
@@ -649,13 +669,13 @@ function activateDocument(
649
669
  * @name sap.fe.core.actions.draft#deleteDraft
650
670
  * @memberof sap.fe.core.actions.draft
651
671
  * @static
652
- * @param {sap.ui.model.odata.v4.Context} oContext Context of the document to be discarded
653
- * @param {boolean} bEnableStrictHandling
672
+ * @param oContext Context of the document to be discarded
673
+ * @param bEnableStrictHandling
654
674
  * @private
655
- * @returns {Promise}
675
+ * @returns A Promise resolved when the context is deleted
656
676
  * @ui5-restricted
657
677
  */
658
- function deleteDraft(oContext: any, bEnableStrictHandling?: boolean): Promise<boolean> {
678
+ function deleteDraft(oContext: V4Context, bEnableStrictHandling?: boolean): Promise<boolean> {
659
679
  const sDiscardAction = getActionName(oContext, draftOperations.DISCARD),
660
680
  bIsActiveEntity = oContext.getObject().IsActiveEntity;
661
681
 
@@ -680,6 +700,20 @@ function deleteDraft(oContext: any, bEnableStrictHandling?: boolean): Promise<bo
680
700
  }
681
701
  }
682
702
 
703
+ /**
704
+ * The method checks whether an optional parameter in the manifest is set to silently keep the draft in case a forward navigation is triggered
705
+ *
706
+ * @param pageController the reference to the current PageController instance.
707
+ * @returns Boolean value with true or false to silently keep the draft
708
+ */
709
+
710
+ function silentlyKeepDraftOnForwardNavigation(pageController: PageController) {
711
+ let rbSilentlyKeep = false;
712
+ const oManifest = pageController.getAppComponent().getManifest() as any;
713
+ rbSilentlyKeep = oManifest?.["sap.fe"]?.app?.silentlyKeepDraftOnForwardNavigation || false;
714
+ return rbSilentlyKeep;
715
+ }
716
+
683
717
  /**
684
718
  * @param fnProcessFunction
685
719
  * @param fnCancelFunction
@@ -697,7 +731,7 @@ function processDataLossOrDraftDiscardConfirmation(
697
731
  navigationType: NavigationType = NavigationType.BackNavigation
698
732
  ) {
699
733
  const oModel = oContext.getModel();
700
- const draftDataContext = oModel.bindContext(oContext.getPath() + "/DraftAdministrativeData").getBoundContext();
734
+ const draftDataContext = oModel.bindContext(`${oContext.getPath()}/DraftAdministrativeData`).getBoundContext();
701
735
 
702
736
  const collaborationConnected = ActivitySync.isConnected(oController.getView());
703
737
  const processFunctionForDrafts = !collaborationConnected
@@ -707,6 +741,7 @@ function processDataLossOrDraftDiscardConfirmation(
707
741
  fnProcessFunction.apply(null, ...args);
708
742
  };
709
743
 
744
+ const bSilentlyKeepDraftOnForwardNavigation = silentlyKeepDraftOnForwardNavigation(oController);
710
745
  if (
711
746
  oContext &&
712
747
  oContext.getObject() &&
@@ -732,74 +767,94 @@ function processDataLossOrDraftDiscardConfirmation(
732
767
  } else {
733
768
  processFunctionForDrafts();
734
769
  }
735
- } else {
736
- if (!oContext.getObject().HasActiveEntity) {
737
- // There is no active entity so we are editing either newly created data or
738
- // a draft which has never been saved to active version
739
- // Since we want to react differently in the two situations, we have to check the
740
- // dirty state
741
- if (EditState.isEditStateDirty()) {
742
- // In this case data is being newly created and then we always want to
743
- // show the dataloss dialog on navigation
770
+ } else if (!oContext.getObject().HasActiveEntity) {
771
+ // There is no active entity so we are editing either newly created data or
772
+ // a draft which has never been saved to active version
773
+ // Since we want to react differently in the two situations, we have to check the
774
+ // dirty state
775
+ if (EditState.isEditStateDirty()) {
776
+ if (
777
+ draftAdminData.CreationDateTime === draftAdminData.LastChangeDateTime &&
778
+ navigationType === NavigationType.BackNavigation
779
+ ) {
780
+ // in case we have untouched changes for the draft and a "back"
781
+ // navigation we can silently discard the draft again
782
+ // eslint-disable-next-line promise/no-nesting
783
+ DataLossOrDraftDiscardHandler.discardDraft(oController, bSkipBindingToView)
784
+ .then(() => {
785
+ processFunctionForDrafts();
786
+ })
787
+ .catch((error: any) => {
788
+ Log.error("Error while canceling the document", error);
789
+ });
790
+ } else if (navigationType === NavigationType.ForwardNavigation && bSilentlyKeepDraftOnForwardNavigation) {
791
+ // In case we have a "forward navigation" and an additional parameter set in the manifest
792
+ // we "silently" keep the draft
793
+ processFunctionForDrafts();
794
+ } else {
795
+ // In this case data is being changed or a forward navigation is triggered
796
+ // and we always want to show the dataloss dialog on navigation
744
797
  DataLossOrDraftDiscardHandler.performAfterDiscardorKeepDraft(
745
798
  processFunctionForDrafts,
746
799
  fnCancelFunction,
747
800
  oController,
748
801
  bSkipBindingToView
749
802
  );
750
- } else {
751
- // We are editing a draft which has been created earlier but never saved to active
752
- // version and since the edit state is not dirty, there have been no user changes
753
- // so in this case we want to silently navigate and do nothing
754
- processFunctionForDrafts();
755
803
  }
756
804
  } else {
757
- // We are editing a draft for an existing active entity
758
- if (draftAdminData.CreationDateTime === draftAdminData.LastChangeDateTime) {
759
- // The CreationDateTime and LastChangeDateTime are equal, so this draft was
760
- // never saved before, hence we're currently editing a newly created draft for
761
- // an existing active entity for the first time.
762
- // Also there have so far been no changes made to the draft and in this
763
- // case we want to silently navigate and delete the draft in case of a back
764
- // navigation but in case of a forward navigation we want to silently keep it!
765
- if (navigationType === NavigationType.BackNavigation) {
766
- const mParameters = {
767
- skipDiscardPopover: true
768
- };
769
- oController.editFlow
770
- .cancelDocument(oContext, mParameters)
771
- .then(() => {
772
- processFunctionForDrafts();
773
- })
774
- .catch((error: any) => {
775
- Log.error("Error while canceling the document", error);
776
- });
777
- } else {
778
- // In case of a forward navigation we silently keep the draft and only
779
- // execute the followup function.
780
- processFunctionForDrafts();
781
- }
782
- } else {
783
- // The CreationDateTime and LastChangeDateTime are NOT equal, so we are currently editing
784
- // an existing draft and need to distinguish depending on if any changes
785
- // have been made in the current editing session or not
786
- if (EditState.isEditStateDirty()) {
787
- // Changes have been made in the current editing session so we want
788
- // to show the dataloss dialog and let the user decide
789
- DataLossOrDraftDiscardHandler.performAfterDiscardorKeepDraft(
790
- processFunctionForDrafts,
791
- fnCancelFunction,
792
- oController,
793
- bSkipBindingToView
794
- );
795
- } else {
796
- // The user started editing the existing draft but did not make any changes
797
- // in the current editing session, so in this case we do not want
798
- // to show the dataloss dialog but just keep the draft
805
+ // We are editing a draft which has been created earlier but never saved to active
806
+ // version and since the edit state is not dirty, there have been no user changes
807
+ // so in this case we want to silently navigate and do nothing
808
+ processFunctionForDrafts();
809
+ }
810
+ } else if (draftAdminData.CreationDateTime === draftAdminData.LastChangeDateTime) {
811
+ // We are editing a draft for an existing active entity
812
+ // The CreationDateTime and LastChangeDateTime are equal, so this draft was
813
+ // never saved before, hence we're currently editing a newly created draft for
814
+ // an existing active entity for the first time.
815
+ // Also there have so far been no changes made to the draft and in this
816
+ // case we want to silently navigate and delete the draftin case of a back
817
+ // navigation but in case of a forward navigation we want to silently keep it!
818
+ if (navigationType === NavigationType.BackNavigation) {
819
+ const mParameters = {
820
+ skipDiscardPopover: true
821
+ };
822
+ oController.editFlow
823
+ .cancelDocument(oContext, mParameters)
824
+ .then(() => {
799
825
  processFunctionForDrafts();
800
- }
801
- }
826
+ })
827
+ .catch((error: any) => {
828
+ Log.error("Error while canceling the document", error);
829
+ });
830
+ } else {
831
+ // In case of a forward navigation we silently keep the draft and only
832
+ // execute the followup function.
833
+ processFunctionForDrafts();
834
+ }
835
+ } else if (EditState.isEditStateDirty()) {
836
+ if (navigationType === NavigationType.ForwardNavigation && bSilentlyKeepDraftOnForwardNavigation) {
837
+ // In case we have a "forward navigation" and an additional parameter set in the manifest
838
+ // we "silently" keep the draft
839
+ processFunctionForDrafts();
840
+ } else {
841
+ // The CreationDateTime and LastChangeDateTime are NOT equal, so we are currently editing
842
+ // an existing draft and need to distinguish depending on if any changes
843
+ // have been made in the current editing session or not
844
+ // Changes have been made in the current editing session so we want
845
+ // to show the dataloss dialog and let the user decide
846
+ DataLossOrDraftDiscardHandler.performAfterDiscardorKeepDraft(
847
+ processFunctionForDrafts,
848
+ fnCancelFunction,
849
+ oController,
850
+ bSkipBindingToView
851
+ );
802
852
  }
853
+ } else {
854
+ // The user started editing the existing draft but did not make any changes
855
+ // in the current editing session, so in this case we do not want
856
+ // to show the dataloss dialog but just keep the draft
857
+ processFunctionForDrafts();
803
858
  }
804
859
  } else {
805
860
  fnProcessFunction();
@@ -816,8 +871,10 @@ const draft = {
816
871
  activateDocument: activateDocument,
817
872
  deleteDraft: deleteDraft,
818
873
  executeDraftEditAction: executeDraftEditAction,
874
+ executeDraftPreparationAction: executeDraftPreparationAction,
819
875
  computeSiblingInformation: computeSiblingInformation,
820
876
  processDataLossOrDraftDiscardConfirmation: processDataLossOrDraftDiscardConfirmation,
877
+ silentlyKeepDraftOnForwardNavigation: silentlyKeepDraftOnForwardNavigation,
821
878
  createOperation: createOperation,
822
879
  executeDraftDiscardAction: executeDraftDiscardAction,
823
880
  NavigationType: NavigationType