@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,783 @@
1
+ import ControllerExtension from "sap/ui/core/mvc/ControllerExtension";
2
+ import OverrideExecution from "sap/ui/core/mvc/OverrideExecution";
3
+ import TransactionHelper from "sap/fe/core/TransactionHelper";
4
+ import Log from "sap/base/Log";
5
+ import CommonUtils from "sap/fe/core/CommonUtils";
6
+ import BusyLocker from "sap/fe/core/BusyLocker";
7
+ import FELibrary from "sap/fe/core/library";
8
+ import EditState from "sap/fe/core/helpers/EditState";
9
+ import { Extensible, Final, Override, Private, Public, UI5Class } from "sap/fe/core/helpers/ClassSupport";
10
+ import ControllerExtensionMetadata from "sap/fe/core/controllerextensions/ControllerExtensionMetadata";
11
+ import AppComponent from "sap/fe/core/AppComponent";
12
+ import PageController from "sap/fe/core/PageController";
13
+ import JSONModel from "sap/ui/model/json/JSONModel";
14
+ import Table from "sap/ui/mdc/Table";
15
+ import Dialog from "sap/m/Dialog";
16
+ import Button from "sap/m/Button";
17
+ import Text from "sap/m/Text";
18
+ import Model from "sap/ui/model/Model";
19
+ import sticky from "sap/fe/core/actions/sticky";
20
+ import View from "sap/ui/core/mvc/View";
21
+ import { send } from "sap/fe/core/actions/collaboration/ActivitySync";
22
+ import { Activity } from "sap/fe/core/actions/collaboration/CollaborationCommon";
23
+ import Context from "sap/ui/model/odata/v4/Context";
24
+
25
+ const ProgrammingModel = FELibrary.ProgrammingModel,
26
+ DraftStatus = FELibrary.DraftStatus,
27
+ EditMode = FELibrary.EditMode,
28
+ CreationMode = FELibrary.CreationMode;
29
+
30
+ @UI5Class("sap.fe.core.controllerextensions.InternalEditFlow", ControllerExtensionMetadata)
31
+ class InternalEditFlow extends ControllerExtension {
32
+ private base!: PageController;
33
+ private _oAppComponent!: AppComponent;
34
+ private _pTasks: any;
35
+ private oActionPromise?: Promise<any>;
36
+ private _oTransactionHelper?: TransactionHelper;
37
+ private fnDirtyStateProvider?: Function;
38
+ private fnHandleSessionTimeout?: Function;
39
+ private fnStickyDiscardAfterNavigation?: Function;
40
+ @Override()
41
+ onInit() {
42
+ this._oAppComponent = this.base.getAppComponent();
43
+ }
44
+
45
+ /**
46
+ * Override to set the creation mode.
47
+ *
48
+ * @param bCreationMode
49
+ * @memberof sap.fe.core.controllerextensions.InternalEditFlow
50
+ * @alias sap.fe.core.controllerextensions.InternalEditFlow#setCreationMode
51
+ * @since 1.90.0
52
+ */
53
+ @Private
54
+ @Extensible(OverrideExecution.After)
55
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
56
+ setCreationMode(bCreationMode: boolean) {
57
+ // to be overridden
58
+ }
59
+ @Public
60
+ @Final
61
+ createMultipleDocuments(oListBinding: any, aData: any, bCreateAtEnd: any, bFromCopyPaste: any, beforeCreateCallBack: any) {
62
+ const transactionHelper = this.getTransactionHelper(),
63
+ oLockObject = this.getGlobalUIModel(),
64
+ oResourceBundle = (this.getView().getController() as any).oResourceBundle;
65
+
66
+ BusyLocker.lock(oLockObject);
67
+ return this.syncTask()
68
+ .then(function() {
69
+ const onBeforeCreatePromise = beforeCreateCallBack
70
+ ? beforeCreateCallBack({ contextPath: oListBinding && oListBinding.getPath() })
71
+ : Promise.resolve();
72
+ return onBeforeCreatePromise;
73
+ })
74
+ .then(() => {
75
+ const oModel = oListBinding.getModel(),
76
+ oMetaModel = oModel.getMetaModel();
77
+ let sMetaPath: string;
78
+
79
+ if (oListBinding.getContext()) {
80
+ sMetaPath = oMetaModel.getMetaPath(oListBinding.getContext().getPath() + "/" + oListBinding.getPath());
81
+ } else {
82
+ sMetaPath = oMetaModel.getMetaPath(oListBinding.getPath());
83
+ }
84
+
85
+ this.handleCreateEvents(oListBinding);
86
+
87
+ // Iterate on all items and store the corresponding creation promise
88
+ const aCreationPromises = aData.map((mPropertyValues: any) => {
89
+ const mParameters: any = { data: {} };
90
+
91
+ mParameters.keepTransientContextOnFailed = false; // currently not fully supported
92
+ mParameters.busyMode = "None";
93
+ mParameters.creationMode = CreationMode.CreationRow;
94
+ mParameters.parentControl = this.getView();
95
+ mParameters.createAtEnd = bCreateAtEnd;
96
+
97
+ // Remove navigation properties as we don't support deep create
98
+ for (const sPropertyPath in mPropertyValues) {
99
+ const oProperty = oMetaModel.getObject(sMetaPath + "/" + sPropertyPath);
100
+ if (oProperty && oProperty.$kind !== "NavigationProperty" && mPropertyValues[sPropertyPath]) {
101
+ mParameters.data[sPropertyPath] = mPropertyValues[sPropertyPath];
102
+ }
103
+ }
104
+
105
+ return transactionHelper.createDocument(
106
+ oListBinding,
107
+ mParameters,
108
+ oResourceBundle,
109
+ this.getMessageHandler(),
110
+ bFromCopyPaste,
111
+ this.getView()
112
+ );
113
+ });
114
+
115
+ return Promise.all(aCreationPromises);
116
+ })
117
+ .then(function(aContexts: any) {
118
+ // transient contexts are reliably removed once oNewContext.created() is resolved
119
+ return Promise.all(
120
+ aContexts.map(function(oNewContext: any) {
121
+ return oNewContext.created();
122
+ })
123
+ );
124
+ })
125
+ .then(() => {
126
+ const oBindingContext = this.getView().getBindingContext();
127
+
128
+ // if there are transient contexts, we must avoid requesting side effects
129
+ // this is avoid a potential list refresh, there could be a side effect that refreshes the list binding
130
+ // if list binding is refreshed, transient contexts might be lost
131
+ if (!CommonUtils.hasTransientContext(oListBinding)) {
132
+ this._oAppComponent
133
+ .getSideEffectsService()
134
+ .requestSideEffectsForNavigationProperty(oListBinding.getPath(), oBindingContext as Context);
135
+ }
136
+ })
137
+ .catch(function(err: any) {
138
+ Log.error("Error while creating multiple documents.");
139
+ return Promise.reject(err);
140
+ })
141
+ .finally(function() {
142
+ BusyLocker.unlock(oLockObject);
143
+ });
144
+ }
145
+ @Public
146
+ @Final
147
+ deleteMultipleDocuments(aContexts: any, mParameters: any) {
148
+ const oRoutingListener = this.getRoutingListener(),
149
+ oLockObject = this.getGlobalUIModel();
150
+ const oTable = this.getView().byId(mParameters.controlId) as Table;
151
+ if (!oTable || !oTable.isA("sap.ui.mdc.Table")) {
152
+ throw new Error("parameter controlId missing or incorrect");
153
+ }
154
+ const oListBinding = oTable.getRowBinding() as any;
155
+ mParameters.bFindActiveContexts = true;
156
+ BusyLocker.lock(oLockObject);
157
+ return this.deleteDocumentTransaction(aContexts, mParameters)
158
+ .then(() => {
159
+ let oResult;
160
+
161
+ // Multiple object deletion is triggered from a list
162
+ // First clear the selection in the table as it's not valid any more
163
+ (oTable as any).clearSelection();
164
+
165
+ // Then refresh the list-binding (LR), or require side-effects (OP)
166
+ const oBindingContext = this.getView().getBindingContext();
167
+ if (oListBinding.isRoot()) {
168
+ // keep promise chain pending until refresh of listbinding is completed
169
+ oResult = new Promise<void>(resolve => {
170
+ oListBinding.attachEventOnce("dataReceived", function() {
171
+ resolve();
172
+ });
173
+ });
174
+ oListBinding.refresh();
175
+ } else if (oBindingContext) {
176
+ // if there are transient contexts, we must avoid requesting side effects
177
+ // this is avoid a potential list refresh, there could be a side effect that refreshes the list binding
178
+ // if list binding is refreshed, transient contexts might be lost
179
+ if (!CommonUtils.hasTransientContext(oListBinding)) {
180
+ this._oAppComponent
181
+ .getSideEffectsService()
182
+ .requestSideEffectsForNavigationProperty(oListBinding.getPath(), oBindingContext as Context);
183
+ }
184
+ }
185
+
186
+ // deleting at least one object should also set the UI to dirty
187
+ EditState.setEditStateDirty();
188
+
189
+ send(this.getView(), Activity.Delete, aContexts);
190
+
191
+ // Finally, check if the current state can be impacted by the deletion, i.e. if there's
192
+ // an OP displaying a deleted object. If yes navigate back to dismiss the OP
193
+ for (let index = 0; index < aContexts.length; index++) {
194
+ if (oRoutingListener.isCurrentStateImpactedBy(aContexts[index])) {
195
+ oRoutingListener.navigateBackFromContext(aContexts[index]);
196
+ break;
197
+ }
198
+ }
199
+
200
+ return oResult;
201
+ })
202
+ .catch(function(oError: any) {
203
+ Log.error("Error while deleting the document(s)", oError);
204
+ })
205
+ .finally(function() {
206
+ BusyLocker.unlock(oLockObject);
207
+ });
208
+ }
209
+
210
+ /**
211
+ * Decides if a document is to be shown in display or edit mode.
212
+ *
213
+ * @function
214
+ * @name _computeEditMode
215
+ * @memberof sap.fe.core.controllerextensions.InternalEditFlow
216
+ * @param {sap.ui.model.odata.v4.Context} oContext The context to be displayed or edited
217
+ * @returns {Promise} Promise resolves once the edit mode is computed
218
+ */
219
+
220
+ @Public
221
+ @Final
222
+ computeEditMode(oContext: any) {
223
+ const sCustomAction = this.getInternalModel().getProperty("/sCustomAction");
224
+ return Promise.resolve(
225
+ (() => {
226
+ const sProgrammingModel = this.getProgrammingModel(oContext);
227
+
228
+ if (sProgrammingModel === ProgrammingModel.Draft) {
229
+ this.setDraftStatus(DraftStatus.Clear);
230
+
231
+ return oContext
232
+ .requestObject("IsActiveEntity")
233
+ .then((bIsActiveEntity: any) => {
234
+ if (bIsActiveEntity === false) {
235
+ // in case the document is draft set it in edit mode
236
+ this.setEditMode(EditMode.Editable);
237
+ return oContext.requestObject("HasActiveEntity").then((bHasActiveEntity: any) => {
238
+ this.setEditMode(undefined, !bHasActiveEntity);
239
+ });
240
+ } else {
241
+ // active document, stay on display mode
242
+ this.setEditMode(EditMode.Display, false);
243
+ }
244
+ })
245
+ .catch(function(oError: any) {
246
+ Log.error("Error while determining the editMode for draft", oError);
247
+ throw oError;
248
+ });
249
+ } else if (sProgrammingModel === ProgrammingModel.Sticky) {
250
+ if (sCustomAction && sCustomAction !== "" && this._hasNewActionForSticky(oContext, this.getView(), sCustomAction)) {
251
+ this.getTransactionHelper()._bCreateMode = true;
252
+ this.getTransactionHelper().handleDocumentModifications();
253
+ this.setEditMode(EditMode.Editable, true);
254
+ EditState.setEditStateDirty();
255
+ this.handleStickyOn(oContext);
256
+ this.getInternalModel().setProperty("/sCustomAction", "");
257
+ }
258
+ }
259
+ })()
260
+ );
261
+ }
262
+
263
+ /**
264
+ * Sets the edit mode.
265
+ *
266
+ * @param {string} sEditMode
267
+ * @param {boolean} bCreationMode CreateMode flag to identify the creation mode
268
+ */
269
+ @Public
270
+ @Final
271
+ setEditMode(sEditMode?: string, bCreationMode: boolean = false) {
272
+ // at this point of time it's not meant to release the edit flow for freestyle usage therefore we can
273
+ // rely on the global UI model to exist
274
+ const oGlobalModel = this.getGlobalUIModel();
275
+
276
+ if (sEditMode) {
277
+ oGlobalModel.setProperty("/editMode", sEditMode, undefined, true);
278
+ oGlobalModel.setProperty("/isEditable", sEditMode === "Editable", undefined, true);
279
+ }
280
+
281
+ if (bCreationMode !== undefined) {
282
+ // Since setCreationMode is public in EditFlow and can be overriden, make sure to call it via the controller
283
+ // to ensure any overrides are taken into account
284
+ this.setCreationMode(bCreationMode);
285
+ }
286
+ }
287
+
288
+ @Public
289
+ @Final
290
+ setDraftStatus(sDraftState: any) {
291
+ // at this point of time it's not meant to release the edit flow for freestyle usage therefore we can
292
+ // rely on the global UI model to exist
293
+ (this.base.getView().getModel("ui") as JSONModel).setProperty("/draftStatus", sDraftState, undefined, true);
294
+ }
295
+
296
+ @Public
297
+ @Final
298
+ getRoutingListener() {
299
+ // at this point of time it's not meant to release the edit flow for FPM custom pages and the routing
300
+ // listener is not yet public therefore keep the logic here for now
301
+
302
+ if (this.base._routing) {
303
+ return this.base._routing;
304
+ } else {
305
+ throw new Error("Edit Flow works only with a given routing listener");
306
+ }
307
+ }
308
+
309
+ @Public
310
+ @Final
311
+ getGlobalUIModel(): JSONModel {
312
+ // at this point of time it's not meant to release the edit flow for freestyle usage therefore we can
313
+ // rely on the global UI model to exist
314
+ return this.base.getView().getModel("ui") as JSONModel;
315
+ }
316
+
317
+ /**
318
+ * Performs a task in sync with other tasks created via this function.
319
+ * Returns the promise chain of the task.
320
+ *
321
+ * @function
322
+ * @name sap.fe.core.controllerextensions.EditFlow#syncTask
323
+ * @memberof sap.fe.core.controllerextensions.EditFlow
324
+ * @static
325
+ * @param {Promise|Function} [vTask] Optional, a promise or function to be executed synchronously
326
+ * @returns {Promise} Promise resolves once the task is completed
327
+ *
328
+ * @ui5-restricted
329
+ * @final
330
+ */
331
+ @Public
332
+ @Final
333
+ syncTask(vTask?: Function | Promise<any>) {
334
+ let fnNewTask;
335
+ if (vTask instanceof Promise) {
336
+ fnNewTask = function() {
337
+ return vTask;
338
+ };
339
+ } else if (typeof vTask === "function") {
340
+ fnNewTask = vTask;
341
+ }
342
+
343
+ this._pTasks = this._pTasks || Promise.resolve();
344
+ if (!!fnNewTask) {
345
+ this._pTasks = this._pTasks.then(fnNewTask).catch(function() {
346
+ return Promise.resolve();
347
+ });
348
+ }
349
+
350
+ return this._pTasks;
351
+ }
352
+
353
+ @Public
354
+ @Final
355
+ getProgrammingModel(oContext: any): typeof ProgrammingModel {
356
+ return this.getTransactionHelper().getProgrammingModel(oContext);
357
+ }
358
+
359
+ @Public
360
+ @Final
361
+ deleteDocumentTransaction(oContext: any, mParameters: any) {
362
+ const oResourceBundle = (this.getView().getController() as any).oResourceBundle,
363
+ transactionHelper = this.getTransactionHelper();
364
+
365
+ mParameters = mParameters || {};
366
+
367
+ // TODO: this setting and removing of contexts shouldn't be in the transaction helper at all
368
+ // for the time being I kept it and provide the internal model context to not break something
369
+ mParameters.internalModelContext = mParameters.controlId
370
+ ? sap.ui
371
+ .getCore()
372
+ .byId(mParameters.controlId)
373
+ ?.getBindingContext("internal")
374
+ : null;
375
+
376
+ return this.syncTask()
377
+ .then(
378
+ transactionHelper.deleteDocument.bind(transactionHelper, oContext, mParameters, oResourceBundle, this.getMessageHandler())
379
+ )
380
+ .then(() => {
381
+ this.getInternalModel().setProperty("/sessionOn", false);
382
+ })
383
+ .catch(function(oError: any) {
384
+ return Promise.reject(oError);
385
+ });
386
+ }
387
+
388
+ /**
389
+ * Handles the create event: shows messages and in case of a draft, updates the draft indicator.
390
+ *
391
+ * @memberof sap.fe.core.controllerextensions.EditFlow
392
+ * @param {object} oBinding OData list binding object
393
+ */
394
+ @Public
395
+ @Final
396
+ handleCreateEvents(oBinding: any) {
397
+ const transactionHelper = this.getTransactionHelper();
398
+
399
+ this.setDraftStatus(DraftStatus.Clear);
400
+
401
+ oBinding = (oBinding.getBinding && oBinding.getBinding()) || oBinding;
402
+ const sProgrammingModel = this.getProgrammingModel(oBinding);
403
+
404
+ oBinding.attachEvent("createSent", () => {
405
+ transactionHelper.handleDocumentModifications();
406
+ if (sProgrammingModel === ProgrammingModel.Draft) {
407
+ this.setDraftStatus(DraftStatus.Saving);
408
+ }
409
+ });
410
+ oBinding.attachEvent("createCompleted", (oEvent: any) => {
411
+ const bSuccess = oEvent.getParameter("success");
412
+ if (sProgrammingModel === ProgrammingModel.Draft) {
413
+ this.setDraftStatus(bSuccess ? DraftStatus.Saved : DraftStatus.Clear);
414
+ }
415
+ this.getMessageHandler().showMessageDialog();
416
+ });
417
+ }
418
+
419
+ @Public
420
+ @Final
421
+ getTransactionHelper() {
422
+ if (!this._oTransactionHelper) {
423
+ // currently also the transaction helper is locking therefore passing lock object
424
+ this._oTransactionHelper = new TransactionHelper(this._oAppComponent, this.getGlobalUIModel());
425
+ }
426
+
427
+ return this._oTransactionHelper;
428
+ }
429
+
430
+ @Public
431
+ @Final
432
+ getInternalModel(): JSONModel {
433
+ return this.base.getView().getModel("internal") as JSONModel;
434
+ }
435
+
436
+ /**
437
+ * Creates a new promise to wait for an action to be executed
438
+ * @function
439
+ * @name _createActionPromise
440
+ * @memberof sap.fe.core.controllerextensions.EditFlow
441
+ *
442
+ * @returns {Function} The resolver function which can be used to externally resolve the promise
443
+ */
444
+
445
+ @Public
446
+ @Final
447
+ createActionPromise(sActionName: any, sControlId: any) {
448
+ let fResolver, fRejector;
449
+ this.oActionPromise = new Promise((resolve, reject) => {
450
+ fResolver = resolve;
451
+ fRejector = reject;
452
+ }).then((oResponse: any) => {
453
+ return Object.assign({ controlId: sControlId }, this.getActionResponseDataAndKeys(sActionName, oResponse));
454
+ });
455
+ return { fResolver: fResolver, fRejector: fRejector };
456
+ }
457
+
458
+ /**
459
+ * Gets the getCurrentActionPromise object.
460
+ *
461
+ * @function
462
+ * @name _getCurrentActionPromise
463
+ * @memberof sap.fe.core.controllerextensions.EditFlow
464
+ *
465
+ * @returns {Promise} Returns the promise
466
+ */
467
+ @Public
468
+ @Final
469
+ getCurrentActionPromise() {
470
+ return this.oActionPromise;
471
+ }
472
+
473
+ @Public
474
+ @Final
475
+ deleteCurrentActionPromise() {
476
+ this.oActionPromise = undefined;
477
+ }
478
+
479
+ /**
480
+ * @function
481
+ * @name getActionResponseDataAndKeys
482
+ * @memberof sap.fe.core.controllerextensions.EditFlow
483
+ * @param {string} sActionName The name of the action that is executed
484
+ * @param {object} oResponse The bound action's response data or response context
485
+ * @returns {object} Object with data and names of the key fields of the response
486
+ */
487
+ @Public
488
+ @Final
489
+ getActionResponseDataAndKeys(sActionName: string, oResponse: any) {
490
+ if (Array.isArray(oResponse)) {
491
+ if (oResponse.length === 1) {
492
+ oResponse = oResponse[0];
493
+ } else {
494
+ return null;
495
+ }
496
+ }
497
+ if (!oResponse) {
498
+ return null;
499
+ }
500
+ const oView = this.getView(),
501
+ oMetaModel = (oView.getModel().getMetaModel() as any).getData(),
502
+ sActionReturnType =
503
+ oMetaModel && oMetaModel[sActionName] && oMetaModel[sActionName][0] && oMetaModel[sActionName][0].$ReturnType
504
+ ? oMetaModel[sActionName][0].$ReturnType.$Type
505
+ : null,
506
+ aKey = sActionReturnType && oMetaModel[sActionReturnType] ? oMetaModel[sActionReturnType].$Key : null;
507
+
508
+ return {
509
+ oData: oResponse.getObject(),
510
+ keys: aKey
511
+ };
512
+ }
513
+
514
+ @Public
515
+ @Final
516
+ getMessageHandler() {
517
+ // at this point of time it's not meant to release the edit flow for FPM custom pages therefore keep
518
+ // the logic here for now
519
+
520
+ if (this.base.messageHandler) {
521
+ return this.base.messageHandler;
522
+ } else {
523
+ throw new Error("Edit Flow works only with a given message handler");
524
+ }
525
+ }
526
+
527
+ @Public
528
+ @Final
529
+ handleStickyOn(oContext: any) {
530
+ const oAppComponent = CommonUtils.getAppComponent(this.getView());
531
+
532
+ try {
533
+ if (oAppComponent === undefined || oContext === undefined) {
534
+ throw new Error("undefined AppComponent or Context for function handleStickyOn");
535
+ }
536
+
537
+ if (!oAppComponent.getRouterProxy().hasNavigationGuard()) {
538
+ const sHashTracker = oAppComponent.getRouterProxy().getHash(),
539
+ oInternalModel = this.getInternalModel();
540
+
541
+ // Set a guard in the RouterProxy
542
+ // A timeout is necessary, as with deferred creation the hashChanger is not updated yet with
543
+ // the new hash, and the guard cannot be found in the managed history of the router proxy
544
+ setTimeout(function() {
545
+ oAppComponent.getRouterProxy().setNavigationGuard();
546
+ }, 0);
547
+
548
+ // Setting back navigation on shell service, to get the dicard message box in case of sticky
549
+ oAppComponent.getShellServices().setBackNavigation(this.onBackNavigationInSession.bind(this));
550
+
551
+ this.fnDirtyStateProvider = this._registerDirtyStateProvider(oAppComponent, oInternalModel, sHashTracker);
552
+ oAppComponent.getShellServices().registerDirtyStateProvider(this.fnDirtyStateProvider);
553
+
554
+ // handle session timeout
555
+ const i18nModel = this.getView().getModel("sap.fe.i18n");
556
+ this.fnHandleSessionTimeout = this._attachSessionTimeout(this, i18nModel);
557
+ (this.getView().getModel() as any).attachSessionTimeout(this.fnHandleSessionTimeout);
558
+
559
+ this.fnStickyDiscardAfterNavigation = this._attachRouteMatched(this, oContext, oAppComponent);
560
+ oAppComponent.getRoutingService().attachRouteMatched(this.fnStickyDiscardAfterNavigation);
561
+ }
562
+ } catch (error) {
563
+ Log.info(error);
564
+ return undefined;
565
+ }
566
+ return true;
567
+ }
568
+
569
+ @Public
570
+ @Final
571
+ handleStickyOff() {
572
+ const oAppComponent = CommonUtils.getAppComponent(this.getView());
573
+ try {
574
+ if (oAppComponent === undefined) {
575
+ throw new Error("undefined AppComponent for function handleStickyOff");
576
+ }
577
+
578
+ if (oAppComponent && oAppComponent.getRouterProxy) {
579
+ // If we have exited from the app, CommonUtils.getAppComponent doesn't return a
580
+ // sap.fe.core.AppComponent, hence the 'if' above
581
+ oAppComponent.getRouterProxy().discardNavigationGuard();
582
+ }
583
+
584
+ if (this.fnDirtyStateProvider) {
585
+ oAppComponent.getShellServices().deregisterDirtyStateProvider(this.fnDirtyStateProvider);
586
+ this.fnDirtyStateProvider = undefined;
587
+ }
588
+
589
+ if (this.getView().getModel() && this.fnHandleSessionTimeout) {
590
+ (this.getView().getModel() as any).detachSessionTimeout(this.fnHandleSessionTimeout);
591
+ }
592
+
593
+ oAppComponent.getRoutingService().detachRouteMatched(this.fnStickyDiscardAfterNavigation);
594
+ this.fnStickyDiscardAfterNavigation = undefined;
595
+
596
+ this.getTransactionHelper()._bCreateMode = false;
597
+ this.setEditMode(EditMode.Display, false);
598
+
599
+ if (oAppComponent) {
600
+ // If we have exited from the app, CommonUtils.getAppComponent doesn't return a
601
+ // sap.fe.core.AppComponent, hence the 'if' above
602
+ oAppComponent.getShellServices().setBackNavigation();
603
+ }
604
+ } catch (error) {
605
+ Log.info(error);
606
+ return undefined;
607
+ }
608
+ return true;
609
+ }
610
+
611
+ /**
612
+ * @description Method to display a 'discard' popover when exiting a sticky session.
613
+ *
614
+ * @function
615
+ * @name onBackNavigationInSession
616
+ * @memberof sap.fe.core.controllerextensions.InternalEditFlow
617
+ */
618
+ @Public
619
+ @Final
620
+ onBackNavigationInSession() {
621
+ const oView = this.getView(),
622
+ oAppComponent = CommonUtils.getAppComponent(oView),
623
+ oRouterProxy = oAppComponent.getRouterProxy();
624
+
625
+ if (oRouterProxy.checkIfBackIsOutOfGuard()) {
626
+ const oBindingContext = oView && oView.getBindingContext();
627
+
628
+ CommonUtils.processDataLossConfirmation(
629
+ () => {
630
+ this.discardStickySession(oBindingContext);
631
+ history.back();
632
+ },
633
+ oView,
634
+ this.getProgrammingModel(oBindingContext)
635
+ );
636
+
637
+ return;
638
+ }
639
+ history.back();
640
+ }
641
+
642
+ @Public
643
+ @Final
644
+ discardStickySession(oContext: any) {
645
+ sticky.discardDocument(oContext);
646
+ this.handleStickyOff();
647
+ }
648
+
649
+ _hasNewActionForSticky(oContext: any, oView: View, sCustomAction: string) {
650
+ try {
651
+ if (oContext === undefined || oView === undefined) {
652
+ throw new Error("Invalid input parameters for function _hasNewActionForSticky");
653
+ }
654
+
655
+ const oMetaModel = oView.getModel().getMetaModel(),
656
+ sMetaPath = oContext.getPath().substring(0, oContext.getPath().indexOf("(")),
657
+ oStickySession = oMetaModel.getObject(sMetaPath + "@com.sap.vocabularies.Session.v1.StickySessionSupported");
658
+
659
+ if (oStickySession && oStickySession.NewAction && oStickySession.NewAction === sCustomAction) {
660
+ return true;
661
+ } else if (oStickySession && oStickySession.AdditionalNewActions) {
662
+ return sCustomAction ===
663
+ oStickySession.AdditionalNewActions.find(function(sAdditionalAction: string) {
664
+ return sAdditionalAction === sCustomAction;
665
+ })
666
+ ? true
667
+ : false;
668
+ } else {
669
+ return false;
670
+ }
671
+ } catch (error) {
672
+ Log.info(error);
673
+ return undefined;
674
+ }
675
+ }
676
+
677
+ _registerDirtyStateProvider(oAppComponent: AppComponent, oInternalModel: JSONModel, sHashTracker: string) {
678
+ return function fnDirtyStateProvider(oNavigationContext: any) {
679
+ try {
680
+ if (oNavigationContext === undefined) {
681
+ throw new Error("Invalid input parameters for function fnDirtyStateProvider");
682
+ }
683
+
684
+ const sTargetHash = oNavigationContext.innerAppRoute,
685
+ oRouterProxy = oAppComponent.getRouterProxy();
686
+ let sLclHashTracker = "";
687
+ let bDirty: boolean;
688
+ const bSessionON = oInternalModel.getProperty("/sessionOn");
689
+
690
+ if (!bSessionON) {
691
+ // If the sticky session was terminated before hand.
692
+ // Eexample in case of navigating away from application using IBN.
693
+ return undefined;
694
+ }
695
+
696
+ if (!oRouterProxy.isNavigationFinalized()) {
697
+ // If navigation is currently happening in RouterProxy, it's a transient state
698
+ // (not dirty)
699
+ bDirty = false;
700
+ sLclHashTracker = sTargetHash;
701
+ } else if (sHashTracker === sTargetHash) {
702
+ // the hash didn't change so either the user attempts to refresh or to leave the app
703
+ bDirty = true;
704
+ } else if (oRouterProxy.checkHashWithGuard(sTargetHash) || oRouterProxy.isGuardCrossAllowedByUser()) {
705
+ // the user attempts to navigate within the root object
706
+ // or crossing the guard has already been allowed by the RouterProxy
707
+ sLclHashTracker = sTargetHash;
708
+ bDirty = false;
709
+ } else {
710
+ // the user attempts to navigate within the app, for example back to the list report
711
+ bDirty = true;
712
+ }
713
+
714
+ if (bDirty) {
715
+ // the FLP doesn't call the dirty state provider anymore once it's dirty, as they can't
716
+ // change this due to compatibility reasons we set it back to not-dirty
717
+ setTimeout(function() {
718
+ oAppComponent.getShellServices().setDirtyFlag(false);
719
+ }, 0);
720
+ } else {
721
+ sHashTracker = sLclHashTracker;
722
+ }
723
+
724
+ return bDirty;
725
+ } catch (error) {
726
+ Log.info(error);
727
+ return undefined;
728
+ }
729
+ };
730
+ }
731
+
732
+ _attachSessionTimeout(oContext: any, i18nModel: Model) {
733
+ const that = oContext;
734
+
735
+ return function fnHandleSessionTimeout() {
736
+ try {
737
+ if (oContext === undefined) {
738
+ throw new Error("Context missing for function fnHandleSessionTimeout");
739
+ }
740
+ // remove transient messages since we will showing our own message
741
+ that.getMessageHandler().removeTransitionMessages();
742
+
743
+ const oDialog = new Dialog({
744
+ title: "{sap.fe.i18n>C_EDITFLOW_OBJECT_PAGE_SESSION_EXPIRED_DIALOG_TITLE}",
745
+ state: "Warning",
746
+ content: new Text({ text: "{sap.fe.i18n>C_EDITFLOW_OBJECT_PAGE_SESSION_EXPIRED_DIALOG_MESSAGE}" }),
747
+ beginButton: new Button({
748
+ text: "{sap.fe.i18n>C_COMMON_DIALOG_OK}",
749
+ type: "Emphasized",
750
+ press: function() {
751
+ // remove sticky handling after navigation since session has already been terminated
752
+ that.handleStickyOff();
753
+ that.getRoutingListener().navigateBackFromContext(oContext);
754
+ }
755
+ }),
756
+ afterClose: function() {
757
+ oDialog.destroy();
758
+ }
759
+ });
760
+ oDialog.addStyleClass("sapUiContentPadding");
761
+ oDialog.setModel(i18nModel, "sap.fe.i18n");
762
+ that.getView().addDependent(oDialog);
763
+ oDialog.open();
764
+ } catch (error) {
765
+ Log.info(error);
766
+ return undefined;
767
+ }
768
+ return true;
769
+ };
770
+ }
771
+
772
+ _attachRouteMatched(oFnContext: any, oContext: any, oAppComponent: AppComponent) {
773
+ return function fnStickyDiscardAfterNavigation() {
774
+ const sCurrentHash = oAppComponent.getRouterProxy().getHash();
775
+ // either current hash is empty so the user left the app or he navigated away from the object
776
+ if (!sCurrentHash || !oAppComponent.getRouterProxy().checkHashWithGuard(sCurrentHash)) {
777
+ oFnContext.discardStickySession(oContext);
778
+ }
779
+ };
780
+ }
781
+ }
782
+
783
+ export default InternalEditFlow;