@sapui5/sap.fe.core 1.101.0 → 1.103.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 (339) hide show
  1. package/package.json +5 -5
  2. package/src/sap/fe/core/.library +1 -1
  3. package/src/sap/fe/core/AppComponent.js +66 -30
  4. package/src/sap/fe/core/AppComponent.ts +68 -51
  5. package/src/sap/fe/core/AppStateHandler.js +13 -13
  6. package/src/sap/fe/core/AppStateHandler.ts +18 -18
  7. package/src/sap/fe/core/BaseController.js +11 -9
  8. package/src/sap/fe/core/BaseController.ts +15 -13
  9. package/src/sap/fe/core/CommonUtils.js +279 -188
  10. package/src/sap/fe/core/CommonUtils.ts +306 -215
  11. package/src/sap/fe/core/ExtensionAPI.js +25 -30
  12. package/src/sap/fe/core/ExtensionAPI.ts +37 -41
  13. package/src/sap/fe/core/PageController.js +12 -7
  14. package/src/sap/fe/core/PageController.ts +10 -5
  15. package/src/sap/fe/core/TemplateComponent.js +6 -6
  16. package/src/sap/fe/core/TemplateComponent.ts +11 -11
  17. package/src/sap/fe/core/TemplateModel.js +2 -2
  18. package/src/sap/fe/core/TemplateModel.ts +3 -3
  19. package/src/sap/fe/core/buildingBlocks/AttributeModel.js +1 -1
  20. package/src/sap/fe/core/buildingBlocks/AttributeModel.ts +1 -1
  21. package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.js +306 -78
  22. package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.ts +280 -70
  23. package/src/sap/fe/core/buildingBlocks/TraceInfo.js +27 -27
  24. package/src/sap/fe/core/buildingBlocks/TraceInfo.ts +28 -26
  25. package/src/sap/fe/core/{BusyLocker.js → controllerextensions/BusyLocker.js} +1 -1
  26. package/src/sap/fe/core/{BusyLocker.ts → controllerextensions/BusyLocker.ts} +7 -7
  27. package/src/sap/fe/core/controllerextensions/EditFlow.js +351 -229
  28. package/src/sap/fe/core/controllerextensions/EditFlow.ts +321 -246
  29. package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +9 -9
  30. package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.ts +10 -10
  31. package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +59 -34
  32. package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +71 -45
  33. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +72 -72
  34. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +82 -80
  35. package/src/sap/fe/core/controllerextensions/InternalRouting.js +152 -131
  36. package/src/sap/fe/core/controllerextensions/InternalRouting.ts +171 -152
  37. package/src/sap/fe/core/controllerextensions/KPIManagement.js +66 -68
  38. package/src/sap/fe/core/controllerextensions/KPIManagement.ts +106 -123
  39. package/src/sap/fe/core/controllerextensions/MassEdit.js +11 -10
  40. package/src/sap/fe/core/controllerextensions/MassEdit.ts +31 -37
  41. package/src/sap/fe/core/controllerextensions/MessageHandler.js +21 -13
  42. package/src/sap/fe/core/controllerextensions/MessageHandler.ts +30 -15
  43. package/src/sap/fe/core/controllerextensions/PageReady.js +97 -25
  44. package/src/sap/fe/core/controllerextensions/PageReady.ts +94 -34
  45. package/src/sap/fe/core/controllerextensions/Paginator.js +19 -11
  46. package/src/sap/fe/core/controllerextensions/Paginator.ts +22 -14
  47. package/src/sap/fe/core/controllerextensions/Placeholder.js +4 -6
  48. package/src/sap/fe/core/controllerextensions/Placeholder.ts +12 -14
  49. package/src/sap/fe/core/controllerextensions/Routing.js +10 -11
  50. package/src/sap/fe/core/controllerextensions/Routing.ts +12 -13
  51. package/src/sap/fe/core/controllerextensions/Share.js +39 -21
  52. package/src/sap/fe/core/controllerextensions/Share.ts +45 -26
  53. package/src/sap/fe/core/controllerextensions/SideEffects.js +47 -51
  54. package/src/sap/fe/core/controllerextensions/SideEffects.ts +58 -62
  55. package/src/sap/fe/core/controllerextensions/ViewState.js +75 -62
  56. package/src/sap/fe/core/controllerextensions/ViewState.ts +78 -63
  57. package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.js +105 -0
  58. package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.ts +99 -0
  59. package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.js +360 -0
  60. package/src/sap/fe/core/{actions → controllerextensions}/collaboration/ActivitySync.ts +58 -112
  61. package/src/sap/fe/core/{actions → controllerextensions}/collaboration/CollaborationCommon.js +2 -2
  62. package/src/sap/fe/core/{actions → controllerextensions}/collaboration/CollaborationCommon.ts +7 -7
  63. package/src/sap/fe/core/controllerextensions/collaboration/Manage.js +262 -0
  64. package/src/sap/fe/core/{actions → controllerextensions}/collaboration/Manage.ts +20 -21
  65. package/src/sap/fe/core/{actions → controllerextensions}/collaboration/ManageDialog.fragment.xml +0 -0
  66. package/src/sap/fe/core/{actions → controllerextensions}/collaboration/UserDetails.fragment.xml +5 -7
  67. package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.js +1631 -0
  68. package/src/sap/fe/core/{TransactionHelper.ts → controllerextensions/editFlow/TransactionHelper.ts} +270 -211
  69. package/src/sap/fe/core/controllerextensions/editFlow/draft.js +772 -0
  70. package/src/sap/fe/core/{actions → controllerextensions/editFlow}/draft.ts +240 -100
  71. package/src/sap/fe/core/controllerextensions/editFlow/operations.js +1199 -0
  72. package/src/sap/fe/core/{actions → controllerextensions/editFlow}/operations.ts +364 -229
  73. package/src/sap/fe/core/controllerextensions/editFlow/sticky.js +188 -0
  74. package/src/sap/fe/core/controllerextensions/editFlow/sticky.ts +185 -0
  75. package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.js +626 -0
  76. package/src/sap/fe/core/{actions → controllerextensions/messageHandler}/messageHandling.ts +112 -69
  77. package/src/sap/fe/core/controllerextensions/routing/RouterProxy.js +937 -0
  78. package/src/sap/fe/core/{RouterProxy.ts → controllerextensions/routing/RouterProxy.ts} +72 -73
  79. package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +21 -18
  80. package/src/sap/fe/core/controls/Any.js +9 -5
  81. package/src/sap/fe/core/controls/Any.ts +10 -4
  82. package/src/sap/fe/core/controls/CommandExecution.js +21 -24
  83. package/src/sap/fe/core/controls/CommandExecution.ts +19 -24
  84. package/src/sap/fe/core/controls/ConditionalWrapper.js +2 -2
  85. package/src/sap/fe/core/controls/ConditionalWrapper.ts +3 -3
  86. package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.js +48 -43
  87. package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.ts +51 -46
  88. package/src/sap/fe/core/controls/CustomQuickViewPage.js +3 -2
  89. package/src/sap/fe/core/controls/CustomQuickViewPage.ts +3 -2
  90. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossDraft.fragment.xml +11 -3
  91. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +19 -9
  92. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +14 -8
  93. package/src/sap/fe/core/controls/FieldWrapper.js +2 -2
  94. package/src/sap/fe/core/controls/FieldWrapper.ts +3 -3
  95. package/src/sap/fe/core/controls/FileWrapper.js +50 -3
  96. package/src/sap/fe/core/controls/FileWrapper.ts +45 -12
  97. package/src/sap/fe/core/controls/FilterBar.js +6 -2
  98. package/src/sap/fe/core/controls/FilterBar.ts +13 -9
  99. package/src/sap/fe/core/controls/FormElementWrapper.js +12 -2
  100. package/src/sap/fe/core/controls/FormElementWrapper.ts +14 -3
  101. package/src/sap/fe/core/controls/MassEditSelect.js +33 -0
  102. package/src/sap/fe/core/controls/MassEditSelect.ts +41 -0
  103. package/src/sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog.fragment.xml +3 -3
  104. package/src/sap/fe/core/controls/filterbar/VisualFilter.js +16 -12
  105. package/src/sap/fe/core/controls/filterbar/VisualFilter.ts +20 -22
  106. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +3 -3
  107. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.ts +8 -8
  108. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +48 -48
  109. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +71 -76
  110. package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +36 -65
  111. package/src/sap/fe/core/controls/massEdit/MassEditField.fragment.xml +107 -0
  112. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +551 -36
  113. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +605 -36
  114. package/src/sap/fe/core/converters/ConverterContext.js +26 -33
  115. package/src/sap/fe/core/converters/ConverterContext.ts +51 -60
  116. package/src/sap/fe/core/converters/ManifestSettings.js +2 -1
  117. package/src/sap/fe/core/converters/ManifestSettings.ts +17 -14
  118. package/src/sap/fe/core/converters/ManifestWrapper.js +59 -45
  119. package/src/sap/fe/core/converters/ManifestWrapper.ts +55 -45
  120. package/src/sap/fe/core/converters/MetaModelConverter.js +56 -67
  121. package/src/sap/fe/core/converters/MetaModelConverter.ts +183 -193
  122. package/src/sap/fe/core/converters/TemplateConverter.js +21 -20
  123. package/src/sap/fe/core/converters/TemplateConverter.ts +27 -24
  124. package/src/sap/fe/core/converters/annotations/DataField.js +73 -37
  125. package/src/sap/fe/core/converters/annotations/DataField.ts +121 -77
  126. package/src/sap/fe/core/converters/common/AnnotationConverter.js +1911 -1495
  127. package/src/sap/fe/core/converters/controls/Common/Action.js +51 -49
  128. package/src/sap/fe/core/converters/controls/Common/Action.ts +58 -54
  129. package/src/sap/fe/core/converters/controls/Common/Chart.js +22 -15
  130. package/src/sap/fe/core/converters/controls/Common/Chart.ts +29 -27
  131. package/src/sap/fe/core/converters/controls/Common/Criticality.js +3 -3
  132. package/src/sap/fe/core/converters/controls/Common/Criticality.ts +4 -4
  133. package/src/sap/fe/core/converters/controls/Common/DataVisualization.js +28 -28
  134. package/src/sap/fe/core/converters/controls/Common/DataVisualization.ts +40 -36
  135. package/src/sap/fe/core/converters/controls/Common/Form.js +30 -34
  136. package/src/sap/fe/core/converters/controls/Common/Form.ts +48 -58
  137. package/src/sap/fe/core/converters/controls/Common/KPI.js +11 -11
  138. package/src/sap/fe/core/converters/controls/Common/KPI.ts +35 -39
  139. package/src/sap/fe/core/converters/controls/Common/Table.js +318 -244
  140. package/src/sap/fe/core/converters/controls/Common/Table.ts +368 -297
  141. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +135 -125
  142. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +162 -148
  143. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +51 -45
  144. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +79 -67
  145. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +28 -26
  146. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +46 -43
  147. package/src/sap/fe/core/converters/controls/ObjectPage/Avatar.js +9 -9
  148. package/src/sap/fe/core/converters/controls/ObjectPage/Avatar.ts +14 -13
  149. package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.js +67 -64
  150. package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.ts +69 -66
  151. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +92 -89
  152. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +124 -120
  153. package/src/sap/fe/core/converters/helpers/Aggregation.js +11 -5
  154. package/src/sap/fe/core/converters/helpers/Aggregation.ts +25 -23
  155. package/src/sap/fe/core/converters/helpers/BindingHelper.js +31 -30
  156. package/src/sap/fe/core/converters/helpers/BindingHelper.ts +31 -29
  157. package/src/sap/fe/core/converters/helpers/ConfigurableObject.js +4 -4
  158. package/src/sap/fe/core/converters/helpers/ConfigurableObject.ts +9 -9
  159. package/src/sap/fe/core/converters/helpers/ID.js +46 -46
  160. package/src/sap/fe/core/converters/helpers/ID.ts +25 -25
  161. package/src/sap/fe/core/converters/helpers/Key.js +7 -7
  162. package/src/sap/fe/core/converters/helpers/Key.ts +7 -7
  163. package/src/sap/fe/core/converters/helpers/SelectionVariantHelper.js +1 -1
  164. package/src/sap/fe/core/converters/helpers/SelectionVariantHelper.ts +4 -4
  165. package/src/sap/fe/core/converters/objectPage/FormMenuActions.js +6 -6
  166. package/src/sap/fe/core/converters/objectPage/FormMenuActions.ts +10 -10
  167. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +46 -62
  168. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +54 -82
  169. package/src/sap/fe/core/converters/templates/ListReportConverter.js +30 -29
  170. package/src/sap/fe/core/converters/templates/ListReportConverter.ts +40 -40
  171. package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +56 -55
  172. package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +65 -77
  173. package/src/sap/fe/core/designtime/AppComponent.designtime.js +6 -6
  174. package/src/sap/fe/core/designtime/AppComponent.designtime.ts +10 -8
  175. package/src/sap/fe/core/formatters/CollaborationFormatter.js +2 -2
  176. package/src/sap/fe/core/formatters/CollaborationFormatter.ts +3 -3
  177. package/src/sap/fe/core/formatters/FPMFormatter.js +5 -5
  178. package/src/sap/fe/core/formatters/FPMFormatter.ts +10 -10
  179. package/src/sap/fe/core/formatters/KPIFormatter.js +7 -7
  180. package/src/sap/fe/core/formatters/KPIFormatter.ts +10 -10
  181. package/src/sap/fe/core/formatters/StandardFormatter.js +89 -0
  182. package/src/sap/fe/core/formatters/StandardFormatter.ts +64 -0
  183. package/src/sap/fe/core/formatters/TableFormatter.js +83 -22
  184. package/src/sap/fe/core/formatters/TableFormatter.ts +80 -25
  185. package/src/sap/fe/core/formatters/ValueFormatter.js +8 -8
  186. package/src/sap/fe/core/formatters/ValueFormatter.ts +9 -9
  187. package/src/sap/fe/core/fpm/Component.js +2 -2
  188. package/src/sap/fe/core/fpm/Component.ts +1 -1
  189. package/src/sap/fe/core/helpers/AppStartupHelper.js +15 -15
  190. package/src/sap/fe/core/helpers/AppStartupHelper.ts +37 -40
  191. package/src/sap/fe/core/helpers/BindingToolkit.js +1809 -0
  192. package/src/sap/fe/core/helpers/{BindingExpression.ts → BindingToolkit.ts} +388 -285
  193. package/src/sap/fe/core/helpers/ClassSupport.js +20 -11
  194. package/src/sap/fe/core/helpers/ClassSupport.ts +15 -10
  195. package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +2 -2
  196. package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.ts +1 -1
  197. package/src/sap/fe/core/helpers/EditState.js +1 -6
  198. package/src/sap/fe/core/helpers/EditState.ts +5 -10
  199. package/src/sap/fe/core/helpers/ExcelFormatHelper.js +2 -2
  200. package/src/sap/fe/core/helpers/ExcelFormatHelper.ts +4 -4
  201. package/src/sap/fe/core/helpers/FPMHelper.js +3 -2
  202. package/src/sap/fe/core/helpers/FPMHelper.ts +10 -9
  203. package/src/sap/fe/core/helpers/KeepAliveHelper.js +31 -31
  204. package/src/sap/fe/core/helpers/KeepAliveHelper.ts +52 -56
  205. package/src/sap/fe/core/helpers/MassEditHelper.js +532 -264
  206. package/src/sap/fe/core/helpers/MassEditHelper.ts +560 -289
  207. package/src/sap/fe/core/helpers/ModelHelper.js +25 -25
  208. package/src/sap/fe/core/helpers/ModelHelper.ts +50 -58
  209. package/src/sap/fe/core/helpers/PasteHelper.js +3 -10
  210. package/src/sap/fe/core/helpers/PasteHelper.ts +20 -25
  211. package/src/sap/fe/core/helpers/SemanticDateOperators.js +1 -1
  212. package/src/sap/fe/core/helpers/SemanticDateOperators.ts +11 -11
  213. package/src/sap/fe/core/helpers/SemanticKeyHelper.js +3 -3
  214. package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +8 -8
  215. package/src/sap/fe/core/helpers/StableIdHelper.js +16 -12
  216. package/src/sap/fe/core/helpers/StableIdHelper.ts +20 -16
  217. package/src/sap/fe/core/{Synchronization.js → helpers/Synchronization.js} +1 -1
  218. package/src/sap/fe/core/{Synchronization.ts → helpers/Synchronization.ts} +1 -1
  219. package/src/sap/fe/core/jsx-runtime/jsx.js +1 -1
  220. package/src/sap/fe/core/jsx-runtime/jsx.ts +8 -8
  221. package/src/sap/fe/core/library.js +51 -3
  222. package/src/sap/fe/core/library.ts +47 -0
  223. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +3 -3
  224. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +2 -2
  225. package/src/sap/fe/core/messagebundle.properties +151 -197
  226. package/src/sap/fe/core/messagebundle_ar.properties +36 -63
  227. package/src/sap/fe/core/messagebundle_bg.properties +36 -63
  228. package/src/sap/fe/core/messagebundle_ca.properties +36 -63
  229. package/src/sap/fe/core/messagebundle_cs.properties +36 -63
  230. package/src/sap/fe/core/messagebundle_cy.properties +36 -63
  231. package/src/sap/fe/core/messagebundle_da.properties +37 -64
  232. package/src/sap/fe/core/messagebundle_de.properties +36 -63
  233. package/src/sap/fe/core/messagebundle_el.properties +38 -65
  234. package/src/sap/fe/core/messagebundle_en.properties +37 -64
  235. package/src/sap/fe/core/messagebundle_en_GB.properties +37 -64
  236. package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +44 -73
  237. package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +37 -64
  238. package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +52 -81
  239. package/src/sap/fe/core/messagebundle_es.properties +36 -63
  240. package/src/sap/fe/core/messagebundle_es_MX.properties +36 -63
  241. package/src/sap/fe/core/messagebundle_et.properties +36 -63
  242. package/src/sap/fe/core/messagebundle_fi.properties +36 -63
  243. package/src/sap/fe/core/messagebundle_fr.properties +39 -66
  244. package/src/sap/fe/core/messagebundle_fr_CA.properties +36 -63
  245. package/src/sap/fe/core/messagebundle_hi.properties +36 -63
  246. package/src/sap/fe/core/messagebundle_hr.properties +36 -63
  247. package/src/sap/fe/core/messagebundle_hu.properties +35 -62
  248. package/src/sap/fe/core/messagebundle_id.properties +37 -64
  249. package/src/sap/fe/core/messagebundle_it.properties +54 -81
  250. package/src/sap/fe/core/messagebundle_iw.properties +36 -63
  251. package/src/sap/fe/core/messagebundle_ja.properties +36 -63
  252. package/src/sap/fe/core/messagebundle_kk.properties +36 -63
  253. package/src/sap/fe/core/messagebundle_ko.properties +36 -63
  254. package/src/sap/fe/core/messagebundle_lt.properties +36 -63
  255. package/src/sap/fe/core/messagebundle_lv.properties +36 -63
  256. package/src/sap/fe/core/messagebundle_ms.properties +37 -64
  257. package/src/sap/fe/core/messagebundle_nl.properties +37 -64
  258. package/src/sap/fe/core/messagebundle_no.properties +36 -63
  259. package/src/sap/fe/core/messagebundle_pl.properties +37 -64
  260. package/src/sap/fe/core/messagebundle_pt.properties +37 -64
  261. package/src/sap/fe/core/messagebundle_pt_PT.properties +36 -63
  262. package/src/sap/fe/core/messagebundle_ro.properties +36 -63
  263. package/src/sap/fe/core/messagebundle_ru.properties +36 -63
  264. package/src/sap/fe/core/messagebundle_sh.properties +36 -63
  265. package/src/sap/fe/core/messagebundle_sk.properties +36 -63
  266. package/src/sap/fe/core/messagebundle_sl.properties +38 -65
  267. package/src/sap/fe/core/messagebundle_sv.properties +36 -63
  268. package/src/sap/fe/core/messagebundle_th.properties +36 -63
  269. package/src/sap/fe/core/messagebundle_tr.properties +36 -63
  270. package/src/sap/fe/core/messagebundle_uk.properties +37 -64
  271. package/src/sap/fe/core/messagebundle_vi.properties +37 -64
  272. package/src/sap/fe/core/messagebundle_zh_CN.properties +36 -63
  273. package/src/sap/fe/core/messagebundle_zh_TW.properties +37 -64
  274. package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +2 -2
  275. package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +5 -5
  276. package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +2 -2
  277. package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +14 -14
  278. package/src/sap/fe/core/services/EnvironmentServiceFactory.js +6 -3
  279. package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +12 -10
  280. package/src/sap/fe/core/services/NavigationServiceFactory.js +54 -45
  281. package/src/sap/fe/core/services/NavigationServiceFactory.ts +61 -49
  282. package/src/sap/fe/core/services/ResourceModelServiceFactory.js +2 -2
  283. package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +4 -4
  284. package/src/sap/fe/core/services/RoutingServiceFactory.js +63 -60
  285. package/src/sap/fe/core/services/RoutingServiceFactory.ts +76 -73
  286. package/src/sap/fe/core/services/ShellServicesFactory.js +102 -71
  287. package/src/sap/fe/core/services/ShellServicesFactory.ts +109 -78
  288. package/src/sap/fe/core/services/SideEffectsServiceFactory.js +61 -61
  289. package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +102 -92
  290. package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +24 -18
  291. package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +53 -50
  292. package/src/sap/fe/core/support/CommonHelper.js +3 -2
  293. package/src/sap/fe/core/support/CommonHelper.ts +9 -13
  294. package/src/sap/fe/core/support/Diagnostics.js +1 -1
  295. package/src/sap/fe/core/support/Diagnostics.ts +5 -5
  296. package/src/sap/fe/core/templating/CommonFormatters.js +84 -0
  297. package/src/sap/fe/core/templating/CommonFormatters.ts +86 -0
  298. package/src/sap/fe/core/templating/CriticalityFormatters.js +31 -31
  299. package/src/sap/fe/core/templating/CriticalityFormatters.ts +42 -40
  300. package/src/sap/fe/core/templating/DataFieldFormatters.js +8 -8
  301. package/src/sap/fe/core/templating/DataFieldFormatters.ts +13 -10
  302. package/src/sap/fe/core/templating/DataModelPathHelper.js +16 -15
  303. package/src/sap/fe/core/templating/DataModelPathHelper.ts +42 -32
  304. package/src/sap/fe/core/templating/DisplayModeFormatter.js +1 -1
  305. package/src/sap/fe/core/templating/DisplayModeFormatter.ts +3 -4
  306. package/src/sap/fe/core/templating/EntitySetHelper.js +7 -15
  307. package/src/sap/fe/core/templating/EntitySetHelper.ts +14 -18
  308. package/src/sap/fe/core/templating/FieldControlHelper.js +35 -34
  309. package/src/sap/fe/core/templating/FieldControlHelper.ts +29 -46
  310. package/src/sap/fe/core/templating/FilterHelper.js +12 -11
  311. package/src/sap/fe/core/templating/FilterHelper.ts +17 -16
  312. package/src/sap/fe/core/templating/FilterTemplating.js +1 -1
  313. package/src/sap/fe/core/templating/FilterTemplating.ts +3 -3
  314. package/src/sap/fe/core/templating/PropertyFormatters.js +7 -7
  315. package/src/sap/fe/core/templating/PropertyFormatters.ts +21 -19
  316. package/src/sap/fe/core/templating/PropertyHelper.js +79 -56
  317. package/src/sap/fe/core/templating/PropertyHelper.ts +41 -27
  318. package/src/sap/fe/core/templating/UIFormatters.js +163 -97
  319. package/src/sap/fe/core/templating/UIFormatters.ts +210 -129
  320. package/src/sap/fe/core/type/DateTimeWithTimezone.js +47 -0
  321. package/src/sap/fe/core/type/DateTimeWithTimezone.ts +23 -0
  322. package/src/sap/fe/core/type/Email.js +2 -2
  323. package/src/sap/fe/core/type/Email.ts +2 -2
  324. package/src/sap/fe/core/AnnotationHelper.js +0 -331
  325. package/src/sap/fe/core/AnnotationHelper.ts +0 -321
  326. package/src/sap/fe/core/RouterProxy.js +0 -938
  327. package/src/sap/fe/core/TransactionHelper.js +0 -1577
  328. package/src/sap/fe/core/actions/collaboration/ActivitySync.js +0 -406
  329. package/src/sap/fe/core/actions/collaboration/Manage.js +0 -264
  330. package/src/sap/fe/core/actions/draft.js +0 -665
  331. package/src/sap/fe/core/actions/messageHandling.js +0 -579
  332. package/src/sap/fe/core/actions/nonDraft.js +0 -20
  333. package/src/sap/fe/core/actions/nonDraft.ts +0 -12
  334. package/src/sap/fe/core/actions/operations.js +0 -1096
  335. package/src/sap/fe/core/actions/sticky.js +0 -130
  336. package/src/sap/fe/core/actions/sticky.ts +0 -119
  337. package/src/sap/fe/core/formatters/CriticalityFormatter.js +0 -77
  338. package/src/sap/fe/core/formatters/CriticalityFormatter.ts +0 -58
  339. package/src/sap/fe/core/helpers/BindingExpression.js +0 -1729
@@ -1,6 +1,7 @@
1
1
  import Log from "sap/base/Log";
2
+ import uid from "sap/base/util/uid";
2
3
  import AttributeModel from "sap/fe/core/buildingBlocks/AttributeModel";
3
- import {
4
+ import type {
4
5
  BuildingBlockAggregationDefinition,
5
6
  BuildingBlockBase,
6
7
  BuildingBlockDefinition,
@@ -9,19 +10,23 @@ import {
9
10
  BuildingBlockMetadataContextDefinition,
10
11
  BuildingBlockPropertyDefinition
11
12
  } from "sap/fe/core/buildingBlocks/BuildingBlock";
13
+ import { compileExpression } from "sap/fe/core/helpers/BindingToolkit";
12
14
  import ResourceModel from "sap/fe/macros/ResourceModel";
13
15
  import BindingParser from "sap/ui/base/BindingParser";
14
16
  import XMLPreprocessor from "sap/ui/core/util/XMLPreprocessor";
15
- import JSONModel from "sap/ui/model/json/JSONModel";
17
+ import type Context from "sap/ui/model/Context";
18
+ import type JSONModel from "sap/ui/model/json/JSONModel";
16
19
  import TraceInfo from "./TraceInfo";
17
20
 
18
21
  const LOGGER_SCOPE = "sap.fe.core.buildingBlocks.BuildingBlockRuntime";
19
22
  const DOMParserInstance = new DOMParser();
23
+ let isTraceMode = false;
20
24
 
21
25
  type ResolvedBuildingBlockMetadata = {
22
26
  properties: Record<string, BuildingBlockPropertyDefinition>;
23
27
  aggregations: Record<string, BuildingBlockAggregationDefinition>;
24
28
  metadataContexts: Record<string, BuildingBlockMetadataContextDefinition>;
29
+ isOpen: boolean;
25
30
  };
26
31
 
27
32
  type ICallback = {
@@ -38,7 +43,7 @@ type ICallback = {
38
43
  * @returns {sap.ui.base.SyncPromise}
39
44
  * A thenable which resolves with <code>undefined</code> as soon as visiting
40
45
  * is done, or is rejected with a corresponding error if visiting fails
41
- **/
46
+ */
42
47
  visitNode(oNode: Node): Promise<void>;
43
48
 
44
49
  /**
@@ -65,6 +70,7 @@ type ICallback = {
65
70
  /**
66
71
  * Interprets the given XML DOM attribute value as a binding and returns the
67
72
  * resulting value.
73
+ *
68
74
  * @param {string} sValue
69
75
  * An XML DOM attribute value
70
76
  * @param {Element} [oElement]
@@ -77,6 +83,7 @@ type ICallback = {
77
83
  * model which is not available) (since 1.57.0)
78
84
  */
79
85
  getResult(sValue: string, element?: Element): Promise<any> | null;
86
+ getContext(sPath: string): Context;
80
87
  /**
81
88
  * Returns a callback interface instance for the given map of variables which
82
89
  * override currently known variables of the same name in <code>this</code>
@@ -165,7 +172,7 @@ export function validateMacroSignature(sName: any, oMetadata: any, mContexts: an
165
172
  const oPropertySettings = oMetadata.properties[sKey];
166
173
  if (!oNode.hasAttribute(sKey)) {
167
174
  if (oPropertySettings.required && !oPropertySettings.hasOwnProperty("defaultValue")) {
168
- throw new Error(sName + ": " + "Required property '" + sKey + "' is missing");
175
+ throw new Error(`${sName}: ` + `Required property '${sKey}' is missing`);
169
176
  }
170
177
  } else {
171
178
  delete oAttributeNames[sKey];
@@ -185,9 +192,10 @@ export function validateMacroSignature(sName: any, oMetadata: any, mContexts: an
185
192
  * Ensures that the metadata for the building block are properly defined.
186
193
  *
187
194
  * @param buildingBlockMetadata The metadata received from the input
195
+ * @param isOpen Whether the building block is open or not
188
196
  * @returns A set of completed metadata for further processing
189
197
  */
190
- function prepareMetadata(buildingBlockMetadata?: BuildingBlockMetadata): ResolvedBuildingBlockMetadata {
198
+ function prepareMetadata(buildingBlockMetadata?: BuildingBlockMetadata, isOpen = false): ResolvedBuildingBlockMetadata {
191
199
  if (buildingBlockMetadata) {
192
200
  const oProperties: any = {};
193
201
  const oAggregations: any = {
@@ -221,7 +229,8 @@ function prepareMetadata(buildingBlockMetadata?: BuildingBlockMetadata): Resolve
221
229
  return {
222
230
  properties: oProperties,
223
231
  aggregations: oAggregations,
224
- metadataContexts: oMetadataContexts
232
+ metadataContexts: oMetadataContexts,
233
+ isOpen: isOpen
225
234
  };
226
235
  } else {
227
236
  return {
@@ -234,12 +243,20 @@ function prepareMetadata(buildingBlockMetadata?: BuildingBlockMetadata): Resolve
234
243
  type: "sap.ui.core.Element"
235
244
  }
236
245
  },
237
- properties: {}
246
+ properties: {},
247
+ isOpen: isOpen
238
248
  };
239
249
  }
240
250
  }
241
251
 
242
- function _getMetadataContext(oSettings: any, oNode: Element, sAttributeName: string, oVisitor: ICallback, bDoNotResolve: boolean) {
252
+ function _getMetadataContext(
253
+ oSettings: any,
254
+ oNode: Element,
255
+ sAttributeName: string,
256
+ oVisitor: ICallback,
257
+ bDoNotResolve: boolean,
258
+ isOpen: boolean
259
+ ) {
243
260
  let oMetadataContext;
244
261
  if (!bDoNotResolve && oNode.hasAttribute(sAttributeName)) {
245
262
  const sAttributeValue = oNode.getAttribute(sAttributeName) as string;
@@ -247,7 +264,15 @@ function _getMetadataContext(oSettings: any, oNode: Element, sAttributeName: str
247
264
  // oVisitor.getResult(sAttributeValue, oNode);
248
265
  oMetadataContext = BindingParser.complexParser(sAttributeValue);
249
266
  if (!oMetadataContext) {
250
- if ((sAttributeName === "metaPath" && oSettings.currentContextPath) || sAttributeName === "contextPath") {
267
+ if (sAttributeValue.startsWith("uid--")) {
268
+ const oData = myStore[sAttributeValue];
269
+ const sContextPath = `/${sAttributeValue}`;
270
+ oSettings.models.converterContext.setProperty(sContextPath, oData);
271
+ oMetadataContext = {
272
+ model: "converterContext",
273
+ path: sContextPath
274
+ };
275
+ } else if ((sAttributeName === "metaPath" && oSettings.currentContextPath) || sAttributeName === "contextPath") {
251
276
  if (sAttributeValue && sAttributeValue.startsWith("/")) {
252
277
  // absolute path - we just use this one
253
278
  sMetaPath = sAttributeValue;
@@ -276,6 +301,17 @@ function _getMetadataContext(oSettings: any, oNode: Element, sAttributeName: str
276
301
  model: sAttributeName,
277
302
  path: ""
278
303
  };
304
+ } else if (isOpen) {
305
+ try {
306
+ if (oVisitor.getContext(`${sAttributeName}>`)) {
307
+ oMetadataContext = {
308
+ model: sAttributeName,
309
+ path: ""
310
+ };
311
+ }
312
+ } catch (e) {
313
+ oMetadataContext = undefined;
314
+ }
279
315
  }
280
316
  return oMetadataContext;
281
317
  }
@@ -319,10 +355,9 @@ async function processProperties(
319
355
  aDefinitionContextsKeys = aDefinitionContextsKeys.sort(function (a: string, b: string) {
320
356
  return a > b ? 1 : -1;
321
357
  });
322
- for (let j = 0; j < aDefinitionContextsKeys.length; j++) {
323
- const sAttributeName = aDefinitionContextsKeys[j];
358
+ for (const sAttributeName of aDefinitionContextsKeys) {
324
359
  const bDoNotResolve = isPublic && !oDefinitionContexts[sAttributeName].isPublic && oNode.hasAttribute(sAttributeName);
325
- const oMetadataContext = _getMetadataContext(oSettings, oNode, sAttributeName, oVisitor, bDoNotResolve);
360
+ const oMetadataContext = _getMetadataContext(oSettings, oNode, sAttributeName, oVisitor, bDoNotResolve, oMetadata.isOpen);
326
361
  if (oMetadataContext) {
327
362
  oMetadataContext.name = sAttributeName;
328
363
  addSingleContext(mContexts, oVisitor, oMetadataContext, oMetadataContexts);
@@ -340,7 +375,7 @@ async function processProperties(
340
375
  mMissingContext[sAttributeName] = true;
341
376
  }
342
377
  }
343
- return { mMissingContext, propertyValues };
378
+ return { mMissingContext, propertyValues: propertyValues };
344
379
  }
345
380
 
346
381
  async function processChildren(
@@ -383,43 +418,43 @@ async function processBuildingBlock(
383
418
  oVisitor: ICallback,
384
419
  isPublic = false
385
420
  ) {
386
- try {
387
- const sFragmentName = buildingBLockDefinition.fragment || `${buildingBLockDefinition.namespace}.${buildingBLockDefinition.name}`;
388
-
389
- const sName = "this";
390
-
391
- const mContexts: any = {};
392
- const oMetadataContexts: any = {};
393
- const oSettings = oVisitor.getSettings();
394
- // TODO Move this elsewhere this is weird :)
395
- if (oSettings.models["sap.fe.i18n"]) {
396
- oSettings.models["sap.fe.i18n"]
397
- .getResourceBundle()
398
- .then(function (oResourceBundle: any) {
399
- ResourceModel.setApplicationI18nBundle(oResourceBundle);
400
- })
401
- .catch(function (error: any) {
402
- Log.error(error);
403
- });
404
- }
405
- const oMetadata = prepareMetadata(buildingBLockDefinition.metadata);
406
-
407
- //Inject storage for macros
408
- if (!oSettings[sFragmentName]) {
409
- oSettings[sFragmentName] = {};
410
- }
421
+ const sFragmentName = buildingBLockDefinition.fragment || `${buildingBLockDefinition.namespace}.${buildingBLockDefinition.name}`;
422
+
423
+ const sName = "this";
424
+
425
+ const mContexts: any = {};
426
+ const oMetadataContexts: any = {};
427
+ const oSettings = oVisitor.getSettings();
428
+ // TODO 0001 Move this elsewhere this is weird :)
429
+ if (oSettings.models["sap.fe.i18n"]) {
430
+ oSettings.models["sap.fe.i18n"]
431
+ .getResourceBundle()
432
+ .then(function (oResourceBundle: any) {
433
+ ResourceModel.setApplicationI18nBundle(oResourceBundle);
434
+ })
435
+ .catch(function (error: any) {
436
+ Log.error(error);
437
+ });
438
+ }
439
+ const oMetadata = prepareMetadata(buildingBLockDefinition.metadata, buildingBLockDefinition.isOpen);
411
440
 
412
- // First of all we need to visit the attributes
413
- let { mMissingContext, propertyValues } = await processProperties(
414
- oMetadata,
415
- oSettings,
416
- oNode,
417
- isPublic,
418
- oVisitor,
419
- mContexts,
420
- oMetadataContexts
421
- );
441
+ //Inject storage for macros
442
+ if (!oSettings[sFragmentName]) {
443
+ oSettings[sFragmentName] = {};
444
+ }
422
445
 
446
+ // First of all we need to visit the attributes
447
+ const { mMissingContext, propertyValues } = await processProperties(
448
+ oMetadata,
449
+ oSettings,
450
+ oNode,
451
+ isPublic,
452
+ oVisitor,
453
+ mContexts,
454
+ oMetadataContexts
455
+ );
456
+ const initialKeys = Object.keys(propertyValues);
457
+ try {
423
458
  // Aggregation and complex type support
424
459
  const oAggregations = await processChildren(oNode, oVisitor, oMetadata, isPublic, propertyValues);
425
460
  let oInstance: any;
@@ -429,9 +464,9 @@ async function processBuildingBlock(
429
464
  // Only used in the Field macro and even then maybe not really useful
430
465
  oControlConfig = oSettings.models.viewData.getProperty("/controlConfiguration");
431
466
  }
432
-
467
+ let processedPropertyValues = propertyValues;
433
468
  if (isV1MacroDef(buildingBLockDefinition) && buildingBLockDefinition.create) {
434
- propertyValues = buildingBLockDefinition.create.call(
469
+ processedPropertyValues = buildingBLockDefinition.create.call(
435
470
  buildingBLockDefinition,
436
471
  propertyValues,
437
472
  oControlConfig,
@@ -441,12 +476,12 @@ async function processBuildingBlock(
441
476
  );
442
477
  Object.keys(oMetadata.metadataContexts).forEach(function (sMetadataName: string) {
443
478
  if (oMetadata.metadataContexts[sMetadataName].computed) {
444
- mContexts[sMetadataName] = propertyValues[sMetadataName];
479
+ mContexts[sMetadataName] = processedPropertyValues[sMetadataName];
445
480
  }
446
481
  });
447
482
  Object.keys(mMissingContext).forEach(function (sContextName: string) {
448
- if (propertyValues.hasOwnProperty(sContextName)) {
449
- mContexts[sContextName] = propertyValues[sContextName];
483
+ if (processedPropertyValues.hasOwnProperty(sContextName)) {
484
+ mContexts[sContextName] = processedPropertyValues[sContextName];
450
485
  }
451
486
  });
452
487
  } else if (buildingBLockDefinition.apiVersion === 2) {
@@ -464,7 +499,7 @@ async function processBuildingBlock(
464
499
  const BuildingBlockClass = buildingBLockDefinition as typeof BuildingBlockBase;
465
500
  oInstance = new BuildingBlockClass(propertyValues /*, oControlConfig, oSettings, oAggregations, isPublic*/);
466
501
  }
467
- const oAttributesModel: JSONModel = new AttributeModel(oNode, propertyValues, buildingBLockDefinition);
502
+ const oAttributesModel: JSONModel = new AttributeModel(oNode, processedPropertyValues, buildingBLockDefinition);
468
503
  mContexts[sName] = oAttributesModel.createBindingContext("/");
469
504
 
470
505
  let oPreviousMacroInfo: any;
@@ -495,17 +530,55 @@ async function processBuildingBlock(
495
530
  buildingBLockDefinition.apiVersion === 2
496
531
  ) {
497
532
  let oTemplate;
533
+ let addDefaultNamespace = false;
498
534
  if (buildingBLockDefinition.apiVersion === 2) {
499
535
  oTemplate = oInstance.getTemplate();
536
+ addDefaultNamespace = true;
500
537
  } else if (buildingBLockDefinition.getTemplate) {
501
- oTemplate = buildingBLockDefinition.getTemplate(propertyValues);
538
+ oTemplate = buildingBLockDefinition.getTemplate(processedPropertyValues);
502
539
  }
503
540
 
541
+ let hasError = "";
504
542
  if (oTemplate) {
505
543
  if (!oTemplate.firstElementChild) {
506
- oTemplate = DOMParserInstance.parseFromString(oTemplate, "text/xml");
544
+ oTemplate = parseXMLString(oTemplate, addDefaultNamespace);
545
+ // For safety purpose we try to detect trailing text in between XML Tags
546
+ const iter = document.createNodeIterator(oTemplate, NodeFilter.SHOW_TEXT);
547
+ let textnode = iter.nextNode();
548
+ while (textnode) {
549
+ if (textnode.textContent && textnode.textContent.trim().length > 0) {
550
+ hasError = textnode.textContent;
551
+ }
552
+ textnode = iter.nextNode();
553
+ }
554
+ }
555
+
556
+ if (oTemplate.localName === "parsererror") {
557
+ // If there is a parseerror while processing the XML it means the XML itself is malformed, as such we rerun the template process
558
+ // Setting isTraceMode true will make it so that each xml` expression is checked for validity from XML perspective and if an error is found it's returned instead of the normal fragment
559
+ Log.error(`Error while processing building block ${buildingBLockDefinition.name}`);
560
+ try {
561
+ isTraceMode = true;
562
+ oTemplate = oInstance?.getTemplate
563
+ ? oInstance.getTemplate()
564
+ : (buildingBLockDefinition as any).getTemplate(processedPropertyValues);
565
+ oTemplate = parseXMLString(oTemplate, true);
566
+ } finally {
567
+ isTraceMode = false;
568
+ }
569
+ } else if (hasError.length > 0) {
570
+ // If there is trailing text we create a standard error and display it.
571
+ Log.error(`Error while processing building block ${buildingBLockDefinition.name}`);
572
+ const oErrorText = createErrorXML(
573
+ [
574
+ `Error while processing building block ${buildingBLockDefinition.name}`,
575
+ `Trailing text was found in the XML: ${hasError}`
576
+ ],
577
+ oTemplate.outerHTML
578
+ );
579
+ oTemplate = parseXMLString(oErrorText, true);
507
580
  }
508
- oNode.replaceWith(oTemplate.firstElementChild);
581
+ oNode.replaceWith(oTemplate);
509
582
  oNode = oParent.children[iChildIndex];
510
583
  oPromise = oContextVisitor.visitNode(oNode);
511
584
  } else {
@@ -534,7 +607,7 @@ async function processBuildingBlock(
534
607
  const sSlotName =
535
608
  (oMetadata.aggregations[sAggregationName] && oMetadata.aggregations[sAggregationName].slot) ||
536
609
  sAggregationName;
537
- const oTargetElement = oMacroElement.querySelector("slot[name='" + sSlotName + "']") as Element;
610
+ const oTargetElement = oMacroElement.querySelector(`slot[name='${sSlotName}']`) as Element;
538
611
  if (oTargetElement) {
539
612
  oTargetElement.replaceWith(...(oNewChild.children as any));
540
613
  }
@@ -550,15 +623,53 @@ async function processBuildingBlock(
550
623
  oSlotElement.remove();
551
624
  });
552
625
  }
553
- if (oPreviousMacroInfo) {
554
- //restore macro info if available
555
- oSettings["_macroInfo"] = oPreviousMacroInfo;
626
+ }
627
+ if (oPreviousMacroInfo) {
628
+ //restore macro info if available
629
+ oSettings["_macroInfo"] = oPreviousMacroInfo;
630
+ } else {
631
+ delete oSettings["_macroInfo"];
632
+ }
633
+ } catch (e) {
634
+ // In case there is a generic error (usually code error), we retrieve the current context information and create a dedicated error message
635
+ const traceDetails = {
636
+ initialProperties: {} as any,
637
+ resolvedProperties: {} as any,
638
+ missingContexts: mMissingContext
639
+ };
640
+ for (const propertyName of initialKeys) {
641
+ const propertyValue = propertyValues[propertyName];
642
+ if (propertyValue && propertyValue.isA && propertyValue.isA("sap.ui.model.Context")) {
643
+ traceDetails.initialProperties[propertyName] = {
644
+ path: propertyValue.getPath(),
645
+ value: propertyValue.getObject()
646
+ };
556
647
  } else {
557
- delete oSettings["_macroInfo"];
648
+ traceDetails.initialProperties[propertyName] = propertyValue;
558
649
  }
559
650
  }
560
- } catch (e) {
561
- Log.error(e as any);
651
+ for (const propertyName in propertyValues) {
652
+ const propertyValue = propertyValues[propertyName];
653
+ if (!initialKeys.includes(propertyName)) {
654
+ if (propertyValue && propertyValue.isA && propertyValue.isA("sap.ui.model.Context")) {
655
+ traceDetails.resolvedProperties[propertyName] = {
656
+ path: propertyValue.getPath(),
657
+ value: propertyValue.getObject()
658
+ };
659
+ } else {
660
+ traceDetails.resolvedProperties[propertyName] = propertyValue;
661
+ }
662
+ }
663
+ }
664
+ const errorAny = e as any;
665
+ Log.error(errorAny, errorAny);
666
+ const oError = createErrorXML(
667
+ [`Error while processing building block ${buildingBLockDefinition.name}`, errorAny.stack],
668
+ oNode.outerHTML,
669
+ traceDetails
670
+ );
671
+ const oTemplate = parseXMLString(oError, true);
672
+ oNode.replaceWith(oTemplate as any);
562
673
  }
563
674
  }
564
675
  function addSingleContext(mContexts: any, oVisitor: any, oCtx: any, oMetadataContexts: any) {
@@ -570,7 +681,7 @@ function addSingleContext(mContexts: any, oVisitor: any, oCtx: any, oMetadataCon
570
681
  try {
571
682
  let sContextPath = oCtx.path;
572
683
  if (oCtx.model != null) {
573
- sContextPath = oCtx.model + ">" + sContextPath;
684
+ sContextPath = `${oCtx.model}>${sContextPath}`;
574
685
  }
575
686
  const mSetting = oVisitor.getSettings();
576
687
  if (!mSetting.bindingContexts[oCtx.model] && mSetting.models[oCtx.model]) {
@@ -584,7 +695,7 @@ function addSingleContext(mContexts: any, oVisitor: any, oCtx: any, oMetadataCon
584
695
  //console.error(ex);
585
696
  // ignore the context as this can only be the case if the model is not ready, i.e. not a preprocessing model but maybe a model for
586
697
  // providing afterwards
587
- // TODO not yet implemented
698
+ // TODO 0002 not yet implemented
588
699
  //mContexts["_$error"].oModel.setProperty("/" + sKey, ex);
589
700
  }
590
701
  }
@@ -609,20 +720,119 @@ export function registerBuildingBlock(buildingBlockDefinition: BuildingBlockDefi
609
720
  }
610
721
  }
611
722
 
723
+ function createErrorXML(errorMessages: string[], xmlFragment: string, additionalData?: object): string {
724
+ const errorLabels = errorMessages.map((errorMessage) => xml`<m:Label text="${escapeXML(errorMessage)}"/>`);
725
+ let additionalText = "";
726
+ if (additionalData) {
727
+ additionalText = xml`<m:VBox>
728
+ <m:Label text="Trace Info"/>
729
+ <code:CodeEditor type="json" value="${escapeXML(JSON.stringify(additionalData, null, 4))}" height="300px" width="100vh"/>
730
+ </m:VBox>`;
731
+ }
732
+ return xml`<m:VBox xmlns:m="sap.m" xmlns:code="sap.ui.codeeditor">
733
+ ${errorLabels}
734
+ <m:HBox>
735
+ <m:VBox>
736
+ <m:Label text="How the building block was called"/>
737
+ <code:CodeEditor type="xml" value="${escapeXML(xmlFragment)}" height="300px" width="100vh"/>
738
+ </m:VBox>
739
+ ${additionalText}
740
+ </m:HBox>
741
+ </m:VBox>`;
742
+ }
743
+
744
+ const myStore: Record<string, any> = {};
745
+ function storeValue(values: any) {
746
+ const propertyUID = `uid--${uid()}`;
747
+ myStore[propertyUID] = values;
748
+ return propertyUID;
749
+ }
750
+
751
+ /**
752
+ * Parse an XML string and return the associated document.
753
+ *
754
+ * @param xmlString The xml string
755
+ * @param addDefaultNamespaces Whether or not we should add default namespace
756
+ * @returns The XML document.
757
+ */
758
+ function parseXMLString(xmlString: string, addDefaultNamespaces = false): Element {
759
+ if (addDefaultNamespaces) {
760
+ xmlString = `<template
761
+ xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1"
762
+ xmlns:m="sap.m"
763
+ xmlns:core="sap.ui.core"
764
+ xmlns:customData="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1">${xmlString}</template>`;
765
+ }
766
+ const xmlDocument = DOMParserInstance.parseFromString(xmlString, "text/xml");
767
+ let output = xmlDocument.firstElementChild;
768
+ while (output?.localName === "template") {
769
+ output = output.firstElementChild;
770
+ }
771
+ return output as Element;
772
+ }
773
+
612
774
  /**
613
- * Create an XML representation of the string used in the template literal.
775
+ * Escape an XML string to include it in an XML fragment.
776
+ *
777
+ * @param str The string to escape
778
+ * @returns The escaped string.
779
+ */
780
+ function escapeXML(str: string): string {
781
+ return str
782
+ .replace(/&/g, "&amp;")
783
+ .replace(/</g, "&lt;")
784
+ .replace(/\n/g, "&#10;")
785
+ .replace(/\{/g, "\\{")
786
+ .replace(/>/g, "&gt;")
787
+ .replace(/"/g, "&quot;")
788
+ .replace(/'/g, "&apos;");
789
+ }
790
+
791
+ /**
792
+ * Escape an XML attribute value.
793
+ *
794
+ * @param val The attribute value to escape.
795
+ * @returns The escaped string.
796
+ */
797
+ function escapeXMLAttributeValue(val: string): string {
798
+ return val.replace(/&/g, "&amp;").replace(/</g, "&lt;");
799
+ }
800
+
801
+ /**
802
+ * Create a string representation of the template literal while handling special object case.
614
803
  *
615
804
  * @param strings The string parts of the template literal
616
805
  * @param values The values part of the template literal
617
- * @returns The XML document representing the string that was used.
806
+ * @returns The XML string document representing the string that was used.
618
807
  */
619
808
  export const xml = (strings: TemplateStringsArray, ...values: any[]) => {
620
809
  let outStr = "";
621
810
  let i;
622
811
  for (i = 0; i < values.length; i++) {
623
812
  outStr += strings[i];
624
- outStr += values[i];
813
+ // Handle the different case of object, if it's an array we join them, if it's a binding expression (determined by _type) then we compile it.
814
+ if (Array.isArray(values[i])) {
815
+ outStr += values[i].flat(5).join("").trim();
816
+ } else if (values[i]?._type) {
817
+ const compiledExpression = compileExpression(values[i]);
818
+ outStr += compiledExpression !== undefined ? escapeXMLAttributeValue(compiledExpression) : undefined;
819
+ } else if (values[i]?.getTemplate) {
820
+ outStr += values[i].getTemplate();
821
+ } else if (typeof values[i] === "object") {
822
+ const propertyUId = storeValue(values[i]);
823
+ outStr += `${propertyUId}`;
824
+ } else {
825
+ outStr += values[i];
826
+ }
625
827
  }
626
828
  outStr += strings[i];
627
- return DOMParserInstance.parseFromString(outStr, "text/xml");
829
+ outStr = outStr.trim();
830
+ if (isTraceMode) {
831
+ const xmlResult = parseXMLString(outStr, true);
832
+ if (xmlResult && xmlResult?.localName === "parsererror") {
833
+ const errorMessage = (xmlResult as any).innerText || (xmlResult as any).innerHTML;
834
+ return createErrorXML([errorMessage.split("\n")[0]], outStr);
835
+ }
836
+ }
837
+ return outStr;
628
838
  };