@sapui5/sap.fe.core 1.97.0 → 1.100.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 (306) hide show
  1. package/package.json +7 -4
  2. package/src/sap/fe/core/.library +1 -1
  3. package/src/sap/fe/core/AnnotationHelper.js +309 -405
  4. package/src/sap/fe/core/AnnotationHelper.ts +315 -0
  5. package/src/sap/fe/core/AppComponent.js +389 -397
  6. package/src/sap/fe/core/AppComponent.ts +403 -0
  7. package/src/sap/fe/core/AppStateHandler.js +198 -181
  8. package/src/sap/fe/core/AppStateHandler.ts +171 -0
  9. package/src/sap/fe/core/BaseController.js +83 -58
  10. package/src/sap/fe/core/BaseController.ts +68 -0
  11. package/src/sap/fe/core/BusyLocker.js +105 -121
  12. package/src/sap/fe/core/BusyLocker.ts +98 -0
  13. package/src/sap/fe/core/CommonUtils.js +2164 -2379
  14. package/src/sap/fe/core/CommonUtils.ts +2177 -0
  15. package/src/sap/fe/core/ExtensionAPI.js +279 -266
  16. package/src/sap/fe/core/ExtensionAPI.ts +250 -0
  17. package/src/sap/fe/core/PageController.js +218 -125
  18. package/src/sap/fe/core/PageController.ts +129 -0
  19. package/src/sap/fe/core/RouterProxy.js +924 -807
  20. package/src/sap/fe/core/RouterProxy.ts +840 -0
  21. package/src/sap/fe/core/Synchronization.js +41 -35
  22. package/src/sap/fe/core/Synchronization.ts +29 -0
  23. package/src/sap/fe/core/TemplateComponent.js +173 -155
  24. package/src/sap/fe/core/TemplateComponent.ts +173 -0
  25. package/src/sap/fe/core/TemplateModel.js +79 -54
  26. package/src/sap/fe/core/TemplateModel.ts +63 -0
  27. package/src/sap/fe/core/TransactionHelper.js +1560 -1579
  28. package/src/sap/fe/core/TransactionHelper.ts +1717 -0
  29. package/src/sap/fe/core/actions/collaboration/ActivitySync.js +392 -0
  30. package/src/sap/fe/core/actions/collaboration/ActivitySync.ts +355 -0
  31. package/src/sap/fe/core/actions/collaboration/CollaborationCommon.js +136 -0
  32. package/src/sap/fe/core/actions/collaboration/CollaborationCommon.ts +119 -0
  33. package/src/sap/fe/core/actions/collaboration/Manage.js +262 -0
  34. package/src/sap/fe/core/actions/collaboration/Manage.ts +244 -0
  35. package/src/sap/fe/core/actions/collaboration/ManageDialog.fragment.xml +103 -0
  36. package/src/sap/fe/core/actions/collaboration/UserDetails.fragment.xml +13 -0
  37. package/src/sap/fe/core/actions/draft.js +521 -581
  38. package/src/sap/fe/core/actions/draft.ts +566 -0
  39. package/src/sap/fe/core/actions/messageHandling.js +564 -511
  40. package/src/sap/fe/core/actions/messageHandling.ts +552 -0
  41. package/src/sap/fe/core/actions/nonDraft.js +17 -19
  42. package/src/sap/fe/core/actions/nonDraft.ts +12 -0
  43. package/src/sap/fe/core/actions/operations.js +1093 -1211
  44. package/src/sap/fe/core/actions/operations.ts +1192 -0
  45. package/src/sap/fe/core/actions/sticky.js +114 -104
  46. package/src/sap/fe/core/actions/sticky.ts +119 -0
  47. package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.js +70 -66
  48. package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.ts +65 -0
  49. package/src/sap/fe/core/controllerextensions/EditFlow.js +1594 -1701
  50. package/src/sap/fe/core/controllerextensions/EditFlow.ts +1672 -0
  51. package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +80 -54
  52. package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.ts +61 -0
  53. package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +719 -505
  54. package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +783 -0
  55. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +797 -813
  56. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +803 -0
  57. package/src/sap/fe/core/controllerextensions/InternalRouting.js +1005 -973
  58. package/src/sap/fe/core/controllerextensions/InternalRouting.ts +978 -0
  59. package/src/sap/fe/core/controllerextensions/KPIManagement.js +530 -476
  60. package/src/sap/fe/core/controllerextensions/KPIManagement.ts +137 -46
  61. package/src/sap/fe/core/controllerextensions/MassEdit.js +144 -0
  62. package/src/sap/fe/core/controllerextensions/MassEdit.ts +156 -0
  63. package/src/sap/fe/core/controllerextensions/MessageHandler.js +234 -232
  64. package/src/sap/fe/core/controllerextensions/MessageHandler.ts +225 -0
  65. package/src/sap/fe/core/controllerextensions/PageReady.js +302 -337
  66. package/src/sap/fe/core/controllerextensions/PageReady.ts +23 -17
  67. package/src/sap/fe/core/controllerextensions/Paginator.js +189 -148
  68. package/src/sap/fe/core/controllerextensions/Paginator.ts +163 -0
  69. package/src/sap/fe/core/controllerextensions/Placeholder.js +158 -146
  70. package/src/sap/fe/core/controllerextensions/Placeholder.ts +151 -0
  71. package/src/sap/fe/core/controllerextensions/Routing.js +145 -106
  72. package/src/sap/fe/core/controllerextensions/Routing.ts +132 -0
  73. package/src/sap/fe/core/controllerextensions/RoutingListener.js +8 -6
  74. package/src/sap/fe/core/controllerextensions/RoutingListener.ts +3 -0
  75. package/src/sap/fe/core/controllerextensions/Share.js +220 -244
  76. package/src/sap/fe/core/controllerextensions/Share.ts +231 -0
  77. package/src/sap/fe/core/controllerextensions/SideEffects.js +593 -634
  78. package/src/sap/fe/core/controllerextensions/SideEffects.ts +29 -27
  79. package/src/sap/fe/core/controllerextensions/ViewState.js +789 -806
  80. package/src/sap/fe/core/controllerextensions/ViewState.ts +805 -0
  81. package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +4 -3
  82. package/src/sap/fe/core/controls/ActionPartial.fragment.xml +2 -2
  83. package/src/sap/fe/core/controls/CommandExecution.js +68 -66
  84. package/src/sap/fe/core/controls/CommandExecution.ts +72 -0
  85. package/src/sap/fe/core/controls/ConditionalWrapper.js +91 -75
  86. package/src/sap/fe/core/controls/ConditionalWrapper.ts +83 -0
  87. package/src/sap/fe/core/controls/CustomQuickViewPage.js +131 -125
  88. package/src/sap/fe/core/controls/CustomQuickViewPage.ts +126 -0
  89. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +105 -110
  90. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +101 -0
  91. package/src/sap/fe/core/controls/FieldWrapper.js +122 -140
  92. package/src/sap/fe/core/controls/FieldWrapper.ts +115 -0
  93. package/src/sap/fe/core/controls/FilterBar.js +163 -159
  94. package/src/sap/fe/core/controls/FilterBar.ts +143 -0
  95. package/src/sap/fe/core/controls/FormElementWrapper.js +46 -44
  96. package/src/sap/fe/core/controls/FormElementWrapper.ts +40 -0
  97. package/src/sap/fe/core/controls/MultiValueParameterDelegate.js +38 -42
  98. package/src/sap/fe/core/controls/MultiValueParameterDelegate.ts +31 -0
  99. package/src/sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog.fragment.xml +2 -1
  100. package/src/sap/fe/core/controls/filterbar/FilterContainer.js +127 -116
  101. package/src/sap/fe/core/controls/filterbar/FilterContainer.ts +98 -0
  102. package/src/sap/fe/core/controls/filterbar/VisualFilter.js +242 -255
  103. package/src/sap/fe/core/controls/filterbar/VisualFilter.ts +245 -0
  104. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +151 -141
  105. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.ts +125 -0
  106. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +336 -322
  107. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +337 -0
  108. package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +106 -0
  109. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +79 -0
  110. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +70 -0
  111. package/src/sap/fe/core/converters/ConverterContext.js +348 -367
  112. package/src/sap/fe/core/converters/ConverterContext.ts +33 -19
  113. package/src/sap/fe/core/converters/ManifestSettings.js +12 -1
  114. package/src/sap/fe/core/converters/ManifestSettings.ts +16 -1
  115. package/src/sap/fe/core/converters/ManifestWrapper.js +354 -354
  116. package/src/sap/fe/core/converters/ManifestWrapper.ts +34 -6
  117. package/src/sap/fe/core/converters/MetaModelConverter.js +72 -9
  118. package/src/sap/fe/core/converters/MetaModelConverter.ts +75 -16
  119. package/src/sap/fe/core/converters/TemplateConverter.js +1 -1
  120. package/src/sap/fe/core/converters/TemplateConverter.ts +4 -3
  121. package/src/sap/fe/core/converters/annotations/DataField.js +28 -14
  122. package/src/sap/fe/core/converters/annotations/DataField.ts +38 -14
  123. package/src/sap/fe/core/converters/common/AnnotationConverter.js +33 -21
  124. package/src/sap/fe/core/converters/controls/Common/Action.js +11 -2
  125. package/src/sap/fe/core/converters/controls/Common/Action.ts +8 -2
  126. package/src/sap/fe/core/converters/controls/Common/Chart.js +5 -3
  127. package/src/sap/fe/core/converters/controls/Common/Chart.ts +11 -3
  128. package/src/sap/fe/core/converters/controls/Common/DataVisualization.js +3 -3
  129. package/src/sap/fe/core/converters/controls/Common/DataVisualization.ts +2 -2
  130. package/src/sap/fe/core/converters/controls/Common/Form.js +21 -11
  131. package/src/sap/fe/core/converters/controls/Common/Form.ts +28 -6
  132. package/src/sap/fe/core/converters/controls/Common/KPI.js +69 -4
  133. package/src/sap/fe/core/converters/controls/Common/KPI.ts +75 -2
  134. package/src/sap/fe/core/converters/controls/Common/Table.js +507 -408
  135. package/src/sap/fe/core/converters/controls/Common/Table.ts +618 -500
  136. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +592 -0
  137. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +718 -0
  138. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +465 -59
  139. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +462 -72
  140. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +2 -2
  141. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +1 -1
  142. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +17 -9
  143. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +24 -9
  144. package/src/sap/fe/core/converters/helpers/Aggregation.js +118 -121
  145. package/src/sap/fe/core/converters/helpers/Aggregation.ts +28 -5
  146. package/src/sap/fe/core/converters/helpers/BindingHelper.js +20 -6
  147. package/src/sap/fe/core/converters/helpers/BindingHelper.ts +16 -4
  148. package/src/sap/fe/core/converters/helpers/ConfigurableObject.js +12 -1
  149. package/src/sap/fe/core/converters/helpers/ConfigurableObject.ts +11 -0
  150. package/src/sap/fe/core/converters/helpers/IssueManager.js +7 -1
  151. package/src/sap/fe/core/converters/helpers/IssueManager.ts +6 -0
  152. package/src/sap/fe/core/converters/helpers/Key.js +42 -57
  153. package/src/sap/fe/core/converters/helpers/Key.ts +1 -1
  154. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +28 -7
  155. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +23 -6
  156. package/src/sap/fe/core/converters/templates/ListReportConverter.js +20 -7
  157. package/src/sap/fe/core/converters/templates/ListReportConverter.ts +36 -14
  158. package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +7 -5
  159. package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +5 -1
  160. package/src/sap/fe/core/designtime/AppComponent.designtime.js +93 -90
  161. package/src/sap/fe/core/designtime/AppComponent.designtime.ts +91 -0
  162. package/src/sap/fe/core/formatters/CollaborationFormatter.js +104 -0
  163. package/src/sap/fe/core/formatters/CollaborationFormatter.ts +60 -0
  164. package/src/sap/fe/core/formatters/CriticalityFormatter.js +1 -1
  165. package/src/sap/fe/core/formatters/CriticalityFormatter.ts +1 -1
  166. package/src/sap/fe/core/formatters/FPMFormatter.js +1 -1
  167. package/src/sap/fe/core/formatters/FPMFormatter.ts +4 -10
  168. package/src/sap/fe/core/formatters/KPIFormatter.js +1 -1
  169. package/src/sap/fe/core/formatters/KPIFormatter.ts +3 -1
  170. package/src/sap/fe/core/formatters/TableFormatter.js +91 -29
  171. package/src/sap/fe/core/formatters/TableFormatter.ts +94 -28
  172. package/src/sap/fe/core/formatters/ValueFormatter.js +30 -5
  173. package/src/sap/fe/core/formatters/ValueFormatter.ts +30 -7
  174. package/src/sap/fe/core/fpm/Component.js +51 -54
  175. package/src/sap/fe/core/fpm/Component.ts +48 -0
  176. package/src/sap/fe/core/helpers/AppStartupHelper.js +373 -0
  177. package/src/sap/fe/core/helpers/AppStartupHelper.ts +417 -0
  178. package/src/sap/fe/core/helpers/BindingExpression.js +489 -442
  179. package/src/sap/fe/core/helpers/BindingExpression.ts +486 -469
  180. package/src/sap/fe/core/helpers/ClassSupport.js +212 -76
  181. package/src/sap/fe/core/helpers/ClassSupport.ts +198 -71
  182. package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +64 -59
  183. package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.ts +52 -0
  184. package/src/sap/fe/core/helpers/EditState.js +81 -84
  185. package/src/sap/fe/core/helpers/EditState.ts +81 -0
  186. package/src/sap/fe/core/helpers/ExcelFormatHelper.js +62 -48
  187. package/src/sap/fe/core/helpers/ExcelFormatHelper.ts +49 -0
  188. package/src/sap/fe/core/helpers/FPMHelper.js +52 -56
  189. package/src/sap/fe/core/helpers/FPMHelper.ts +62 -0
  190. package/src/sap/fe/core/helpers/KeepAliveHelper.js +4 -5
  191. package/src/sap/fe/core/helpers/KeepAliveHelper.ts +10 -10
  192. package/src/sap/fe/core/helpers/MassEditHelper.js +604 -0
  193. package/src/sap/fe/core/helpers/MassEditHelper.ts +699 -0
  194. package/src/sap/fe/core/helpers/ModelHelper.js +253 -225
  195. package/src/sap/fe/core/helpers/ModelHelper.ts +250 -0
  196. package/src/sap/fe/core/helpers/PasteHelper.js +210 -132
  197. package/src/sap/fe/core/helpers/PasteHelper.ts +196 -0
  198. package/src/sap/fe/core/helpers/SemanticDateOperators.js +336 -313
  199. package/src/sap/fe/core/helpers/SemanticDateOperators.ts +334 -0
  200. package/src/sap/fe/core/helpers/SemanticKeyHelper.js +66 -67
  201. package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +73 -0
  202. package/src/sap/fe/core/helpers/StableIdHelper.js +4 -7
  203. package/src/sap/fe/core/helpers/StableIdHelper.ts +2 -6
  204. package/src/sap/fe/core/jsx-runtime/jsx.js +1 -1
  205. package/src/sap/fe/core/jsx-runtime/jsx.ts +1 -1
  206. package/src/sap/fe/core/library.js +427 -425
  207. package/src/sap/fe/core/library.support.js +23 -27
  208. package/src/sap/fe/core/library.support.ts +23 -0
  209. package/src/sap/fe/core/library.ts +420 -0
  210. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +64 -0
  211. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +69 -0
  212. package/src/sap/fe/core/messagebundle.properties +78 -13
  213. package/src/sap/fe/core/messagebundle_ar.properties +58 -7
  214. package/src/sap/fe/core/messagebundle_bg.properties +58 -7
  215. package/src/sap/fe/core/messagebundle_ca.properties +58 -7
  216. package/src/sap/fe/core/messagebundle_cs.properties +59 -8
  217. package/src/sap/fe/core/messagebundle_cy.properties +58 -7
  218. package/src/sap/fe/core/messagebundle_da.properties +58 -7
  219. package/src/sap/fe/core/messagebundle_de.properties +58 -7
  220. package/src/sap/fe/core/messagebundle_el.properties +58 -7
  221. package/src/sap/fe/core/messagebundle_en.properties +57 -6
  222. package/src/sap/fe/core/messagebundle_en_GB.properties +57 -6
  223. package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +61 -6
  224. package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +58 -7
  225. package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +58 -7
  226. package/src/sap/fe/core/messagebundle_es.properties +58 -7
  227. package/src/sap/fe/core/messagebundle_es_MX.properties +58 -7
  228. package/src/sap/fe/core/messagebundle_et.properties +58 -7
  229. package/src/sap/fe/core/messagebundle_fi.properties +60 -9
  230. package/src/sap/fe/core/messagebundle_fr.properties +64 -13
  231. package/src/sap/fe/core/messagebundle_fr_CA.properties +59 -8
  232. package/src/sap/fe/core/messagebundle_hi.properties +58 -7
  233. package/src/sap/fe/core/messagebundle_hr.properties +58 -7
  234. package/src/sap/fe/core/messagebundle_hu.properties +59 -8
  235. package/src/sap/fe/core/messagebundle_id.properties +61 -10
  236. package/src/sap/fe/core/messagebundle_it.properties +58 -7
  237. package/src/sap/fe/core/messagebundle_iw.properties +58 -7
  238. package/src/sap/fe/core/messagebundle_ja.properties +58 -7
  239. package/src/sap/fe/core/messagebundle_kk.properties +58 -7
  240. package/src/sap/fe/core/messagebundle_ko.properties +58 -7
  241. package/src/sap/fe/core/messagebundle_lt.properties +58 -7
  242. package/src/sap/fe/core/messagebundle_lv.properties +59 -8
  243. package/src/sap/fe/core/messagebundle_ms.properties +58 -7
  244. package/src/sap/fe/core/messagebundle_nl.properties +58 -7
  245. package/src/sap/fe/core/messagebundle_no.properties +58 -7
  246. package/src/sap/fe/core/messagebundle_pl.properties +58 -7
  247. package/src/sap/fe/core/messagebundle_pt.properties +59 -8
  248. package/src/sap/fe/core/messagebundle_pt_PT.properties +58 -7
  249. package/src/sap/fe/core/messagebundle_ro.properties +58 -7
  250. package/src/sap/fe/core/messagebundle_ru.properties +58 -7
  251. package/src/sap/fe/core/messagebundle_sh.properties +58 -7
  252. package/src/sap/fe/core/messagebundle_sk.properties +58 -7
  253. package/src/sap/fe/core/messagebundle_sl.properties +58 -7
  254. package/src/sap/fe/core/messagebundle_sv.properties +59 -8
  255. package/src/sap/fe/core/messagebundle_th.properties +58 -7
  256. package/src/sap/fe/core/messagebundle_tr.properties +60 -9
  257. package/src/sap/fe/core/messagebundle_uk.properties +58 -7
  258. package/src/sap/fe/core/messagebundle_vi.properties +58 -7
  259. package/src/sap/fe/core/messagebundle_zh_CN.properties +58 -7
  260. package/src/sap/fe/core/messagebundle_zh_TW.properties +58 -7
  261. package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +45 -71
  262. package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +3 -1
  263. package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +231 -202
  264. package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +212 -0
  265. package/src/sap/fe/core/services/EnvironmentServiceFactory.js +67 -92
  266. package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +10 -6
  267. package/src/sap/fe/core/services/NavigationServiceFactory.js +351 -300
  268. package/src/sap/fe/core/services/NavigationServiceFactory.ts +313 -0
  269. package/src/sap/fe/core/services/ResourceModelServiceFactory.js +114 -81
  270. package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +83 -0
  271. package/src/sap/fe/core/services/RoutingServiceFactory.js +927 -1152
  272. package/src/sap/fe/core/services/RoutingServiceFactory.ts +898 -0
  273. package/src/sap/fe/core/services/ShellServicesFactory.js +649 -707
  274. package/src/sap/fe/core/services/ShellServicesFactory.ts +52 -15
  275. package/src/sap/fe/core/services/SideEffectsServiceFactory.js +569 -637
  276. package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +78 -102
  277. package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +429 -478
  278. package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +460 -0
  279. package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +10 -8
  280. package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.ts +8 -0
  281. package/src/sap/fe/core/support/AnnotationIssue.support.js +15 -3
  282. package/src/sap/fe/core/support/AnnotationIssue.support.ts +16 -2
  283. package/src/sap/fe/core/support/CollectionFacetUnsupportedLevel.support.js +2 -2
  284. package/src/sap/fe/core/support/CollectionFacetUnsupportedLevel.support.ts +1 -1
  285. package/src/sap/fe/core/support/CommonHelper.js +1 -1
  286. package/src/sap/fe/core/support/CommonHelper.ts +1 -1
  287. package/src/sap/fe/core/support/Diagnostics.js +36 -48
  288. package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.js +38 -0
  289. package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.ts +18 -0
  290. package/src/sap/fe/core/templating/DataModelPathHelper.js +97 -127
  291. package/src/sap/fe/core/templating/DataModelPathHelper.ts +112 -135
  292. package/src/sap/fe/core/templating/DisplayModeFormatter.js +114 -0
  293. package/src/sap/fe/core/templating/DisplayModeFormatter.ts +86 -0
  294. package/src/sap/fe/core/templating/FieldControlHelper.js +8 -8
  295. package/src/sap/fe/core/templating/FieldControlHelper.ts +25 -7
  296. package/src/sap/fe/core/templating/FilterHelper.js +140 -78
  297. package/src/sap/fe/core/templating/FilterHelper.ts +149 -78
  298. package/src/sap/fe/core/templating/PropertyHelper.js +3 -3
  299. package/src/sap/fe/core/templating/PropertyHelper.ts +2 -2
  300. package/src/sap/fe/core/templating/UIFormatters.js +76 -135
  301. package/src/sap/fe/core/templating/UIFormatters.ts +76 -99
  302. package/src/sap/fe/core/type/Email.js +1 -1
  303. package/src/sap/fe/core/type/Email.ts +4 -6
  304. package/ui5.yaml +0 -3
  305. package/src/sap/fe/core/controls/filterbar.d.js +0 -8
  306. package/src/sap/fe/core/controls/filterbar.d.ts +0 -0
@@ -0,0 +1,1192 @@
1
+ import MessageBox from "sap/m/MessageBox";
2
+ import Dialog from "sap/m/Dialog";
3
+ import JSONModel from "sap/ui/model/json/JSONModel";
4
+ import XMLTemplateProcessor from "sap/ui/core/XMLTemplateProcessor";
5
+ import XMLPreprocessor from "sap/ui/core/util/XMLPreprocessor";
6
+ import Fragment from "sap/ui/core/Fragment";
7
+ import messageHandling from "sap/fe/core/actions/messageHandling";
8
+ import BusyLocker from "sap/fe/core/BusyLocker";
9
+ import CommonUtils from "sap/fe/core/CommonUtils";
10
+ import Log from "sap/base/Log";
11
+ import FELibrary from "sap/fe/core/library";
12
+ import FPMHelper from "sap/fe/core/helpers/FPMHelper";
13
+ import Button from "sap/m/Button";
14
+ import { generate } from "sap/fe/core/helpers/StableIdHelper";
15
+
16
+ const Constants = FELibrary.Constants,
17
+ InvocationGrouping = FELibrary.InvocationGrouping;
18
+ const Action = (MessageBox as any).Action;
19
+
20
+ /**
21
+ * Calls a bound action for one or multiple contexts.
22
+ *
23
+ * @function
24
+ * @static
25
+ * @name sap.fe.core.actions.operations.callBoundAction
26
+ * @memberof sap.fe.core.actions.operations
27
+ * @param {string} sActionName The name of the action to be called
28
+ * @param {sap.ui.model.odata.v4.Context} contexts Either one context or an array with contexts for which the action is to be be called
29
+ * @param {sap.ui.model.odata.v4.Model} oModel OData Model
30
+ * @param {object} oAppComponent The AppComponent
31
+ * @param {map} [mParameters] Optional, can contain the following attributes:
32
+ * @param {map} [mParameters.actionParameters] A map of parameters to be sent for every action call
33
+ * @param {map} [mParameters.mBindingParameters] A map of binding parameters that would be part of $select and $expand coming from side effects for bound actions
34
+ * @param {Array} [mParameters.additionalSideEffect] Array of property paths to be requested in addition to actual target properties of the side effect
35
+ * @param {boolean} [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
36
+ * @param {string} [mParameters.label] A human-readable label for the action
37
+ * @param {string} [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
38
+ * @param {Function} [mParameters.onSubmitted] Function which is called once the actions are submitted with an array of promises
39
+ * @param {map} [mParameters.defaultParameters] Can contain default parameters from FLP user defaults
40
+ * @param {sap.ui.core.Element} [mParameters.parentControl] If specified the dialogs are added as dependent of the parent control
41
+ * @param {boolean} [mParameters.bGetBoundContext] If specified the action promise returns the bound context
42
+ * @returns {Promise} Promise resolves with an array of response objects (TODO: to be changed)
43
+ * @private
44
+ * @ui5-restricted
45
+ */
46
+ function callBoundAction(sActionName: string, contexts: any, oModel: any, oAppComponent: object, mParameters: any) {
47
+ if (!contexts || contexts.length === 0) {
48
+ //In Freestyle apps bound actions can have no context
49
+ return Promise.reject("Bound actions always requires at least one context");
50
+ }
51
+ // we expect either one context or an array of contexts
52
+ if (Array.isArray(contexts)) {
53
+ mParameters.bReturnAsArray = true;
54
+ } else {
55
+ //action needs to be called on this context from the dependent binding so UI fields are updated with response data
56
+ contexts = [contexts];
57
+ }
58
+ const oMetaModel = oModel.getMetaModel(),
59
+ sActionPath = oMetaModel.getMetaPath(contexts[0].getPath()) + "/" + sActionName,
60
+ oBoundAction = oMetaModel.createBindingContext(sActionPath + "/@$ui5.overload/0");
61
+ mParameters.aContexts = contexts;
62
+ mParameters.isCriticalAction = getIsActionCritical(oMetaModel, sActionPath, contexts, oBoundAction);
63
+ return callAction(sActionName, oModel, oBoundAction, oAppComponent, mParameters);
64
+ }
65
+ /**
66
+ * Calls an action import.
67
+ *
68
+ * @function
69
+ * @static
70
+ * @name sap.fe.core.actions.operations.callActionImport
71
+ * @memberof sap.fe.core.actions.operations
72
+ * @param {string} sActionName The name of the action import to be called
73
+ * @param {sap.ui.model.odata.v4.ODataModel} oModel An instance of an OData v4 model
74
+ * @param {object} oAppComponent The AppComponent
75
+ * @param {map} [mParameters] Optional, can contain the following attributes:
76
+ * @param {map} [mParameters.actionParameters] A map of parameters to be sent with the action import
77
+ * @param {string} [mParameters.label] A human-readable label for the action
78
+ * @param {boolean} [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
79
+ * @param {Function} [mParameters.onSubmitted] Function which is called once the actions are submitted with an array of promises
80
+ * @param {map} [mParameters.defaultParameters] Can contain default parameters from FLP user defaults
81
+ * @returns {Promise} Promise resolves with an array of response objects (TODO: to be changed)
82
+ * @private
83
+ * @ui5-restricted
84
+ */
85
+ function callActionImport(sActionName: string, oModel: any, oAppComponent: object, mParameters: any) {
86
+ if (!oModel) {
87
+ return Promise.reject("Action expects a model/context for execution");
88
+ }
89
+ const oMetaModel = oModel.getMetaModel(),
90
+ sActionPath = oModel.bindContext("/" + sActionName).getPath(),
91
+ oActionImport = oMetaModel.createBindingContext("/" + oMetaModel.createBindingContext(sActionPath).getObject("$Action") + "/0");
92
+ mParameters.isCriticalAction = getIsActionCritical(oMetaModel, sActionPath + "/@$ui5.overload");
93
+ return callAction(sActionName, oModel, oActionImport, oAppComponent, mParameters);
94
+ }
95
+ function callBoundFunction(sFunctionName: string, context: any, oModel: any) {
96
+ if (!context) {
97
+ return Promise.reject("Bound functions always requires a context");
98
+ }
99
+ const oMetaModel = oModel.getMetaModel(),
100
+ sFunctionPath = oMetaModel.getMetaPath(context.getPath()) + "/" + sFunctionName,
101
+ oBoundFunction = oMetaModel.createBindingContext(sFunctionPath);
102
+ return _executeFunction(sFunctionName, oModel, oBoundFunction, context);
103
+ }
104
+ /**
105
+ * Calls a function import.
106
+ *
107
+ * @function
108
+ * @static
109
+ * @name sap.fe.core.actions.operations.callFunctionImport
110
+ * @memberof sap.fe.core.actions.operations
111
+ * @param {string} sFunctionName The name of the function to be called
112
+ * @param {sap.ui.model.odata.v4.ODataModel} oModel An instance of an OData v4 model
113
+ * @returns {Promise} Promise resolves
114
+ * @private
115
+ */
116
+ function callFunctionImport(sFunctionName: string, oModel: any) {
117
+ if (!sFunctionName) {
118
+ return Promise.resolve();
119
+ }
120
+ const oMetaModel = oModel.getMetaModel(),
121
+ sFunctionPath = oModel.bindContext("/" + sFunctionName).getPath(),
122
+ oFunctionImport = oMetaModel.createBindingContext(
123
+ "/" + oMetaModel.createBindingContext(sFunctionPath).getObject("$Function") + "/0"
124
+ );
125
+ return _executeFunction(sFunctionName, oModel, oFunctionImport);
126
+ }
127
+ function _executeFunction(sFunctionName: any, oModel: any, oFunction: any, context?: any) {
128
+ let sGroupId;
129
+ if (!oFunction || !oFunction.getObject()) {
130
+ return Promise.reject(new Error("Function " + sFunctionName + " not found"));
131
+ }
132
+ if (context) {
133
+ oFunction = oModel.bindContext(sFunctionName + "(...)", context);
134
+ sGroupId = "functionGroup";
135
+ } else {
136
+ oFunction = oModel.bindContext("/" + sFunctionName + "(...)");
137
+ sGroupId = "functionImport";
138
+ }
139
+ const oFunctionPromise = oFunction.execute(sGroupId);
140
+ oModel.submitBatch(sGroupId);
141
+ return oFunctionPromise.then(function() {
142
+ return oFunction.getBoundContext();
143
+ });
144
+ }
145
+ function callAction(sActionName: any, oModel: any, oAction: any, oAppComponent: any, mParameters: any) {
146
+ return new Promise(function(resolve: (value: any) => void, reject: (reason?: any) => void) {
147
+ let aActionParameters = mParameters.actionParameters || [];
148
+ let mActionExecutionParameters: any = {};
149
+ let fnDialog;
150
+ let oActionPromise;
151
+ const sActionLabel = mParameters.label;
152
+ let bShowActionParameterDialog = mParameters.showActionParameterDialog;
153
+ const aContexts = mParameters.aContexts;
154
+ const bIsCreateAction = mParameters.bIsCreateAction;
155
+ const bIsCriticalAction = mParameters.isCriticalAction;
156
+ let oMetaModel;
157
+ let sMetaPath;
158
+ let sMessagesPath: any;
159
+ let iMessageSideEffect;
160
+ if (!oAction || !oAction.getObject()) {
161
+ return reject(new Error("Action " + sActionName + " not found"));
162
+ }
163
+ if (bShowActionParameterDialog || aActionParameters.length > 0) {
164
+ aActionParameters = prepareActionParameters(oAction, aActionParameters);
165
+ if (!aActionParameters || aActionParameters.length === 0) {
166
+ bShowActionParameterDialog = false;
167
+ }
168
+ }
169
+ if (bShowActionParameterDialog) {
170
+ fnDialog = showActionParameterDialog;
171
+ } else if (bIsCriticalAction) {
172
+ fnDialog = confirmCriticalAction;
173
+ }
174
+ mActionExecutionParameters = {
175
+ fnOnSubmitted: mParameters.onSubmitted,
176
+ fnOnResponse: mParameters.onResponse,
177
+ actionName: sActionName,
178
+ model: oModel,
179
+ aActionParameters: aActionParameters,
180
+ bGetBoundContext: mParameters.bGetBoundContext,
181
+ defaultValuesExtensionFunction: mParameters.defaultValuesExtensionFunction,
182
+ label: mParameters.label
183
+ };
184
+ if (oAction.getObject("$IsBound")) {
185
+ if (mParameters.additionalSideEffect && mParameters.additionalSideEffect.pathExpressions) {
186
+ oMetaModel = oModel.getMetaModel();
187
+ sMetaPath = oMetaModel.getMetaPath(aContexts[0].getPath());
188
+ sMessagesPath = oMetaModel.getObject(sMetaPath + "/@com.sap.vocabularies.Common.v1.Messages/$Path");
189
+
190
+ if (sMessagesPath) {
191
+ iMessageSideEffect = mParameters.additionalSideEffect.pathExpressions.findIndex(function(exp: any) {
192
+ return exp.$PropertyPath === sMessagesPath;
193
+ });
194
+
195
+ if (iMessageSideEffect > -1) {
196
+ // the message path is annotated as side effect. As there's no binding for it and the model does currently not allow
197
+ // 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
198
+ mParameters.mBindingParameters = mParameters.mBindingParameters || {};
199
+
200
+ if (
201
+ oAction.getObject("$ReturnType/$Type/" + sMessagesPath) &&
202
+ (!mParameters.mBindingParameters.$select ||
203
+ mParameters.mBindingParameters.$select.split(",").indexOf(sMessagesPath) === -1)
204
+ ) {
205
+ mParameters.mBindingParameters.$select = mParameters.mBindingParameters.$select
206
+ ? mParameters.mBindingParameters.$select + "," + sMessagesPath
207
+ : sMessagesPath;
208
+
209
+ if (mParameters.additionalSideEffect.triggerActions.length === 0) {
210
+ // no trigger action therefore no need to request messages again
211
+ mParameters.additionalSideEffect.pathExpressions.splice(iMessageSideEffect, 1);
212
+ }
213
+ }
214
+ }
215
+ }
216
+ }
217
+
218
+ mActionExecutionParameters.aContexts = aContexts;
219
+ mActionExecutionParameters.mBindingParameters = mParameters.mBindingParameters;
220
+ mActionExecutionParameters.additionalSideEffect = mParameters.additionalSideEffect;
221
+ mActionExecutionParameters.bGrouped = mParameters.invocationGrouping === InvocationGrouping.ChangeSet;
222
+ mActionExecutionParameters.bReturnAsArray = mParameters.bReturnAsArray;
223
+ mActionExecutionParameters.internalModelContext = mParameters.internalModelContext;
224
+ mActionExecutionParameters.operationAvailableMap = mParameters.operationAvailableMap;
225
+ mActionExecutionParameters.bObjectPage = mParameters.bObjectPage;
226
+ }
227
+ if (bIsCreateAction) {
228
+ mActionExecutionParameters.bIsCreateAction = bIsCreateAction;
229
+ }
230
+ if (fnDialog) {
231
+ oActionPromise = fnDialog(
232
+ sActionName,
233
+ oAppComponent,
234
+ sActionLabel,
235
+ mActionExecutionParameters,
236
+ aActionParameters,
237
+ oAction,
238
+ mParameters.parentControl,
239
+ mParameters.entitySetName,
240
+ mParameters.messageHandler
241
+ );
242
+ } else {
243
+ oActionPromise = _executeAction(oAppComponent, mActionExecutionParameters);
244
+ }
245
+ return oActionPromise
246
+ .then(function(oOperationResult: any) {
247
+ resolve(oOperationResult);
248
+ })
249
+ .catch(function(oOperationResult: any) {
250
+ reject(oOperationResult);
251
+ });
252
+ });
253
+ }
254
+ function confirmCriticalAction(
255
+ sActionName: any,
256
+ oAppComponent: any,
257
+ sActionLabel: any,
258
+ mParameters: any,
259
+ aActionParameters: any,
260
+ oActionContext: any,
261
+ oParentControl: any,
262
+ entitySetName: any,
263
+ messageHandler: any
264
+ ) {
265
+ return new Promise<void>((resolve, reject) => {
266
+ let boundActionName = sActionName ? sActionName : null;
267
+ boundActionName =
268
+ boundActionName.indexOf(".") >= 0 ? boundActionName.split(".")[boundActionName.split(".").length - 1] : boundActionName;
269
+ const suffixResourceKey = boundActionName && entitySetName ? entitySetName + "|" + boundActionName : "";
270
+ const oResourceBundle = oParentControl.getController().oResourceBundle;
271
+ const sConfirmationText = CommonUtils.getTranslatedText(
272
+ "C_OPERATIONS_ACTION_CONFIRM_MESSAGE",
273
+ oResourceBundle,
274
+ null,
275
+ suffixResourceKey
276
+ );
277
+
278
+ MessageBox.confirm(sConfirmationText, {
279
+ onClose: function(sAction: any) {
280
+ if (sAction === Action.OK) {
281
+ return _executeAction(oAppComponent, mParameters)
282
+ .then(function(oOperation: any) {
283
+ resolve(oOperation);
284
+ })
285
+ .catch(function(oError: any) {
286
+ messageHandler
287
+ .showMessageDialog()
288
+ .then(function() {
289
+ reject(oError);
290
+ })
291
+ .catch(function() {
292
+ reject(oError);
293
+ });
294
+ });
295
+ } else {
296
+ resolve();
297
+ }
298
+ }
299
+ });
300
+ });
301
+ }
302
+ function showActionParameterDialog(
303
+ sActionName: any,
304
+ oAppComponent: any,
305
+ sActionLabel: any,
306
+ mParameters: any,
307
+ aActionParameters: any,
308
+ oActionContext: any,
309
+ oParentControl: any,
310
+ entitySetName: any,
311
+ messageHandler: any
312
+ ) {
313
+ const sPath = _getPath(oActionContext, sActionName),
314
+ metaModel = oActionContext.getModel().oModel.getMetaModel(),
315
+ entitySetContext = metaModel.createBindingContext(sPath),
316
+ sActionNamePath = oActionContext.getObject("$IsBound")
317
+ ? oActionContext.getPath().split("/@$ui5.overload/0")[0]
318
+ : oActionContext.getPath().split("/0")[0],
319
+ actionNameContext = metaModel.createBindingContext(sActionNamePath),
320
+ sFragmentName = "sap/fe/core/controls/ActionParameterDialog";
321
+ return new Promise(function(resolve: (value: any) => void, reject: (reason?: any) => void) {
322
+ const oFragment = XMLTemplateProcessor.loadTemplate(sFragmentName, "fragment");
323
+ const oParameterModel = new JSONModel({
324
+ $displayMode: {}
325
+ });
326
+ let aFieldInvalid: any[] = [];
327
+ let aFormElements: any[] = [];
328
+ const mFieldValueMap: any = {};
329
+ const validateRequiredProperties = function() {
330
+ return Promise.all(
331
+ aFormElements
332
+ .filter(function(oFormElement: any) {
333
+ const oField = oFormElement.getFields()[0];
334
+ return oField.getRequired() && oField.getValueState() !== "Error";
335
+ })
336
+ .map(function(oFormElement: any) {
337
+ const value = oFormElement.getFields()[0].isA("sap.ui.mdc.MultiValueField")
338
+ ? oFormElement.getFields()[0].getItems()
339
+ : oFormElement.getFields()[0].getValue();
340
+ if (value === undefined || value === null || value === "") {
341
+ return oFormElement.getLabel().getText();
342
+ }
343
+ })
344
+ ).then(function(aResults: any[]) {
345
+ aResults = aResults.filter(function(result: any) {
346
+ return result !== undefined;
347
+ });
348
+ return aResults;
349
+ });
350
+ };
351
+ const _validateMessages = function(aActionParameters: any, aFieldInvalid: any, bClearTarget?: boolean) {
352
+ const oMessageManager = sap.ui.getCore().getMessageManager();
353
+ const aMessages = oMessageManager.getMessageModel().getData();
354
+
355
+ aFieldInvalid = aFieldInvalid || [];
356
+
357
+ if (!aMessages.length) {
358
+ aFieldInvalid = [];
359
+ }
360
+ aActionParameters.forEach(function(oActionParameters: any) {
361
+ const sParameter = oActionParameters.$Name;
362
+ aMessages.forEach(function(oMessage: any) {
363
+ const sParam = sParameter.replace("-inner", "");
364
+ if (
365
+ oMessage.controlIds.length > 0 &&
366
+ (oMessage.getControlId().includes("APD_::" + sParameter) ||
367
+ (oMessage.getControlId().includes("APD_::" + sParameter + "inner") &&
368
+ aFieldInvalid.indexOf("APD_::" + sParam) < 0))
369
+ ) {
370
+ if (bClearTarget) {
371
+ oMessageManager.removeMessages(oMessage);
372
+ } else {
373
+ aFieldInvalid.push("APD_::" + sParam);
374
+ }
375
+ }
376
+ // Handle messages related to input with invalid token
377
+ if (oMessage.target.includes("APD_::" + sParameter)) {
378
+ aFieldInvalid.push("APD_::" + sParam);
379
+ oMessage.target = bClearTarget ? "" : oMessage.target;
380
+ if (bClearTarget) {
381
+ oMessageManager.removeMessages(oMessage);
382
+ }
383
+ }
384
+ });
385
+ });
386
+ return aFieldInvalid;
387
+ };
388
+ const oController = {
389
+ handleChange: function(oEvent: any) {
390
+ messageHandler.removeTransitionMessages();
391
+ const oField = oEvent.getSource();
392
+ const sFieldId = oEvent.getParameter("id");
393
+ const oFieldPromise = oEvent.getParameter("promise");
394
+ if (oFieldPromise) {
395
+ mFieldValueMap[sFieldId] = oFieldPromise.then(function() {
396
+ return oField.getValue();
397
+ });
398
+ }
399
+ _validateMessages(aActionParameters, aFieldInvalid);
400
+ }
401
+ };
402
+
403
+ return Promise.resolve(
404
+ XMLPreprocessor.process(
405
+ oFragment,
406
+ { name: sFragmentName },
407
+ {
408
+ bindingContexts: {
409
+ action: oActionContext,
410
+ actionName: actionNameContext,
411
+ entitySet: entitySetContext
412
+ },
413
+ models: {
414
+ action: oActionContext.getModel(),
415
+ actionName: actionNameContext.getModel(),
416
+ entitySet: entitySetContext.getModel(),
417
+ metaModel: entitySetContext.getModel()
418
+ }
419
+ }
420
+ )
421
+ )
422
+ .then(function(oFragment: any) {
423
+ // TODO: move the dialog into the fragment and move the handlers to the oController
424
+ let aContexts: any[];
425
+ const aFunctionParams: any[] = [];
426
+ let oOperationBinding: any;
427
+ return CommonUtils.setUserDefaults(oAppComponent, aActionParameters, oParameterModel, true).then(function() {
428
+ // TODO: move the dialog into the fragment and move the handlers to the oController
429
+ return Fragment.load({ definition: oFragment, controller: oController }).then(function(oDialogContent: any) {
430
+ const oResourceBundle = oParentControl.getController().oResourceBundle;
431
+ const oDialog = new Dialog(undefined, {
432
+ title:
433
+ sActionLabel ||
434
+ CommonUtils.getTranslatedText("C_OPERATIONS_ACTION_PARAMETER_DIALOG_TITLE", oResourceBundle),
435
+ content: [oDialogContent],
436
+ escapeHandler: function() {
437
+ oDialog.close();
438
+ messageHandler.removeTransitionMessages();
439
+ reject();
440
+ },
441
+ beginButton: new Button(generate(["fe", "APD_", sActionName, "Action", "Ok"]), {
442
+ text: sActionLabel || CommonUtils.getTranslatedText("C_COMMON_DIALOG_OK", oResourceBundle),
443
+ type: "Emphasized",
444
+ press: function() {
445
+ validateRequiredProperties()
446
+ .then(function(aEmptyMandatoryFields: any[]) {
447
+ if (aEmptyMandatoryFields.length) {
448
+ const oMessages = [];
449
+ for (let i = 0; i < aEmptyMandatoryFields.length; i++) {
450
+ oMessages.push({
451
+ text: CommonUtils.getTranslatedText(
452
+ "C_OPERATIONS_ACTION_PARAMETER_DIALOG_MISSING_MANDATORY_MSG",
453
+ oResourceBundle,
454
+ aEmptyMandatoryFields[i]
455
+ ),
456
+ code: 200,
457
+ type: "Error"
458
+ });
459
+ }
460
+ messageHandler.showMessageDialog({
461
+ customMessages: oMessages
462
+ });
463
+ return;
464
+ }
465
+
466
+ aFieldInvalid = _validateMessages(aActionParameters, aFieldInvalid);
467
+
468
+ if (aFieldInvalid.length > 0) {
469
+ return messageHandling.showUnboundMessages();
470
+ }
471
+ BusyLocker.lock(oDialog);
472
+ return Promise.all(
473
+ Object.keys(mFieldValueMap).map(function(sKey: string) {
474
+ return mFieldValueMap[sKey];
475
+ })
476
+ )
477
+ .then(function() {
478
+ // TODO: due to using the search and value helps on the action dialog transient messages could appear
479
+ // we need an UX design for those to show them to the user - for now remove them before continuing
480
+ messageHandler.removeTransitionMessages();
481
+ // move parameter values from Dialog (SimpleForm) to mParameters.actionParameters so that they are available in the operation bindings for all contexts
482
+ let vParameterValue;
483
+ const oParameterContext = oOperationBinding && oOperationBinding.getParameterContext();
484
+ for (const i in aActionParameters) {
485
+ if (aActionParameters[i].$isCollection) {
486
+ const aMVFContent = oDialog
487
+ .getModel("mvfview")
488
+ .getProperty("/" + aActionParameters[i].$Name),
489
+ aKeyValues = [];
490
+ for (const j in aMVFContent) {
491
+ aKeyValues.push(aMVFContent[j].Key);
492
+ }
493
+ vParameterValue = aKeyValues;
494
+ } else {
495
+ vParameterValue = oParameterContext.getProperty(aActionParameters[i].$Name);
496
+ }
497
+ aActionParameters[i].value = vParameterValue;
498
+ vParameterValue = undefined;
499
+ }
500
+ mParameters.label = sActionLabel;
501
+ return _executeAction(oAppComponent, mParameters)
502
+ .then(function(oOperation: any) {
503
+ oDialog.close();
504
+ resolve(oOperation);
505
+ })
506
+ .catch(function(oError: any) {
507
+ throw oError;
508
+ });
509
+ })
510
+ .catch(function() {
511
+ const oMessageManager = sap.ui.getCore().getMessageManager();
512
+ const bHasEtagMessage = messageHandling.modifyETagMessagesOnly(
513
+ oMessageManager,
514
+ oResourceBundle
515
+ );
516
+
517
+ messageHandler.showMessages({
518
+ bHasEtagMessage: bHasEtagMessage,
519
+ context: mParameters.aContexts[0],
520
+ isActionParameterDialogOpen: true,
521
+ messagePageNavigationCallback: function() {
522
+ oDialog.close();
523
+ }
524
+ });
525
+ if (oDialog && bHasEtagMessage) {
526
+ oDialog.close(); //close the action parameter dialog after refresh of the context after etag mismatch
527
+ }
528
+ })
529
+ .finally(function() {
530
+ BusyLocker.unlock(oDialog);
531
+ });
532
+ })
533
+ .catch(function() {
534
+ return messageHandler.showMessageDialog();
535
+ });
536
+ }
537
+ }),
538
+ endButton: new Button(generate(["fe", "APD_", sActionName, "Action", "Cancel"]), {
539
+ text: CommonUtils.getTranslatedText("C_COMMON_ACTION_PARAMETER_DIALOG_CANCEL", oResourceBundle),
540
+ press: function() {
541
+ _validateMessages(aActionParameters, aFieldInvalid, true);
542
+ oDialog.close();
543
+ messageHandler.removeTransitionMessages();
544
+ reject(Constants.CancelActionDialog);
545
+ }
546
+ }),
547
+ beforeOpen: function(oEvent: any) {
548
+ // clone event for actionWrapper as oEvent.oSource gets lost during processing of beforeOpen event handler
549
+ const oCloneEvent = Object.assign({}, oEvent);
550
+
551
+ messageHandler.removeTransitionMessages();
552
+ const getDefaultValuesFunction = function() {
553
+ const oMetaModel = oDialog.getModel().getMetaModel(),
554
+ sActionPath = oActionContext.sPath && oActionContext.sPath.split("/@")[0],
555
+ sDefaultValuesFunction = oMetaModel.getObject(
556
+ sActionPath + "@com.sap.vocabularies.Common.v1.DefaultValuesFunction"
557
+ );
558
+ return sDefaultValuesFunction;
559
+ };
560
+ const fnSetDefaultsAndOpenDialog = function(sBindingParameter?: any) {
561
+ const sBoundFunctionName = getDefaultValuesFunction();
562
+ const prefillParameter = function(sParamName: any, vParamDefaultValue: any) {
563
+ return new Promise(resolve => {
564
+ // Case 1: There is a ParameterDefaultValue annotation
565
+ if (vParamDefaultValue !== undefined) {
566
+ if (aContexts.length > 0 && vParamDefaultValue.$Path) {
567
+ const oPromise = CommonUtils.requestSingletonProperty(
568
+ vParamDefaultValue.$Path,
569
+ oOperationBinding.getModel()
570
+ );
571
+ oPromise
572
+ .then(function(oValue: any) {
573
+ if (oValue === null) {
574
+ return oOperationBinding
575
+ .getParameterContext()
576
+ .requestProperty(vParamDefaultValue.$Path);
577
+ }
578
+ return oValue;
579
+ })
580
+ .then(function(vParamValue: any) {
581
+ if (aContexts.length > 1) {
582
+ // For multi select, need to loop over aContexts (as contexts cannot be retrieved via binding parameter of the operation binding)
583
+ let sPathForContext = vParamDefaultValue.$Path;
584
+ if (sPathForContext.indexOf(sBindingParameter + "/") === 0) {
585
+ sPathForContext = sPathForContext.replace(sBindingParameter + "/", "");
586
+ }
587
+ for (let i = 1; i < aContexts.length; i++) {
588
+ if (aContexts[i].getProperty(sPathForContext) !== vParamValue) {
589
+ // if the values from the contexts are not all the same, do not prefill
590
+ resolve({
591
+ paramName: sParamName,
592
+ value: undefined,
593
+ bNoPossibleValue: true
594
+ });
595
+ }
596
+ }
597
+ }
598
+ resolve({ paramName: sParamName, value: vParamValue });
599
+ })
600
+ .catch(function() {
601
+ // Simply clear parameter default if an error has occurred
602
+ Log.error(
603
+ "Error while reading default action parameter",
604
+ sParamName,
605
+ mParameters.actionName
606
+ );
607
+ resolve({
608
+ paramName: sParamName,
609
+ value: undefined,
610
+ bLatePropertyError: true
611
+ });
612
+ });
613
+ } else {
614
+ // Case 1.2: ParameterDefaultValue defines a fixed string value (i.e. vParamDefaultValue = 'someString')
615
+ resolve({ paramName: sParamName, value: vParamDefaultValue });
616
+ }
617
+ } else {
618
+ // Case 2: There is no ParameterDefaultValue annotation (=> look into the FLP User Defaults)
619
+ if (oParameterModel && (oParameterModel as any).oData[sParamName]) {
620
+ resolve({
621
+ paramName: sParamName,
622
+ value: (oParameterModel as any).oData[sParamName]
623
+ });
624
+ } else {
625
+ resolve({ paramName: sParamName, value: undefined });
626
+ }
627
+ }
628
+ });
629
+ };
630
+
631
+ const getParameterDefaultValue = function(sParamName: any) {
632
+ const oMetaModel = oDialog.getModel().getMetaModel(),
633
+ sActionPath = oActionContext.sPath && oActionContext.sPath.split("/@")[0],
634
+ sActionParameterAnnotationTarget = sActionPath + "/" + sParamName + "@",
635
+ oParameterAnnotations = oMetaModel.getObject(sActionParameterAnnotationTarget),
636
+ oParameterDefaultValue =
637
+ oParameterAnnotations &&
638
+ oParameterAnnotations["@com.sap.vocabularies.UI.v1.ParameterDefaultValue"]; // either { $Path: 'somePath' } or 'someString'
639
+ return oParameterDefaultValue;
640
+ };
641
+
642
+ const aCurrentParamDefaultValue = [];
643
+ let sParamName, vParameterDefaultValue;
644
+ for (const i in aActionParameters) {
645
+ sParamName = aActionParameters[i].$Name;
646
+ vParameterDefaultValue = getParameterDefaultValue(sParamName);
647
+ aCurrentParamDefaultValue.push(prefillParameter(sParamName, vParameterDefaultValue));
648
+ }
649
+
650
+ if (oActionContext.getObject("$IsBound") && aContexts.length > 0) {
651
+ if (sBoundFunctionName && sBoundFunctionName.length > 0 && typeof sBoundFunctionName === "string") {
652
+ for (const i in aContexts) {
653
+ aFunctionParams.push(
654
+ callBoundFunction(sBoundFunctionName, aContexts[i], mParameters.model)
655
+ );
656
+ }
657
+ }
658
+ }
659
+
660
+ const aPrefillParamPromises = Promise.all(aCurrentParamDefaultValue);
661
+ let aExecFunctionPromises: Promise<any[]> = Promise.resolve([]);
662
+ let oExecFunctionFromManifestPromise;
663
+ if (aFunctionParams && aFunctionParams.length > 0) {
664
+ aExecFunctionPromises = Promise.all(aFunctionParams);
665
+ }
666
+ if (mParameters.defaultValuesExtensionFunction) {
667
+ const sModule = mParameters.defaultValuesExtensionFunction
668
+ .substring(0, mParameters.defaultValuesExtensionFunction.lastIndexOf(".") || -1)
669
+ .replace(/\./gi, "/"),
670
+ sFunctionName = mParameters.defaultValuesExtensionFunction.substring(
671
+ mParameters.defaultValuesExtensionFunction.lastIndexOf(".") + 1,
672
+ mParameters.defaultValuesExtensionFunction.length
673
+ );
674
+ oExecFunctionFromManifestPromise = FPMHelper.actionWrapper(oCloneEvent, sModule, sFunctionName, {
675
+ "contexts": aContexts
676
+ });
677
+ }
678
+
679
+ Promise.all([aPrefillParamPromises, aExecFunctionPromises, oExecFunctionFromManifestPromise])
680
+ .then(function(aPromises: [any[], any[], any]) {
681
+ const aCurrentParamDefaultValue: any = aPromises[0];
682
+ const aFunctionParams = aPromises[1];
683
+ const oFunctionParamsFromManifest = aPromises[2];
684
+ let sDialogParamName;
685
+ for (const i in aActionParameters) {
686
+ sDialogParamName = aActionParameters[i].$Name;
687
+ if (
688
+ oFunctionParamsFromManifest &&
689
+ oFunctionParamsFromManifest.hasOwnProperty(sDialogParamName)
690
+ ) {
691
+ oOperationBinding.setParameter(
692
+ aActionParameters[i].$Name,
693
+ oFunctionParamsFromManifest[sDialogParamName]
694
+ );
695
+ } else if (
696
+ aCurrentParamDefaultValue[i] &&
697
+ aCurrentParamDefaultValue[i].value !== undefined
698
+ ) {
699
+ oOperationBinding.setParameter(
700
+ aActionParameters[i].$Name,
701
+ aCurrentParamDefaultValue[i].value
702
+ );
703
+ // if the default value had not been previously determined due to different contexts, we do nothing else
704
+ } else if (sBoundFunctionName && !aCurrentParamDefaultValue[i].bNoPossibleValue) {
705
+ if (aContexts.length > 1) {
706
+ // we check if the function retrieves the same param value for all the contexts:
707
+ let j = 0;
708
+ while (j < aContexts.length - 1) {
709
+ if (
710
+ aFunctionParams[j] &&
711
+ aFunctionParams[j + 1] &&
712
+ aFunctionParams[j].getObject(sDialogParamName) ===
713
+ aFunctionParams[j + 1].getObject(sDialogParamName)
714
+ ) {
715
+ j++;
716
+ } else {
717
+ break;
718
+ }
719
+ }
720
+ //param values are all the same:
721
+ if (j === aContexts.length - 1) {
722
+ oOperationBinding.setParameter(
723
+ aActionParameters[i].$Name,
724
+ aFunctionParams[j].getObject(sDialogParamName)
725
+ );
726
+ }
727
+ } else {
728
+ //Only one context, then the default param values are to be verified from the function:
729
+
730
+ if (aFunctionParams[0] && aFunctionParams[0].getObject(sDialogParamName)) {
731
+ oOperationBinding.setParameter(
732
+ aActionParameters[i].$Name,
733
+ aFunctionParams[0].getObject(sDialogParamName)
734
+ );
735
+ }
736
+ }
737
+ }
738
+ }
739
+ const bErrorFound = aCurrentParamDefaultValue.some(function(oValue: any) {
740
+ if (oValue.bLatePropertyError) {
741
+ return oValue.bLatePropertyError;
742
+ }
743
+ });
744
+ // If at least one Default Property is a Late Property and an eTag error was raised.
745
+ if (bErrorFound) {
746
+ const sText = CommonUtils.getTranslatedText(
747
+ "C_APP_COMPONENT_SAPFE_ETAG_LATE_PROPERTY",
748
+ oResourceBundle
749
+ );
750
+ MessageBox.warning(sText, { contentWidth: "25em" } as any);
751
+ }
752
+ })
753
+ .catch();
754
+ };
755
+
756
+ if (oActionContext.getObject("$IsBound") && aContexts.length > 0) {
757
+ const aParameters = oActionContext.getObject("$Parameter"),
758
+ sBindingParameter = aParameters[0] && aParameters[0].$Name;
759
+ aContexts[0]
760
+ .requestObject()
761
+ .then(function(oContextObject: any) {
762
+ if (oContextObject) {
763
+ oOperationBinding.setParameter(sBindingParameter, oContextObject);
764
+ }
765
+ fnSetDefaultsAndOpenDialog(sBindingParameter);
766
+ })
767
+ .catch(function(oError: any) {
768
+ Log.error("Error while retrieving the parameter", oError);
769
+ });
770
+ } else {
771
+ fnSetDefaultsAndOpenDialog();
772
+ }
773
+ },
774
+ afterClose: function() {
775
+ oDialog.destroy();
776
+ }
777
+ });
778
+ aFormElements = oDialogContent
779
+ .getAggregation("form")
780
+ .getAggregation("formContainers")[0]
781
+ .getAggregation("formElements");
782
+ oDialog.setModel(oActionContext.getModel().oModel);
783
+ oDialog.setModel(oParameterModel, "paramsModel");
784
+ oDialog.bindElement({
785
+ path: "/",
786
+ model: "paramsModel"
787
+ });
788
+ // empty model to add elements dynamically depending on number of MVF fields defined on the dialog
789
+ const oMVFModel = new JSONModel({});
790
+ oDialog.setModel(oMVFModel, "mvfview");
791
+
792
+ let sActionPath = sActionName + "(...)";
793
+ aContexts = mParameters.aContexts || [];
794
+ if (!aContexts.length) {
795
+ sActionPath = "/" + sActionPath;
796
+ }
797
+ oDialog.bindElement({
798
+ path: sActionPath
799
+ });
800
+ if (oParentControl) {
801
+ // if there is a parent control specified add the dialog as dependent
802
+ oParentControl.addDependent(oDialog);
803
+ }
804
+ if (aContexts.length > 0) {
805
+ oDialog.setBindingContext(aContexts[0]); // use context of first selected line item
806
+ }
807
+ oOperationBinding = oDialog.getObjectBinding();
808
+ oDialog.open();
809
+ });
810
+ });
811
+ })
812
+ .catch(reject);
813
+ });
814
+ }
815
+ function prepareActionParameters(oAction: any, aPredefinedParameters: any) {
816
+ // check if parameters exist at all
817
+ const aParameters = getActionParameters(oAction);
818
+ aPredefinedParameters = aPredefinedParameters || [];
819
+
820
+ if (aPredefinedParameters.length > 0) {
821
+ // TODO: merge the predefined once with the real existing one
822
+ }
823
+
824
+ return aParameters;
825
+ }
826
+ function getActionParameters(oAction: any) {
827
+ const aParameters = oAction.getObject("$Parameter") || [];
828
+ if (aParameters && aParameters.length) {
829
+ if (oAction.getObject("$IsBound")) {
830
+ //in case of bound actions, ignore the first parameter and consider the rest
831
+ return aParameters.slice(1, aParameters.length) || [];
832
+ }
833
+ }
834
+ return aParameters;
835
+ }
836
+ function getIsActionCritical(oMetaModel: any, sPath: any, contexts?: any, oBoundAction?: any) {
837
+ const vActionCritical = oMetaModel.getObject(sPath + "@com.sap.vocabularies.Common.v1.IsActionCritical");
838
+ let sCriticalPath = vActionCritical && vActionCritical.$Path;
839
+ if (!sCriticalPath) {
840
+ // the static value scenario for isActionCritical
841
+ return !!vActionCritical;
842
+ }
843
+ const aBindingParams = oBoundAction && oBoundAction.getObject("$Parameter"),
844
+ aPaths = sCriticalPath && sCriticalPath.split("/"),
845
+ bCondition =
846
+ aBindingParams && aBindingParams.length && typeof aBindingParams === "object" && sCriticalPath && contexts && contexts.length;
847
+ if (bCondition) {
848
+ //in case binding patameters are there in path need to remove eg: - _it/isVerified => need to remove _it and the path should be isVerified
849
+ aBindingParams.filter(function(oParams: any) {
850
+ const index = aPaths && aPaths.indexOf(oParams.$Name);
851
+ if (index > -1) {
852
+ aPaths.splice(index, 1);
853
+ }
854
+ });
855
+ sCriticalPath = aPaths.join("/");
856
+ return contexts[0].getObject(sCriticalPath);
857
+ } else if (sCriticalPath) {
858
+ //if scenario is path based return the path value
859
+ return contexts[0].getObject(sCriticalPath);
860
+ }
861
+ }
862
+
863
+ function executeDependingOnSelectedContexts(oAction: any, mParameters: any, bGetBoundContext: boolean, sGroupId: string) {
864
+ let oActionPromise;
865
+ if (mParameters.internalModelContext && mParameters.internalModelContext.getObject().numberOfSelectedContexts > 1) {
866
+ oActionPromise = bGetBoundContext
867
+ ? oAction.execute(sGroupId).then(function() {
868
+ return oAction.getBoundContext();
869
+ })
870
+ : oAction.execute(sGroupId);
871
+ } else {
872
+ oActionPromise = bGetBoundContext
873
+ ? oAction
874
+ .execute(
875
+ sGroupId,
876
+ undefined,
877
+ CommonUtils.fnOnStrictHandlingFailed.bind(operations, sGroupId, mParameters.label, mParameters.model)
878
+ )
879
+ .then(function() {
880
+ return oAction.getBoundContext();
881
+ })
882
+ : oAction.execute(
883
+ sGroupId,
884
+ undefined,
885
+ CommonUtils.fnOnStrictHandlingFailed.bind(operations, sGroupId, mParameters.label, mParameters.model)
886
+ );
887
+ }
888
+
889
+ return oActionPromise;
890
+ }
891
+ function _executeAction(oAppComponent: any, mParameters: any) {
892
+ const aContexts = mParameters.aContexts || [];
893
+ const oModel = mParameters.model;
894
+ const iExistingMessages = messageHandling.getMessages().length || 0;
895
+ const aActionParameters = mParameters.aActionParameters || [];
896
+ const sActionName = mParameters.actionName;
897
+ const fnOnSubmitted = mParameters.fnOnSubmitted;
898
+ const fnOnResponse = mParameters.fnOnResponse;
899
+ const bIsCreateAction = mParameters.bIsCreateAction;
900
+ let oAction: any;
901
+
902
+ function fnDifferentiate(promise: any) {
903
+ return promise.then(
904
+ function(response: any) {
905
+ const aMessages = messageHandling.getMessages();
906
+ // Action Dialog must remain open if there are response error-messages, because in the java stack the dialog would be closed immediately.
907
+ if (aMessages.length > iExistingMessages && aMessages[aMessages.length - 1].type === "Error") {
908
+ return { response: response, status: "rejected" };
909
+ }
910
+ return { response: response, status: "resolved" };
911
+ },
912
+ function(response: any) {
913
+ return { response: response, status: "rejected" };
914
+ }
915
+ );
916
+ }
917
+
918
+ function setActionParameterDefaultValue() {
919
+ if (aActionParameters && aActionParameters.length) {
920
+ for (let j = 0; j < aActionParameters.length; j++) {
921
+ if (!aActionParameters[j].value) {
922
+ switch (aActionParameters[j].$Type) {
923
+ case "Edm.String":
924
+ aActionParameters[j].value = "";
925
+ break;
926
+ case "Edm.Boolean":
927
+ aActionParameters[j].value = false;
928
+ break;
929
+ case "Edm.Byte":
930
+ case "Edm.Int16":
931
+ case "Edm.Int32":
932
+ case "Edm.Int64":
933
+ aActionParameters[j].value = 0;
934
+ break;
935
+ // tbc
936
+ default:
937
+ break;
938
+ }
939
+ }
940
+ oAction.setParameter(aActionParameters[j].$Name, aActionParameters[j].value);
941
+ }
942
+ }
943
+ }
944
+
945
+ if (aContexts.length) {
946
+ return new Promise(function(resolve: (value: any) => void, reject: (reason?: any) => void) {
947
+ const mBindingParameters = mParameters.mBindingParameters;
948
+ const bGrouped = mParameters.bGrouped;
949
+ const bReturnAsArray = mParameters.bReturnAsArray;
950
+ const bGetBoundContext = mParameters.bGetBoundContext;
951
+ const aActionPromises: any[] = [];
952
+ let oActionPromise;
953
+ let i;
954
+ let sGroupId: string;
955
+ const fnExecuteAction = function(oAction: any, index: any, oSideEffect: any) {
956
+ setActionParameterDefaultValue();
957
+ // For invocation grouping "isolated" need batch group per action call
958
+ sGroupId = !bGrouped ? "$auto." + index : oAction.getUpdateGroupId();
959
+ oActionPromise = executeDependingOnSelectedContexts(oAction, mParameters, bGetBoundContext, sGroupId);
960
+ aActionPromises.push(oActionPromise);
961
+ const oSideEffectsService = oAppComponent.getSideEffectsService();
962
+ // trigger actions from side effects
963
+ if (oSideEffect && oSideEffect.triggerActions && oSideEffect.triggerActions.length) {
964
+ oSideEffect.triggerActions.forEach(function(sTriggerAction: any) {
965
+ if (sTriggerAction) {
966
+ oSideEffectsService.executeAction(sTriggerAction, oSideEffect.context, sGroupId);
967
+ }
968
+ });
969
+ }
970
+ // request side effects for this action
971
+ // as we move the messages request to POST $select we need to be prepared for an empty array
972
+ if (oSideEffect && oSideEffect.pathExpressions && oSideEffect.pathExpressions.length > 0) {
973
+ oSideEffectsService
974
+ .requestSideEffects(oSideEffect.pathExpressions, oSideEffect.context, sGroupId)
975
+ .then(function() {
976
+ if (mParameters.operationAvailableMap && mParameters.internalModelContext) {
977
+ CommonUtils.setActionEnablement(
978
+ mParameters.internalModelContext,
979
+ JSON.parse(mParameters.operationAvailableMap),
980
+ mParameters.aContexts
981
+ );
982
+ }
983
+ })
984
+ .catch(function(oError: any) {
985
+ Log.error("Error while requesting side effects", oError);
986
+ });
987
+ }
988
+ };
989
+ const fnExecuteSingleAction = function(oAction: any, index: any, oSideEffect: any) {
990
+ const oPromise = new Promise<void>(resolve => {
991
+ let oLocalPromise;
992
+ const aLocalPromise = [];
993
+ setActionParameterDefaultValue();
994
+ // For invocation grouping "isolated" need batch group per action call
995
+ sGroupId = "apiMode" + index;
996
+ oActionPromise = executeDependingOnSelectedContexts(oAction, mParameters, bGetBoundContext, sGroupId);
997
+ aActionPromises.push(oActionPromise);
998
+ aLocalPromise.push(oActionPromise);
999
+ const oSideEffectsService = oAppComponent.getSideEffectsService();
1000
+ // trigger actions from side effects
1001
+ if (oSideEffect && oSideEffect.triggerActions && oSideEffect.triggerActions.length) {
1002
+ oSideEffect.triggerActions.forEach(function(sTriggerAction: any) {
1003
+ if (sTriggerAction) {
1004
+ oLocalPromise = oSideEffectsService.executeAction(sTriggerAction, oSideEffect.context, sGroupId);
1005
+ aLocalPromise.push(oLocalPromise);
1006
+ }
1007
+ });
1008
+ }
1009
+ // request side effects for this action
1010
+ // as we move the messages request to POST $select we need to be prepared for an empty array
1011
+ if (oSideEffect && oSideEffect.pathExpressions && oSideEffect.pathExpressions.length > 0) {
1012
+ oLocalPromise = oSideEffectsService.requestSideEffects(oSideEffect.pathExpressions, oSideEffect.context, sGroupId);
1013
+ aLocalPromise.push(oLocalPromise);
1014
+ oLocalPromise
1015
+ .then(function() {
1016
+ if (mParameters.operationAvailableMap && mParameters.internalModelContext) {
1017
+ CommonUtils.setActionEnablement(
1018
+ mParameters.internalModelContext,
1019
+ JSON.parse(mParameters.operationAvailableMap),
1020
+ mParameters.aContexts
1021
+ );
1022
+ }
1023
+ })
1024
+ .catch(function(oError: any) {
1025
+ Log.error("Error while requesting side effects", oError);
1026
+ });
1027
+ }
1028
+ oModel.submitBatch(sGroupId);
1029
+ Promise.all(aLocalPromise)
1030
+ .then(function() {
1031
+ return resolve();
1032
+ })
1033
+ .catch(function() {
1034
+ return resolve();
1035
+ });
1036
+ });
1037
+ return oPromise;
1038
+ };
1039
+
1040
+ function fnExecuteSequentially(aContexts: any) {
1041
+ // One action and its side effects are completed before the next action is executed
1042
+ (
1043
+ fnOnSubmitted ||
1044
+ function noop() {
1045
+ /**/
1046
+ }
1047
+ )(aActionPromises);
1048
+ function processOneAction(context: any, i: any) {
1049
+ oAction = oModel.bindContext(sActionName + "(...)", context, mBindingParameters);
1050
+ return fnExecuteSingleAction(oAction, i, {
1051
+ context: context,
1052
+ pathExpressions: mParameters.additionalSideEffect && mParameters.additionalSideEffect.pathExpressions,
1053
+ triggerActions: mParameters.additionalSideEffect && mParameters.additionalSideEffect.triggerActions
1054
+ });
1055
+ }
1056
+
1057
+ let oActionAndSideEffectPromise = Promise.resolve();
1058
+ let j = 0;
1059
+ aContexts.forEach(function(context: any) {
1060
+ const id = ++j;
1061
+ oActionAndSideEffectPromise = oActionAndSideEffectPromise.then(function() {
1062
+ return processOneAction(context, id);
1063
+ });
1064
+ });
1065
+ oActionAndSideEffectPromise
1066
+ .then(function() {
1067
+ fnHandleResults();
1068
+ })
1069
+ .catch();
1070
+ }
1071
+
1072
+ if (mParameters.bObjectPage && !bGrouped) {
1073
+ // For invocation grouping "isolated" called from ObjectPage, ensure that each action and matching side effects
1074
+ // are processed before the next set is submitted. Workaround until JSON batch is available.
1075
+ fnExecuteSequentially(aContexts);
1076
+ } else {
1077
+ for (i = 0; i < aContexts.length; i++) {
1078
+ oAction = oModel.bindContext(sActionName + "(...)", aContexts[i], mBindingParameters);
1079
+ fnExecuteAction(oAction, aContexts.length <= 1 ? null : i, {
1080
+ context: aContexts[i],
1081
+ pathExpressions: mParameters.additionalSideEffect && mParameters.additionalSideEffect.pathExpressions,
1082
+ triggerActions: mParameters.additionalSideEffect && mParameters.additionalSideEffect.triggerActions
1083
+ });
1084
+ }
1085
+ (
1086
+ fnOnSubmitted ||
1087
+ function noop() {
1088
+ /**/
1089
+ }
1090
+ )(aActionPromises);
1091
+ fnHandleResults();
1092
+ }
1093
+
1094
+ function fnHandleResults() {
1095
+ Promise.all(aActionPromises.map(fnDifferentiate))
1096
+ .then(function(results: any[]) {
1097
+ const aRejectedItems = [];
1098
+ const aResolvedItems = [];
1099
+ let iResultCount;
1100
+ for (iResultCount = 0; iResultCount < results.length; iResultCount++) {
1101
+ if (results[iResultCount].status === "rejected") {
1102
+ aRejectedItems.push(results[iResultCount].response);
1103
+ }
1104
+ if (results[iResultCount].status === "resolved") {
1105
+ if (bIsCreateAction) {
1106
+ // removed the bActionParametersExist so that create new action can work in both cases - with and without dialog
1107
+ //only used for NewAction
1108
+ results[iResultCount].bConsiderDocumentModified = true;
1109
+ aResolvedItems.push(results[iResultCount]);
1110
+ } else {
1111
+ aResolvedItems.push(results[iResultCount].response);
1112
+ }
1113
+ }
1114
+ }
1115
+ if (!results || (results && results.length === 0)) {
1116
+ reject(true);
1117
+ }
1118
+ if (aRejectedItems.length === 0) {
1119
+ if (bReturnAsArray) {
1120
+ resolve(aResolvedItems);
1121
+ } else {
1122
+ // context is given directly without an array so also no array is expected
1123
+ resolve(aResolvedItems[0]);
1124
+ }
1125
+ } else {
1126
+ reject({
1127
+ resolvedItems: aResolvedItems,
1128
+ rejectedItems: aRejectedItems
1129
+ });
1130
+ }
1131
+ })
1132
+ .catch(reject);
1133
+ }
1134
+ }).finally(function() {
1135
+ (
1136
+ fnOnResponse ||
1137
+ function noop() {
1138
+ /**/
1139
+ }
1140
+ )();
1141
+ });
1142
+ } else {
1143
+ oAction = oModel.bindContext("/" + sActionName + "(...)");
1144
+ setActionParameterDefaultValue();
1145
+ const sGroupId = "actionImport";
1146
+ const oActionPromise = oAction.execute(
1147
+ sGroupId,
1148
+ undefined,
1149
+ CommonUtils.fnOnStrictHandlingFailed.bind(operations, sGroupId, mParameters.label, oModel)
1150
+ );
1151
+ oModel.submitBatch(sGroupId);
1152
+ // trigger onSubmitted "event"
1153
+ (
1154
+ fnOnSubmitted ||
1155
+ function noop() {
1156
+ /**/
1157
+ }
1158
+ )(oActionPromise);
1159
+ return oActionPromise.finally(function() {
1160
+ (
1161
+ fnOnResponse ||
1162
+ function noop() {
1163
+ /**/
1164
+ }
1165
+ )();
1166
+ });
1167
+ }
1168
+ }
1169
+ function _getPath(oActionContext: any, sActionName: any) {
1170
+ let sPath = oActionContext.getPath();
1171
+ sPath = oActionContext.getObject("$IsBound") ? sPath.split("@$ui5.overload")[0] : sPath.split("/0")[0];
1172
+ return sPath.split("/" + sActionName)[0];
1173
+ }
1174
+
1175
+ /**
1176
+ * Static functions to call OData actions (bound/import) and functions (bound/import)
1177
+ *
1178
+ * @namespace
1179
+ * @alias sap.fe.core.actions.operations
1180
+ * @private
1181
+ * @experimental This module is only for experimental use! <br/><b>This is only a POC and maybe deleted</b>
1182
+ * @since 1.56.0
1183
+ */
1184
+ const operations = {
1185
+ callBoundAction: callBoundAction,
1186
+ callActionImport: callActionImport,
1187
+ callBoundFunction: callBoundFunction,
1188
+ callFunctionImport: callFunctionImport,
1189
+ executeDependingOnSelectedContexts: executeDependingOnSelectedContexts
1190
+ };
1191
+
1192
+ export default operations;