@sapui5/sap.fe.core 1.111.0 → 1.112.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 (524) hide show
  1. package/package.json +1 -1
  2. package/src/sap/fe/core/.library +1 -1
  3. package/src/sap/fe/core/ActionRuntime-dbg.js +4 -4
  4. package/src/sap/fe/core/ActionRuntime.js +1 -1
  5. package/src/sap/fe/core/ActionRuntime.js.map +1 -1
  6. package/src/sap/fe/core/ActionRuntime.ts +11 -11
  7. package/src/sap/fe/core/AppComponent-dbg.js +27 -5
  8. package/src/sap/fe/core/AppComponent.js +1 -1
  9. package/src/sap/fe/core/AppComponent.js.map +1 -1
  10. package/src/sap/fe/core/AppComponent.ts +58 -3
  11. package/src/sap/fe/core/AppStateHandler-dbg.js +5 -2
  12. package/src/sap/fe/core/AppStateHandler.js +1 -1
  13. package/src/sap/fe/core/AppStateHandler.js.map +1 -1
  14. package/src/sap/fe/core/AppStateHandler.ts +10 -1
  15. package/src/sap/fe/core/BaseController-dbg.js +1 -1
  16. package/src/sap/fe/core/BaseController.ts +2 -1
  17. package/src/sap/fe/core/CommonUtils-dbg.js +152 -365
  18. package/src/sap/fe/core/CommonUtils.js +1 -1
  19. package/src/sap/fe/core/CommonUtils.js.map +1 -1
  20. package/src/sap/fe/core/CommonUtils.ts +201 -478
  21. package/src/sap/fe/core/ExtensionAPI-dbg.js +2 -1
  22. package/src/sap/fe/core/ExtensionAPI.js +1 -1
  23. package/src/sap/fe/core/ExtensionAPI.js.map +1 -1
  24. package/src/sap/fe/core/ExtensionAPI.ts +9 -1
  25. package/src/sap/fe/core/PageController-dbg.js +26 -31
  26. package/src/sap/fe/core/PageController.js +1 -1
  27. package/src/sap/fe/core/PageController.js.map +1 -1
  28. package/src/sap/fe/core/PageController.ts +17 -3
  29. package/src/sap/fe/core/ResourceModel-dbg.js +71 -0
  30. package/src/sap/fe/core/ResourceModel.js +6 -0
  31. package/src/sap/fe/core/ResourceModel.js.map +1 -0
  32. package/src/sap/fe/core/ResourceModel.ts +67 -0
  33. package/src/sap/fe/core/TemplateComponent-dbg.js +1 -1
  34. package/src/sap/fe/core/TemplateComponent.ts +1 -0
  35. package/src/sap/fe/core/TemplateModel-dbg.js +1 -1
  36. package/src/sap/fe/core/TemplateModel.ts +6 -1
  37. package/src/sap/fe/core/buildingBlocks/AttributeModel-dbg.js +5 -7
  38. package/src/sap/fe/core/buildingBlocks/AttributeModel.js +1 -1
  39. package/src/sap/fe/core/buildingBlocks/AttributeModel.js.map +1 -1
  40. package/src/sap/fe/core/buildingBlocks/AttributeModel.ts +6 -5
  41. package/src/sap/fe/core/buildingBlocks/BuildingBlockBase-dbg.js +163 -0
  42. package/src/sap/fe/core/buildingBlocks/BuildingBlockBase.js +6 -0
  43. package/src/sap/fe/core/buildingBlocks/BuildingBlockBase.js.map +1 -0
  44. package/src/sap/fe/core/buildingBlocks/BuildingBlockBase.ts +169 -0
  45. package/src/sap/fe/core/buildingBlocks/BuildingBlockSupport-dbg.js +88 -0
  46. package/src/sap/fe/core/buildingBlocks/BuildingBlockSupport.js +6 -0
  47. package/src/sap/fe/core/buildingBlocks/BuildingBlockSupport.js.map +1 -0
  48. package/src/sap/fe/core/buildingBlocks/BuildingBlockSupport.ts +147 -0
  49. package/src/sap/fe/core/buildingBlocks/BuildingBlockTemplateProcessor-dbg.js +905 -0
  50. package/src/sap/fe/core/buildingBlocks/BuildingBlockTemplateProcessor.js +21 -0
  51. package/src/sap/fe/core/buildingBlocks/BuildingBlockTemplateProcessor.js.map +1 -0
  52. package/src/sap/fe/core/buildingBlocks/{BuildingBlockRuntime.ts → BuildingBlockTemplateProcessor.ts} +279 -335
  53. package/src/sap/fe/core/buildingBlocks/RuntimeBuildingBlock-dbg.js +79 -0
  54. package/src/sap/fe/core/buildingBlocks/RuntimeBuildingBlock.js +15 -0
  55. package/src/sap/fe/core/buildingBlocks/RuntimeBuildingBlock.js.map +1 -0
  56. package/src/sap/fe/core/buildingBlocks/RuntimeBuildingBlock.ts +68 -0
  57. package/src/sap/fe/core/buildingBlocks/RuntimeBuildingBlockFragment-dbg.js +162 -0
  58. package/src/sap/fe/core/buildingBlocks/RuntimeBuildingBlockFragment.js +6 -0
  59. package/src/sap/fe/core/buildingBlocks/RuntimeBuildingBlockFragment.js.map +1 -0
  60. package/src/sap/fe/core/buildingBlocks/RuntimeBuildingBlockFragment.ts +181 -0
  61. package/src/sap/fe/core/buildingBlocks/TraceInfo-dbg.js +4 -2
  62. package/src/sap/fe/core/buildingBlocks/TraceInfo.js +1 -1
  63. package/src/sap/fe/core/buildingBlocks/TraceInfo.js.map +1 -1
  64. package/src/sap/fe/core/buildingBlocks/TraceInfo.ts +5 -3
  65. package/src/sap/fe/core/controllerextensions/EditFlow-dbg.js +890 -220
  66. package/src/sap/fe/core/controllerextensions/EditFlow.js +1 -1
  67. package/src/sap/fe/core/controllerextensions/EditFlow.js.map +1 -1
  68. package/src/sap/fe/core/controllerextensions/EditFlow.ts +974 -239
  69. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation-dbg.js +24 -34
  70. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +1 -1
  71. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js.map +1 -1
  72. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +71 -61
  73. package/src/sap/fe/core/controllerextensions/InternalRouting-dbg.js +14 -17
  74. package/src/sap/fe/core/controllerextensions/InternalRouting.js +1 -1
  75. package/src/sap/fe/core/controllerextensions/InternalRouting.js.map +1 -1
  76. package/src/sap/fe/core/controllerextensions/InternalRouting.ts +23 -17
  77. package/src/sap/fe/core/controllerextensions/KPIManagement-dbg.js +1 -1
  78. package/src/sap/fe/core/controllerextensions/KPIManagement.ts +2 -0
  79. package/src/sap/fe/core/controllerextensions/MassEdit-dbg.js +3 -3
  80. package/src/sap/fe/core/controllerextensions/MassEdit.js +1 -1
  81. package/src/sap/fe/core/controllerextensions/MassEdit.js.map +1 -1
  82. package/src/sap/fe/core/controllerextensions/MassEdit.ts +2 -2
  83. package/src/sap/fe/core/controllerextensions/MessageHandler-dbg.js +2 -1
  84. package/src/sap/fe/core/controllerextensions/MessageHandler.js.map +1 -1
  85. package/src/sap/fe/core/controllerextensions/MessageHandler.ts +2 -0
  86. package/src/sap/fe/core/controllerextensions/PageReady-dbg.js +1 -1
  87. package/src/sap/fe/core/controllerextensions/PageReady.ts +24 -0
  88. package/src/sap/fe/core/controllerextensions/Paginator-dbg.js +2 -1
  89. package/src/sap/fe/core/controllerextensions/Paginator.js.map +1 -1
  90. package/src/sap/fe/core/controllerextensions/Paginator.ts +7 -0
  91. package/src/sap/fe/core/controllerextensions/Placeholder-dbg.js +1 -1
  92. package/src/sap/fe/core/controllerextensions/Placeholder.ts +8 -0
  93. package/src/sap/fe/core/controllerextensions/Share-dbg.js +8 -1
  94. package/src/sap/fe/core/controllerextensions/Share.js.map +1 -1
  95. package/src/sap/fe/core/controllerextensions/Share.ts +11 -0
  96. package/src/sap/fe/core/controllerextensions/SideEffects-dbg.js +14 -13
  97. package/src/sap/fe/core/controllerextensions/SideEffects.js +1 -1
  98. package/src/sap/fe/core/controllerextensions/SideEffects.js.map +1 -1
  99. package/src/sap/fe/core/controllerextensions/SideEffects.ts +27 -27
  100. package/src/sap/fe/core/controllerextensions/ViewState-dbg.js +17 -8
  101. package/src/sap/fe/core/controllerextensions/ViewState.js +1 -1
  102. package/src/sap/fe/core/controllerextensions/ViewState.js.map +1 -1
  103. package/src/sap/fe/core/controllerextensions/ViewState.ts +35 -14
  104. package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase-dbg.js +6 -5
  105. package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.js +1 -1
  106. package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.js.map +1 -1
  107. package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.ts +7 -4
  108. package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync-dbg.js +285 -82
  109. package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.js +1 -1
  110. package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.js.map +1 -1
  111. package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.ts +326 -89
  112. package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon-dbg.js +23 -2
  113. package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.js +1 -1
  114. package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.js.map +1 -1
  115. package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.ts +32 -3
  116. package/src/sap/fe/core/controllerextensions/collaboration/Manage-dbg.js +1 -1
  117. package/src/sap/fe/core/controllerextensions/collaboration/Manage.js.map +1 -1
  118. package/src/sap/fe/core/controllerextensions/collaboration/Manage.ts +2 -3
  119. package/src/sap/fe/core/controllerextensions/collaboration/ManageDialog.fragment.xml +17 -3
  120. package/src/sap/fe/core/controllerextensions/dialog/OperationsDialog.block-dbg.js +65 -34
  121. package/src/sap/fe/core/controllerextensions/dialog/OperationsDialog.block.js +1 -1
  122. package/src/sap/fe/core/controllerextensions/dialog/OperationsDialog.block.js.map +1 -1
  123. package/src/sap/fe/core/controllerextensions/dialog/OperationsDialog.block.tsx +33 -18
  124. package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper-dbg.js +45 -31
  125. package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.js +1 -1
  126. package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.js.map +1 -1
  127. package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.ts +52 -42
  128. package/src/sap/fe/core/controllerextensions/editFlow/draft-dbg.js +44 -49
  129. package/src/sap/fe/core/controllerextensions/editFlow/draft.js +1 -1
  130. package/src/sap/fe/core/controllerextensions/editFlow/draft.js.map +1 -1
  131. package/src/sap/fe/core/controllerextensions/editFlow/draft.ts +43 -63
  132. package/src/sap/fe/core/controllerextensions/editFlow/draftDataLossPopup.js.map +1 -1
  133. package/src/sap/fe/core/controllerextensions/editFlow/operations/_internal-dbg.js +77 -0
  134. package/src/sap/fe/core/controllerextensions/editFlow/operations/_internal.js +6 -0
  135. package/src/sap/fe/core/controllerextensions/editFlow/operations/_internal.js.map +1 -0
  136. package/src/sap/fe/core/controllerextensions/editFlow/operations/_internal.ts +114 -0
  137. package/src/sap/fe/core/controllerextensions/editFlow/operations/facade-dbg.js +1505 -0
  138. package/src/sap/fe/core/controllerextensions/editFlow/operations/facade.js +6 -0
  139. package/src/sap/fe/core/controllerextensions/editFlow/operations/facade.js.map +1 -0
  140. package/src/sap/fe/core/controllerextensions/editFlow/operations/facade.ts +1985 -0
  141. package/src/sap/fe/core/controllerextensions/editFlow/operations-dbg.js +3 -1415
  142. package/src/sap/fe/core/controllerextensions/editFlow/operations.js +1 -1
  143. package/src/sap/fe/core/controllerextensions/editFlow/operations.js.map +1 -1
  144. package/src/sap/fe/core/controllerextensions/editFlow/operations.ts +2 -1921
  145. package/src/sap/fe/core/controllerextensions/editFlow/sticky-dbg.js +10 -11
  146. package/src/sap/fe/core/controllerextensions/editFlow/sticky.js +1 -1
  147. package/src/sap/fe/core/controllerextensions/editFlow/sticky.js.map +1 -1
  148. package/src/sap/fe/core/controllerextensions/editFlow/sticky.ts +9 -13
  149. package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling-dbg.js +43 -41
  150. package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.js +1 -1
  151. package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.js.map +1 -1
  152. package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.ts +44 -47
  153. package/src/sap/fe/core/controllerextensions/pageReady/DataQueryWatcher-dbg.js +12 -1
  154. package/src/sap/fe/core/controllerextensions/pageReady/DataQueryWatcher.js.map +1 -1
  155. package/src/sap/fe/core/controllerextensions/pageReady/DataQueryWatcher.ts +19 -0
  156. package/src/sap/fe/core/controllerextensions/routing/RouterProxy-dbg.js +12 -13
  157. package/src/sap/fe/core/controllerextensions/routing/RouterProxy.js +1 -1
  158. package/src/sap/fe/core/controllerextensions/routing/RouterProxy.js.map +1 -1
  159. package/src/sap/fe/core/controllerextensions/routing/RouterProxy.ts +32 -13
  160. package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +4 -1
  161. package/src/sap/fe/core/controls/CommandExecution-dbg.js +16 -5
  162. package/src/sap/fe/core/controls/CommandExecution.js +1 -1
  163. package/src/sap/fe/core/controls/CommandExecution.js.map +1 -1
  164. package/src/sap/fe/core/controls/CommandExecution.ts +15 -3
  165. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler-dbg.js +3 -2
  166. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +1 -1
  167. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js.map +1 -1
  168. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +4 -1
  169. package/src/sap/fe/core/controls/FilterBar-dbg.js +1 -1
  170. package/src/sap/fe/core/controls/FilterBar.ts +5 -0
  171. package/src/sap/fe/core/controls/FormElementWrapper-dbg.js +1 -1
  172. package/src/sap/fe/core/controls/FormElementWrapper.ts +3 -0
  173. package/src/sap/fe/core/controls/filterbar/FilterContainer-dbg.js +1 -1
  174. package/src/sap/fe/core/controls/filterbar/FilterContainer.ts +7 -0
  175. package/src/sap/fe/core/controls/filterbar/VisualFilter-dbg.js +1 -1
  176. package/src/sap/fe/core/controls/filterbar/VisualFilter.ts +4 -0
  177. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer-dbg.js +1 -1
  178. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.ts +10 -0
  179. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils-dbg.js +4 -3
  180. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +1 -1
  181. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js.map +1 -1
  182. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +3 -2
  183. package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +0 -1
  184. package/src/sap/fe/core/controls/massEdit/MassEditField.fragment.xml +2 -0
  185. package/src/sap/fe/core/controls/massEdit/MassEditHandlers-dbg.js +6 -1
  186. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +1 -1
  187. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js.map +1 -1
  188. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +5 -0
  189. package/src/sap/fe/core/converters/ConverterContext-dbg.js +1 -1
  190. package/src/sap/fe/core/converters/ConverterContext.ts +2 -1
  191. package/src/sap/fe/core/converters/ManifestSettings-dbg.js +1 -8
  192. package/src/sap/fe/core/converters/ManifestSettings.js +1 -1
  193. package/src/sap/fe/core/converters/ManifestSettings.js.map +1 -1
  194. package/src/sap/fe/core/converters/ManifestSettings.ts +15 -6
  195. package/src/sap/fe/core/converters/ManifestWrapper-dbg.js +17 -1
  196. package/src/sap/fe/core/converters/ManifestWrapper.js +1 -1
  197. package/src/sap/fe/core/converters/ManifestWrapper.js.map +1 -1
  198. package/src/sap/fe/core/converters/ManifestWrapper.ts +16 -0
  199. package/src/sap/fe/core/converters/MetaModelConverter-dbg.js +61 -49
  200. package/src/sap/fe/core/converters/MetaModelConverter.js +1 -1
  201. package/src/sap/fe/core/converters/MetaModelConverter.js.map +1 -1
  202. package/src/sap/fe/core/converters/MetaModelConverter.ts +65 -51
  203. package/src/sap/fe/core/converters/TemplateConverter-dbg.js +2 -1
  204. package/src/sap/fe/core/converters/TemplateConverter.js.map +1 -1
  205. package/src/sap/fe/core/converters/TemplateConverter.ts +2 -1
  206. package/src/sap/fe/core/converters/annotations/DataField-dbg.js +65 -16
  207. package/src/sap/fe/core/converters/annotations/DataField.js +1 -1
  208. package/src/sap/fe/core/converters/annotations/DataField.js.map +1 -1
  209. package/src/sap/fe/core/converters/annotations/DataField.ts +62 -18
  210. package/src/sap/fe/core/converters/common/AnnotationConverter-dbg.js +1010 -957
  211. package/src/sap/fe/core/converters/common/AnnotationConverter.js +1 -1
  212. package/src/sap/fe/core/converters/common/AnnotationConverter.js.map +1 -1
  213. package/src/sap/fe/core/converters/controls/Common/Action-dbg.js +8 -8
  214. package/src/sap/fe/core/converters/controls/Common/Action.js +1 -1
  215. package/src/sap/fe/core/converters/controls/Common/Action.js.map +1 -1
  216. package/src/sap/fe/core/converters/controls/Common/Action.ts +28 -26
  217. package/src/sap/fe/core/converters/controls/Common/Chart-dbg.js +95 -33
  218. package/src/sap/fe/core/converters/controls/Common/Chart.js +1 -1
  219. package/src/sap/fe/core/converters/controls/Common/Chart.js.map +1 -1
  220. package/src/sap/fe/core/converters/controls/Common/Chart.ts +133 -49
  221. package/src/sap/fe/core/converters/controls/Common/DataVisualization-dbg.js +99 -62
  222. package/src/sap/fe/core/converters/controls/Common/DataVisualization.js +1 -1
  223. package/src/sap/fe/core/converters/controls/Common/DataVisualization.js.map +1 -1
  224. package/src/sap/fe/core/converters/controls/Common/DataVisualization.ts +140 -75
  225. package/src/sap/fe/core/converters/controls/Common/Form-dbg.js +1 -1
  226. package/src/sap/fe/core/converters/controls/Common/Form.ts +3 -3
  227. package/src/sap/fe/core/converters/controls/Common/KPI-dbg.js +6 -6
  228. package/src/sap/fe/core/converters/controls/Common/KPI.js +1 -1
  229. package/src/sap/fe/core/converters/controls/Common/KPI.js.map +1 -1
  230. package/src/sap/fe/core/converters/controls/Common/KPI.ts +15 -15
  231. package/src/sap/fe/core/converters/controls/Common/Table-dbg.js +97 -69
  232. package/src/sap/fe/core/converters/controls/Common/Table.js +1 -1
  233. package/src/sap/fe/core/converters/controls/Common/Table.js.map +1 -1
  234. package/src/sap/fe/core/converters/controls/Common/Table.ts +161 -137
  235. package/src/sap/fe/core/converters/controls/Common/table/StandardActions-dbg.js +3 -3
  236. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +1 -1
  237. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js.map +1 -1
  238. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +10 -9
  239. package/src/sap/fe/core/converters/controls/ListReport/FilterBar-dbg.js +48 -44
  240. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +1 -1
  241. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js.map +1 -1
  242. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +130 -86
  243. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters-dbg.js +34 -26
  244. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +1 -1
  245. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js.map +1 -1
  246. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +62 -45
  247. package/src/sap/fe/core/converters/controls/ObjectPage/Avatar-dbg.js +1 -1
  248. package/src/sap/fe/core/converters/controls/ObjectPage/Avatar.ts +1 -1
  249. package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet-dbg.js +6 -6
  250. package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.js +1 -1
  251. package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.js.map +1 -1
  252. package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.ts +5 -8
  253. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection-dbg.js +34 -13
  254. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +1 -1
  255. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js.map +1 -1
  256. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +54 -20
  257. package/src/sap/fe/core/converters/helpers/Aggregation-dbg.js +3 -1
  258. package/src/sap/fe/core/converters/helpers/Aggregation.js.map +1 -1
  259. package/src/sap/fe/core/converters/helpers/Aggregation.ts +8 -0
  260. package/src/sap/fe/core/converters/helpers/ConfigurableObject-dbg.js +7 -6
  261. package/src/sap/fe/core/converters/helpers/ConfigurableObject.js +1 -1
  262. package/src/sap/fe/core/converters/helpers/ConfigurableObject.js.map +1 -1
  263. package/src/sap/fe/core/converters/helpers/ConfigurableObject.ts +19 -10
  264. package/src/sap/fe/core/converters/helpers/DataFieldHelper-dbg.js +1 -1
  265. package/src/sap/fe/core/converters/helpers/DataFieldHelper.ts +7 -2
  266. package/src/sap/fe/core/converters/helpers/ID-dbg.js +1 -1
  267. package/src/sap/fe/core/converters/helpers/ID.ts +2 -1
  268. package/src/sap/fe/core/converters/helpers/IssueManager-dbg.js +9 -8
  269. package/src/sap/fe/core/converters/helpers/IssueManager.js +1 -1
  270. package/src/sap/fe/core/converters/helpers/IssueManager.js.map +1 -1
  271. package/src/sap/fe/core/converters/helpers/IssueManager.ts +8 -7
  272. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction-dbg.js +8 -7
  273. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +1 -1
  274. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js.map +1 -1
  275. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +9 -6
  276. package/src/sap/fe/core/converters/templates/ListReportConverter-dbg.js +25 -33
  277. package/src/sap/fe/core/converters/templates/ListReportConverter.js +1 -1
  278. package/src/sap/fe/core/converters/templates/ListReportConverter.js.map +1 -1
  279. package/src/sap/fe/core/converters/templates/ListReportConverter.ts +35 -35
  280. package/src/sap/fe/core/converters/templates/ObjectPageConverter-dbg.js +11 -4
  281. package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +1 -1
  282. package/src/sap/fe/core/converters/templates/ObjectPageConverter.js.map +1 -1
  283. package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +7 -1
  284. package/src/sap/fe/core/formatters/FPMFormatter-dbg.js +1 -1
  285. package/src/sap/fe/core/formatters/FPMFormatter.ts +1 -1
  286. package/src/sap/fe/core/formatters/FiscalFormat-dbg.js +2 -2
  287. package/src/sap/fe/core/formatters/FiscalFormat.ts +6 -1
  288. package/src/sap/fe/core/formatters/TableFormatter-dbg.js +2 -2
  289. package/src/sap/fe/core/formatters/TableFormatter.js +1 -1
  290. package/src/sap/fe/core/formatters/TableFormatter.js.map +1 -1
  291. package/src/sap/fe/core/formatters/TableFormatter.ts +1 -1
  292. package/src/sap/fe/core/formatters/ValueFormatter-dbg.js +5 -5
  293. package/src/sap/fe/core/formatters/ValueFormatter.js +1 -1
  294. package/src/sap/fe/core/formatters/ValueFormatter.js.map +1 -1
  295. package/src/sap/fe/core/formatters/ValueFormatter.ts +6 -4
  296. package/src/sap/fe/core/fpm/Component-dbg.js +1 -1
  297. package/src/sap/fe/core/fpm/Component.ts +1 -0
  298. package/src/sap/fe/core/fpm/manifest.json +1 -1
  299. package/src/sap/fe/core/helpers/AppStartupHelper-dbg.js +2 -2
  300. package/src/sap/fe/core/helpers/AppStartupHelper.js +1 -1
  301. package/src/sap/fe/core/helpers/AppStartupHelper.js.map +1 -1
  302. package/src/sap/fe/core/helpers/AppStartupHelper.ts +1 -1
  303. package/src/sap/fe/core/helpers/BindingToolkit-dbg.js +6 -6
  304. package/src/sap/fe/core/helpers/BindingToolkit.js.map +1 -1
  305. package/src/sap/fe/core/helpers/BindingToolkit.ts +8 -8
  306. package/src/sap/fe/core/helpers/ClassSupport-dbg.js +1 -1
  307. package/src/sap/fe/core/helpers/ClassSupport.js.map +1 -1
  308. package/src/sap/fe/core/helpers/ClassSupport.ts +1 -0
  309. package/src/sap/fe/core/helpers/DeleteHelper-dbg.js +93 -62
  310. package/src/sap/fe/core/helpers/DeleteHelper.js +1 -1
  311. package/src/sap/fe/core/helpers/DeleteHelper.js.map +1 -1
  312. package/src/sap/fe/core/helpers/DeleteHelper.ts +140 -185
  313. package/src/sap/fe/core/helpers/MassEditHelper-dbg.js +20 -18
  314. package/src/sap/fe/core/helpers/MassEditHelper.js +1 -1
  315. package/src/sap/fe/core/helpers/MassEditHelper.js.map +1 -1
  316. package/src/sap/fe/core/helpers/MassEditHelper.ts +22 -23
  317. package/src/sap/fe/core/helpers/MessageStrip-dbg.js +4 -5
  318. package/src/sap/fe/core/helpers/MessageStrip.js +1 -1
  319. package/src/sap/fe/core/helpers/MessageStrip.js.map +1 -1
  320. package/src/sap/fe/core/helpers/MessageStrip.ts +4 -4
  321. package/src/sap/fe/core/helpers/MetaModelFunction-dbg.js +354 -0
  322. package/src/sap/fe/core/helpers/MetaModelFunction.js +6 -0
  323. package/src/sap/fe/core/helpers/MetaModelFunction.js.map +1 -0
  324. package/src/sap/fe/core/helpers/MetaModelFunction.ts +408 -0
  325. package/src/sap/fe/core/helpers/ModelHelper-dbg.js +13 -13
  326. package/src/sap/fe/core/helpers/ModelHelper.js.map +1 -1
  327. package/src/sap/fe/core/helpers/ModelHelper.ts +13 -13
  328. package/src/sap/fe/core/helpers/PasteHelper-dbg.js +5 -5
  329. package/src/sap/fe/core/helpers/PasteHelper.js +1 -1
  330. package/src/sap/fe/core/helpers/PasteHelper.js.map +1 -1
  331. package/src/sap/fe/core/helpers/PasteHelper.ts +6 -10
  332. package/src/sap/fe/core/helpers/ResourceModelHelper-dbg.js +26 -0
  333. package/src/sap/fe/core/helpers/ResourceModelHelper.js +6 -0
  334. package/src/sap/fe/core/helpers/ResourceModelHelper.js.map +1 -0
  335. package/src/sap/fe/core/helpers/ResourceModelHelper.ts +19 -0
  336. package/src/sap/fe/core/helpers/SemanticDateOperators-dbg.js +93 -18
  337. package/src/sap/fe/core/helpers/SemanticDateOperators.js +1 -1
  338. package/src/sap/fe/core/helpers/SemanticDateOperators.js.map +1 -1
  339. package/src/sap/fe/core/helpers/SemanticDateOperators.ts +70 -17
  340. package/src/sap/fe/core/helpers/SemanticKeyHelper-dbg.js +2 -2
  341. package/src/sap/fe/core/helpers/SemanticKeyHelper.js +1 -1
  342. package/src/sap/fe/core/helpers/SemanticKeyHelper.js.map +1 -1
  343. package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +1 -1
  344. package/src/sap/fe/core/helpers/Synchronization-dbg.js +1 -1
  345. package/src/sap/fe/core/helpers/Synchronization.ts +2 -0
  346. package/src/sap/fe/core/helpers/TypeGuards-dbg.js +5 -1
  347. package/src/sap/fe/core/helpers/TypeGuards.js +1 -1
  348. package/src/sap/fe/core/helpers/TypeGuards.js.map +1 -1
  349. package/src/sap/fe/core/helpers/TypeGuards.ts +12 -1
  350. package/src/sap/fe/core/jsx-runtime/ViewLoader-dbg.js +2 -1
  351. package/src/sap/fe/core/jsx-runtime/ViewLoader.js.map +1 -1
  352. package/src/sap/fe/core/jsx-runtime/ViewLoader.tsx +6 -2
  353. package/src/sap/fe/core/jsx-runtime/jsx-control-dbg.js +1 -1
  354. package/src/sap/fe/core/jsx-runtime/jsx-control.ts +3 -1
  355. package/src/sap/fe/core/jsx-runtime/useMDXComponents-dbg.js +3 -3
  356. package/src/sap/fe/core/jsx-runtime/useMDXComponents.js +1 -1
  357. package/src/sap/fe/core/jsx-runtime/useMDXComponents.js.map +1 -1
  358. package/src/sap/fe/core/jsx-runtime/useMDXComponents.tsx +1 -1
  359. package/src/sap/fe/core/library-dbg.js +2 -2
  360. package/src/sap/fe/core/library-preload.js +127 -125
  361. package/src/sap/fe/core/library-preload.js.map +1 -1
  362. package/src/sap/fe/core/library.js +1 -1
  363. package/src/sap/fe/core/library.ts +7 -0
  364. package/src/sap/fe/core/manifest.json +1 -1
  365. package/src/sap/fe/core/messagebundle.properties +33 -0
  366. package/src/sap/fe/core/messagebundle_ar.properties +12 -10
  367. package/src/sap/fe/core/messagebundle_bg.properties +11 -9
  368. package/src/sap/fe/core/messagebundle_ca.properties +11 -9
  369. package/src/sap/fe/core/messagebundle_cs.properties +11 -9
  370. package/src/sap/fe/core/messagebundle_cy.properties +11 -9
  371. package/src/sap/fe/core/messagebundle_da.properties +11 -9
  372. package/src/sap/fe/core/messagebundle_de.properties +3 -1
  373. package/src/sap/fe/core/messagebundle_el.properties +11 -9
  374. package/src/sap/fe/core/messagebundle_en.properties +3 -1
  375. package/src/sap/fe/core/messagebundle_en_GB.properties +2 -0
  376. package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +2 -0
  377. package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +20 -0
  378. package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +21 -3
  379. package/src/sap/fe/core/messagebundle_es.properties +11 -9
  380. package/src/sap/fe/core/messagebundle_es_MX.properties +11 -9
  381. package/src/sap/fe/core/messagebundle_et.properties +11 -9
  382. package/src/sap/fe/core/messagebundle_fi.properties +11 -9
  383. package/src/sap/fe/core/messagebundle_fr.properties +11 -9
  384. package/src/sap/fe/core/messagebundle_fr_CA.properties +3 -1
  385. package/src/sap/fe/core/messagebundle_hi.properties +2 -0
  386. package/src/sap/fe/core/messagebundle_hr.properties +11 -9
  387. package/src/sap/fe/core/messagebundle_hu.properties +11 -9
  388. package/src/sap/fe/core/messagebundle_id.properties +3 -1
  389. package/src/sap/fe/core/messagebundle_it.properties +11 -9
  390. package/src/sap/fe/core/messagebundle_iw.properties +11 -9
  391. package/src/sap/fe/core/messagebundle_ja.properties +11 -9
  392. package/src/sap/fe/core/messagebundle_kk.properties +11 -9
  393. package/src/sap/fe/core/messagebundle_ko.properties +2 -0
  394. package/src/sap/fe/core/messagebundle_lt.properties +11 -9
  395. package/src/sap/fe/core/messagebundle_lv.properties +2 -0
  396. package/src/sap/fe/core/messagebundle_ms.properties +12 -10
  397. package/src/sap/fe/core/messagebundle_nl.properties +12 -10
  398. package/src/sap/fe/core/messagebundle_no.properties +11 -9
  399. package/src/sap/fe/core/messagebundle_pl.properties +2 -0
  400. package/src/sap/fe/core/messagebundle_pt.properties +11 -9
  401. package/src/sap/fe/core/messagebundle_pt_PT.properties +11 -9
  402. package/src/sap/fe/core/messagebundle_ro.properties +3 -1
  403. package/src/sap/fe/core/messagebundle_ru.properties +3 -1
  404. package/src/sap/fe/core/messagebundle_sh.properties +11 -9
  405. package/src/sap/fe/core/messagebundle_sk.properties +11 -9
  406. package/src/sap/fe/core/messagebundle_sl.properties +11 -9
  407. package/src/sap/fe/core/messagebundle_sv.properties +2 -0
  408. package/src/sap/fe/core/messagebundle_th.properties +11 -9
  409. package/src/sap/fe/core/messagebundle_tr.properties +11 -9
  410. package/src/sap/fe/core/messagebundle_uk.properties +11 -9
  411. package/src/sap/fe/core/messagebundle_vi.properties +12 -10
  412. package/src/sap/fe/core/messagebundle_zh_CN.properties +2 -0
  413. package/src/sap/fe/core/messagebundle_zh_TW.properties +2 -0
  414. package/src/sap/fe/core/operationsHelper-dbg.js +70 -44
  415. package/src/sap/fe/core/operationsHelper.js +1 -1
  416. package/src/sap/fe/core/operationsHelper.js.map +1 -1
  417. package/src/sap/fe/core/operationsHelper.ts +88 -63
  418. package/src/sap/fe/core/rootView/Fcl-dbg.controller.js +1 -1
  419. package/src/sap/fe/core/rootView/Fcl.controller.ts +10 -0
  420. package/src/sap/fe/core/rootView/NavContainer-dbg.controller.js +2 -2
  421. package/src/sap/fe/core/rootView/NavContainer.controller.js +1 -1
  422. package/src/sap/fe/core/rootView/NavContainer.controller.js.map +1 -1
  423. package/src/sap/fe/core/rootView/NavContainer.controller.ts +5 -3
  424. package/src/sap/fe/core/rootView/RootViewBaseController-dbg.js +4 -3
  425. package/src/sap/fe/core/rootView/RootViewBaseController.js +1 -1
  426. package/src/sap/fe/core/rootView/RootViewBaseController.js.map +1 -1
  427. package/src/sap/fe/core/rootView/RootViewBaseController.ts +15 -5
  428. package/src/sap/fe/core/services/AsyncComponentServiceFactory-dbg.js +1 -1
  429. package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +3 -1
  430. package/src/sap/fe/core/services/CacheHandlerServiceFactory-dbg.js +1 -1
  431. package/src/sap/fe/core/services/CacheHandlerServiceFactory.js.map +1 -1
  432. package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +15 -1
  433. package/src/sap/fe/core/services/EnvironmentServiceFactory-dbg.js +1 -1
  434. package/src/sap/fe/core/services/EnvironmentServiceFactory.js.map +1 -1
  435. package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +4 -1
  436. package/src/sap/fe/core/services/NavigationServiceFactory-dbg.js +9 -1
  437. package/src/sap/fe/core/services/NavigationServiceFactory.js.map +1 -1
  438. package/src/sap/fe/core/services/NavigationServiceFactory.ts +19 -1
  439. package/src/sap/fe/core/services/ResourceModelServiceFactory-dbg.js +2 -2
  440. package/src/sap/fe/core/services/ResourceModelServiceFactory.js +1 -1
  441. package/src/sap/fe/core/services/ResourceModelServiceFactory.js.map +1 -1
  442. package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +10 -3
  443. package/src/sap/fe/core/services/RoutingServiceFactory-dbg.js +3 -3
  444. package/src/sap/fe/core/services/RoutingServiceFactory.js +1 -1
  445. package/src/sap/fe/core/services/RoutingServiceFactory.js.map +1 -1
  446. package/src/sap/fe/core/services/RoutingServiceFactory.ts +29 -3
  447. package/src/sap/fe/core/services/ShellServicesFactory-dbg.js +1 -1
  448. package/src/sap/fe/core/services/ShellServicesFactory.ts +14 -2
  449. package/src/sap/fe/core/services/SideEffectsServiceFactory-dbg.js +448 -279
  450. package/src/sap/fe/core/services/SideEffectsServiceFactory.js +1 -1
  451. package/src/sap/fe/core/services/SideEffectsServiceFactory.js.map +1 -1
  452. package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +502 -333
  453. package/src/sap/fe/core/services/TemplatedViewServiceFactory-dbg.js +18 -5
  454. package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +1 -1
  455. package/src/sap/fe/core/services/TemplatedViewServiceFactory.js.map +1 -1
  456. package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +41 -12
  457. package/src/sap/fe/core/support/Diagnostics-dbg.js +1 -1
  458. package/src/sap/fe/core/support/Diagnostics.ts +5 -0
  459. package/src/sap/fe/core/templating/DataModelPathHelper-dbg.js +185 -86
  460. package/src/sap/fe/core/templating/DataModelPathHelper.js +1 -1
  461. package/src/sap/fe/core/templating/DataModelPathHelper.js.map +1 -1
  462. package/src/sap/fe/core/templating/DataModelPathHelper.ts +190 -82
  463. package/src/sap/fe/core/templating/DisplayModeFormatter-dbg.js +1 -1
  464. package/src/sap/fe/core/templating/DisplayModeFormatter.ts +1 -1
  465. package/src/sap/fe/core/templating/EntitySetHelper-dbg.js +2 -3
  466. package/src/sap/fe/core/templating/EntitySetHelper.js +1 -1
  467. package/src/sap/fe/core/templating/EntitySetHelper.js.map +1 -1
  468. package/src/sap/fe/core/templating/EntitySetHelper.ts +1 -3
  469. package/src/sap/fe/core/templating/FilterHelper-dbg.js +3 -3
  470. package/src/sap/fe/core/templating/FilterHelper.js +1 -1
  471. package/src/sap/fe/core/templating/FilterHelper.js.map +1 -1
  472. package/src/sap/fe/core/templating/FilterHelper.ts +5 -3
  473. package/src/sap/fe/core/templating/PropertyHelper-dbg.js +1 -1
  474. package/src/sap/fe/core/templating/PropertyHelper.ts +2 -2
  475. package/src/sap/fe/core/templating/UIFormatters-dbg.js +1 -1
  476. package/src/sap/fe/core/templating/UIFormatters.ts +4 -0
  477. package/src/sap/fe/core/type/DateTimeWithTimezone-dbg.js +1 -1
  478. package/src/sap/fe/core/type/DateTimeWithTimezone.ts +2 -0
  479. package/src/sap/fe/core/type/FiscalDate-dbg.js +2 -2
  480. package/src/sap/fe/core/type/FiscalDate.js.map +1 -1
  481. package/src/sap/fe/core/type/FiscalDate.ts +2 -1
  482. package/src/sap/fe/core/type/TypeUtil-dbg.js +5 -10
  483. package/src/sap/fe/core/type/TypeUtil.js +1 -1
  484. package/src/sap/fe/core/type/TypeUtil.js.map +1 -1
  485. package/src/sap/fe/core/type/TypeUtil.ts +3 -6
  486. package/src/sap/fe/core/buildingBlocks/BuildingBlock-dbg.js +0 -410
  487. package/src/sap/fe/core/buildingBlocks/BuildingBlock.js +0 -15
  488. package/src/sap/fe/core/buildingBlocks/BuildingBlock.js.map +0 -1
  489. package/src/sap/fe/core/buildingBlocks/BuildingBlock.ts +0 -536
  490. package/src/sap/fe/core/buildingBlocks/BuildingBlockFragment-dbg.js +0 -44
  491. package/src/sap/fe/core/buildingBlocks/BuildingBlockFragment.js +0 -6
  492. package/src/sap/fe/core/buildingBlocks/BuildingBlockFragment.js.map +0 -1
  493. package/src/sap/fe/core/buildingBlocks/BuildingBlockFragment.ts +0 -14
  494. package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime-dbg.js +0 -932
  495. package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.js +0 -19
  496. package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.js.map +0 -1
  497. package/src/sap/fe/core/controllerextensions/InternalEditFlow-dbg.js +0 -711
  498. package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +0 -6
  499. package/src/sap/fe/core/controllerextensions/InternalEditFlow.js.map +0 -1
  500. package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +0 -863
  501. package/src/sap/fe/core/controls/ConditionalWrapper-dbg.js +0 -151
  502. package/src/sap/fe/core/controls/ConditionalWrapper.js +0 -6
  503. package/src/sap/fe/core/controls/ConditionalWrapper.js.map +0 -1
  504. package/src/sap/fe/core/controls/ConditionalWrapper.ts +0 -88
  505. package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper-dbg.js +0 -330
  506. package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.js +0 -6
  507. package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.js.map +0 -1
  508. package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.ts +0 -292
  509. package/src/sap/fe/core/controls/CustomQuickViewPage-dbg.js +0 -126
  510. package/src/sap/fe/core/controls/CustomQuickViewPage.js +0 -6
  511. package/src/sap/fe/core/controls/CustomQuickViewPage.js.map +0 -1
  512. package/src/sap/fe/core/controls/CustomQuickViewPage.ts +0 -105
  513. package/src/sap/fe/core/controls/FieldWrapper-dbg.js +0 -194
  514. package/src/sap/fe/core/controls/FieldWrapper.js +0 -6
  515. package/src/sap/fe/core/controls/FieldWrapper.js.map +0 -1
  516. package/src/sap/fe/core/controls/FieldWrapper.ts +0 -121
  517. package/src/sap/fe/core/controls/FileWrapper-dbg.js +0 -280
  518. package/src/sap/fe/core/controls/FileWrapper.js +0 -6
  519. package/src/sap/fe/core/controls/FileWrapper.js.map +0 -1
  520. package/src/sap/fe/core/controls/FileWrapper.ts +0 -202
  521. package/src/sap/fe/core/helpers/SideEffectsHelper-dbg.js +0 -141
  522. package/src/sap/fe/core/helpers/SideEffectsHelper.js +0 -6
  523. package/src/sap/fe/core/helpers/SideEffectsHelper.js.map +0 -1
  524. package/src/sap/fe/core/helpers/SideEffectsHelper.ts +0 -129
@@ -0,0 +1,1985 @@
1
+ import Log from "sap/base/Log";
2
+ import ActionRuntime from "sap/fe/core/ActionRuntime";
3
+ import CommonUtils from "sap/fe/core/CommonUtils";
4
+ import BusyLocker from "sap/fe/core/controllerextensions/BusyLocker";
5
+ import messageHandling from "sap/fe/core/controllerextensions/messageHandler/messageHandling";
6
+ import FPMHelper from "sap/fe/core/helpers/FPMHelper";
7
+ import { getResourceModel } from "sap/fe/core/helpers/ResourceModelHelper";
8
+ import { generate } from "sap/fe/core/helpers/StableIdHelper";
9
+ import FELibrary from "sap/fe/core/library";
10
+ import ResourceModel from "sap/fe/core/ResourceModel";
11
+ import Button from "sap/m/Button";
12
+ import Dialog from "sap/m/Dialog";
13
+ import MessageBox from "sap/m/MessageBox";
14
+ import type Event from "sap/ui/base/Event";
15
+ import type Control from "sap/ui/core/Control";
16
+ import Core from "sap/ui/core/Core";
17
+ import Fragment from "sap/ui/core/Fragment";
18
+ import { MessageType } from "sap/ui/core/library";
19
+ import Message from "sap/ui/core/message/Message";
20
+ import XMLPreprocessor from "sap/ui/core/util/XMLPreprocessor";
21
+ import XMLTemplateProcessor from "sap/ui/core/XMLTemplateProcessor";
22
+ import type Field from "sap/ui/mdc/Field";
23
+ import type MultiValueField from "sap/ui/mdc/MultiValueField";
24
+ import type Context from "sap/ui/model/Context";
25
+ import JSONModel from "sap/ui/model/json/JSONModel";
26
+ import type ODataMetaModel from "sap/ui/model/odata/v4/ODataMetaModel";
27
+ import type AppComponent from "../../../AppComponent";
28
+ import operationsHelper, { type StrictHandlingUtilities } from "../../../operationsHelper";
29
+ import type MessageHandler from "../../MessageHandler";
30
+ import { ActionParameter, ActionParameterInfo, _addMessageForActionParameter, _validateProperties } from "./_internal";
31
+
32
+ const Constants = FELibrary.Constants,
33
+ InvocationGrouping = FELibrary.InvocationGrouping;
34
+ const Action = (MessageBox as any).Action;
35
+
36
+ /**
37
+ * Calls a bound action for one or multiple contexts.
38
+ *
39
+ * @function
40
+ * @static
41
+ * @name sap.fe.core.actions.operations.callBoundAction
42
+ * @memberof sap.fe.core.actions.operations
43
+ * @param sActionName The name of the action to be called
44
+ * @param contexts Either one context or an array with contexts for which the action is to be be called
45
+ * @param oModel OData Model
46
+ * @param oAppComponent The AppComponent
47
+ * @param [mParameters] Optional, can contain the following attributes:
48
+ * @param [mParameters.parameterValues] A map of action parameter names and provided values
49
+ * @param [mParameters.mBindingParameters] A map of binding parameters that would be part of $select and $expand coming from side effects for bound actions
50
+ * @param [mParameters.additionalSideEffect] Array of property paths to be requested in addition to actual target properties of the side effect
51
+ * @param [mParameters.showActionParameterDialog] If set and if parameters exist the user retrieves a dialog to fill in parameters, if actionParameters are passed they are shown to the user
52
+ * @param [mParameters.label] A human-readable label for the action
53
+ * @param [mParameters.invocationGrouping] Mode how actions are to be called: Changeset to put all action calls into one changeset, Isolated to put them into separate changesets, defaults to Isolated
54
+ * @param [mParameters.onSubmitted] Function which is called once the actions are submitted with an array of promises
55
+ * @param [mParameters.defaultParameters] Can contain default parameters from FLP user defaults
56
+ * @param [mParameters.parentControl] If specified, the dialogs are added as dependent of the parent control
57
+ * @param [mParameters.bGetBoundContext] If specified, the action promise returns the bound context
58
+ * @param [strictHandlingUtilities] Optional, utility flags and messages for strictHandling
59
+ * @returns Promise resolves with an array of response objects (TODO: to be changed)
60
+ * @private
61
+ * @ui5-restricted
62
+ */
63
+ function callBoundAction(
64
+ sActionName: string,
65
+ contexts: any,
66
+ oModel: any,
67
+ oAppComponent: AppComponent,
68
+ mParameters: any,
69
+ strictHandlingUtilities?: StrictHandlingUtilities
70
+ ) {
71
+ if (!strictHandlingUtilities) {
72
+ strictHandlingUtilities = {
73
+ is412Executed: false,
74
+ strictHandlingTransitionFails: [],
75
+ strictHandlingPromises: [],
76
+ strictHandlingWarningMessages: [],
77
+ delaySuccessMessages: [],
78
+ processedMessageIds: []
79
+ };
80
+ }
81
+ if (!contexts || contexts.length === 0) {
82
+ //In Freestyle apps bound actions can have no context
83
+ return Promise.reject("Bound actions always requires at least one context");
84
+ }
85
+ // this method either accepts single context or an array of contexts
86
+ // TODO: Refactor to an unambiguos API
87
+ const isCalledWithArray = Array.isArray(contexts);
88
+
89
+ // in case of single context wrap into an array for called methods (esp. callAction)
90
+ mParameters.aContexts = isCalledWithArray ? contexts : [contexts];
91
+
92
+ const oMetaModel = oModel.getMetaModel(),
93
+ // Analyzing metaModelPath for action only from first context seems weird, but probably works in all existing szenarios - if several contexts are passed, they probably
94
+ // belong to the same metamodelpath. TODO: Check, whether this can be improved / szenarios with different metaModelPaths might exist
95
+ sActionPath = `${oMetaModel.getMetaPath(mParameters.aContexts[0].getPath())}/${sActionName}`,
96
+ oBoundAction = oMetaModel.createBindingContext(`${sActionPath}/@$ui5.overload/0`);
97
+ mParameters.isCriticalAction = getIsActionCritical(oMetaModel, sActionPath, mParameters.aContexts, oBoundAction);
98
+
99
+ // Promise returned by callAction currently is rejected in case of execution for multiple contexts partly failing. This should be changed (some failing contexts do not mean
100
+ // that function did not fulfill its task), but as this is a bigger refactoring, for the time being we need to deal with that at the calling place (i.e. here)
101
+ // => provide the same handler (mapping back from array to single result/error if needed) for resolved/rejected case
102
+ const extractSingleResult = function (result: any) {
103
+ // single action could be resolved or rejected
104
+ if (result[0].status === "fulfilled") {
105
+ return result[0].value;
106
+ } else {
107
+ // In case of dialog cancellation, no array is returned => throw the result.
108
+ // Ideally, differentiating should not be needed here => TODO: Find better solution when separating dialog handling (single object with single result) from backend
109
+ // execution (potentially multiple objects)
110
+ throw result[0].reason || result;
111
+ }
112
+ };
113
+
114
+ return callAction(sActionName, oModel, oBoundAction, oAppComponent, mParameters, strictHandlingUtilities).then(
115
+ (result: any) => {
116
+ if (isCalledWithArray) {
117
+ return result;
118
+ } else {
119
+ return extractSingleResult(result);
120
+ }
121
+ },
122
+ (result: any) => {
123
+ if (isCalledWithArray) {
124
+ throw result;
125
+ } else {
126
+ return extractSingleResult(result);
127
+ }
128
+ }
129
+ );
130
+ }
131
+ /**
132
+ * Calls an action import.
133
+ *
134
+ * @function
135
+ * @static
136
+ * @name sap.fe.core.actions.operations.callActionImport
137
+ * @memberof sap.fe.core.actions.operations
138
+ * @param sActionName The name of the action import to be called
139
+ * @param oModel An instance of an OData V4 model
140
+ * @param oAppComponent The AppComponent
141
+ * @param [mParameters] Optional, can contain the following attributes:
142
+ * @param [mParameters.parameterValues] A map of action parameter names and provided values
143
+ * @param [mParameters.label] A human-readable label for the action
144
+ * @param [mParameters.showActionParameterDialog] If set and if parameters exist the user retrieves a dialog to fill in parameters, if actionParameters are passed they are shown to the user
145
+ * @param [mParameters.onSubmitted] Function which is called once the actions are submitted with an array of promises
146
+ * @param [mParameters.defaultParameters] Can contain default parameters from FLP user defaults
147
+ * @param [strictHandlingUtilities] Optional, utility flags and messages for strictHandling
148
+ * @returns Promise resolves with an array of response objects (TODO: to be changed)
149
+ * @private
150
+ * @ui5-restricted
151
+ */
152
+ function callActionImport(
153
+ sActionName: string,
154
+ oModel: any,
155
+ oAppComponent: AppComponent,
156
+ mParameters: any,
157
+ strictHandlingUtilities?: StrictHandlingUtilities
158
+ ) {
159
+ if (!oModel) {
160
+ return Promise.reject("Action expects a model/context for execution");
161
+ }
162
+ const oMetaModel = oModel.getMetaModel(),
163
+ sActionPath = oModel.bindContext(`/${sActionName}`).getPath(),
164
+ oActionImport = oMetaModel.createBindingContext(`/${oMetaModel.createBindingContext(sActionPath).getObject("$Action")}/0`);
165
+ mParameters.isCriticalAction = getIsActionCritical(oMetaModel, `${sActionPath}/@$ui5.overload`);
166
+ return callAction(sActionName, oModel, oActionImport, oAppComponent, mParameters, strictHandlingUtilities);
167
+ }
168
+ function callBoundFunction(sFunctionName: string, context: any, oModel: any) {
169
+ if (!context) {
170
+ return Promise.reject("Bound functions always requires a context");
171
+ }
172
+ const oMetaModel = oModel.getMetaModel(),
173
+ sFunctionPath = `${oMetaModel.getMetaPath(context.getPath())}/${sFunctionName}`,
174
+ oBoundFunction = oMetaModel.createBindingContext(sFunctionPath);
175
+ return _executeFunction(sFunctionName, oModel, oBoundFunction, context);
176
+ }
177
+ /**
178
+ * Calls a function import.
179
+ *
180
+ * @function
181
+ * @static
182
+ * @name sap.fe.core.actions.operations.callFunctionImport
183
+ * @memberof sap.fe.core.actions.operations
184
+ * @param sFunctionName The name of the function to be called
185
+ * @param oModel An instance of an OData v4 model
186
+ * @returns Promise resolves
187
+ * @private
188
+ */
189
+ function callFunctionImport(sFunctionName: string, oModel: any) {
190
+ if (!sFunctionName) {
191
+ return Promise.resolve();
192
+ }
193
+ const oMetaModel = oModel.getMetaModel(),
194
+ sFunctionPath = oModel.bindContext(`/${sFunctionName}`).getPath(),
195
+ oFunctionImport = oMetaModel.createBindingContext(`/${oMetaModel.createBindingContext(sFunctionPath).getObject("$Function")}/0`);
196
+ return _executeFunction(sFunctionName, oModel, oFunctionImport);
197
+ }
198
+ function _executeFunction(sFunctionName: any, oModel: any, oFunction: any, context?: any) {
199
+ let sGroupId;
200
+ if (!oFunction || !oFunction.getObject()) {
201
+ return Promise.reject(new Error(`Function ${sFunctionName} not found`));
202
+ }
203
+ if (context) {
204
+ oFunction = oModel.bindContext(`${context.getPath()}/${sFunctionName}(...)`);
205
+ sGroupId = "functionGroup";
206
+ } else {
207
+ oFunction = oModel.bindContext(`/${sFunctionName}(...)`);
208
+ sGroupId = "functionImport";
209
+ }
210
+ const oFunctionPromise = oFunction.execute(sGroupId);
211
+ oModel.submitBatch(sGroupId);
212
+ return oFunctionPromise.then(function () {
213
+ return oFunction.getBoundContext();
214
+ });
215
+ }
216
+ function callAction(
217
+ sActionName: any,
218
+ oModel: any,
219
+ oAction: any,
220
+ oAppComponent: AppComponent,
221
+ mParameters: any,
222
+ strictHandlingUtilities?: StrictHandlingUtilities
223
+ ) {
224
+ if (!strictHandlingUtilities) {
225
+ strictHandlingUtilities = {
226
+ is412Executed: false,
227
+ strictHandlingTransitionFails: [],
228
+ strictHandlingPromises: [],
229
+ strictHandlingWarningMessages: [],
230
+ delaySuccessMessages: [],
231
+ processedMessageIds: []
232
+ };
233
+ }
234
+ mParameters.bGrouped = mParameters.invocationGrouping === InvocationGrouping.ChangeSet;
235
+ return new Promise(async function (resolve: (value: any) => void, reject: (reason?: any) => void) {
236
+ let mActionExecutionParameters: any = {};
237
+ let fnDialog;
238
+ let oActionPromise;
239
+ //let failedActionPromise: any;
240
+ const sActionLabel = mParameters.label;
241
+ const bSkipParameterDialog = mParameters.skipParameterDialog;
242
+ const aContexts = mParameters.aContexts;
243
+ const bIsCreateAction = mParameters.bIsCreateAction;
244
+ const bIsCriticalAction = mParameters.isCriticalAction;
245
+ let oMetaModel;
246
+ let sMetaPath;
247
+ let sMessagesPath: any;
248
+ let iMessageSideEffect;
249
+ let bIsSameEntity;
250
+ let oReturnType;
251
+ let bValuesProvidedForAllParameters;
252
+ const actionDefinition = oAction.getObject();
253
+ if (!oAction || !oAction.getObject()) {
254
+ return reject(new Error(`Action ${sActionName} not found`));
255
+ }
256
+
257
+ // Get the parameters of the action
258
+ const aActionParameters = getActionParameters(oAction);
259
+
260
+ // Check if the action has parameters and would need a parameter dialog
261
+ // The parameter ResultIsActiveEntity is always hidden in the dialog! Hence if
262
+ // this is the only parameter, this is treated as no parameter here because the
263
+ // dialog would be empty!
264
+ // FIXME: Should only ignore this if this is a 'create' action, otherwise it is just some normal parameter that happens to have this name
265
+ const bActionNeedsParameterDialog =
266
+ aActionParameters.length > 0 && !(aActionParameters.length === 1 && aActionParameters[0].$Name === "ResultIsActiveEntity");
267
+
268
+ // Provided values for the action parameters from invokeAction call
269
+ const aParameterValues = mParameters.parameterValues;
270
+
271
+ // Determine startup parameters if provided
272
+ const oComponentData = oAppComponent.getComponentData();
273
+ const oStartupParameters = (oComponentData && oComponentData.startupParameters) || {};
274
+
275
+ // In case an action parameter is needed, and we shall skip the dialog, check if values are provided for all parameters
276
+ if (bActionNeedsParameterDialog && bSkipParameterDialog) {
277
+ bValuesProvidedForAllParameters = _valuesProvidedForAllParameters(
278
+ bIsCreateAction,
279
+ aActionParameters,
280
+ aParameterValues,
281
+ oStartupParameters
282
+ );
283
+ }
284
+
285
+ // Depending on the previously determined data, either set a dialog or leave it empty which
286
+ // will lead to direct execution of the action without a dialog
287
+ fnDialog = null;
288
+ if (bActionNeedsParameterDialog) {
289
+ if (!(bSkipParameterDialog && bValuesProvidedForAllParameters)) {
290
+ fnDialog = showActionParameterDialog;
291
+ }
292
+ } else if (bIsCriticalAction) {
293
+ fnDialog = confirmCriticalAction;
294
+ }
295
+
296
+ mActionExecutionParameters = {
297
+ fnOnSubmitted: mParameters.onSubmitted,
298
+ fnOnResponse: mParameters.onResponse,
299
+ actionName: sActionName,
300
+ model: oModel,
301
+ aActionParameters: aActionParameters,
302
+ bGetBoundContext: mParameters.bGetBoundContext,
303
+ defaultValuesExtensionFunction: mParameters.defaultValuesExtensionFunction,
304
+ label: mParameters.label,
305
+ selectedItems: mParameters.selectedItems
306
+ };
307
+ if (oAction.getObject("$IsBound")) {
308
+ if (mParameters.additionalSideEffect && mParameters.additionalSideEffect.pathExpressions) {
309
+ oMetaModel = oModel.getMetaModel();
310
+ sMetaPath = oMetaModel.getMetaPath(aContexts[0].getPath());
311
+ sMessagesPath = oMetaModel.getObject(`${sMetaPath}/@com.sap.vocabularies.Common.v1.Messages/$Path`);
312
+
313
+ if (sMessagesPath) {
314
+ iMessageSideEffect = mParameters.additionalSideEffect.pathExpressions.findIndex(function (exp: any) {
315
+ return typeof exp === "string" && exp === sMessagesPath;
316
+ });
317
+
318
+ // Add SAP_Messages by default if not annotated by side effects, action does not return a collection and
319
+ // the return type is the same as the bound type
320
+ oReturnType = oAction.getObject("$ReturnType");
321
+ bIsSameEntity =
322
+ oReturnType && !oReturnType.$isCollection && oAction.getModel().getObject(sMetaPath).$Type === oReturnType.$Type;
323
+
324
+ if (iMessageSideEffect > -1 || bIsSameEntity) {
325
+ // the message path is annotated as side effect. As there's no binding for it and the model does currently not allow
326
+ // to add it at a later point of time we have to take care it's part of the $select of the POST, therefore moving it.
327
+ mParameters.mBindingParameters = mParameters.mBindingParameters || {};
328
+
329
+ if (
330
+ oAction.getObject(`$ReturnType/$Type/${sMessagesPath}`) &&
331
+ (!mParameters.mBindingParameters.$select ||
332
+ mParameters.mBindingParameters.$select.split(",").indexOf(sMessagesPath) === -1)
333
+ ) {
334
+ mParameters.mBindingParameters.$select = mParameters.mBindingParameters.$select
335
+ ? `${mParameters.mBindingParameters.$select},${sMessagesPath}`
336
+ : sMessagesPath;
337
+ // Add side effects at entity level because $select stops these being returned by the action
338
+ // Only if no other side effects were added for Messages
339
+ if (iMessageSideEffect === -1) {
340
+ mParameters.additionalSideEffect.pathExpressions.push("*");
341
+ }
342
+
343
+ if (mParameters.additionalSideEffect.triggerActions.length === 0 && iMessageSideEffect > -1) {
344
+ // no trigger action therefore no need to request messages again
345
+ mParameters.additionalSideEffect.pathExpressions.splice(iMessageSideEffect, 1);
346
+ }
347
+ }
348
+ }
349
+ }
350
+ }
351
+
352
+ mActionExecutionParameters.aContexts = aContexts;
353
+ mActionExecutionParameters.mBindingParameters = mParameters.mBindingParameters;
354
+ mActionExecutionParameters.additionalSideEffect = mParameters.additionalSideEffect;
355
+ mActionExecutionParameters.bGrouped = mParameters.invocationGrouping === InvocationGrouping.ChangeSet;
356
+ mActionExecutionParameters.internalModelContext = mParameters.internalModelContext;
357
+ mActionExecutionParameters.operationAvailableMap = mParameters.operationAvailableMap;
358
+ mActionExecutionParameters.isCreateAction = bIsCreateAction;
359
+ mActionExecutionParameters.bObjectPage = mParameters.bObjectPage;
360
+ if (mParameters.controlId) {
361
+ mActionExecutionParameters.control = mParameters.parentControl.byId(mParameters.controlId);
362
+ mParameters.control = mActionExecutionParameters.control;
363
+ } else {
364
+ mActionExecutionParameters.control = mParameters.parentControl;
365
+ mParameters.control = mParameters.parentControl;
366
+ }
367
+ }
368
+ if (bIsCreateAction) {
369
+ mActionExecutionParameters.bIsCreateAction = bIsCreateAction;
370
+ }
371
+ //check for skipping static actions
372
+ const isStatic = (actionDefinition.$Parameter || []).some((aParameter: any) => {
373
+ return (
374
+ ((actionDefinition.$EntitySetPath && actionDefinition.$EntitySetPath === aParameter.$Name) || actionDefinition.$IsBound) &&
375
+ aParameter.$isCollection
376
+ );
377
+ });
378
+ mActionExecutionParameters.isStatic = isStatic;
379
+ if (fnDialog) {
380
+ oActionPromise = fnDialog(
381
+ sActionName,
382
+ oAppComponent,
383
+ sActionLabel,
384
+ mActionExecutionParameters,
385
+ aActionParameters,
386
+ aParameterValues,
387
+ oAction,
388
+ mParameters.parentControl,
389
+ mParameters.entitySetName,
390
+ mParameters.messageHandler,
391
+ strictHandlingUtilities
392
+ );
393
+ return oActionPromise
394
+ .then(function (oOperationResult: any) {
395
+ afterActionResolution(mParameters, mActionExecutionParameters, actionDefinition);
396
+ resolve(oOperationResult);
397
+ })
398
+ .catch(function (oOperationResult: any) {
399
+ reject(oOperationResult);
400
+ });
401
+ } else {
402
+ // Take over all provided parameter values and call the action.
403
+ // This shall only happen if values are provided for all the parameters, otherwise the parameter dialog shall be shown which is ensured earlier
404
+ if (aParameterValues) {
405
+ for (const i in mActionExecutionParameters.aActionParameters) {
406
+ mActionExecutionParameters.aActionParameters[i].value = aParameterValues?.find(
407
+ (element: any) => element.name === mActionExecutionParameters.aActionParameters[i].$Name
408
+ )?.value;
409
+ }
410
+ } else {
411
+ for (const i in mActionExecutionParameters.aActionParameters) {
412
+ mActionExecutionParameters.aActionParameters[i].value =
413
+ oStartupParameters[mActionExecutionParameters.aActionParameters[i].$Name]?.[0];
414
+ }
415
+ }
416
+ let oOperationResult: any;
417
+ try {
418
+ oOperationResult = await _executeAction(
419
+ oAppComponent,
420
+ mActionExecutionParameters,
421
+ mParameters.parentControl,
422
+ mParameters.messageHandler,
423
+ strictHandlingUtilities
424
+ );
425
+
426
+ const messages = Core.getMessageManager().getMessageModel().getData();
427
+ if (
428
+ strictHandlingUtilities &&
429
+ strictHandlingUtilities.is412Executed &&
430
+ strictHandlingUtilities.strictHandlingTransitionFails.length
431
+ ) {
432
+ strictHandlingUtilities.delaySuccessMessages = strictHandlingUtilities.delaySuccessMessages.concat(messages);
433
+ }
434
+ afterActionResolution(mParameters, mActionExecutionParameters, actionDefinition);
435
+ resolve(oOperationResult);
436
+ } catch {
437
+ reject(oOperationResult);
438
+ } finally {
439
+ if (
440
+ strictHandlingUtilities &&
441
+ strictHandlingUtilities.is412Executed &&
442
+ strictHandlingUtilities.strictHandlingTransitionFails.length
443
+ ) {
444
+ try {
445
+ const strictHandlingFails = strictHandlingUtilities.strictHandlingTransitionFails;
446
+ const aFailedContexts = [] as any;
447
+ strictHandlingFails.forEach(function (fail: any) {
448
+ aFailedContexts.push(fail.oAction.getContext());
449
+ });
450
+ mActionExecutionParameters.aContexts = aFailedContexts;
451
+ const oFailedOperationResult = await _executeAction(
452
+ oAppComponent,
453
+ mActionExecutionParameters,
454
+ mParameters.parentControl,
455
+ mParameters.messageHandler,
456
+ strictHandlingUtilities
457
+ );
458
+ strictHandlingUtilities.strictHandlingTransitionFails = [];
459
+ Core.getMessageManager().addMessages(strictHandlingUtilities.delaySuccessMessages);
460
+ afterActionResolution(mParameters, mActionExecutionParameters, actionDefinition);
461
+ resolve(oFailedOperationResult);
462
+ } catch (oFailedOperationResult) {
463
+ reject(oFailedOperationResult);
464
+ }
465
+ }
466
+ let showGenericErrorMessageForChangeSet = false;
467
+ if (
468
+ (mParameters.bGrouped && strictHandlingUtilities && strictHandlingUtilities.strictHandlingPromises.length) ||
469
+ checkforOtherMessages(mParameters.bGrouped) !== -1
470
+ ) {
471
+ showGenericErrorMessageForChangeSet = true;
472
+ }
473
+ mParameters?.messageHandler?.showMessageDialog({
474
+ control: mActionExecutionParameters?.control,
475
+ onBeforeShowMessage: function (aMessages: any, showMessageParametersIn: any) {
476
+ return actionParameterShowMessageCallback(
477
+ mParameters,
478
+ aContexts,
479
+ undefined,
480
+ aMessages,
481
+ showMessageParametersIn,
482
+ showGenericErrorMessageForChangeSet
483
+ );
484
+ },
485
+ aSelectedContexts: mParameters.aContexts,
486
+ sActionName: sActionLabel
487
+ });
488
+ if (strictHandlingUtilities) {
489
+ strictHandlingUtilities = {
490
+ is412Executed: false,
491
+ strictHandlingTransitionFails: [],
492
+ strictHandlingPromises: [],
493
+ strictHandlingWarningMessages: [],
494
+ delaySuccessMessages: [],
495
+ processedMessageIds: []
496
+ };
497
+ }
498
+ }
499
+ }
500
+ });
501
+ }
502
+ function confirmCriticalAction(
503
+ sActionName: any,
504
+ oAppComponent: AppComponent,
505
+ sActionLabel: any,
506
+ mParameters: any,
507
+ aActionParameters: any,
508
+ aParameterValues: any,
509
+ oActionContext: any,
510
+ oParentControl: any,
511
+ entitySetName: any,
512
+ messageHandler: any
513
+ ) {
514
+ return new Promise<void>((resolve, reject) => {
515
+ let boundActionName = sActionName ? sActionName : null;
516
+ boundActionName =
517
+ boundActionName.indexOf(".") >= 0 ? boundActionName.split(".")[boundActionName.split(".").length - 1] : boundActionName;
518
+ const suffixResourceKey = boundActionName && entitySetName ? `${entitySetName}|${boundActionName}` : "";
519
+ const resourceModel = getResourceModel(oParentControl);
520
+ const sConfirmationText = resourceModel.getText("C_OPERATIONS_ACTION_CONFIRM_MESSAGE", undefined, suffixResourceKey);
521
+
522
+ MessageBox.confirm(sConfirmationText, {
523
+ onClose: async function (sAction: any) {
524
+ if (sAction === Action.OK) {
525
+ try {
526
+ const oOperation = await _executeAction(oAppComponent, mParameters, oParentControl, messageHandler);
527
+ resolve(oOperation);
528
+ } catch (oError: any) {
529
+ try {
530
+ await messageHandler.showMessageDialog();
531
+ reject(oError);
532
+ } catch (e) {
533
+ reject(oError);
534
+ }
535
+ }
536
+ } else {
537
+ resolve();
538
+ }
539
+ }
540
+ });
541
+ });
542
+ }
543
+
544
+ async function executeAPMAction(
545
+ oAppComponent: AppComponent,
546
+ mParameters: any,
547
+ oParentControl: any,
548
+ messageHandler: MessageHandler,
549
+ aContexts: any,
550
+ oDialog: any,
551
+ after412: boolean,
552
+ strictHandlingUtilities?: StrictHandlingUtilities
553
+ ) {
554
+ const aResult = await _executeAction(oAppComponent, mParameters, oParentControl, messageHandler, strictHandlingUtilities);
555
+ // If some entries were successful, and others have failed, the overall process is still successful. However, this was treated as rejection
556
+ // before, and this currently is still kept, as long as dialog handling is mixed with backend process handling.
557
+ // TODO: Refactor to only reject in case of overall process error.
558
+ // For the time being: map to old logic to reject if at least one entry has failed
559
+ // This check is only done for bound actions => aContexts not empty
560
+ if (mParameters.aContexts?.length) {
561
+ if (aResult?.some((oSingleResult: any) => oSingleResult.status === "rejected")) {
562
+ throw aResult;
563
+ }
564
+ }
565
+
566
+ const messages = Core.getMessageManager().getMessageModel().getData();
567
+ if (strictHandlingUtilities && strictHandlingUtilities.is412Executed && strictHandlingUtilities.strictHandlingTransitionFails.length) {
568
+ if (!after412) {
569
+ strictHandlingUtilities.delaySuccessMessages = strictHandlingUtilities.delaySuccessMessages.concat(messages);
570
+ } else {
571
+ Core.getMessageManager().addMessages(strictHandlingUtilities.delaySuccessMessages);
572
+ let showGenericErrorMessageForChangeSet = false;
573
+ if (
574
+ (mParameters.bGrouped && strictHandlingUtilities.strictHandlingPromises.length) ||
575
+ checkforOtherMessages(mParameters.bGrouped) !== -1
576
+ ) {
577
+ showGenericErrorMessageForChangeSet = true;
578
+ }
579
+ if (messages.length) {
580
+ // BOUND TRANSITION AS PART OF SAP_MESSAGE
581
+ oDialog.attachEventOnce("afterClose", function () {
582
+ messageHandler.showMessageDialog({
583
+ onBeforeShowMessage: function (aMessages: any, showMessageParametersIn: any) {
584
+ return actionParameterShowMessageCallback(
585
+ mParameters,
586
+ aContexts,
587
+ oDialog,
588
+ aMessages,
589
+ showMessageParametersIn,
590
+ showGenericErrorMessageForChangeSet
591
+ );
592
+ },
593
+ control: mParameters.control,
594
+ aSelectedContexts: mParameters.aContexts,
595
+ sActionName: mParameters.label
596
+ });
597
+ });
598
+ }
599
+ }
600
+ } else if (messages.length) {
601
+ // BOUND TRANSITION AS PART OF SAP_MESSAGE
602
+ let showGenericErrorMessageForChangeSet = false;
603
+ if (
604
+ (mParameters.bGrouped && strictHandlingUtilities && strictHandlingUtilities.strictHandlingPromises.length) ||
605
+ checkforOtherMessages(mParameters.bGrouped) !== -1
606
+ ) {
607
+ showGenericErrorMessageForChangeSet = true;
608
+ }
609
+ oDialog.attachEventOnce("afterClose", function () {
610
+ messageHandler.showMessageDialog({
611
+ isActionParameterDialogOpen: mParameters?.oDialog.isOpen(),
612
+ onBeforeShowMessage: function (aMessages: any, showMessageParametersIn: any) {
613
+ return actionParameterShowMessageCallback(
614
+ mParameters,
615
+ aContexts,
616
+ oDialog,
617
+ aMessages,
618
+ showMessageParametersIn,
619
+ showGenericErrorMessageForChangeSet
620
+ );
621
+ },
622
+ control: mParameters.control,
623
+ aSelectedContexts: mParameters.aContexts,
624
+ sActionName: mParameters.label
625
+ });
626
+ });
627
+ }
628
+
629
+ return aResult;
630
+ }
631
+
632
+ function afterActionResolution(mParameters: any, mActionExecutionParameters: any, actionDefinition: any) {
633
+ if (
634
+ mActionExecutionParameters.internalModelContext &&
635
+ mActionExecutionParameters.operationAvailableMap &&
636
+ mActionExecutionParameters.aContexts &&
637
+ mActionExecutionParameters.aContexts.length &&
638
+ actionDefinition.$IsBound
639
+ ) {
640
+ //check for skipping static actions
641
+ const isStatic = mActionExecutionParameters.isStatic;
642
+ if (!isStatic) {
643
+ ActionRuntime.setActionEnablement(
644
+ mActionExecutionParameters.internalModelContext,
645
+ JSON.parse(mActionExecutionParameters.operationAvailableMap),
646
+ mParameters.selectedItems,
647
+ "table"
648
+ );
649
+ } else if (mActionExecutionParameters.control) {
650
+ const oControl = mActionExecutionParameters.control;
651
+ if (oControl.isA("sap.ui.mdc.Table")) {
652
+ const aSelectedContexts = oControl.getSelectedContexts();
653
+ ActionRuntime.setActionEnablement(
654
+ mActionExecutionParameters.internalModelContext,
655
+ JSON.parse(mActionExecutionParameters.operationAvailableMap),
656
+ aSelectedContexts,
657
+ "table"
658
+ );
659
+ }
660
+ }
661
+ }
662
+ }
663
+
664
+ function actionParameterShowMessageCallback(
665
+ mParameters: any,
666
+ aContexts: any,
667
+ oDialog: any,
668
+ messages: any,
669
+ showMessageParametersIn: { showMessageBox: boolean; showMessageDialog: boolean },
670
+ showGenericErrorMessageForChangeSet: boolean
671
+ ): {
672
+ fnGetMessageSubtitle: Function | undefined;
673
+ showMessageBox: boolean;
674
+ showMessageDialog: boolean;
675
+ filteredMessages: any[];
676
+ showChangeSetErrorDialog: boolean;
677
+ } {
678
+ let showMessageBox = showMessageParametersIn.showMessageBox,
679
+ showMessageDialog = showMessageParametersIn.showMessageDialog;
680
+ const oControl = mParameters.control;
681
+ const oResourceBundle = Core.getLibraryResourceBundle("sap.fe.core");
682
+ const unboundMessages = messages.filter(function (message: any) {
683
+ return message.getTarget() === "";
684
+ });
685
+ const APDmessages = messages.filter(function (message: any) {
686
+ return (
687
+ message.getTarget &&
688
+ message.getTarget().indexOf(mParameters.actionName) !== -1 &&
689
+ mParameters?.aActionParameters?.some(function (actionParam: any) {
690
+ return message.getTarget().indexOf(actionParam.$Name) !== -1;
691
+ })
692
+ );
693
+ });
694
+ APDmessages?.forEach(function (APDMessage: any) {
695
+ APDMessage.isAPDTarget = true;
696
+ });
697
+
698
+ const errorTargetsInAPD = APDmessages.length ? true : false;
699
+ let hasChangeSetModifiedMessage = false;
700
+ if (showGenericErrorMessageForChangeSet && !errorTargetsInAPD) {
701
+ hasChangeSetModifiedMessage = true;
702
+ let sMessage = oResourceBundle.getText("C_COMMON_DIALOG_CANCEL_ERROR_MESSAGES_TEXT");
703
+ let sDescriptionText = oResourceBundle.getText("C_COMMON_DIALOG_CANCEL_ERROR_MESSAGES_DETAIL_TEXT");
704
+ const messageModel = Core.getMessageManager().getMessageModel();
705
+ const messagesInModel = messageModel.getData();
706
+ const aBoundMessages = messageHandling.getMessages(true);
707
+ let genericMessage;
708
+ const isEditable = oControl && oControl.getModel("ui").getProperty("/isEditable");
709
+
710
+ const nonErrorMessageExistsInDialog = messages.findIndex(function (message: Message) {
711
+ return message.getType() === "Error" || message.getType() === "Warning";
712
+ });
713
+ const nonErrorMessageExistsInModel = messagesInModel.findIndex(function (message: Message) {
714
+ return message.getType() === "Error" || message.getType() === "Warning";
715
+ });
716
+
717
+ if (nonErrorMessageExistsInDialog !== 1 && nonErrorMessageExistsInModel !== -1) {
718
+ if (messagesInModel.length === 1 && aBoundMessages.length === 1) {
719
+ if (isEditable === false) {
720
+ messagesInModel[0].setMessage(
721
+ oResourceBundle.getText("C_COMMON_DIALOG_CANCEL_SINGLE_ERROR_MESSAGE_TEXT") +
722
+ "\n\n" +
723
+ messagesInModel[0].getMessage()
724
+ );
725
+ } else {
726
+ sMessage = isEditable
727
+ ? oResourceBundle.getText("C_COMMON_DIALOG_CANCEL_SINGLE_ERROR_MESSAGE_TEXT_EDIT")
728
+ : oResourceBundle.getText("C_COMMON_DIALOG_CANCEL_SINGLE_ERROR_MESSAGE_TEXT");
729
+ sDescriptionText = "";
730
+ genericMessage = new Message({
731
+ message: sMessage,
732
+ type: MessageType.Error,
733
+ target: "",
734
+ persistent: true,
735
+ description: sDescriptionText,
736
+ code: "FE_CUSTOM_MESSAGE_CHANGESET_ALL_FAILED"
737
+ });
738
+ messages.unshift(genericMessage);
739
+ if (messages.length === 1) {
740
+ showMessageBox = true;
741
+ showMessageDialog = false;
742
+ } else {
743
+ showMessageDialog = true;
744
+ showMessageBox = false;
745
+ }
746
+ }
747
+ } else {
748
+ genericMessage = new Message({
749
+ message: sMessage,
750
+ type: MessageType.Error,
751
+ target: "",
752
+ persistent: true,
753
+ description: sDescriptionText,
754
+ code: "FE_CUSTOM_MESSAGE_CHANGESET_ALL_FAILED"
755
+ });
756
+ messages.unshift(genericMessage);
757
+ if (messages.length === 1) {
758
+ showMessageBox = true;
759
+ showMessageDialog = false;
760
+ } else {
761
+ showMessageDialog = true;
762
+ showMessageBox = false;
763
+ }
764
+ }
765
+ }
766
+ }
767
+
768
+ if (oDialog && oDialog.isOpen() && aContexts.length !== 0 && !mParameters.isStatic) {
769
+ if (!mParameters.bGrouped) {
770
+ //isolated
771
+ if (aContexts.length > 1 || !errorTargetsInAPD) {
772
+ // does not matter if error is in APD or not, if there are multiple contexts selected or if the error is not the APD, we close it.
773
+ // TODO: Dilaog handling should not be part of message handling. Refactor accordingly - dialog should not be needed inside this method - neither
774
+ // to ask whether it's open, nor to close/destroy it!
775
+ oDialog.close();
776
+ oDialog.destroy();
777
+ }
778
+ } else if (!errorTargetsInAPD) {
779
+ //changeset
780
+ oDialog.close();
781
+ oDialog.destroy();
782
+ }
783
+ }
784
+ let filteredMessages: any[] = [];
785
+ const bIsAPDOpen = oDialog && oDialog.isOpen();
786
+ if (!hasChangeSetModifiedMessage) {
787
+ if (messages.length === 1 && messages[0].getTarget && messages[0].getTarget() !== undefined && messages[0].getTarget() !== "") {
788
+ if ((oControl && oControl.getModel("ui").getProperty("/isEditable") === false) || !oControl) {
789
+ // OP edit or LR
790
+ showMessageBox = !errorTargetsInAPD;
791
+ showMessageDialog = false;
792
+ } else if (oControl && oControl.getModel("ui").getProperty("/isEditable") === true) {
793
+ showMessageBox = false;
794
+ showMessageDialog = false;
795
+ }
796
+ } else if (oControl) {
797
+ if (oControl.getModel("ui").getProperty("/isEditable") === false) {
798
+ if (bIsAPDOpen && errorTargetsInAPD) {
799
+ showMessageDialog = false;
800
+ }
801
+ } else if (oControl.getModel("ui").getProperty("/isEditable") === true) {
802
+ if (!bIsAPDOpen && errorTargetsInAPD) {
803
+ showMessageDialog = true;
804
+ filteredMessages = unboundMessages.concat(APDmessages);
805
+ } else if (!bIsAPDOpen && unboundMessages.length === 0) {
806
+ // error targets in APD => there is atleast one bound message. If there are unbound messages, dialog must be shown.
807
+ // for draft entity, we already closed the APD
808
+ showMessageDialog = false;
809
+ }
810
+ }
811
+ }
812
+ }
813
+
814
+ return {
815
+ showMessageBox: showMessageBox,
816
+ showMessageDialog: showMessageDialog,
817
+ filteredMessages: filteredMessages.length ? filteredMessages : messages,
818
+ fnGetMessageSubtitle:
819
+ oControl && oControl.isA("sap.ui.mdc.Table") && messageHandling.setMessageSubtitle.bind({}, oControl, aContexts),
820
+ showChangeSetErrorDialog: mParameters.bGrouped
821
+ };
822
+ }
823
+
824
+ /*
825
+ * Currently, this method is responsible for showing the dialog and executing the action. The promise returned is pending while waiting for user input, as well as while the
826
+ * back-end request is running. The promise is rejected when the user cancels the dialog and also when the back-end request fails.
827
+ * TODO: Refactoring: Separate dialog handling from backend processing. Dialog handling should return a Promise resolving to parameters to be provided to backend. If dialog is
828
+ * cancelled, that promise can be rejected. Method responsible for backend processing need to deal with multiple contexts - i.e. it should either return an array of Promises or
829
+ * a Promise resolving to an array. In the latter case, that Promise should be resolved also when some or even all contexts failed in backend - the overall process still was
830
+ * successful.
831
+ *
832
+ */
833
+
834
+ function showActionParameterDialog(
835
+ sActionName: any,
836
+ oAppComponent: AppComponent,
837
+ sActionLabel: any,
838
+ mParameters: any,
839
+ aActionParameters: ActionParameter[],
840
+ aParameterValues: any,
841
+ oActionContext: any,
842
+ oParentControl: any,
843
+ entitySetName: any,
844
+ messageHandler: any,
845
+ strictHandlingUtilities?: StrictHandlingUtilities
846
+ ) {
847
+ const sPath = _getPath(oActionContext, sActionName),
848
+ metaModel = oActionContext.getModel().oModel.getMetaModel(),
849
+ entitySetContext = metaModel.createBindingContext(sPath),
850
+ sActionNamePath = oActionContext.getObject("$IsBound")
851
+ ? oActionContext.getPath().split("/@$ui5.overload/0")[0]
852
+ : oActionContext.getPath().split("/0")[0],
853
+ actionNameContext = metaModel.createBindingContext(sActionNamePath),
854
+ bIsCreateAction = mParameters.isCreateAction,
855
+ sFragmentName = "sap/fe/core/controls/ActionParameterDialog";
856
+ return new Promise(async function (resolve, reject) {
857
+ let actionParameterInfos: ActionParameterInfo[]; // to be filled after fragment (for action parameter dialog) is loaded. Actually only needed during dialog processing, i.e. could be moved into the controller and directly initialized there, but only after moving all handlers (esp. press handler for action button) to controller.
858
+
859
+ const messageManager = Core.getMessageManager();
860
+
861
+ const _removeMessagesForActionParamter = (parameter: ActionParameter) => {
862
+ const allMessages = messageManager.getMessageModel().getData();
863
+ const controlId = generate(["APD_", parameter.$Name]);
864
+ // also remove messages assigned to inner controls, but avoid removing messages for different paramters (with name being substring of another parameter name)
865
+ const relevantMessages = allMessages.filter((msg: Message) =>
866
+ msg.getControlIds().some((id: string) => controlId.split("-").includes(id))
867
+ );
868
+ messageManager.removeMessages(relevantMessages);
869
+ };
870
+
871
+ const oController = {
872
+ handleChange: async function (oEvent: Event) {
873
+ const field = oEvent.getSource();
874
+ const actionParameterInfo = actionParameterInfos.find(
875
+ (actionParameterInfo) => actionParameterInfo.field === field
876
+ ) as ActionParameterInfo;
877
+ // field value is being changed, thus existing messages related to that field are not valid anymore
878
+ _removeMessagesForActionParamter(actionParameterInfo.parameter);
879
+ // adapt info. Promise is resolved to value or rejected with exception containing message
880
+ actionParameterInfo.validationPromise = oEvent.getParameter("promise") as Promise<string>;
881
+ try {
882
+ actionParameterInfo.value = await actionParameterInfo.validationPromise;
883
+ } catch (error) {
884
+ delete actionParameterInfo.value;
885
+ _addMessageForActionParameter(messageManager, [
886
+ {
887
+ actionParameterInfo: actionParameterInfo,
888
+ message: (error as { message: string }).message
889
+ }
890
+ ]);
891
+ }
892
+ }
893
+ };
894
+
895
+ const oFragment = XMLTemplateProcessor.loadTemplate(sFragmentName, "fragment");
896
+ const oParameterModel = new JSONModel({
897
+ $displayMode: {}
898
+ });
899
+
900
+ try {
901
+ const createdFragment = await XMLPreprocessor.process(
902
+ oFragment,
903
+ { name: sFragmentName },
904
+ {
905
+ bindingContexts: {
906
+ action: oActionContext,
907
+ actionName: actionNameContext,
908
+ entitySet: entitySetContext
909
+ },
910
+ models: {
911
+ action: oActionContext.getModel(),
912
+ actionName: actionNameContext.getModel(),
913
+ entitySet: entitySetContext.getModel(),
914
+ metaModel: entitySetContext.getModel()
915
+ }
916
+ }
917
+ );
918
+ // TODO: move the dialog into the fragment and move the handlers to the oController
919
+ const aContexts: any[] = mParameters.aContexts || [];
920
+ const aFunctionParams: any[] = [];
921
+ // eslint-disable-next-line prefer-const
922
+ let oOperationBinding: any;
923
+ await CommonUtils.setUserDefaults(oAppComponent, aActionParameters, oParameterModel, true);
924
+ const oDialogContent = (await Fragment.load({
925
+ definition: createdFragment,
926
+ controller: oController
927
+ })) as Control;
928
+
929
+ actionParameterInfos = aActionParameters.map((actionParameter) => {
930
+ const field = Core.byId(generate(["APD_", actionParameter.$Name])) as Field | MultiValueField;
931
+ const isMultiValue = field.isA("sap.ui.mdc.MultiValueField");
932
+ return {
933
+ parameter: actionParameter,
934
+ field: field,
935
+ isMultiValue: isMultiValue
936
+ };
937
+ });
938
+
939
+ const resourceModel = getResourceModel(oParentControl);
940
+ let actionResult = {
941
+ dialogCancelled: true, // to be set to false in case of successful action exection
942
+ result: undefined
943
+ };
944
+ const oDialog = new Dialog(generate(["fe", "APD_", sActionName]), {
945
+ title: sActionLabel || resourceModel.getText("C_OPERATIONS_ACTION_PARAMETER_DIALOG_TITLE"),
946
+ content: [oDialogContent],
947
+ escapeHandler: function () {
948
+ // escape handler is meant to possibly suppress or postpone closing the dialog on escape (by calling "reject" on the provided object, or "resolve" only when
949
+ // done with all tasks to happen before dialog can be closed). It's not intended to explicetly close the dialog here (that happens automatically when no
950
+ // escapeHandler is provided or the resolve-callback is called) or for own wrap up tasks (like removing validition messages - this should happen in the
951
+ // afterClose).
952
+ // TODO: Move wrap up tasks to afterClose, and remove this method completely. Take care to also adapt end button press handler accordingly.
953
+ // Currently only still needed to differentiate closing dialog after successful execution (uses resolve) from user cancellation (using reject)
954
+ oDialog.close();
955
+ // reject(Constants.CancelActionDialog);
956
+ },
957
+ beginButton: new Button(generate(["fe", "APD_", sActionName, "Action", "Ok"]), {
958
+ text: bIsCreateAction
959
+ ? resourceModel.getText("C_TRANSACTION_HELPER_SAPFE_ACTION_CREATE_BUTTON")
960
+ : _getActionParameterActionName(resourceModel, sActionLabel, sActionName, entitySetName),
961
+ type: "Emphasized",
962
+ press: async function () {
963
+ try {
964
+ if (!(await _validateProperties(messageManager, actionParameterInfos, resourceModel))) {
965
+ return;
966
+ }
967
+
968
+ BusyLocker.lock(oDialog);
969
+
970
+ try {
971
+ // TODO: due to using the search and value helps on the action dialog transient messages could appear
972
+ // we need an UX design for those to show them to the user - for now remove them before continuing
973
+ messageHandler.removeTransitionMessages();
974
+ // move parameter values from Dialog (SimpleForm) to mParameters.actionParameters so that they are available in the operation bindings for all contexts
975
+ let vParameterValue;
976
+ const oParameterContext = oOperationBinding && oOperationBinding.getParameterContext();
977
+ for (const i in aActionParameters) {
978
+ if (aActionParameters[i].$isCollection) {
979
+ const aMVFContent = oDialog.getModel("mvfview").getProperty(`/${aActionParameters[i].$Name}`),
980
+ aKeyValues = [];
981
+ for (const j in aMVFContent) {
982
+ aKeyValues.push(aMVFContent[j].Key);
983
+ }
984
+ vParameterValue = aKeyValues;
985
+ } else {
986
+ vParameterValue = oParameterContext.getProperty(aActionParameters[i].$Name);
987
+ }
988
+ aActionParameters[i].value = vParameterValue; // writing the current value (ueser input!) into the metamodel => should be refactored to use ActionParameterInfos instead. Used in setActionParameterDefaultValue
989
+ vParameterValue = undefined;
990
+ }
991
+ mParameters.label = sActionLabel;
992
+ try {
993
+ const aResult = await executeAPMAction(
994
+ oAppComponent,
995
+ mParameters,
996
+ oParentControl,
997
+ messageHandler,
998
+ aContexts,
999
+ oDialog,
1000
+ false,
1001
+ strictHandlingUtilities
1002
+ );
1003
+ actionResult = {
1004
+ dialogCancelled: false,
1005
+ result: aResult
1006
+ };
1007
+ oDialog.close();
1008
+ // resolve(aResult);
1009
+ } catch (oError: any) {
1010
+ const messages = sap.ui.getCore().getMessageManager().getMessageModel().getData();
1011
+ if (
1012
+ strictHandlingUtilities &&
1013
+ strictHandlingUtilities.is412Executed &&
1014
+ strictHandlingUtilities.strictHandlingTransitionFails.length
1015
+ ) {
1016
+ strictHandlingUtilities.delaySuccessMessages =
1017
+ strictHandlingUtilities.delaySuccessMessages.concat(messages);
1018
+ }
1019
+ throw oError;
1020
+ } finally {
1021
+ if (
1022
+ strictHandlingUtilities &&
1023
+ strictHandlingUtilities.is412Executed &&
1024
+ strictHandlingUtilities.strictHandlingTransitionFails.length
1025
+ ) {
1026
+ try {
1027
+ const strictHandlingFails = strictHandlingUtilities.strictHandlingTransitionFails;
1028
+ const aFailedContexts = [] as any;
1029
+ strictHandlingFails.forEach(function (fail: any) {
1030
+ aFailedContexts.push(fail.oAction.getContext());
1031
+ });
1032
+ mParameters.aContexts = aFailedContexts;
1033
+ const aResult = await executeAPMAction(
1034
+ oAppComponent,
1035
+ mParameters,
1036
+ oParentControl,
1037
+ messageHandler,
1038
+ aContexts,
1039
+ oDialog,
1040
+ true,
1041
+ strictHandlingUtilities
1042
+ );
1043
+
1044
+ strictHandlingUtilities.strictHandlingTransitionFails = [];
1045
+ actionResult = {
1046
+ dialogCancelled: false,
1047
+ result: aResult
1048
+ };
1049
+ // resolve(aResult);
1050
+ } catch {
1051
+ if (
1052
+ strictHandlingUtilities.is412Executed &&
1053
+ strictHandlingUtilities.strictHandlingTransitionFails.length
1054
+ ) {
1055
+ Core.getMessageManager().addMessages(strictHandlingUtilities.delaySuccessMessages);
1056
+ }
1057
+ let showGenericErrorMessageForChangeSet = false;
1058
+ if (
1059
+ (mParameters.bGrouped && strictHandlingUtilities.strictHandlingPromises.length) ||
1060
+ checkforOtherMessages(mParameters.bGrouped) !== -1
1061
+ ) {
1062
+ showGenericErrorMessageForChangeSet = true;
1063
+ }
1064
+ await messageHandler.showMessageDialog({
1065
+ isActionParameterDialogOpen: oDialog.isOpen(),
1066
+ onBeforeShowMessage: function (aMessages: any, showMessageParametersIn: any) {
1067
+ return actionParameterShowMessageCallback(
1068
+ mParameters,
1069
+ aContexts,
1070
+ oDialog,
1071
+ aMessages,
1072
+ showMessageParametersIn,
1073
+ showGenericErrorMessageForChangeSet
1074
+ );
1075
+ },
1076
+ aSelectedContexts: mParameters.aContexts,
1077
+ sActionName: sActionLabel
1078
+ });
1079
+ }
1080
+ }
1081
+ if (BusyLocker.isLocked(oDialog)) {
1082
+ BusyLocker.unlock(oDialog);
1083
+ }
1084
+ }
1085
+ } catch (oError: any) {
1086
+ let showMessageDialog = true;
1087
+ let showGenericErrorMessageForChangeSet = false;
1088
+ if (
1089
+ (mParameters.bGrouped &&
1090
+ strictHandlingUtilities &&
1091
+ strictHandlingUtilities.strictHandlingPromises.length) ||
1092
+ checkforOtherMessages(mParameters.bGrouped) !== -1
1093
+ ) {
1094
+ showGenericErrorMessageForChangeSet = true;
1095
+ }
1096
+ await messageHandler.showMessages({
1097
+ context: mParameters.aContexts[0],
1098
+ isActionParameterDialogOpen: oDialog.isOpen(),
1099
+ messagePageNavigationCallback: function () {
1100
+ oDialog.close();
1101
+ },
1102
+ onBeforeShowMessage: function (aMessages: any, showMessageParametersIn: any) {
1103
+ // Why is this implemented as callback? Apparently, all needed information is available beforehand
1104
+ // TODO: refactor accordingly
1105
+ const showMessageParameters = actionParameterShowMessageCallback(
1106
+ mParameters,
1107
+ aContexts,
1108
+ oDialog,
1109
+ aMessages,
1110
+ showMessageParametersIn,
1111
+ showGenericErrorMessageForChangeSet
1112
+ );
1113
+ showMessageDialog = showMessageParameters.showMessageDialog;
1114
+ return showMessageParameters;
1115
+ },
1116
+ aSelectedContexts: mParameters.aContexts,
1117
+ sActionName: sActionLabel,
1118
+ control: mParameters.control
1119
+ });
1120
+
1121
+ // In case of backend validation error(s?), message shall not be shown in message dialog but next to the field on parameter dialog, which should
1122
+ // stay open in this case => in this case, we must not resolve or reject the promise controlling the parameter dialog.
1123
+ // In all other cases (e.g. other backend errors or user cancellation), the promise controlling the parameter dialog needs to be rejected to allow
1124
+ // callers to react. (Example: If creation in backend after navigation to transient context fails, back navigation needs to be triggered)
1125
+ // TODO: Refactor to separate dialog handling from backend request istead of taking decision based on message handling
1126
+ if (showMessageDialog) {
1127
+ if (oDialog.isOpen()) {
1128
+ // do nothing, do not reject promise here
1129
+ // We do not close the APM dialog if user enters a wrong value in of the fields that results in an error from the backend.
1130
+ // The user can close the message dialog and the APM dialog would still be open on which he could enter a new value and trigger the action again.
1131
+ // Earlier we were rejecting the promise on error here, and the call stack was destroyed as the promise was rejected and returned to EditFlow invoke action.
1132
+ // But since the APM dialog was still open, a new promise was resolved in case the user retried the action and the object was created, but the navigation to object page was not taking place.
1133
+ } else {
1134
+ reject(oError);
1135
+ }
1136
+ }
1137
+ }
1138
+ } finally {
1139
+ if (strictHandlingUtilities) {
1140
+ strictHandlingUtilities = {
1141
+ is412Executed: false,
1142
+ strictHandlingTransitionFails: [],
1143
+ strictHandlingPromises: [],
1144
+ strictHandlingWarningMessages: [],
1145
+ delaySuccessMessages: [],
1146
+ processedMessageIds: []
1147
+ };
1148
+ }
1149
+ if (BusyLocker.isLocked(oDialog)) {
1150
+ BusyLocker.unlock(oDialog);
1151
+ }
1152
+ }
1153
+ }
1154
+ }),
1155
+ endButton: new Button(generate(["fe", "APD_", sActionName, "Action", "Cancel"]), {
1156
+ text: resourceModel.getText("C_COMMON_ACTION_PARAMETER_DIALOG_CANCEL"),
1157
+ press: function () {
1158
+ // TODO: cancel button should just close the dialog (similar to using escape). All wrap up tasks should be moved to afterClose.
1159
+ oDialog.close();
1160
+ // reject(Constants.CancelActionDialog);
1161
+ }
1162
+ }),
1163
+ // TODO: beforeOpen is just an event, i.e. not waiting for the Promise to be resolved. Check if tasks of this function need to be done before opening the dialog
1164
+ // - if yes, they need to be moved outside.
1165
+ // Assumption: Sometimes dialog can be seen without any fields for a short time - maybe this is caused by this asynchronity
1166
+ beforeOpen: async function (oEvent: any) {
1167
+ // clone event for actionWrapper as oEvent.oSource gets lost during processing of beforeOpen event handler
1168
+ const oCloneEvent = Object.assign({}, oEvent);
1169
+
1170
+ messageHandler.removeTransitionMessages();
1171
+ const getDefaultValuesFunction = function () {
1172
+ const oMetaModel = oDialog.getModel().getMetaModel() as ODataMetaModel,
1173
+ sActionPath = oActionContext.sPath && oActionContext.sPath.split("/@")[0],
1174
+ sDefaultValuesFunction = oMetaModel.getObject(
1175
+ `${sActionPath}@com.sap.vocabularies.Common.v1.DefaultValuesFunction`
1176
+ );
1177
+ return sDefaultValuesFunction;
1178
+ };
1179
+ const fnSetDefaultsAndOpenDialog = async function (sBindingParameter?: any) {
1180
+ const sBoundFunctionName = getDefaultValuesFunction();
1181
+ const prefillParameter = async function (sParamName: any, vParamDefaultValue: any) {
1182
+ // Case 1: There is a ParameterDefaultValue annotation
1183
+ if (vParamDefaultValue !== undefined) {
1184
+ if (aContexts.length > 0 && vParamDefaultValue.$Path) {
1185
+ try {
1186
+ let vParamValue = await CommonUtils.requestSingletonProperty(
1187
+ vParamDefaultValue.$Path,
1188
+ oOperationBinding.getModel()
1189
+ );
1190
+ if (vParamValue === null) {
1191
+ vParamValue = await oOperationBinding
1192
+ .getParameterContext()
1193
+ .requestProperty(vParamDefaultValue.$Path);
1194
+ }
1195
+ if (aContexts.length > 1) {
1196
+ // For multi select, need to loop over aContexts (as contexts cannot be retrieved via binding parameter of the operation binding)
1197
+ let sPathForContext = vParamDefaultValue.$Path;
1198
+ if (sPathForContext.indexOf(`${sBindingParameter}/`) === 0) {
1199
+ sPathForContext = sPathForContext.replace(`${sBindingParameter}/`, "");
1200
+ }
1201
+ for (let i = 1; i < aContexts.length; i++) {
1202
+ if (aContexts[i].getProperty(sPathForContext) !== vParamValue) {
1203
+ // if the values from the contexts are not all the same, do not prefill
1204
+ return {
1205
+ paramName: sParamName,
1206
+ value: undefined,
1207
+ bNoPossibleValue: true
1208
+ };
1209
+ }
1210
+ }
1211
+ }
1212
+ return { paramName: sParamName, value: vParamValue };
1213
+ } catch (oError) {
1214
+ Log.error("Error while reading default action parameter", sParamName, mParameters.actionName);
1215
+ return {
1216
+ paramName: sParamName,
1217
+ value: undefined,
1218
+ bLatePropertyError: true
1219
+ };
1220
+ }
1221
+ } else {
1222
+ // Case 1.2: ParameterDefaultValue defines a fixed string value (i.e. vParamDefaultValue = 'someString')
1223
+ return { paramName: sParamName, value: vParamDefaultValue };
1224
+ }
1225
+ } else if (oParameterModel && (oParameterModel as any).oData[sParamName]) {
1226
+ // Case 2: There is no ParameterDefaultValue annotation (=> look into the FLP User Defaults)
1227
+
1228
+ return {
1229
+ paramName: sParamName,
1230
+ value: (oParameterModel as any).oData[sParamName]
1231
+ };
1232
+ } else {
1233
+ return { paramName: sParamName, value: undefined };
1234
+ }
1235
+ };
1236
+
1237
+ const getParameterDefaultValue = function (sParamName: any) {
1238
+ const oMetaModel = oDialog.getModel().getMetaModel() as ODataMetaModel,
1239
+ sActionParameterAnnotationPath = CommonUtils.getParameterPath(oActionContext.getPath(), sParamName) + "@",
1240
+ oParameterAnnotations = oMetaModel.getObject(sActionParameterAnnotationPath),
1241
+ oParameterDefaultValue =
1242
+ oParameterAnnotations && oParameterAnnotations["@com.sap.vocabularies.UI.v1.ParameterDefaultValue"]; // either { $Path: 'somePath' } or 'someString'
1243
+ return oParameterDefaultValue;
1244
+ };
1245
+
1246
+ const aCurrentParamDefaultValue = [];
1247
+ let sParamName, vParameterDefaultValue;
1248
+ for (const i in aActionParameters) {
1249
+ sParamName = aActionParameters[i].$Name;
1250
+ vParameterDefaultValue = getParameterDefaultValue(sParamName);
1251
+ aCurrentParamDefaultValue.push(prefillParameter(sParamName, vParameterDefaultValue));
1252
+ }
1253
+
1254
+ if (oActionContext.getObject("$IsBound") && aContexts.length > 0) {
1255
+ if (sBoundFunctionName && sBoundFunctionName.length > 0 && typeof sBoundFunctionName === "string") {
1256
+ for (const i in aContexts) {
1257
+ aFunctionParams.push(callBoundFunction(sBoundFunctionName, aContexts[i], mParameters.model));
1258
+ }
1259
+ }
1260
+ }
1261
+
1262
+ const aPrefillParamPromises = Promise.all(aCurrentParamDefaultValue);
1263
+ let aExecFunctionPromises: Promise<any[]> = Promise.resolve([]);
1264
+ let oExecFunctionFromManifestPromise;
1265
+ if (aFunctionParams && aFunctionParams.length > 0) {
1266
+ aExecFunctionPromises = Promise.all(aFunctionParams);
1267
+ }
1268
+ if (mParameters.defaultValuesExtensionFunction) {
1269
+ const sModule = mParameters.defaultValuesExtensionFunction
1270
+ .substring(0, mParameters.defaultValuesExtensionFunction.lastIndexOf(".") || -1)
1271
+ .replace(/\./gi, "/"),
1272
+ sFunctionName = mParameters.defaultValuesExtensionFunction.substring(
1273
+ mParameters.defaultValuesExtensionFunction.lastIndexOf(".") + 1,
1274
+ mParameters.defaultValuesExtensionFunction.length
1275
+ );
1276
+ oExecFunctionFromManifestPromise = FPMHelper.actionWrapper(oCloneEvent, sModule, sFunctionName, {
1277
+ contexts: aContexts
1278
+ });
1279
+ }
1280
+
1281
+ try {
1282
+ const aPromises = await Promise.all([
1283
+ aPrefillParamPromises,
1284
+ aExecFunctionPromises,
1285
+ oExecFunctionFromManifestPromise
1286
+ ]);
1287
+ const currentParamDefaultValue: any = aPromises[0];
1288
+ const functionParams = aPromises[1];
1289
+ const oFunctionParamsFromManifest = aPromises[2];
1290
+ let sDialogParamName: string;
1291
+
1292
+ // Fill the dialog with the earlier determined parameter values from the different sources
1293
+ for (const i in aActionParameters) {
1294
+ sDialogParamName = aActionParameters[i].$Name;
1295
+ // Parameter values provided in the call of invokeAction overrule other sources
1296
+ const vParameterProvidedValue = aParameterValues?.find(
1297
+ (element: any) => element.name === aActionParameters[i].$Name
1298
+ )?.value;
1299
+ if (vParameterProvidedValue) {
1300
+ oOperationBinding.setParameter(aActionParameters[i].$Name, vParameterProvidedValue);
1301
+ } else if (oFunctionParamsFromManifest && oFunctionParamsFromManifest.hasOwnProperty(sDialogParamName)) {
1302
+ oOperationBinding.setParameter(
1303
+ aActionParameters[i].$Name,
1304
+ oFunctionParamsFromManifest[sDialogParamName]
1305
+ );
1306
+ } else if (currentParamDefaultValue[i] && currentParamDefaultValue[i].value !== undefined) {
1307
+ oOperationBinding.setParameter(aActionParameters[i].$Name, currentParamDefaultValue[i].value);
1308
+ // if the default value had not been previously determined due to different contexts, we do nothing else
1309
+ } else if (sBoundFunctionName && !currentParamDefaultValue[i].bNoPossibleValue) {
1310
+ if (aContexts.length > 1) {
1311
+ // we check if the function retrieves the same param value for all the contexts:
1312
+ let j = 0;
1313
+ while (j < aContexts.length - 1) {
1314
+ if (
1315
+ functionParams[j] &&
1316
+ functionParams[j + 1] &&
1317
+ functionParams[j].getObject(sDialogParamName) ===
1318
+ functionParams[j + 1].getObject(sDialogParamName)
1319
+ ) {
1320
+ j++;
1321
+ } else {
1322
+ break;
1323
+ }
1324
+ }
1325
+ //param values are all the same:
1326
+ if (j === aContexts.length - 1) {
1327
+ oOperationBinding.setParameter(
1328
+ aActionParameters[i].$Name,
1329
+ functionParams[j].getObject(sDialogParamName)
1330
+ );
1331
+ }
1332
+ } else if (functionParams[0] && functionParams[0].getObject(sDialogParamName)) {
1333
+ //Only one context, then the default param values are to be verified from the function:
1334
+
1335
+ oOperationBinding.setParameter(
1336
+ aActionParameters[i].$Name,
1337
+ functionParams[0].getObject(sDialogParamName)
1338
+ );
1339
+ }
1340
+ }
1341
+ }
1342
+ const bErrorFound = currentParamDefaultValue.some(function (oValue: any) {
1343
+ if (oValue.bLatePropertyError) {
1344
+ return oValue.bLatePropertyError;
1345
+ }
1346
+ });
1347
+ // If at least one Default Property is a Late Property and an eTag error was raised.
1348
+ if (bErrorFound) {
1349
+ const sText = resourceModel.getText("C_APP_COMPONENT_SAPFE_ETAG_LATE_PROPERTY");
1350
+ MessageBox.warning(sText, { contentWidth: "25em" } as any);
1351
+ }
1352
+ } catch (oError: any) {
1353
+ Log.error("Error while retrieving the parameter", oError);
1354
+ }
1355
+ };
1356
+ const fnAsyncBeforeOpen = async function () {
1357
+ if (oActionContext.getObject("$IsBound") && aContexts.length > 0) {
1358
+ const aParameters = oActionContext.getObject("$Parameter");
1359
+ const sBindingParameter = aParameters[0] && aParameters[0].$Name;
1360
+
1361
+ try {
1362
+ const oContextObject = await aContexts[0].requestObject();
1363
+ if (oContextObject) {
1364
+ oOperationBinding.setParameter(sBindingParameter, oContextObject);
1365
+ }
1366
+ await fnSetDefaultsAndOpenDialog(sBindingParameter);
1367
+ } catch (oError: any) {
1368
+ Log.error("Error while retrieving the parameter", oError);
1369
+ }
1370
+ } else {
1371
+ await fnSetDefaultsAndOpenDialog();
1372
+ }
1373
+ };
1374
+
1375
+ await fnAsyncBeforeOpen();
1376
+
1377
+ // adding defaulted values only here after they are not set to the fields
1378
+ for (const actionParameterInfo of actionParameterInfos) {
1379
+ const value = actionParameterInfo.isMultiValue
1380
+ ? (actionParameterInfo.field as MultiValueField).getItems()
1381
+ : (actionParameterInfo.field as Field).getValue();
1382
+ actionParameterInfo.value = value;
1383
+ actionParameterInfo.validationPromise = Promise.resolve(value);
1384
+ }
1385
+ },
1386
+ afterClose: function () {
1387
+ // when the dialog is cancelled, messages need to be removed in case the same action should be executed again
1388
+ aActionParameters.forEach(_removeMessagesForActionParamter);
1389
+ oDialog.destroy();
1390
+ if (actionResult.dialogCancelled) {
1391
+ reject(Constants.CancelActionDialog);
1392
+ } else {
1393
+ resolve(actionResult.result);
1394
+ }
1395
+ }
1396
+ });
1397
+ mParameters.oDialog = oDialog;
1398
+ oDialog.setModel(oActionContext.getModel().oModel);
1399
+ oDialog.setModel(oParameterModel, "paramsModel");
1400
+ oDialog.bindElement({
1401
+ path: "/",
1402
+ model: "paramsModel"
1403
+ });
1404
+
1405
+ // empty model to add elements dynamically depending on number of MVF fields defined on the dialog
1406
+ const oMVFModel = new JSONModel({});
1407
+ oDialog.setModel(oMVFModel, "mvfview");
1408
+
1409
+ /* Event needed for removing messages of valid changed field */
1410
+ for (const actionParameterInfo of actionParameterInfos) {
1411
+ if (actionParameterInfo.isMultiValue) {
1412
+ actionParameterInfo?.field?.getBinding("items")?.attachChange(() => {
1413
+ _removeMessagesForActionParamter(actionParameterInfo.parameter);
1414
+ });
1415
+ } else {
1416
+ actionParameterInfo?.field?.getBinding("value")?.attachChange(() => {
1417
+ _removeMessagesForActionParamter(actionParameterInfo.parameter);
1418
+ });
1419
+ }
1420
+ }
1421
+
1422
+ let sActionPath = `${sActionName}(...)`;
1423
+ if (!aContexts.length) {
1424
+ sActionPath = `/${sActionPath}`;
1425
+ }
1426
+ oDialog.bindElement({
1427
+ path: sActionPath
1428
+ });
1429
+ if (oParentControl) {
1430
+ // if there is a parent control specified add the dialog as dependent
1431
+ oParentControl.addDependent(oDialog);
1432
+ }
1433
+ if (aContexts.length > 0) {
1434
+ oDialog.setBindingContext(aContexts[0]); // use context of first selected line item
1435
+ }
1436
+ oOperationBinding = oDialog.getObjectBinding();
1437
+ oDialog.open();
1438
+ } catch (oError: any) {
1439
+ reject(oError);
1440
+ }
1441
+ });
1442
+ }
1443
+ function getActionParameters(oAction: any) {
1444
+ const aParameters = oAction.getObject("$Parameter") || [];
1445
+ if (aParameters && aParameters.length) {
1446
+ if (oAction.getObject("$IsBound")) {
1447
+ //in case of bound actions, ignore the first parameter and consider the rest
1448
+ return aParameters.slice(1, aParameters.length) || [];
1449
+ }
1450
+ }
1451
+ return aParameters;
1452
+ }
1453
+ function getIsActionCritical(oMetaModel: any, sPath: any, contexts?: any, oBoundAction?: any) {
1454
+ const vActionCritical = oMetaModel.getObject(`${sPath}@com.sap.vocabularies.Common.v1.IsActionCritical`);
1455
+ let sCriticalPath = vActionCritical && vActionCritical.$Path;
1456
+ if (!sCriticalPath) {
1457
+ // the static value scenario for isActionCritical
1458
+ return !!vActionCritical;
1459
+ }
1460
+ const aBindingParams = oBoundAction && oBoundAction.getObject("$Parameter"),
1461
+ aPaths = sCriticalPath && sCriticalPath.split("/"),
1462
+ bCondition =
1463
+ aBindingParams && aBindingParams.length && typeof aBindingParams === "object" && sCriticalPath && contexts && contexts.length;
1464
+ if (bCondition) {
1465
+ //in case binding patameters are there in path need to remove eg: - _it/isVerified => need to remove _it and the path should be isVerified
1466
+ aBindingParams.filter(function (oParams: any) {
1467
+ const index = aPaths && aPaths.indexOf(oParams.$Name);
1468
+ if (index > -1) {
1469
+ aPaths.splice(index, 1);
1470
+ }
1471
+ });
1472
+ sCriticalPath = aPaths.join("/");
1473
+ return contexts[0].getObject(sCriticalPath);
1474
+ } else if (sCriticalPath) {
1475
+ //if scenario is path based return the path value
1476
+ return contexts[0].getObject(sCriticalPath);
1477
+ }
1478
+ }
1479
+
1480
+ function _getActionParameterActionName(resourceModel: ResourceModel, sActionLabel: string, sActionName: string, sEntitySetName: string) {
1481
+ let boundActionName: any = sActionName ? sActionName : null;
1482
+ const aActionName = boundActionName.split(".");
1483
+ boundActionName = boundActionName.indexOf(".") >= 0 ? aActionName[aActionName.length - 1] : boundActionName;
1484
+ const suffixResourceKey = boundActionName && sEntitySetName ? `${sEntitySetName}|${boundActionName}` : "";
1485
+ const sKey = "ACTION_PARAMETER_DIALOG_ACTION_NAME";
1486
+ const bResourceKeyExists = resourceModel.checkIfResourceKeyExists(`${sKey}|${suffixResourceKey}`);
1487
+ if (sActionLabel) {
1488
+ if (bResourceKeyExists) {
1489
+ return resourceModel.getText(sKey, undefined, suffixResourceKey);
1490
+ } else if (resourceModel.checkIfResourceKeyExists(`${sKey}|${sEntitySetName}`)) {
1491
+ return resourceModel.getText(sKey, undefined, `${sEntitySetName}`);
1492
+ } else if (resourceModel.checkIfResourceKeyExists(`${sKey}`)) {
1493
+ return resourceModel.getText(sKey);
1494
+ } else {
1495
+ return sActionLabel;
1496
+ }
1497
+ } else {
1498
+ return resourceModel.getText("C_COMMON_DIALOG_OK");
1499
+ }
1500
+ }
1501
+
1502
+ function executeDependingOnSelectedContexts(
1503
+ oAction: any,
1504
+ mParameters: any,
1505
+ bGetBoundContext: boolean,
1506
+ sGroupId: string,
1507
+ resourceModel: ResourceModel,
1508
+ messageHandler: MessageHandler | undefined,
1509
+ iContextLength: number | null,
1510
+ current_context_index: number | null,
1511
+ internalOperationsPromiseResolve: Function,
1512
+ internalOperationsPromiseReject: Function,
1513
+ strictHandlingUtilities?: StrictHandlingUtilities
1514
+ ) {
1515
+ let oActionPromise,
1516
+ bEnableStrictHandling = true;
1517
+ if (mParameters) {
1518
+ mParameters.internalOperationsPromiseResolve = internalOperationsPromiseResolve;
1519
+ }
1520
+ if (bGetBoundContext) {
1521
+ const sPath = oAction.getBoundContext().getPath();
1522
+ const sMetaPath = oAction.getModel().getMetaModel().getMetaPath(sPath);
1523
+ const oProperty = oAction.getModel().getMetaModel().getObject(sMetaPath);
1524
+ if (oProperty && oProperty[0]?.$kind !== "Action") {
1525
+ //do not enable the strict handling if its not an action
1526
+ bEnableStrictHandling = false;
1527
+ }
1528
+ }
1529
+
1530
+ if (!bEnableStrictHandling) {
1531
+ oActionPromise = bGetBoundContext
1532
+ ? oAction.execute(sGroupId).then(function () {
1533
+ return oAction.getBoundContext();
1534
+ })
1535
+ : oAction.execute(sGroupId);
1536
+ } else {
1537
+ oActionPromise = bGetBoundContext
1538
+ ? oAction
1539
+ .execute(
1540
+ sGroupId,
1541
+ undefined,
1542
+ (operationsHelper as any).fnOnStrictHandlingFailed.bind(
1543
+ operations,
1544
+ sGroupId,
1545
+ mParameters,
1546
+ resourceModel,
1547
+ current_context_index,
1548
+ oAction.getContext(),
1549
+ iContextLength,
1550
+ messageHandler,
1551
+ strictHandlingUtilities
1552
+ )
1553
+ )
1554
+ .then(function () {
1555
+ internalOperationsPromiseResolve(oAction.getBoundContext());
1556
+ return oAction.getBoundContext();
1557
+ })
1558
+ .catch(function () {
1559
+ internalOperationsPromiseReject();
1560
+ return Promise.reject();
1561
+ })
1562
+ : oAction
1563
+ .execute(
1564
+ sGroupId,
1565
+ undefined,
1566
+ (operationsHelper as any).fnOnStrictHandlingFailed.bind(
1567
+ operations,
1568
+ sGroupId,
1569
+ mParameters,
1570
+ resourceModel,
1571
+ current_context_index,
1572
+ oAction.getContext(),
1573
+ iContextLength,
1574
+ messageHandler,
1575
+ strictHandlingUtilities
1576
+ )
1577
+ )
1578
+ .then(function (result: any) {
1579
+ internalOperationsPromiseResolve(result);
1580
+ return result;
1581
+ })
1582
+ .catch(function () {
1583
+ internalOperationsPromiseReject();
1584
+ return Promise.reject();
1585
+ });
1586
+ }
1587
+
1588
+ return oActionPromise.catch(() => {
1589
+ throw Constants.ActionExecutionFailed;
1590
+ });
1591
+ }
1592
+
1593
+ function createinternalOperationsPromiseForActionExecution() {
1594
+ let internalOperationsPromiseResolve: any = null,
1595
+ internalOperationsPromiseReject: any = null;
1596
+ const oLocalActionPromise = new Promise(function (resolve, reject) {
1597
+ internalOperationsPromiseResolve = resolve;
1598
+ internalOperationsPromiseReject = reject;
1599
+ });
1600
+
1601
+ return { oLocalActionPromise, internalOperationsPromiseResolve, internalOperationsPromiseReject };
1602
+ }
1603
+
1604
+ function checkforOtherMessages(isChangeSet: boolean) {
1605
+ if (isChangeSet) {
1606
+ const aMessages: Message[] = Core.getMessageManager().getMessageModel().getData();
1607
+ return aMessages.findIndex(function (message: Message) {
1608
+ return message.getType() === "Error" || message.getType() === "Warning";
1609
+ });
1610
+ }
1611
+ return -1;
1612
+ }
1613
+
1614
+ function _executeAction(
1615
+ oAppComponent: any,
1616
+ mParameters: any,
1617
+ oParentControl?: any,
1618
+ messageHandler?: MessageHandler,
1619
+ strictHandlingUtilities?: StrictHandlingUtilities
1620
+ ) {
1621
+ const aContexts = mParameters.aContexts || [];
1622
+ const oModel = mParameters.model;
1623
+ const aActionParameters = mParameters.aActionParameters || [];
1624
+ const sActionName = mParameters.actionName;
1625
+ const fnOnSubmitted = mParameters.fnOnSubmitted;
1626
+ const fnOnResponse = mParameters.fnOnResponse;
1627
+ const resourceModel = getResourceModel(oParentControl);
1628
+ let oAction: any;
1629
+
1630
+ function setActionParameterDefaultValue() {
1631
+ if (aActionParameters && aActionParameters.length) {
1632
+ for (let j = 0; j < aActionParameters.length; j++) {
1633
+ if (!aActionParameters[j].value) {
1634
+ switch (aActionParameters[j].$Type) {
1635
+ case "Edm.String":
1636
+ aActionParameters[j].value = "";
1637
+ break;
1638
+ case "Edm.Boolean":
1639
+ aActionParameters[j].value = false;
1640
+ break;
1641
+ case "Edm.Byte":
1642
+ case "Edm.Int16":
1643
+ case "Edm.Int32":
1644
+ case "Edm.Int64":
1645
+ aActionParameters[j].value = 0;
1646
+ break;
1647
+ // tbc
1648
+ default:
1649
+ break;
1650
+ }
1651
+ }
1652
+ oAction.setParameter(aActionParameters[j].$Name, aActionParameters[j].value);
1653
+ }
1654
+ }
1655
+ }
1656
+ if (aContexts.length) {
1657
+ // TODO: refactor to direct use of Promise.allSettled
1658
+ return new Promise(function (resolve: (value: any) => void) {
1659
+ const mBindingParameters = mParameters.mBindingParameters;
1660
+ const bGrouped = mParameters.bGrouped;
1661
+ const bGetBoundContext = mParameters.bGetBoundContext;
1662
+ const aActionPromises: any[] = [];
1663
+ let oActionPromise;
1664
+ let i;
1665
+ let sGroupId: string;
1666
+ const ointernalOperationsPromiseObject = createinternalOperationsPromiseForActionExecution();
1667
+ const fnExecuteAction = function (actionContext: any, current_context_index: any, oSideEffect: any, iContextLength: any) {
1668
+ setActionParameterDefaultValue();
1669
+ const individualActionPromise: any = [];
1670
+ // For invocation grouping "isolated" need batch group per action call
1671
+ sGroupId = !bGrouped ? `$auto.${current_context_index}` : actionContext.getUpdateGroupId();
1672
+ mParameters.requestSideEffects = fnRequestSideEffects.bind(operations, oAppComponent, oSideEffect, mParameters, sGroupId, individualActionPromise);
1673
+ oActionPromise = executeDependingOnSelectedContexts(
1674
+ actionContext,
1675
+ mParameters,
1676
+ bGetBoundContext,
1677
+ sGroupId,
1678
+ resourceModel,
1679
+ messageHandler,
1680
+ iContextLength,
1681
+ current_context_index,
1682
+ ointernalOperationsPromiseObject.internalOperationsPromiseResolve,
1683
+ ointernalOperationsPromiseObject.internalOperationsPromiseReject,
1684
+ strictHandlingUtilities
1685
+ );
1686
+ aActionPromises.push(oActionPromise);
1687
+ individualActionPromise.push(ointernalOperationsPromiseObject.oLocalActionPromise);
1688
+ fnRequestSideEffects(oAppComponent, oSideEffect, mParameters, sGroupId, individualActionPromise);
1689
+ return Promise.allSettled(individualActionPromise);
1690
+ };
1691
+ const fnExecuteSingleAction = function (actionContext: any, current_context_index: any, oSideEffect: any, iContextLength: any) {
1692
+ const individualActionPromise: any = [];
1693
+ setActionParameterDefaultValue();
1694
+ // For invocation grouping "isolated" need batch group per action call
1695
+ sGroupId = `apiMode${current_context_index}`;
1696
+ mParameters.requestSideEffects = fnRequestSideEffects.bind(
1697
+ operations,
1698
+ oAppComponent,
1699
+ oSideEffect,
1700
+ mParameters,
1701
+ sGroupId,
1702
+ individualActionPromise
1703
+ );
1704
+ oActionPromise = executeDependingOnSelectedContexts(
1705
+ actionContext,
1706
+ mParameters,
1707
+ bGetBoundContext,
1708
+ sGroupId,
1709
+ resourceModel,
1710
+ messageHandler,
1711
+ iContextLength,
1712
+ current_context_index,
1713
+ ointernalOperationsPromiseObject.internalOperationsPromiseResolve,
1714
+ ointernalOperationsPromiseObject.internalOperationsPromiseReject,
1715
+ strictHandlingUtilities
1716
+ );
1717
+ aActionPromises.push(oActionPromise);
1718
+ individualActionPromise.push(ointernalOperationsPromiseObject.oLocalActionPromise);
1719
+ fnRequestSideEffects(oAppComponent, oSideEffect, mParameters, sGroupId, individualActionPromise);
1720
+ oModel.submitBatch(sGroupId);
1721
+ return Promise.allSettled(individualActionPromise);
1722
+ };
1723
+
1724
+ async function fnExecuteChangeset() {
1725
+ const aChangeSetLocalPromises = [] as any;
1726
+ for (i = 0; i < aContexts.length; i++) {
1727
+ oAction = oModel.bindContext(`${sActionName}(...)`, aContexts[i], mBindingParameters);
1728
+ aChangeSetLocalPromises.push(
1729
+ fnExecuteAction(
1730
+ oAction,
1731
+ aContexts.length <= 1 ? null : i,
1732
+ {
1733
+ context: aContexts[i],
1734
+ pathExpressions: mParameters.additionalSideEffect && mParameters.additionalSideEffect.pathExpressions,
1735
+ triggerActions: mParameters.additionalSideEffect && mParameters.additionalSideEffect.triggerActions
1736
+ },
1737
+ aContexts.length
1738
+ )
1739
+ );
1740
+ }
1741
+ (
1742
+ fnOnSubmitted ||
1743
+ function noop() {
1744
+ /**/
1745
+ }
1746
+ )(aActionPromises);
1747
+
1748
+ await Promise.allSettled(aChangeSetLocalPromises);
1749
+ if (strictHandlingUtilities && strictHandlingUtilities.strictHandlingPromises.length) {
1750
+ try {
1751
+ const otherErrorMessageIndex = checkforOtherMessages(true);
1752
+ if (otherErrorMessageIndex === -1) {
1753
+ await operationsHelper.renderMessageView(
1754
+ mParameters,
1755
+ resourceModel,
1756
+ messageHandler,
1757
+ strictHandlingUtilities.strictHandlingWarningMessages,
1758
+ strictHandlingUtilities,
1759
+ aContexts.length > 1
1760
+ );
1761
+ } else {
1762
+ strictHandlingUtilities.strictHandlingPromises.forEach(function (shPromise) {
1763
+ shPromise.resolve(false);
1764
+ });
1765
+ const messageModel = Core.getMessageManager().getMessageModel();
1766
+ const messagesInModel = messageModel.getData();
1767
+ messageModel.setData(messagesInModel.concat(strictHandlingUtilities.strictHandlingWarningMessages));
1768
+ }
1769
+ } catch {
1770
+ Log.error("Retriggering of strict handling actions failed");
1771
+ }
1772
+ }
1773
+ fnHandleResults();
1774
+ }
1775
+
1776
+ async function fnExecuteSequentially(contextsToExecute: Context[]) {
1777
+ // One action and its side effects are completed before the next action is executed
1778
+ (
1779
+ fnOnSubmitted ||
1780
+ function noop() {
1781
+ /**/
1782
+ }
1783
+ )(aActionPromises);
1784
+ function processOneAction(context: any, actionIndex: any, iContextLength: any) {
1785
+ oAction = oModel.bindContext(`${sActionName}(...)`, context, mBindingParameters);
1786
+ return fnExecuteSingleAction(
1787
+ oAction,
1788
+ actionIndex,
1789
+ {
1790
+ context: context,
1791
+ pathExpressions: mParameters.additionalSideEffect && mParameters.additionalSideEffect.pathExpressions,
1792
+ triggerActions: mParameters.additionalSideEffect && mParameters.additionalSideEffect.triggerActions
1793
+ },
1794
+ iContextLength
1795
+ );
1796
+ }
1797
+
1798
+ // serialization: processOneAction to be called for each entry in contextsToExecute only after the promise returned from the one before has been resolved
1799
+ await contextsToExecute.reduce(async (promise: Promise<void>, context: Context, id: number): Promise<void> => {
1800
+ await promise;
1801
+ await processOneAction(context, id + 1, aContexts.length);
1802
+ }, Promise.resolve());
1803
+
1804
+ if (strictHandlingUtilities && strictHandlingUtilities.strictHandlingPromises.length) {
1805
+ await operationsHelper.renderMessageView(
1806
+ mParameters,
1807
+ resourceModel,
1808
+ messageHandler,
1809
+ strictHandlingUtilities.strictHandlingWarningMessages,
1810
+ strictHandlingUtilities,
1811
+ aContexts.length > 1
1812
+ );
1813
+ }
1814
+ fnHandleResults();
1815
+ }
1816
+
1817
+ if (!bGrouped) {
1818
+ // For invocation grouping "isolated", ensure that each action and matching side effects
1819
+ // are processed before the next set is submitted. Workaround until JSON batch is available.
1820
+ // Allow also for List Report.
1821
+ fnExecuteSequentially(aContexts);
1822
+ } else {
1823
+ fnExecuteChangeset();
1824
+ }
1825
+
1826
+ function fnHandleResults() {
1827
+ // Promise.allSettled will never be rejected. However, eslint requires either catch or return - thus we return the resulting Promise although no one will use it.
1828
+ return Promise.allSettled(aActionPromises).then(resolve);
1829
+ }
1830
+ }).finally(function () {
1831
+ (
1832
+ fnOnResponse ||
1833
+ function noop() {
1834
+ /**/
1835
+ }
1836
+ )();
1837
+ });
1838
+ } else {
1839
+ oAction = oModel.bindContext(`/${sActionName}(...)`);
1840
+ setActionParameterDefaultValue();
1841
+ const sGroupId = "actionImport";
1842
+ const oActionPromise = oAction.execute(
1843
+ sGroupId,
1844
+ undefined,
1845
+ (operationsHelper as any).fnOnStrictHandlingFailed.bind(
1846
+ operations,
1847
+ sGroupId,
1848
+ { label: mParameters.label, model: oModel },
1849
+ resourceModel,
1850
+ null,
1851
+ null,
1852
+ null,
1853
+ messageHandler,
1854
+ strictHandlingUtilities
1855
+ )
1856
+ );
1857
+ oModel.submitBatch(sGroupId);
1858
+ // trigger onSubmitted "event"
1859
+ (
1860
+ fnOnSubmitted ||
1861
+ function noop() {
1862
+ /**/
1863
+ }
1864
+ )(oActionPromise);
1865
+ return oActionPromise
1866
+ .then(function (currentPromiseValue: unknown) {
1867
+ // Here we ensure that we return the response we got from an unbound action to the
1868
+ // caller BCP : 2270139279
1869
+ if (currentPromiseValue) {
1870
+ return currentPromiseValue;
1871
+ } else {
1872
+ return oAction.getBoundContext?.()?.getObject();
1873
+ }
1874
+ })
1875
+ .catch(function (oError: any) {
1876
+ Log.error("Error while executing action " + sActionName, oError);
1877
+ throw oError;
1878
+ })
1879
+ .finally(function () {
1880
+ (
1881
+ fnOnResponse ||
1882
+ function noop() {
1883
+ /**/
1884
+ }
1885
+ )();
1886
+ });
1887
+ }
1888
+ }
1889
+ function _getPath(oActionContext: any, sActionName: any) {
1890
+ let sPath = oActionContext.getPath();
1891
+ sPath = oActionContext.getObject("$IsBound") ? sPath.split("@$ui5.overload")[0] : sPath.split("/0")[0];
1892
+ return sPath.split(`/${sActionName}`)[0];
1893
+ }
1894
+
1895
+ function _valuesProvidedForAllParameters(
1896
+ isCreateAction: boolean,
1897
+ actionParameters: Record<string, any>[],
1898
+ parameterValues?: Record<string, any>[],
1899
+ startupParameters?: any
1900
+ ): boolean {
1901
+ if (parameterValues) {
1902
+ // If showDialog is false but there are parameters from the invokeAction call, we need to check that values have been
1903
+ // provided for all of them
1904
+ for (const actionParameter of actionParameters) {
1905
+ if (
1906
+ actionParameter.$Name !== "ResultIsActiveEntity" &&
1907
+ !parameterValues?.find((element: any) => element.name === actionParameter.$Name)
1908
+ ) {
1909
+ // At least for one parameter no value has been provided, so we can't skip the dialog
1910
+ return false;
1911
+ }
1912
+ }
1913
+ } else if (isCreateAction && startupParameters) {
1914
+ // If parameters have been provided during application launch, we need to check if the set is complete
1915
+ // If not, the parameter dialog still needs to be shown.
1916
+ for (const actionParameter of actionParameters) {
1917
+ if (!startupParameters[actionParameter.$Name]) {
1918
+ // At least for one parameter no value has been provided, so we can't skip the dialog
1919
+ return false;
1920
+ }
1921
+ }
1922
+ }
1923
+ return true;
1924
+ }
1925
+
1926
+ function fnRequestSideEffects(oAppComponent: any, oSideEffect: any, mParameters: any, sGroupId: any, aLocalPromise?: any) {
1927
+ const oSideEffectsService = oAppComponent.getSideEffectsService();
1928
+ let oLocalPromise;
1929
+ // trigger actions from side effects
1930
+ if (oSideEffect && oSideEffect.triggerActions && oSideEffect.triggerActions.length) {
1931
+ oSideEffect.triggerActions.forEach(function (sTriggerAction: any) {
1932
+ if (sTriggerAction) {
1933
+ oLocalPromise = oSideEffectsService.executeAction(sTriggerAction, oSideEffect.context, sGroupId);
1934
+ if (aLocalPromise) {
1935
+ aLocalPromise.push(oLocalPromise);
1936
+ }
1937
+ }
1938
+ });
1939
+ }
1940
+ // request side effects for this action
1941
+ // as we move the messages request to POST $select we need to be prepared for an empty array
1942
+ if (oSideEffect && oSideEffect.pathExpressions && oSideEffect.pathExpressions.length > 0) {
1943
+ oLocalPromise = oSideEffectsService.requestSideEffects(oSideEffect.pathExpressions, oSideEffect.context, sGroupId);
1944
+ if (aLocalPromise) {
1945
+ aLocalPromise.push(oLocalPromise);
1946
+ }
1947
+ oLocalPromise
1948
+ .then(function () {
1949
+ if (mParameters.operationAvailableMap && mParameters.internalModelContext) {
1950
+ ActionRuntime.setActionEnablement(
1951
+ mParameters.internalModelContext,
1952
+ JSON.parse(mParameters.operationAvailableMap),
1953
+ mParameters.selectedItems,
1954
+ "table"
1955
+ );
1956
+ }
1957
+ })
1958
+ .catch(function (oError: any) {
1959
+ Log.error("Error while requesting side effects", oError);
1960
+ });
1961
+ }
1962
+ }
1963
+
1964
+ /**
1965
+ * Static functions to call OData actions (bound/import) and functions (bound/import)
1966
+ *
1967
+ * @namespace
1968
+ * @alias sap.fe.core.actions.operations
1969
+ * @private
1970
+ * @experimental This module is only for experimental use! <br/><b>This is only a POC and maybe deleted</b>
1971
+ * @since 1.56.0
1972
+ */
1973
+ const operations = {
1974
+ callBoundAction: callBoundAction,
1975
+ callActionImport: callActionImport,
1976
+ callBoundFunction: callBoundFunction,
1977
+ callFunctionImport: callFunctionImport,
1978
+ executeDependingOnSelectedContexts: executeDependingOnSelectedContexts,
1979
+ valuesProvidedForAllParameters: _valuesProvidedForAllParameters,
1980
+ getActionParameterActionName: _getActionParameterActionName,
1981
+ actionParameterShowMessageCallback: actionParameterShowMessageCallback,
1982
+ afterActionResolution: afterActionResolution
1983
+ };
1984
+
1985
+ export default operations;