@sapui5/sap.fe.core 1.100.0 → 1.102.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (295) hide show
  1. package/package.json +4 -4
  2. package/src/sap/fe/core/.library +2 -3
  3. package/src/sap/fe/core/AppComponent.js +23 -30
  4. package/src/sap/fe/core/AppComponent.ts +35 -40
  5. package/src/sap/fe/core/AppStateHandler.js +8 -8
  6. package/src/sap/fe/core/AppStateHandler.ts +11 -11
  7. package/src/sap/fe/core/BaseController.js +9 -9
  8. package/src/sap/fe/core/BaseController.ts +3 -4
  9. package/src/sap/fe/core/CommonUtils.js +122 -101
  10. package/src/sap/fe/core/CommonUtils.ts +239 -193
  11. package/src/sap/fe/core/ExtensionAPI.js +12 -13
  12. package/src/sap/fe/core/ExtensionAPI.ts +21 -31
  13. package/src/sap/fe/core/PageController.js +19 -13
  14. package/src/sap/fe/core/PageController.ts +40 -34
  15. package/src/sap/fe/core/TemplateComponent.js +198 -123
  16. package/src/sap/fe/core/TemplateComponent.ts +109 -121
  17. package/src/sap/fe/core/TemplateModel.js +7 -9
  18. package/src/sap/fe/core/TemplateModel.ts +3 -3
  19. package/src/sap/fe/core/buildingBlocks/AttributeModel.js +60 -0
  20. package/src/sap/fe/core/buildingBlocks/AttributeModel.ts +37 -0
  21. package/src/sap/fe/core/buildingBlocks/BuildingBlock.js +165 -0
  22. package/src/sap/fe/core/buildingBlocks/BuildingBlock.ts +178 -0
  23. package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.js +935 -0
  24. package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.ts +837 -0
  25. package/src/sap/fe/core/buildingBlocks/TraceInfo.js +436 -0
  26. package/src/sap/fe/core/buildingBlocks/TraceInfo.ts +431 -0
  27. package/src/sap/fe/core/{BusyLocker.js → controllerextensions/BusyLocker.js} +1 -1
  28. package/src/sap/fe/core/{BusyLocker.ts → controllerextensions/BusyLocker.ts} +7 -7
  29. package/src/sap/fe/core/controllerextensions/EditFlow.js +660 -288
  30. package/src/sap/fe/core/controllerextensions/EditFlow.ts +513 -331
  31. package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +11 -11
  32. package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.ts +6 -7
  33. package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +43 -25
  34. package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +132 -103
  35. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +16 -16
  36. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +64 -55
  37. package/src/sap/fe/core/controllerextensions/InternalRouting.js +166 -99
  38. package/src/sap/fe/core/controllerextensions/InternalRouting.ts +187 -149
  39. package/src/sap/fe/core/controllerextensions/KPIManagement.js +14 -14
  40. package/src/sap/fe/core/controllerextensions/KPIManagement.ts +12 -11
  41. package/src/sap/fe/core/controllerextensions/MassEdit.js +13 -12
  42. package/src/sap/fe/core/controllerextensions/MassEdit.ts +22 -22
  43. package/src/sap/fe/core/controllerextensions/MessageHandler.js +14 -26
  44. package/src/sap/fe/core/controllerextensions/MessageHandler.ts +20 -30
  45. package/src/sap/fe/core/controllerextensions/PageReady.js +25 -23
  46. package/src/sap/fe/core/controllerextensions/PageReady.ts +49 -47
  47. package/src/sap/fe/core/controllerextensions/Paginator.js +24 -15
  48. package/src/sap/fe/core/controllerextensions/Paginator.ts +35 -20
  49. package/src/sap/fe/core/controllerextensions/Placeholder.js +10 -10
  50. package/src/sap/fe/core/controllerextensions/Placeholder.ts +12 -14
  51. package/src/sap/fe/core/controllerextensions/Routing.js +11 -11
  52. package/src/sap/fe/core/controllerextensions/Routing.ts +12 -13
  53. package/src/sap/fe/core/controllerextensions/Share.js +34 -16
  54. package/src/sap/fe/core/controllerextensions/Share.ts +50 -32
  55. package/src/sap/fe/core/controllerextensions/SideEffects.js +15 -15
  56. package/src/sap/fe/core/controllerextensions/SideEffects.ts +64 -65
  57. package/src/sap/fe/core/controllerextensions/ViewState.js +27 -31
  58. package/src/sap/fe/core/controllerextensions/ViewState.ts +103 -102
  59. package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.js +105 -0
  60. package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.ts +98 -0
  61. package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.js +360 -0
  62. package/src/sap/fe/core/{actions → controllerextensions}/collaboration/ActivitySync.ts +90 -132
  63. package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.js +146 -0
  64. package/src/sap/fe/core/{actions → controllerextensions}/collaboration/CollaborationCommon.ts +18 -8
  65. package/src/sap/fe/core/controllerextensions/collaboration/Manage.js +264 -0
  66. package/src/sap/fe/core/{actions → controllerextensions}/collaboration/Manage.ts +35 -33
  67. package/src/sap/fe/core/controllerextensions/collaboration/ManageDialog.fragment.xml +100 -0
  68. package/src/sap/fe/core/{actions → controllerextensions}/collaboration/UserDetails.fragment.xml +5 -7
  69. package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.js +1584 -0
  70. package/src/sap/fe/core/{TransactionHelper.ts → controllerextensions/editFlow/TransactionHelper.ts} +190 -159
  71. package/src/sap/fe/core/controllerextensions/editFlow/draft.js +780 -0
  72. package/src/sap/fe/core/{actions → controllerextensions/editFlow}/draft.ts +329 -76
  73. package/src/sap/fe/core/controllerextensions/editFlow/operations.js +1149 -0
  74. package/src/sap/fe/core/{actions → controllerextensions/editFlow}/operations.ts +169 -97
  75. package/src/sap/fe/core/controllerextensions/editFlow/sticky.js +190 -0
  76. package/src/sap/fe/core/{actions → controllerextensions/editFlow}/sticky.ts +76 -12
  77. package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.js +592 -0
  78. package/src/sap/fe/core/{actions → controllerextensions/messageHandler}/messageHandling.ts +83 -60
  79. package/src/sap/fe/core/controllerextensions/routing/RouterProxy.js +940 -0
  80. package/src/sap/fe/core/{RouterProxy.ts → controllerextensions/routing/RouterProxy.ts} +52 -36
  81. package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +21 -18
  82. package/src/sap/fe/core/controls/Any.js +28 -0
  83. package/src/sap/fe/core/controls/Any.ts +30 -0
  84. package/src/sap/fe/core/controls/CommandExecution.js +50 -16
  85. package/src/sap/fe/core/controls/CommandExecution.ts +31 -22
  86. package/src/sap/fe/core/controls/ConditionalWrapper.js +136 -65
  87. package/src/sap/fe/core/controls/ConditionalWrapper.ts +49 -58
  88. package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.js +371 -0
  89. package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.ts +282 -0
  90. package/src/sap/fe/core/controls/CustomQuickViewPage.js +74 -36
  91. package/src/sap/fe/core/controls/CustomQuickViewPage.ts +23 -32
  92. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossDraft.fragment.xml +52 -5
  93. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +127 -67
  94. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +127 -67
  95. package/src/sap/fe/core/controls/FieldWrapper.js +171 -87
  96. package/src/sap/fe/core/controls/FieldWrapper.ts +69 -80
  97. package/src/sap/fe/core/controls/FileWrapper.js +360 -0
  98. package/src/sap/fe/core/controls/FileWrapper.ts +202 -0
  99. package/src/sap/fe/core/controls/FilterBar.js +154 -119
  100. package/src/sap/fe/core/controls/FilterBar.ts +128 -123
  101. package/src/sap/fe/core/controls/FormElementWrapper.js +102 -37
  102. package/src/sap/fe/core/controls/FormElementWrapper.ts +43 -35
  103. package/src/sap/fe/core/controls/MassEditSelect.js +33 -0
  104. package/src/sap/fe/core/controls/MassEditSelect.ts +45 -0
  105. package/src/sap/fe/core/controls/filterbar/FilterContainer.js +111 -89
  106. package/src/sap/fe/core/controls/filterbar/FilterContainer.ts +86 -82
  107. package/src/sap/fe/core/controls/filterbar/VisualFilter.js +242 -193
  108. package/src/sap/fe/core/controls/filterbar/VisualFilter.ts +211 -204
  109. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +152 -116
  110. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.ts +105 -105
  111. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +2 -2
  112. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +23 -28
  113. package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +41 -81
  114. package/src/sap/fe/core/controls/massEdit/MassEditField.fragment.xml +107 -0
  115. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +550 -35
  116. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +604 -35
  117. package/src/sap/fe/core/converters/ManifestSettings.js +3 -1
  118. package/src/sap/fe/core/converters/ManifestSettings.ts +9 -2
  119. package/src/sap/fe/core/converters/MetaModelConverter.js +11 -40
  120. package/src/sap/fe/core/converters/MetaModelConverter.ts +56 -84
  121. package/src/sap/fe/core/converters/annotations/DataField.js +20 -5
  122. package/src/sap/fe/core/converters/annotations/DataField.ts +27 -6
  123. package/src/sap/fe/core/converters/controls/Common/Action.js +14 -21
  124. package/src/sap/fe/core/converters/controls/Common/Action.ts +23 -28
  125. package/src/sap/fe/core/converters/controls/Common/Chart.js +17 -10
  126. package/src/sap/fe/core/converters/controls/Common/Chart.ts +20 -14
  127. package/src/sap/fe/core/converters/controls/Common/Form.js +16 -18
  128. package/src/sap/fe/core/converters/controls/Common/Form.ts +20 -20
  129. package/src/sap/fe/core/converters/controls/Common/KPI.js +1 -1
  130. package/src/sap/fe/core/converters/controls/Common/KPI.ts +2 -3
  131. package/src/sap/fe/core/converters/controls/Common/Table.js +389 -173
  132. package/src/sap/fe/core/converters/controls/Common/Table.ts +440 -244
  133. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +26 -16
  134. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +27 -19
  135. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +78 -47
  136. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +146 -107
  137. package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.js +6 -6
  138. package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.ts +20 -18
  139. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +30 -25
  140. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +39 -34
  141. package/src/sap/fe/core/converters/helpers/Aggregation.js +10 -2
  142. package/src/sap/fe/core/converters/helpers/Aggregation.ts +18 -13
  143. package/src/sap/fe/core/converters/helpers/BindingHelper.js +3 -2
  144. package/src/sap/fe/core/converters/helpers/BindingHelper.ts +6 -5
  145. package/src/sap/fe/core/converters/objectPage/FormMenuActions.js +1 -1
  146. package/src/sap/fe/core/converters/objectPage/FormMenuActions.ts +0 -4
  147. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +27 -24
  148. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +49 -40
  149. package/src/sap/fe/core/converters/templates/ListReportConverter.js +33 -22
  150. package/src/sap/fe/core/converters/templates/ListReportConverter.ts +77 -62
  151. package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +28 -28
  152. package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +38 -45
  153. package/src/sap/fe/core/designtime/AppComponent.designtime.js +3 -3
  154. package/src/sap/fe/core/designtime/AppComponent.designtime.ts +8 -6
  155. package/src/sap/fe/core/formatters/KPIFormatter.js +3 -12
  156. package/src/sap/fe/core/formatters/KPIFormatter.ts +3 -2
  157. package/src/sap/fe/core/formatters/TableFormatter.js +74 -13
  158. package/src/sap/fe/core/formatters/TableFormatter.ts +71 -16
  159. package/src/sap/fe/core/formatters/ValueFormatter.js +4 -4
  160. package/src/sap/fe/core/formatters/ValueFormatter.ts +4 -7
  161. package/src/sap/fe/core/fpm/Component.js +46 -17
  162. package/src/sap/fe/core/fpm/Component.ts +11 -16
  163. package/src/sap/fe/core/helpers/AppStartupHelper.js +4 -4
  164. package/src/sap/fe/core/helpers/AppStartupHelper.ts +3 -3
  165. package/src/sap/fe/core/helpers/BindingExpression.js +10 -7
  166. package/src/sap/fe/core/helpers/BindingExpression.ts +37 -35
  167. package/src/sap/fe/core/helpers/ClassSupport.js +273 -256
  168. package/src/sap/fe/core/helpers/ClassSupport.ts +315 -237
  169. package/src/sap/fe/core/helpers/FPMHelper.js +3 -2
  170. package/src/sap/fe/core/helpers/FPMHelper.ts +9 -8
  171. package/src/sap/fe/core/helpers/MassEditHelper.js +522 -147
  172. package/src/sap/fe/core/helpers/MassEditHelper.ts +563 -236
  173. package/src/sap/fe/core/helpers/ModelHelper.js +29 -1
  174. package/src/sap/fe/core/helpers/ModelHelper.ts +39 -26
  175. package/src/sap/fe/core/helpers/PasteHelper.js +4 -4
  176. package/src/sap/fe/core/helpers/PasteHelper.ts +4 -3
  177. package/src/sap/fe/core/helpers/SemanticDateOperators.js +3 -3
  178. package/src/sap/fe/core/helpers/SemanticDateOperators.ts +3 -1
  179. package/src/sap/fe/core/helpers/SemanticKeyHelper.js +1 -1
  180. package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +1 -1
  181. package/src/sap/fe/core/helpers/StableIdHelper.js +5 -7
  182. package/src/sap/fe/core/helpers/StableIdHelper.ts +8 -8
  183. package/src/sap/fe/core/{Synchronization.js → helpers/Synchronization.js} +1 -1
  184. package/src/sap/fe/core/{Synchronization.ts → helpers/Synchronization.ts} +1 -1
  185. package/src/sap/fe/core/jsx-runtime/jsx.js +35 -5
  186. package/src/sap/fe/core/jsx-runtime/jsx.ts +22 -8
  187. package/src/sap/fe/core/library.js +13 -5
  188. package/src/sap/fe/core/library.ts +26 -17
  189. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +1 -1
  190. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +0 -3
  191. package/src/sap/fe/core/messagebundle.properties +135 -180
  192. package/src/sap/fe/core/messagebundle_ar.properties +31 -64
  193. package/src/sap/fe/core/messagebundle_bg.properties +31 -64
  194. package/src/sap/fe/core/messagebundle_ca.properties +31 -64
  195. package/src/sap/fe/core/messagebundle_cs.properties +31 -64
  196. package/src/sap/fe/core/messagebundle_cy.properties +32 -65
  197. package/src/sap/fe/core/messagebundle_da.properties +31 -64
  198. package/src/sap/fe/core/messagebundle_de.properties +29 -62
  199. package/src/sap/fe/core/messagebundle_el.properties +32 -65
  200. package/src/sap/fe/core/messagebundle_en.properties +32 -65
  201. package/src/sap/fe/core/messagebundle_en_GB.properties +29 -62
  202. package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +41 -74
  203. package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +32 -65
  204. package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +20 -6
  205. package/src/sap/fe/core/messagebundle_es.properties +31 -64
  206. package/src/sap/fe/core/messagebundle_es_MX.properties +31 -64
  207. package/src/sap/fe/core/messagebundle_et.properties +31 -64
  208. package/src/sap/fe/core/messagebundle_fi.properties +29 -62
  209. package/src/sap/fe/core/messagebundle_fr.properties +36 -69
  210. package/src/sap/fe/core/messagebundle_fr_CA.properties +33 -66
  211. package/src/sap/fe/core/messagebundle_hi.properties +29 -62
  212. package/src/sap/fe/core/messagebundle_hr.properties +32 -65
  213. package/src/sap/fe/core/messagebundle_hu.properties +30 -63
  214. package/src/sap/fe/core/messagebundle_id.properties +32 -65
  215. package/src/sap/fe/core/messagebundle_it.properties +31 -64
  216. package/src/sap/fe/core/messagebundle_iw.properties +31 -64
  217. package/src/sap/fe/core/messagebundle_ja.properties +29 -62
  218. package/src/sap/fe/core/messagebundle_kk.properties +31 -64
  219. package/src/sap/fe/core/messagebundle_ko.properties +31 -64
  220. package/src/sap/fe/core/messagebundle_lt.properties +31 -64
  221. package/src/sap/fe/core/messagebundle_lv.properties +32 -65
  222. package/src/sap/fe/core/messagebundle_ms.properties +31 -64
  223. package/src/sap/fe/core/messagebundle_nl.properties +31 -64
  224. package/src/sap/fe/core/messagebundle_no.properties +31 -64
  225. package/src/sap/fe/core/messagebundle_pl.properties +34 -67
  226. package/src/sap/fe/core/messagebundle_pt.properties +32 -65
  227. package/src/sap/fe/core/messagebundle_pt_PT.properties +31 -64
  228. package/src/sap/fe/core/messagebundle_ro.properties +33 -66
  229. package/src/sap/fe/core/messagebundle_ru.properties +33 -66
  230. package/src/sap/fe/core/messagebundle_sh.properties +31 -64
  231. package/src/sap/fe/core/messagebundle_sk.properties +31 -64
  232. package/src/sap/fe/core/messagebundle_sl.properties +29 -62
  233. package/src/sap/fe/core/messagebundle_sv.properties +30 -63
  234. package/src/sap/fe/core/messagebundle_th.properties +31 -64
  235. package/src/sap/fe/core/messagebundle_tr.properties +31 -64
  236. package/src/sap/fe/core/messagebundle_uk.properties +32 -65
  237. package/src/sap/fe/core/messagebundle_vi.properties +31 -64
  238. package/src/sap/fe/core/messagebundle_zh_CN.properties +32 -65
  239. package/src/sap/fe/core/messagebundle_zh_TW.properties +34 -67
  240. package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +4 -4
  241. package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +1 -1
  242. package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +5 -5
  243. package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +1 -2
  244. package/src/sap/fe/core/services/EnvironmentServiceFactory.js +11 -8
  245. package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +15 -13
  246. package/src/sap/fe/core/services/NavigationServiceFactory.js +5 -5
  247. package/src/sap/fe/core/services/NavigationServiceFactory.ts +9 -5
  248. package/src/sap/fe/core/services/ResourceModelServiceFactory.js +4 -4
  249. package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +1 -1
  250. package/src/sap/fe/core/services/RoutingServiceFactory.js +105 -66
  251. package/src/sap/fe/core/services/RoutingServiceFactory.ts +59 -49
  252. package/src/sap/fe/core/services/ShellServicesFactory.js +104 -29
  253. package/src/sap/fe/core/services/ShellServicesFactory.ts +64 -30
  254. package/src/sap/fe/core/services/SideEffectsServiceFactory.js +4 -4
  255. package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +1 -1
  256. package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +11 -10
  257. package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +38 -51
  258. package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +43 -5
  259. package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.ts +6 -3
  260. package/src/sap/fe/core/support/CommonHelper.js +1 -1
  261. package/src/sap/fe/core/support/CommonHelper.ts +0 -3
  262. package/src/sap/fe/core/templating/DataModelPathHelper.js +2 -9
  263. package/src/sap/fe/core/templating/DataModelPathHelper.ts +32 -38
  264. package/src/sap/fe/core/templating/DisplayModeFormatter.js +23 -3
  265. package/src/sap/fe/core/templating/DisplayModeFormatter.ts +27 -6
  266. package/src/sap/fe/core/templating/EntitySetHelper.js +1 -9
  267. package/src/sap/fe/core/templating/EntitySetHelper.ts +11 -13
  268. package/src/sap/fe/core/templating/FilterHelper.js +4 -4
  269. package/src/sap/fe/core/templating/FilterHelper.ts +6 -5
  270. package/src/sap/fe/core/templating/PropertyHelper.js +70 -33
  271. package/src/sap/fe/core/templating/PropertyHelper.ts +49 -27
  272. package/src/sap/fe/core/templating/UIFormatters.js +133 -22
  273. package/src/sap/fe/core/templating/UIFormatters.ts +144 -50
  274. package/src/sap/fe/core/type/DateTimeWithTimezone.js +47 -0
  275. package/src/sap/fe/core/type/DateTimeWithTimezone.ts +23 -0
  276. package/src/sap/fe/core/type/Email.js +26 -8
  277. package/src/sap/fe/core/type/Email.ts +8 -7
  278. package/src/sap/fe/core/AnnotationHelper.js +0 -312
  279. package/src/sap/fe/core/AnnotationHelper.ts +0 -315
  280. package/src/sap/fe/core/RouterProxy.js +0 -926
  281. package/src/sap/fe/core/TransactionHelper.js +0 -1562
  282. package/src/sap/fe/core/actions/collaboration/ActivitySync.js +0 -392
  283. package/src/sap/fe/core/actions/collaboration/CollaborationCommon.js +0 -136
  284. package/src/sap/fe/core/actions/collaboration/Manage.js +0 -262
  285. package/src/sap/fe/core/actions/collaboration/ManageDialog.fragment.xml +0 -103
  286. package/src/sap/fe/core/actions/draft.js +0 -523
  287. package/src/sap/fe/core/actions/messageHandling.js +0 -567
  288. package/src/sap/fe/core/actions/nonDraft.js +0 -20
  289. package/src/sap/fe/core/actions/nonDraft.ts +0 -12
  290. package/src/sap/fe/core/actions/operations.js +0 -1096
  291. package/src/sap/fe/core/actions/sticky.js +0 -130
  292. package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.js +0 -78
  293. package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.ts +0 -65
  294. package/src/sap/fe/core/formatters/CriticalityFormatter.js +0 -77
  295. package/src/sap/fe/core/formatters/CriticalityFormatter.ts +0 -58
@@ -1,17 +1,27 @@
1
- import Dialog from "sap/m/Dialog";
2
- import Button from "sap/m/Button";
3
- import Text from "sap/m/Text";
4
- import MessageBox from "sap/m/MessageBox";
5
- import messageHandling from "sap/fe/core/actions/messageHandling";
6
- import CommonUtils from "sap/fe/core/CommonUtils";
1
+ import ResourceBundle from "sap/base/i18n/ResourceBundle";
7
2
  import Log from "sap/base/Log";
8
3
  import AppComponent from "sap/fe/core/AppComponent";
4
+ import CommonUtils from "sap/fe/core/CommonUtils";
5
+ import ActivitySync from "sap/fe/core/controllerextensions/collaboration/ActivitySync";
6
+ import messageHandling from "sap/fe/core/controllerextensions/messageHandler/messageHandling";
7
+ import DataLossOrDraftDiscardHandler from "sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler";
8
+ import EditState from "sap/fe/core/helpers/EditState";
9
9
  import { SideEffectsService } from "sap/fe/core/services/SideEffectsServiceFactory";
10
- import ResourceBundle from "sap/base/i18n/ResourceBundle";
10
+ import Button from "sap/m/Button";
11
+ import Dialog from "sap/m/Dialog";
12
+ import MessageBox from "sap/m/MessageBox";
13
+ import Text from "sap/m/Text";
14
+ import Core from "sap/ui/core/Core";
11
15
  import View from "sap/ui/core/mvc/View";
12
16
  import Context from "sap/ui/model/odata/v4/Context";
13
17
  import ODataMetaModel from "sap/ui/model/odata/v4/ODataMetaModel";
14
18
  import ResourceModel from "sap/ui/model/resource/ResourceModel";
19
+ import { CoreEx } from "types/extension_types";
20
+
21
+ export type SiblingInformation = {
22
+ targetContext: Context;
23
+ pathMapping: { oldPath: string; newPath: string }[];
24
+ };
15
25
 
16
26
  /**
17
27
  * Interface for callbacks used in the functions
@@ -69,6 +79,11 @@ const draftOperations = {
69
79
  DISCARD: "DiscardAction",
70
80
  PREPARE: "PreparationAction"
71
81
  };
82
+ /* Enum for navigation types */
83
+ enum NavigationType {
84
+ BackNavigation = "BackNavigation",
85
+ ForwardNavigation = "ForwardNavigation"
86
+ }
72
87
  /**
73
88
  * Static functions for the draft programming model
74
89
  *
@@ -78,11 +93,7 @@ const draftOperations = {
78
93
  * @experimental This module is only for experimental use! <br/><b>This is only a POC and maybe deleted</b>
79
94
  * @since 1.54.0
80
95
  */
81
- const draft = {
82
- createDraftFromActiveDocument: createDraftFromActiveDocument,
83
- activateDocument: activateDocument,
84
- deleteDraft: deleteDraft
85
- };
96
+
86
97
  /**
87
98
  * Determines action name for a draft operation.
88
99
  *
@@ -135,11 +146,17 @@ function executeDraftEditAction(oContext: any, bPreserveChanges: boolean) {
135
146
  const oOperation = createOperation(oContext, draftOperations.EDIT, oOptions);
136
147
  oOperation.setParameter("PreserveChanges", bPreserveChanges);
137
148
  const sGroupId = "direct";
138
- const localI18nRef = sap.ui.getCore().getLibraryResourceBundle("sap.fe.core") as ResourceBundle;
149
+ const localI18nRef = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core");
139
150
  const sActionName = localI18nRef.getText("C_COMMON_OBJECT_PAGE_EDIT");
151
+ //If the context is coming from a list binding we pass the flag true to replace the context by the active one
140
152
  const oEditPromise = oOperation
141
- .execute(sGroupId, undefined, CommonUtils.fnOnStrictHandlingFailed.bind(draft, sGroupId, sActionName, oContext.getModel()))
142
- .then(function(oDraftDocumentContext: any) {
153
+ .execute(
154
+ sGroupId,
155
+ undefined,
156
+ CommonUtils.fnOnStrictHandlingFailed.bind(draft, sGroupId, sActionName, oContext.getModel()),
157
+ oContext.getBinding().isA("sap.ui.model.odata.v4.ODataListBinding")
158
+ )
159
+ .then(function (oDraftDocumentContext: any) {
143
160
  return oDraftDocumentContext;
144
161
  });
145
162
  oOperation.getModel().submitBatch(sGroupId);
@@ -169,31 +186,32 @@ function executeDraftActivationAction(oContext: any, oAppComponent: AppComponent
169
186
 
170
187
  if (!oContext.getProperty("IsActiveEntity")) {
171
188
  const oOperation = createOperation(oContext, draftOperations.ACTIVATION, { $$inheritExpandSelect: true });
172
- const localI18nRef = sap.ui.getCore().getLibraryResourceBundle("sap.fe.core") as ResourceBundle;
189
+ const localI18nRef = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core");
173
190
  const sActionName = localI18nRef.getText("C_OP_OBJECT_PAGE_SAVE");
174
191
  return oOperation
175
192
  .execute(
176
193
  sGroupId,
177
194
  bIgnoreEtag,
178
- sGroupId ? CommonUtils.fnOnStrictHandlingFailed.bind(draft, sGroupId, sActionName, oContext.getModel()) : undefined
195
+ sGroupId ? CommonUtils.fnOnStrictHandlingFailed.bind(draft, sGroupId, sActionName, oContext.getModel()) : undefined,
196
+ oContext.getBinding().isA("sap.ui.model.odata.v4.ODataListBinding")
179
197
  ) //3rd parameter<------
180
- .then(function(oActiveDocumentContext: any) {
198
+ .then(function (oActiveDocumentContext: any) {
181
199
  return oActiveDocumentContext;
182
200
  })
183
201
  .catch(
184
202
  //if ACTIVATE action fails then we request either the sideEffects against PREPARE action (if annotated) or the messages as fallback:
185
- function() {
203
+ function () {
186
204
  if (bHasPrepareAction) {
187
205
  const sActionName = getActionName(oContext, draftOperations.PREPARE),
188
206
  oSideEffectsService = oAppComponent.getSideEffectsService(),
189
207
  oBindingParameters = oSideEffectsService.getODataActionSideEffects(sActionName, oContext),
190
208
  aTargetPaths = oBindingParameters && oBindingParameters.pathExpressions;
191
209
  if (aTargetPaths && aTargetPaths.length > 0) {
192
- oSideEffectsService.requestSideEffects(aTargetPaths, oContext).catch(function(oError: any) {
210
+ oSideEffectsService.requestSideEffects(aTargetPaths, oContext).catch(function (oError: any) {
193
211
  Log.error("Error while requesting side effects", oError);
194
212
  });
195
213
  } else {
196
- requestMessages(oContext, oSideEffectsService).catch(function(oError: any) {
214
+ requestMessages(oContext, oSideEffectsService).catch(function (oError: any) {
197
215
  Log.error("Error while requesting messages", oError);
198
216
  });
199
217
  }
@@ -225,10 +243,10 @@ function executeDraftPreparationAction(oContext: Context, groupId?: string) {
225
243
  const sGroupId = groupId || oOperation.getGroupId();
226
244
  return oOperation
227
245
  .execute(sGroupId)
228
- .then(function() {
246
+ .then(function () {
229
247
  return oOperation;
230
248
  })
231
- .catch(function(oError: any) {
249
+ .catch(function (oError: any) {
232
250
  Log.error("Error while executing the operation", oError);
233
251
  });
234
252
  } else {
@@ -279,13 +297,15 @@ function requestMessages(oContext: any, oSideEffectsService: SideEffectsService)
279
297
  function executeDraftDiscardAction(oContext: any): Promise<boolean> {
280
298
  if (!oContext.getProperty("IsActiveEntity")) {
281
299
  const oDiscardOperation = createOperation(oContext, draftOperations.DISCARD);
282
- const localI18nRef = sap.ui.getCore().getLibraryResourceBundle("sap.fe.core") as ResourceBundle;
300
+ const localI18nRef = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core");
283
301
  const sGroupId = "direct";
284
302
  const sActionName = localI18nRef.getText("C_TRANSACTION_HELPER_DRAFT_DISCARD_BUTTON");
303
+ // as the discard action doesnt' send the active version in the response we do not use the replace in cache
285
304
  const oDiscardPromise = oDiscardOperation.execute(
286
305
  sGroupId,
287
306
  undefined,
288
- CommonUtils.fnOnStrictHandlingFailed.bind(draft, sGroupId, sActionName, oContext.getModel())
307
+ CommonUtils.fnOnStrictHandlingFailed.bind(draft, sGroupId, sActionName, oContext.getModel()),
308
+ false
289
309
  );
290
310
  oContext.getModel().submitBatch(sGroupId);
291
311
  return oDiscardPromise;
@@ -293,6 +313,84 @@ function executeDraftDiscardAction(oContext: any): Promise<boolean> {
293
313
  throw new Error("The discard action cannot be executed on an active document");
294
314
  }
295
315
  }
316
+
317
+ /**
318
+ * This method creates a sibling context for a subobject page and calculates a sibling path for all intermediate paths
319
+ * between the object page and the subobject page.
320
+ *
321
+ * @param {object} rootCurrentContext The context for the root of the draft
322
+ * @param {object} rightmostCurrentContext The context of the subobject page
323
+ * @returns {Promise} returns the siblingInformation object
324
+ */
325
+ async function computeSiblingInformation(
326
+ rootCurrentContext: Context,
327
+ rightmostCurrentContext: Context
328
+ ): Promise<SiblingInformation | undefined> {
329
+ if (!rightmostCurrentContext.getPath().startsWith(rootCurrentContext.getPath())) {
330
+ // Wrong usage !!
331
+ Log.error("Cannot compute rightmost sibling context");
332
+ throw new Error("Cannot compute rightmost sibling context");
333
+ }
334
+
335
+ const model = rootCurrentContext.getModel();
336
+ try {
337
+ // //////////////////////////////////////////////////////////////////
338
+ // 1. Find all segments between the root object and the sub-object
339
+ // Example: for root = /Param(aa)/Entity(bb) and rightMost = /Param(aa)/Entity(bb)/_Nav(cc)/_SubNav(dd)
340
+ // ---> ["Param(aa)/Entity(bb)", "_Nav(cc)", "_SubNav(dd)"]
341
+
342
+ // Find all segments in the rightmost path
343
+ const additionalPath = rightmostCurrentContext.getPath().replace(rootCurrentContext.getPath(), "");
344
+ const segments = additionalPath ? additionalPath.substring(1).split("/") : [];
345
+ // First segment is always the full path of the root object, which can contain '/' in case of a parametrized entity
346
+ segments.unshift(rootCurrentContext.getPath().substring(1));
347
+
348
+ // //////////////////////////////////////////////////////////////////
349
+ // 2. Request canonical paths of the sibling entity for eah segment
350
+ // Example: for ["Param(aa)/Entity(bb)", "_Nav(cc)", "_SubNav(dd)"]
351
+ // --> request canonical paths for "Param(aa)/Entity(bb)/SiblingEntity", "Param(aa)/Entity(bb)/_Nav(cc)/SiblingEntity", "Param(aa)/Entity(bb)/_Nav(cc)/_SubNav(dd)/SiblingEntity"
352
+ const oldPaths: string[] = [];
353
+ const newPaths: string[] = [];
354
+ let currentPath = "";
355
+ const canonicalPathPromises = segments.map((segment) => {
356
+ currentPath += `/${segment}`;
357
+ oldPaths.unshift(currentPath);
358
+ const siblingContext = model.bindContext(currentPath + "/SiblingEntity").getBoundContext() as Context;
359
+ return siblingContext.requestCanonicalPath();
360
+ });
361
+
362
+ // //////////////////////////////////////////////////////////////////
363
+ // 3. Reconstruct the full paths from canonical paths (for path mapping)
364
+ // Example: for canonical paths "/Param(aa)/Entity(bb-sibling)", "/Entity2(cc-sibling)", "/Entity3(dd-sibling)"
365
+ // --> ["Param(aa)/Entity(bb-sibling)", "Param(aa)/Entity(bb-sibling)/_Nav(cc-sibling)", "Param(aa)/Entity(bb-sibling)/_Nav(cc-sibling)/_SubNav(dd-sibling)"]
366
+ const canonicalPaths = (await Promise.all(canonicalPathPromises)) as string[];
367
+ let siblingPath = "";
368
+ canonicalPaths.forEach((canonicalPath, index) => {
369
+ if (index !== 0) {
370
+ const navigation = segments[index].replace(/\(.*$/, ""); // Keep only navigation name from the segment, i.e. aaa(xxx) --> aaa
371
+ const keys = canonicalPath.replace(/.*\(/, "("); // Keep only the keys fmro the canonical path, i.e. aaa(xxx) --> (xxx)
372
+ siblingPath += `/${navigation}${keys}`;
373
+ } else {
374
+ siblingPath = canonicalPath; // To manage parametrized entities
375
+ }
376
+ newPaths.unshift(siblingPath);
377
+ });
378
+
379
+ return {
380
+ targetContext: model.bindContext(siblingPath).getBoundContext() as Context, // Create the rightmost sibling context from its path
381
+ pathMapping: oldPaths.map((oldPath, index) => {
382
+ return {
383
+ oldPath,
384
+ newPath: newPaths[index]
385
+ };
386
+ })
387
+ };
388
+ } catch (error) {
389
+ // A canonical path couldn't be resolved (because a sibling doesn't exist)
390
+ return undefined;
391
+ }
392
+ }
393
+
296
394
  /**
297
395
  * Creates a draft document from an existing document.
298
396
  *
@@ -314,7 +412,7 @@ function executeDraftDiscardAction(oContext: any): Promise<boolean> {
314
412
  * @private
315
413
  * @ui5-restricted
316
414
  */
317
- function createDraftFromActiveDocument(
415
+ async function createDraftFromActiveDocument(
318
416
  oContext: any,
319
417
  oAppComponent: AppComponent,
320
418
  mParameters: {
@@ -326,7 +424,7 @@ function createDraftFromActiveDocument(
326
424
  }
327
425
  ) {
328
426
  const mParam = mParameters || {},
329
- localI18nRef = sap.ui.getCore().getLibraryResourceBundle("sap.fe.core") as ResourceBundle,
427
+ localI18nRef = (Core as CoreEx).getLibraryResourceBundle("sap.fe.core"),
330
428
  bRunPreserveChangesFlow =
331
429
  typeof mParam.bPreserveChanges === "undefined" || (typeof mParam.bPreserveChanges === "boolean" && mParam.bPreserveChanges); //default true
332
430
 
@@ -344,11 +442,11 @@ function createDraftFromActiveDocument(
344
442
  let oResourceBundle: ResourceBundle;
345
443
 
346
444
  return ((mParameters.oView.getModel("sap.fe.i18n") as ResourceModel).getResourceBundle() as Promise<ResourceBundle>)
347
- .then(function(_oResourceBundle: any) {
445
+ .then(function (_oResourceBundle: any) {
348
446
  oResourceBundle = _oResourceBundle;
349
447
  return draftDataContext.requestObject();
350
448
  })
351
- .then(function(draftAdminData: any) {
449
+ .then(function (draftAdminData: any) {
352
450
  if (draftAdminData) {
353
451
  // remove all unbound transition messages as we show a special dialog
354
452
  messageHandling.removeUnboundTransitionMessages();
@@ -371,7 +469,7 @@ function createDraftFromActiveDocument(
371
469
  sInfo,
372
470
  sEntitySet
373
471
  );
374
- return showMessageBox(sUnsavedChangesMsg).then(function() {
472
+ return showMessageBox(sUnsavedChangesMsg).then(function () {
375
473
  return executeDraftEditAction(oContext, false);
376
474
  });
377
475
  }
@@ -382,7 +480,7 @@ function createDraftFromActiveDocument(
382
480
  }
383
481
 
384
482
  function showMessageBox(sUnsavedChangesMsg: any) {
385
- return new Promise(function(resolve: (value: any) => void, reject: (reason?: any) => void) {
483
+ return new Promise(function (resolve: (value: any) => void, reject: (reason?: any) => void) {
386
484
  const oDialog = new Dialog({
387
485
  title: localI18nRef.getText("C_DRAFT_OBJECT_PAGE_WARNING"),
388
486
  state: "Warning",
@@ -392,19 +490,19 @@ function createDraftFromActiveDocument(
392
490
  beginButton: new Button({
393
491
  text: localI18nRef.getText("C_COMMON_OBJECT_PAGE_EDIT"),
394
492
  type: "Emphasized",
395
- press: function() {
493
+ press: function () {
396
494
  oDialog.close();
397
495
  resolve(true);
398
496
  }
399
497
  }),
400
498
  endButton: new Button({
401
499
  text: localI18nRef.getText("C_COMMON_OBJECT_PAGE_CANCEL"),
402
- press: function() {
500
+ press: function () {
403
501
  oDialog.close();
404
502
  reject("Draft creation aborted for document: " + oContext.getPath());
405
503
  }
406
504
  }),
407
- afterClose: function() {
505
+ afterClose: function () {
408
506
  oDialog.destroy();
409
507
  }
410
508
  });
@@ -417,50 +515,64 @@ function createDraftFromActiveDocument(
417
515
  return Promise.reject(new Error("Binding context to active document is required"));
418
516
  }
419
517
 
420
- return Promise.resolve(
421
- mParam.fnBeforeCreateDraftFromActiveDocument
422
- ? mParam.fnBeforeCreateDraftFromActiveDocument(oContext, bRunPreserveChangesFlow)
423
- : true
424
- )
425
- .then(function(bExecute: any) {
426
- if (!bExecute) {
427
- throw new Error("Draft creation was aborted by extension for document: " + oContext.getPath());
428
- }
429
- return executeDraftEditAction(oContext, bRunPreserveChangesFlow).catch(function(oResponse: any) {
430
- //Only call back if error 409
431
- if (bRunPreserveChangesFlow && oResponse.status === 409) {
432
- return Promise.resolve(
433
- mParam.fnWhenDecisionToOverwriteDocumentIsRequired ? mParam.fnWhenDecisionToOverwriteDocumentIsRequired() : true
434
- ).then(overwriteOnDemand);
518
+ const bExecute = mParam.fnBeforeCreateDraftFromActiveDocument
519
+ ? mParam.fnBeforeCreateDraftFromActiveDocument(oContext, bRunPreserveChangesFlow)
520
+ : true;
521
+
522
+ if (!bExecute) {
523
+ throw new Error("Draft creation was aborted by extension for document: " + oContext.getPath());
524
+ }
525
+ let openingSiblingContext = false;
526
+ try {
527
+ let oDraftContext: Context | null = null;
528
+ try {
529
+ oDraftContext = await draft.executeDraftEditAction(oContext, bRunPreserveChangesFlow);
530
+ } catch (oResponse: any) {
531
+ //Only call back if error 409
532
+ if (bRunPreserveChangesFlow && oResponse.status === 409) {
533
+ messageHandling.removeUnboundTransitionMessages();
534
+ if (ActivitySync.isCollaborationEnabled(mParameters.oView)) {
535
+ const siblingInfo = await draft.computeSiblingInformation(oContext, oContext);
536
+ const siblingContext = (mParameters.oView.getController() as any)._routing._createBindingContext(
537
+ siblingInfo?.targetContext.getPath(),
538
+ oContext.getModel()
539
+ );
540
+ openingSiblingContext = true;
541
+ return siblingContext;
435
542
  } else {
543
+ oDraftContext = await overwriteOnDemand(
544
+ mParam.fnWhenDecisionToOverwriteDocumentIsRequired ? mParam.fnWhenDecisionToOverwriteDocumentIsRequired() : true
545
+ );
546
+ }
547
+ } else {
548
+ if (!(oResponse && oResponse.canceled)) {
436
549
  throw new Error(oResponse);
437
550
  }
438
- });
439
- })
440
- .then(function(oDraftContext: any) {
441
- return Promise.resolve(
442
- mParam.fnAfterCreateDraftFromActiveDocument
443
- ? mParam.fnAfterCreateDraftFromActiveDocument(oContext, oDraftContext)
444
- : oDraftContext
445
- );
446
- })
447
- .then(function(oDraftContext: any) {
551
+ }
552
+ }
553
+ if (openingSiblingContext) {
554
+ return oDraftContext;
555
+ }
556
+
557
+ oDraftContext =
558
+ oDraftContext && mParam.fnAfterCreateDraftFromActiveDocument
559
+ ? mParam.fnAfterCreateDraftFromActiveDocument(oContext, oDraftContext)
560
+ : oDraftContext;
561
+
562
+ if (oDraftContext) {
448
563
  const sEditActionName = getActionName(oDraftContext, draftOperations.EDIT);
449
564
  const oSideEffects = oAppComponent.getSideEffectsService().getODataActionSideEffects(sEditActionName, oDraftContext);
450
565
  if (oSideEffects?.triggerActions?.length) {
451
- return oAppComponent
452
- .getSideEffectsService()
453
- .requestSideEffectsForODataAction(oSideEffects, oDraftContext)
454
- .then(() => {
455
- return oDraftContext;
456
- });
566
+ await oAppComponent.getSideEffectsService().requestSideEffectsForODataAction(oSideEffects, oDraftContext);
567
+
568
+ return oDraftContext;
457
569
  } else {
458
570
  return oDraftContext;
459
571
  }
460
- })
461
- .catch(function(exc: any) {
462
- return Promise.reject(exc);
463
- });
572
+ }
573
+ } catch (exc: any) {
574
+ return Promise.reject(exc);
575
+ }
464
576
  }
465
577
  /**
466
578
  * Creates an active document from a draft document.
@@ -491,7 +603,7 @@ function activateDocument(
491
603
  return Promise.reject(new Error("Binding context to draft document is required"));
492
604
  }
493
605
  return Promise.resolve(mParam.fnBeforeActivateDocument ? mParam.fnBeforeActivateDocument(oContext) : true)
494
- .then(function(bExecute: any) {
606
+ .then(function (bExecute: any) {
495
607
  if (!bExecute) {
496
608
  return Promise.reject(new Error("Activation of the document was aborted by extension for document: " + oContext.getPath()));
497
609
  }
@@ -509,19 +621,19 @@ function activateDocument(
509
621
  const oActivatePromise = executeDraftActivationAction(oContext, oAppComponent, sBatchGroup);
510
622
 
511
623
  return Promise.all([oPreparePromise, oActivatePromise])
512
- .then(function(values: [any, any]) {
624
+ .then(function (values: [any, any]) {
513
625
  return values[1];
514
626
  })
515
- .catch(function(exc: any) {
627
+ .catch(function (exc: any) {
516
628
  return Promise.reject(exc);
517
629
  });
518
630
  })
519
- .then(function(oActiveDocumentContext: any) {
631
+ .then(function (oActiveDocumentContext: any) {
520
632
  return Promise.resolve(
521
633
  mParam.fnAfterActivateDocument ? mParam.fnAfterActivateDocument(oContext, oActiveDocumentContext) : oActiveDocumentContext
522
634
  );
523
635
  })
524
- .catch(function(exc: any) {
636
+ .catch(function (exc: any) {
525
637
  return Promise.reject(exc);
526
638
  });
527
639
  }
@@ -548,10 +660,10 @@ function deleteDraft(oContext: any): Promise<boolean> {
548
660
  return oContext
549
661
  .getBinding()
550
662
  .resetChanges()
551
- .then(function() {
663
+ .then(function () {
552
664
  return oContext.delete();
553
665
  })
554
- .catch(function(error: any) {
666
+ .catch(function (error: any) {
555
667
  return Promise.reject(error);
556
668
  });
557
669
  } else {
@@ -563,4 +675,145 @@ function deleteDraft(oContext: any): Promise<boolean> {
563
675
  }
564
676
  }
565
677
 
678
+ /**
679
+ * @param fnProcessFunction
680
+ * @param fnCancelFunction
681
+ * @param oContext
682
+ * @param oController
683
+ * @param bSkipBindingToView
684
+ * @param navigationType
685
+ */
686
+ function processDataLossOrDraftDiscardConfirmation(
687
+ fnProcessFunction: any,
688
+ fnCancelFunction: any,
689
+ oContext: any,
690
+ oController: any,
691
+ bSkipBindingToView?: boolean,
692
+ navigationType: NavigationType = NavigationType.BackNavigation
693
+ ) {
694
+ const oModel = oContext.getModel();
695
+ const draftDataContext = oModel.bindContext(oContext.getPath() + "/DraftAdministrativeData").getBoundContext();
696
+
697
+ const collaborationConnected = ActivitySync.isConnected(oController.getView());
698
+ const processFunctionForDrafts = !collaborationConnected
699
+ ? fnProcessFunction
700
+ : function (...args: any[]) {
701
+ ActivitySync.disconnect(oController.getView());
702
+ fnProcessFunction.apply(null, ...args);
703
+ };
704
+
705
+ if (
706
+ oContext &&
707
+ oContext.getObject() &&
708
+ (!oContext.getObject().DraftAdministrativeData || oContext.getObject().IsActiveEntity === true)
709
+ ) {
710
+ fnProcessFunction();
711
+ } else {
712
+ draftDataContext
713
+ .requestObject()
714
+ .then(function (draftAdminData: any) {
715
+ if (draftAdminData) {
716
+ if (oController.getAppComponent().getRootViewController().isFclEnabled()) {
717
+ // The application is running in FCL mode so in this case we fall back to
718
+ // the old logic since the dirty state handling is not properly working
719
+ // for FCL.
720
+ if (!(draftAdminData.CreationDateTime === draftAdminData.LastChangeDateTime)) {
721
+ DataLossOrDraftDiscardHandler.performAfterDiscardorKeepDraft(
722
+ processFunctionForDrafts,
723
+ fnCancelFunction,
724
+ oController,
725
+ bSkipBindingToView
726
+ );
727
+ } else {
728
+ processFunctionForDrafts();
729
+ }
730
+ } else {
731
+ if (!oContext.getObject().HasActiveEntity) {
732
+ // There is no active entity so we are editing either newly created data or
733
+ // a draft which has never been saved to active version
734
+ // Since we want to react differently in the two situations, we have to check the
735
+ // dirty state
736
+ if (EditState.isEditStateDirty()) {
737
+ // In this case data is being newly created and then we always want to
738
+ // show the dataloss dialog on navigation
739
+ DataLossOrDraftDiscardHandler.performAfterDiscardorKeepDraft(
740
+ processFunctionForDrafts,
741
+ fnCancelFunction,
742
+ oController,
743
+ bSkipBindingToView
744
+ );
745
+ } else {
746
+ // We are editing a draft which has been created earlier but never saved to active
747
+ // version and since the edit state is not dirty, there have been no user changes
748
+ // so in this case we want to silently navigate and do nothing
749
+ processFunctionForDrafts();
750
+ }
751
+ } else {
752
+ // We are editing a draft for an existing active entity
753
+ if (draftAdminData.CreationDateTime === draftAdminData.LastChangeDateTime) {
754
+ // The CreationDateTime and LastChangeDateTime are equal, so this draft was
755
+ // never saved before, hence we're currently editing a newly created draft for
756
+ // an existing active entity for the first time.
757
+ // Also there have so far been no changes made to the draft and in this
758
+ // case we want to silently navigate and delete the draft in case of a back
759
+ // navigation but in case of a forward navigation we want to silently keep it!
760
+ if (navigationType === NavigationType.BackNavigation) {
761
+ const mParameters = {
762
+ skipDiscardPopover: true
763
+ };
764
+ oController.editFlow
765
+ .cancelDocument(oContext, mParameters)
766
+ .then(() => {
767
+ processFunctionForDrafts();
768
+ })
769
+ .catch((error: any) => {
770
+ Log.error("Error while canceling the document", error);
771
+ });
772
+ } else {
773
+ // In case of a forward navigation we silently keep the draft and only
774
+ // execute the followup function.
775
+ processFunctionForDrafts();
776
+ }
777
+ } else {
778
+ // The CreationDateTime and LastChangeDateTime are NOT equal, so we are currently editing
779
+ // an existing draft and need to distinguish depending on if any changes
780
+ // have been made in the current editing session or not
781
+ if (EditState.isEditStateDirty()) {
782
+ // Changes have been made in the current editing session so we want
783
+ // to show the dataloss dialog and let the user decide
784
+ DataLossOrDraftDiscardHandler.performAfterDiscardorKeepDraft(
785
+ processFunctionForDrafts,
786
+ fnCancelFunction,
787
+ oController,
788
+ bSkipBindingToView
789
+ );
790
+ } else {
791
+ // The user started editing the existing draft but did not make any changes
792
+ // in the current editing session, so in this case we do not want
793
+ // to show the dataloss dialog but just keep the draft
794
+ processFunctionForDrafts();
795
+ }
796
+ }
797
+ }
798
+ }
799
+ } else {
800
+ fnProcessFunction();
801
+ }
802
+ })
803
+ .catch(function (oError: any) {
804
+ Log.error("Cannot retrieve draftDataContext information", oError);
805
+ });
806
+ }
807
+ }
808
+
809
+ const draft = {
810
+ createDraftFromActiveDocument: createDraftFromActiveDocument,
811
+ activateDocument: activateDocument,
812
+ deleteDraft: deleteDraft,
813
+ executeDraftEditAction: executeDraftEditAction,
814
+ computeSiblingInformation: computeSiblingInformation,
815
+ processDataLossOrDraftDiscardConfirmation: processDataLossOrDraftDiscardConfirmation,
816
+ NavigationType: NavigationType
817
+ };
818
+
566
819
  export default draft;