@sapui5/sap.fe.core 1.102.2 → 1.104.1

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 (324) hide show
  1. package/package.json +6 -6
  2. package/src/sap/fe/core/.library +1 -1
  3. package/src/sap/fe/core/AppComponent.js +73 -30
  4. package/src/sap/fe/core/AppComponent.ts +65 -43
  5. package/src/sap/fe/core/AppStateHandler.js +82 -70
  6. package/src/sap/fe/core/AppStateHandler.ts +32 -37
  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 +227 -126
  10. package/src/sap/fe/core/CommonUtils.ts +240 -163
  11. package/src/sap/fe/core/ExtensionAPI.js +24 -27
  12. package/src/sap/fe/core/ExtensionAPI.ts +36 -38
  13. package/src/sap/fe/core/PageController.js +4 -4
  14. package/src/sap/fe/core/PageController.ts +4 -5
  15. package/src/sap/fe/core/TemplateComponent.js +1 -1
  16. package/src/sap/fe/core/TemplateComponent.ts +6 -6
  17. package/src/sap/fe/core/TemplateModel.js +1 -1
  18. package/src/sap/fe/core/TemplateModel.ts +1 -1
  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/BuildingBlock.js +181 -43
  22. package/src/sap/fe/core/buildingBlocks/BuildingBlock.ts +150 -24
  23. package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.js +585 -210
  24. package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.ts +246 -96
  25. package/src/sap/fe/core/buildingBlocks/TraceInfo.js +30 -30
  26. package/src/sap/fe/core/buildingBlocks/TraceInfo.ts +32 -29
  27. package/src/sap/fe/core/controllerextensions/EditFlow.js +379 -330
  28. package/src/sap/fe/core/controllerextensions/EditFlow.ts +253 -245
  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 +101 -74
  32. package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +69 -79
  33. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +67 -67
  34. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +76 -76
  35. package/src/sap/fe/core/controllerextensions/InternalRouting.js +85 -77
  36. package/src/sap/fe/core/controllerextensions/InternalRouting.ts +103 -99
  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 +9 -9
  40. package/src/sap/fe/core/controllerextensions/MassEdit.ts +20 -27
  41. package/src/sap/fe/core/controllerextensions/MessageHandler.js +20 -12
  42. package/src/sap/fe/core/controllerextensions/MessageHandler.ts +21 -14
  43. package/src/sap/fe/core/controllerextensions/PageReady.js +97 -25
  44. package/src/sap/fe/core/controllerextensions/PageReady.ts +98 -34
  45. package/src/sap/fe/core/controllerextensions/Paginator.js +21 -22
  46. package/src/sap/fe/core/controllerextensions/Paginator.ts +24 -25
  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 +170 -139
  52. package/src/sap/fe/core/controllerextensions/Share.ts +117 -118
  53. package/src/sap/fe/core/controllerextensions/SideEffects.js +46 -50
  54. package/src/sap/fe/core/controllerextensions/SideEffects.ts +56 -60
  55. package/src/sap/fe/core/controllerextensions/ViewState.js +200 -131
  56. package/src/sap/fe/core/controllerextensions/ViewState.ts +141 -148
  57. package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.js +5 -5
  58. package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.ts +8 -7
  59. package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.js +11 -10
  60. package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.ts +17 -20
  61. package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.js +2 -2
  62. package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.ts +4 -4
  63. package/src/sap/fe/core/controllerextensions/collaboration/Manage.js +7 -9
  64. package/src/sap/fe/core/controllerextensions/collaboration/Manage.ts +18 -19
  65. package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.js +190 -141
  66. package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.ts +258 -210
  67. package/src/sap/fe/core/controllerextensions/editFlow/draft.js +183 -125
  68. package/src/sap/fe/core/controllerextensions/editFlow/draft.ts +213 -156
  69. package/src/sap/fe/core/controllerextensions/editFlow/operations.js +164 -140
  70. package/src/sap/fe/core/controllerextensions/editFlow/operations.ts +180 -150
  71. package/src/sap/fe/core/controllerextensions/editFlow/sticky.js +24 -26
  72. package/src/sap/fe/core/controllerextensions/editFlow/sticky.ts +35 -33
  73. package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.js +71 -41
  74. package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.ts +102 -82
  75. package/src/sap/fe/core/controllerextensions/routing/RouterProxy.js +61 -71
  76. package/src/sap/fe/core/controllerextensions/routing/RouterProxy.ts +56 -64
  77. package/src/sap/fe/core/controls/Any.js +9 -5
  78. package/src/sap/fe/core/controls/Any.ts +10 -4
  79. package/src/sap/fe/core/controls/CommandExecution.js +11 -25
  80. package/src/sap/fe/core/controls/CommandExecution.ts +11 -25
  81. package/src/sap/fe/core/controls/ConditionalWrapper.js +2 -2
  82. package/src/sap/fe/core/controls/ConditionalWrapper.ts +3 -3
  83. package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.js +22 -22
  84. package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.ts +25 -24
  85. package/src/sap/fe/core/controls/CustomQuickViewPage.js +2 -2
  86. package/src/sap/fe/core/controls/CustomQuickViewPage.ts +2 -2
  87. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +3 -3
  88. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +5 -5
  89. package/src/sap/fe/core/controls/FieldWrapper.js +2 -2
  90. package/src/sap/fe/core/controls/FieldWrapper.ts +3 -3
  91. package/src/sap/fe/core/controls/FileWrapper.js +7 -2
  92. package/src/sap/fe/core/controls/FileWrapper.ts +15 -11
  93. package/src/sap/fe/core/controls/FilterBar.js +6 -2
  94. package/src/sap/fe/core/controls/FilterBar.ts +13 -9
  95. package/src/sap/fe/core/controls/FormElementWrapper.js +1 -1
  96. package/src/sap/fe/core/controls/FormElementWrapper.ts +2 -2
  97. package/src/sap/fe/core/controls/MassEditSelect.js +1 -1
  98. package/src/sap/fe/core/controls/MassEditSelect.ts +0 -4
  99. package/src/sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog.fragment.xml +3 -3
  100. package/src/sap/fe/core/controls/filterbar/VisualFilter.js +16 -12
  101. package/src/sap/fe/core/controls/filterbar/VisualFilter.ts +20 -22
  102. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +3 -3
  103. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.ts +8 -8
  104. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +49 -49
  105. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +54 -54
  106. package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +8 -2
  107. package/src/sap/fe/core/controls/massEdit/MassEditField.fragment.xml +22 -35
  108. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +89 -88
  109. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +107 -106
  110. package/src/sap/fe/core/converters/ConverterContext.js +26 -33
  111. package/src/sap/fe/core/converters/ConverterContext.ts +52 -61
  112. package/src/sap/fe/core/converters/ManifestSettings.js +1 -1
  113. package/src/sap/fe/core/converters/ManifestSettings.ts +17 -15
  114. package/src/sap/fe/core/converters/ManifestWrapper.js +59 -45
  115. package/src/sap/fe/core/converters/ManifestWrapper.ts +55 -45
  116. package/src/sap/fe/core/converters/MetaModelConverter.js +64 -35
  117. package/src/sap/fe/core/converters/MetaModelConverter.ts +154 -129
  118. package/src/sap/fe/core/converters/TemplateConverter.js +21 -20
  119. package/src/sap/fe/core/converters/TemplateConverter.ts +27 -24
  120. package/src/sap/fe/core/converters/annotations/DataField.js +58 -35
  121. package/src/sap/fe/core/converters/annotations/DataField.ts +102 -76
  122. package/src/sap/fe/core/converters/common/AnnotationConverter.js +1911 -1495
  123. package/src/sap/fe/core/converters/controls/Common/Action.js +50 -41
  124. package/src/sap/fe/core/converters/controls/Common/Action.ts +56 -46
  125. package/src/sap/fe/core/converters/controls/Common/Chart.js +14 -14
  126. package/src/sap/fe/core/converters/controls/Common/Chart.ts +26 -33
  127. package/src/sap/fe/core/converters/controls/Common/Criticality.js +3 -3
  128. package/src/sap/fe/core/converters/controls/Common/Criticality.ts +4 -4
  129. package/src/sap/fe/core/converters/controls/Common/DataVisualization.js +30 -28
  130. package/src/sap/fe/core/converters/controls/Common/DataVisualization.ts +60 -61
  131. package/src/sap/fe/core/converters/controls/Common/Form.js +27 -28
  132. package/src/sap/fe/core/converters/controls/Common/Form.ts +44 -57
  133. package/src/sap/fe/core/converters/controls/Common/KPI.js +11 -11
  134. package/src/sap/fe/core/converters/controls/Common/KPI.ts +49 -52
  135. package/src/sap/fe/core/converters/controls/Common/Table.js +181 -197
  136. package/src/sap/fe/core/converters/controls/Common/Table.ts +251 -280
  137. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +119 -119
  138. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +144 -141
  139. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +45 -41
  140. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +65 -59
  141. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +28 -26
  142. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +46 -43
  143. package/src/sap/fe/core/converters/controls/ObjectPage/Avatar.js +9 -9
  144. package/src/sap/fe/core/converters/controls/ObjectPage/Avatar.ts +14 -13
  145. package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.js +67 -64
  146. package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.ts +69 -66
  147. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +77 -73
  148. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +101 -97
  149. package/src/sap/fe/core/converters/helpers/Aggregation.js +2 -4
  150. package/src/sap/fe/core/converters/helpers/Aggregation.ts +12 -15
  151. package/src/sap/fe/core/converters/helpers/BindingHelper.js +31 -31
  152. package/src/sap/fe/core/converters/helpers/BindingHelper.ts +30 -29
  153. package/src/sap/fe/core/converters/helpers/ConfigurableObject.js +4 -4
  154. package/src/sap/fe/core/converters/helpers/ConfigurableObject.ts +9 -9
  155. package/src/sap/fe/core/converters/helpers/ID.js +48 -46
  156. package/src/sap/fe/core/converters/helpers/ID.ts +26 -25
  157. package/src/sap/fe/core/converters/helpers/Key.js +7 -7
  158. package/src/sap/fe/core/converters/helpers/Key.ts +7 -7
  159. package/src/sap/fe/core/converters/helpers/SelectionVariantHelper.js +1 -1
  160. package/src/sap/fe/core/converters/helpers/SelectionVariantHelper.ts +4 -5
  161. package/src/sap/fe/core/converters/objectPage/FormMenuActions.js +6 -6
  162. package/src/sap/fe/core/converters/objectPage/FormMenuActions.ts +10 -10
  163. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +46 -62
  164. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +54 -82
  165. package/src/sap/fe/core/converters/templates/ListReportConverter.js +55 -42
  166. package/src/sap/fe/core/converters/templates/ListReportConverter.ts +81 -66
  167. package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +39 -38
  168. package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +52 -61
  169. package/src/sap/fe/core/designtime/AppComponent.designtime.js +4 -4
  170. package/src/sap/fe/core/designtime/AppComponent.designtime.ts +4 -4
  171. package/src/sap/fe/core/formatters/CollaborationFormatter.js +2 -2
  172. package/src/sap/fe/core/formatters/CollaborationFormatter.ts +3 -3
  173. package/src/sap/fe/core/formatters/FPMFormatter.js +5 -5
  174. package/src/sap/fe/core/formatters/FPMFormatter.ts +10 -10
  175. package/src/sap/fe/core/formatters/KPIFormatter.js +7 -7
  176. package/src/sap/fe/core/formatters/KPIFormatter.ts +10 -10
  177. package/src/sap/fe/core/formatters/StandardFormatter.js +96 -0
  178. package/src/sap/fe/core/formatters/StandardFormatter.ts +70 -0
  179. package/src/sap/fe/core/formatters/TableFormatter.js +11 -11
  180. package/src/sap/fe/core/formatters/TableFormatter.ts +12 -12
  181. package/src/sap/fe/core/formatters/ValueFormatter.js +8 -8
  182. package/src/sap/fe/core/formatters/ValueFormatter.ts +9 -9
  183. package/src/sap/fe/core/helpers/AppStartupHelper.js +15 -15
  184. package/src/sap/fe/core/helpers/AppStartupHelper.ts +37 -40
  185. package/src/sap/fe/core/helpers/BindingToolkit.js +1832 -0
  186. package/src/sap/fe/core/helpers/{BindingExpression.ts → BindingToolkit.ts} +396 -269
  187. package/src/sap/fe/core/helpers/ClassSupport.js +49 -12
  188. package/src/sap/fe/core/helpers/ClassSupport.ts +37 -10
  189. package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +2 -2
  190. package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.ts +1 -1
  191. package/src/sap/fe/core/helpers/EditState.js +1 -6
  192. package/src/sap/fe/core/helpers/EditState.ts +5 -10
  193. package/src/sap/fe/core/helpers/ExcelFormatHelper.js +2 -2
  194. package/src/sap/fe/core/helpers/ExcelFormatHelper.ts +4 -4
  195. package/src/sap/fe/core/helpers/FPMHelper.js +1 -1
  196. package/src/sap/fe/core/helpers/FPMHelper.ts +2 -2
  197. package/src/sap/fe/core/helpers/KeepAliveHelper.js +31 -31
  198. package/src/sap/fe/core/helpers/KeepAliveHelper.ts +52 -56
  199. package/src/sap/fe/core/helpers/MassEditHelper.js +306 -280
  200. package/src/sap/fe/core/helpers/MassEditHelper.ts +380 -360
  201. package/src/sap/fe/core/helpers/MessageStrip.js +81 -0
  202. package/src/sap/fe/core/helpers/MessageStrip.ts +79 -0
  203. package/src/sap/fe/core/helpers/ModelHelper.js +25 -25
  204. package/src/sap/fe/core/helpers/ModelHelper.ts +34 -32
  205. package/src/sap/fe/core/helpers/PasteHelper.js +3 -10
  206. package/src/sap/fe/core/helpers/PasteHelper.ts +20 -25
  207. package/src/sap/fe/core/helpers/SemanticDateOperators.js +1 -1
  208. package/src/sap/fe/core/helpers/SemanticDateOperators.ts +11 -11
  209. package/src/sap/fe/core/helpers/SemanticKeyHelper.js +3 -3
  210. package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +8 -8
  211. package/src/sap/fe/core/helpers/StableIdHelper.js +12 -12
  212. package/src/sap/fe/core/helpers/StableIdHelper.ts +12 -12
  213. package/src/sap/fe/core/helpers/ToES6Promise.js +32 -0
  214. package/src/sap/fe/core/helpers/ToES6Promise.ts +19 -0
  215. package/src/sap/fe/core/jsx-runtime/Fragment.js +16 -0
  216. package/src/sap/fe/core/jsx-runtime/Fragment.ts +3 -0
  217. package/src/sap/fe/core/jsx-runtime/jsx-control.js +99 -0
  218. package/src/sap/fe/core/jsx-runtime/jsx-control.ts +82 -0
  219. package/src/sap/fe/core/jsx-runtime/jsx-xml.js +105 -0
  220. package/src/sap/fe/core/jsx-runtime/jsx-xml.ts +89 -0
  221. package/src/sap/fe/core/jsx-runtime/jsx.js +12 -90
  222. package/src/sap/fe/core/jsx-runtime/jsx.ts +24 -85
  223. package/src/sap/fe/core/library.js +42 -3
  224. package/src/sap/fe/core/library.ts +38 -0
  225. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +3 -3
  226. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +2 -2
  227. package/src/sap/fe/core/messagebundle.properties +39 -63
  228. package/src/sap/fe/core/messagebundle_ar.properties +25 -39
  229. package/src/sap/fe/core/messagebundle_bg.properties +25 -39
  230. package/src/sap/fe/core/messagebundle_ca.properties +25 -39
  231. package/src/sap/fe/core/messagebundle_cs.properties +25 -39
  232. package/src/sap/fe/core/messagebundle_cy.properties +25 -39
  233. package/src/sap/fe/core/messagebundle_da.properties +25 -39
  234. package/src/sap/fe/core/messagebundle_de.properties +25 -39
  235. package/src/sap/fe/core/messagebundle_el.properties +26 -40
  236. package/src/sap/fe/core/messagebundle_en.properties +25 -39
  237. package/src/sap/fe/core/messagebundle_en_GB.properties +25 -39
  238. package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +25 -39
  239. package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +25 -39
  240. package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +26 -18
  241. package/src/sap/fe/core/messagebundle_es.properties +27 -41
  242. package/src/sap/fe/core/messagebundle_es_MX.properties +25 -39
  243. package/src/sap/fe/core/messagebundle_et.properties +25 -39
  244. package/src/sap/fe/core/messagebundle_fi.properties +25 -39
  245. package/src/sap/fe/core/messagebundle_fr.properties +26 -40
  246. package/src/sap/fe/core/messagebundle_fr_CA.properties +25 -39
  247. package/src/sap/fe/core/messagebundle_hi.properties +25 -39
  248. package/src/sap/fe/core/messagebundle_hr.properties +25 -39
  249. package/src/sap/fe/core/messagebundle_hu.properties +25 -39
  250. package/src/sap/fe/core/messagebundle_id.properties +25 -39
  251. package/src/sap/fe/core/messagebundle_it.properties +41 -55
  252. package/src/sap/fe/core/messagebundle_iw.properties +25 -39
  253. package/src/sap/fe/core/messagebundle_ja.properties +25 -39
  254. package/src/sap/fe/core/messagebundle_kk.properties +25 -39
  255. package/src/sap/fe/core/messagebundle_ko.properties +30 -44
  256. package/src/sap/fe/core/messagebundle_lt.properties +25 -39
  257. package/src/sap/fe/core/messagebundle_lv.properties +25 -39
  258. package/src/sap/fe/core/messagebundle_ms.properties +25 -39
  259. package/src/sap/fe/core/messagebundle_nl.properties +27 -41
  260. package/src/sap/fe/core/messagebundle_no.properties +25 -39
  261. package/src/sap/fe/core/messagebundle_pl.properties +26 -40
  262. package/src/sap/fe/core/messagebundle_pt.properties +26 -40
  263. package/src/sap/fe/core/messagebundle_pt_PT.properties +25 -39
  264. package/src/sap/fe/core/messagebundle_ro.properties +25 -39
  265. package/src/sap/fe/core/messagebundle_ru.properties +25 -39
  266. package/src/sap/fe/core/messagebundle_sh.properties +25 -39
  267. package/src/sap/fe/core/messagebundle_sk.properties +25 -39
  268. package/src/sap/fe/core/messagebundle_sl.properties +25 -39
  269. package/src/sap/fe/core/messagebundle_sv.properties +25 -39
  270. package/src/sap/fe/core/messagebundle_th.properties +25 -39
  271. package/src/sap/fe/core/messagebundle_tr.properties +25 -39
  272. package/src/sap/fe/core/messagebundle_uk.properties +25 -39
  273. package/src/sap/fe/core/messagebundle_vi.properties +25 -39
  274. package/src/sap/fe/core/messagebundle_zh_CN.properties +25 -39
  275. package/src/sap/fe/core/messagebundle_zh_TW.properties +25 -39
  276. package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +2 -2
  277. package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +5 -5
  278. package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +97 -69
  279. package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +68 -69
  280. package/src/sap/fe/core/services/EnvironmentServiceFactory.js +1 -1
  281. package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +3 -2
  282. package/src/sap/fe/core/services/NavigationServiceFactory.js +61 -49
  283. package/src/sap/fe/core/services/NavigationServiceFactory.ts +63 -52
  284. package/src/sap/fe/core/services/ResourceModelServiceFactory.js +2 -2
  285. package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +4 -4
  286. package/src/sap/fe/core/services/RoutingServiceFactory.js +55 -55
  287. package/src/sap/fe/core/services/RoutingServiceFactory.ts +67 -65
  288. package/src/sap/fe/core/services/ShellServicesFactory.js +92 -76
  289. package/src/sap/fe/core/services/ShellServicesFactory.ts +95 -82
  290. package/src/sap/fe/core/services/SideEffectsServiceFactory.js +61 -61
  291. package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +102 -92
  292. package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +224 -198
  293. package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +138 -139
  294. package/src/sap/fe/core/support/CommonHelper.js +3 -2
  295. package/src/sap/fe/core/support/CommonHelper.ts +9 -13
  296. package/src/sap/fe/core/support/Diagnostics.js +1 -1
  297. package/src/sap/fe/core/support/Diagnostics.ts +5 -5
  298. package/src/sap/fe/core/templating/CommonFormatters.js +84 -0
  299. package/src/sap/fe/core/templating/CommonFormatters.ts +86 -0
  300. package/src/sap/fe/core/templating/CriticalityFormatters.js +31 -31
  301. package/src/sap/fe/core/templating/CriticalityFormatters.ts +42 -40
  302. package/src/sap/fe/core/templating/DataFieldFormatters.js +8 -8
  303. package/src/sap/fe/core/templating/DataFieldFormatters.ts +13 -10
  304. package/src/sap/fe/core/templating/DataModelPathHelper.js +16 -15
  305. package/src/sap/fe/core/templating/DataModelPathHelper.ts +42 -32
  306. package/src/sap/fe/core/templating/DisplayModeFormatter.js +1 -1
  307. package/src/sap/fe/core/templating/DisplayModeFormatter.ts +2 -3
  308. package/src/sap/fe/core/templating/EntitySetHelper.js +7 -7
  309. package/src/sap/fe/core/templating/EntitySetHelper.ts +6 -8
  310. package/src/sap/fe/core/templating/FieldControlHelper.js +35 -34
  311. package/src/sap/fe/core/templating/FieldControlHelper.ts +29 -46
  312. package/src/sap/fe/core/templating/FilterHelper.js +16 -15
  313. package/src/sap/fe/core/templating/FilterHelper.ts +18 -18
  314. package/src/sap/fe/core/templating/FilterTemplating.js +1 -1
  315. package/src/sap/fe/core/templating/FilterTemplating.ts +3 -3
  316. package/src/sap/fe/core/templating/PropertyFormatters.js +7 -7
  317. package/src/sap/fe/core/templating/PropertyFormatters.ts +21 -19
  318. package/src/sap/fe/core/templating/PropertyHelper.js +25 -25
  319. package/src/sap/fe/core/templating/PropertyHelper.ts +25 -26
  320. package/src/sap/fe/core/templating/UIFormatters.js +152 -95
  321. package/src/sap/fe/core/templating/UIFormatters.ts +202 -128
  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/helpers/BindingExpression.js +0 -1732
@@ -1,7 +1,7 @@
1
1
  import Log from "sap/base/Log";
2
2
  import uid from "sap/base/util/uid";
3
3
  import AttributeModel from "sap/fe/core/buildingBlocks/AttributeModel";
4
- import {
4
+ import type {
5
5
  BuildingBlockAggregationDefinition,
6
6
  BuildingBlockBase,
7
7
  BuildingBlockDefinition,
@@ -10,12 +10,12 @@ import {
10
10
  BuildingBlockMetadataContextDefinition,
11
11
  BuildingBlockPropertyDefinition
12
12
  } from "sap/fe/core/buildingBlocks/BuildingBlock";
13
- import { compileBinding } from "sap/fe/core/helpers/BindingExpression";
13
+ import { compileExpression } from "sap/fe/core/helpers/BindingToolkit";
14
14
  import ResourceModel from "sap/fe/macros/ResourceModel";
15
15
  import BindingParser from "sap/ui/base/BindingParser";
16
16
  import XMLPreprocessor from "sap/ui/core/util/XMLPreprocessor";
17
- import Context from "sap/ui/model/Context";
18
- 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";
19
19
  import TraceInfo from "./TraceInfo";
20
20
 
21
21
  const LOGGER_SCOPE = "sap.fe.core.buildingBlocks.BuildingBlockRuntime";
@@ -27,6 +27,7 @@ type ResolvedBuildingBlockMetadata = {
27
27
  aggregations: Record<string, BuildingBlockAggregationDefinition>;
28
28
  metadataContexts: Record<string, BuildingBlockMetadataContextDefinition>;
29
29
  isOpen: boolean;
30
+ defaultAggregation?: string;
30
31
  };
31
32
 
32
33
  type ICallback = {
@@ -43,7 +44,7 @@ type ICallback = {
43
44
  * @returns {sap.ui.base.SyncPromise}
44
45
  * A thenable which resolves with <code>undefined</code> as soon as visiting
45
46
  * is done, or is rejected with a corresponding error if visiting fails
46
- **/
47
+ */
47
48
  visitNode(oNode: Node): Promise<void>;
48
49
 
49
50
  /**
@@ -70,6 +71,7 @@ type ICallback = {
70
71
  /**
71
72
  * Interprets the given XML DOM attribute value as a binding and returns the
72
73
  * resulting value.
74
+ *
73
75
  * @param {string} sValue
74
76
  * An XML DOM attribute value
75
77
  * @param {Element} [oElement]
@@ -171,7 +173,7 @@ export function validateMacroSignature(sName: any, oMetadata: any, mContexts: an
171
173
  const oPropertySettings = oMetadata.properties[sKey];
172
174
  if (!oNode.hasAttribute(sKey)) {
173
175
  if (oPropertySettings.required && !oPropertySettings.hasOwnProperty("defaultValue")) {
174
- throw new Error(sName + ": " + "Required property '" + sKey + "' is missing");
176
+ throw new Error(`${sName}: ` + `Required property '${sKey}' is missing`);
175
177
  }
176
178
  } else {
177
179
  delete oAttributeNames[sKey];
@@ -187,6 +189,10 @@ export function validateMacroSignature(sName: any, oMetadata: any, mContexts: an
187
189
  });
188
190
  }
189
191
 
192
+ const SAP_UI_CORE_ELEMENT = "sap.ui.core.Element";
193
+
194
+ const SAP_UI_MODEL_CONTEXT = "sap.ui.model.Context";
195
+
190
196
  /**
191
197
  * Ensures that the metadata for the building block are properly defined.
192
198
  *
@@ -199,16 +205,16 @@ function prepareMetadata(buildingBlockMetadata?: BuildingBlockMetadata, isOpen =
199
205
  const oProperties: any = {};
200
206
  const oAggregations: any = {
201
207
  "dependents": {
202
- type: "sap.ui.core.Element"
208
+ type: SAP_UI_CORE_ELEMENT
203
209
  },
204
210
  "customData": {
205
- type: "sap.ui.core.Element"
211
+ type: SAP_UI_CORE_ELEMENT
206
212
  }
207
213
  };
208
214
  const oMetadataContexts: Record<string, BuildingBlockPropertyDefinition> = {};
209
-
215
+ let foundDefaultAggregation;
210
216
  Object.keys(buildingBlockMetadata.properties).forEach(function (sPropertyName: string) {
211
- if (buildingBlockMetadata.properties[sPropertyName].type !== "sap.ui.model.Context") {
217
+ if (buildingBlockMetadata.properties[sPropertyName].type !== SAP_UI_MODEL_CONTEXT) {
212
218
  oProperties[sPropertyName] = buildingBlockMetadata.properties[sPropertyName];
213
219
  } else {
214
220
  oMetadataContexts[sPropertyName] = buildingBlockMetadata.properties[sPropertyName];
@@ -223,11 +229,15 @@ function prepareMetadata(buildingBlockMetadata?: BuildingBlockMetadata, isOpen =
223
229
  if (buildingBlockMetadata.aggregations) {
224
230
  Object.keys(buildingBlockMetadata.aggregations).forEach(function (sPropertyName: string) {
225
231
  oAggregations[sPropertyName] = buildingBlockMetadata.aggregations[sPropertyName];
232
+ if (oAggregations[sPropertyName].isDefault) {
233
+ foundDefaultAggregation = sPropertyName;
234
+ }
226
235
  });
227
236
  }
228
237
  return {
229
238
  properties: oProperties,
230
239
  aggregations: oAggregations,
240
+ defaultAggregation: foundDefaultAggregation,
231
241
  metadataContexts: oMetadataContexts,
232
242
  isOpen: isOpen
233
243
  };
@@ -236,10 +246,10 @@ function prepareMetadata(buildingBlockMetadata?: BuildingBlockMetadata, isOpen =
236
246
  metadataContexts: {},
237
247
  aggregations: {
238
248
  "dependents": {
239
- type: "sap.ui.core.Element"
249
+ type: SAP_UI_CORE_ELEMENT
240
250
  },
241
251
  "customData": {
242
- type: "sap.ui.core.Element"
252
+ type: SAP_UI_CORE_ELEMENT
243
253
  }
244
254
  },
245
255
  properties: {},
@@ -260,16 +270,14 @@ function _getMetadataContext(
260
270
  if (!bDoNotResolve && oNode.hasAttribute(sAttributeName)) {
261
271
  const sAttributeValue = oNode.getAttribute(sAttributeName) as string;
262
272
  let sMetaPath;
263
- // oVisitor.getResult(sAttributeValue, oNode);
264
273
  oMetadataContext = BindingParser.complexParser(sAttributeValue);
265
274
  if (!oMetadataContext) {
266
- if (sAttributeValue.startsWith("uid--")) {
275
+ if (sAttributeValue.startsWith("/uid--")) {
267
276
  const oData = myStore[sAttributeValue];
268
- const sContextPath = "/" + sAttributeValue;
269
- oSettings.models.converterContext.setProperty(sContextPath, oData);
277
+ oSettings.models.converterContext.setProperty(sAttributeValue, oData);
270
278
  oMetadataContext = {
271
279
  model: "converterContext",
272
- path: sContextPath
280
+ path: sAttributeValue
273
281
  };
274
282
  } else if ((sAttributeName === "metaPath" && oSettings.currentContextPath) || sAttributeName === "contextPath") {
275
283
  if (sAttributeValue && sAttributeValue.startsWith("/")) {
@@ -322,7 +330,8 @@ async function processProperties(
322
330
  isPublic: boolean,
323
331
  oVisitor: ICallback,
324
332
  mContexts: any,
325
- oMetadataContexts: any
333
+ oMetadataContexts: any,
334
+ apiVersion?: number
326
335
  ) {
327
336
  const mMissingContext: any = {};
328
337
  const oDefinitionProperties = oMetadata.properties;
@@ -333,10 +342,9 @@ async function processProperties(
333
342
  const aDefinitionPropertiesKeys = Object.keys(oDefinitionProperties);
334
343
  let aDefinitionContextsKeys = Object.keys(oDefinitionContexts);
335
344
  const propertyValues: Record<string, any> = {};
336
- for (let j = 0; j < aDefinitionPropertiesKeys.length; j++) {
337
- const sKeyValue = aDefinitionPropertiesKeys[j];
345
+ for (const sKeyValue of aDefinitionPropertiesKeys) {
338
346
  if (oDefinitionProperties[sKeyValue].type === "object") {
339
- propertyValues[sKeyValue] = {}; // To avoid vales being reused accross macros
347
+ propertyValues[sKeyValue] = {}; // To avoid values being reused accross macros
340
348
  } else {
341
349
  propertyValues[sKeyValue] = oDefinitionProperties[sKeyValue].defaultValue;
342
350
  }
@@ -344,8 +352,11 @@ async function processProperties(
344
352
  Log.error(`Property ${sKeyValue} was ignored as it is not intended for public usage`);
345
353
  } else if (oNode.hasAttribute(sKeyValue)) {
346
354
  await oVisitor.visitAttribute(oNode, oNode.attributes.getNamedItem(sKeyValue) as Attr);
347
- const vValue = oNode.getAttribute(sKeyValue);
355
+ let vValue: any = oNode.getAttribute(sKeyValue);
348
356
  if (vValue !== undefined) {
357
+ if (apiVersion === 2 && typeof vValue === "string" && oDefinitionProperties[sKeyValue].type === "boolean") {
358
+ vValue = vValue === "true";
359
+ }
349
360
  propertyValues[sKeyValue] = vValue;
350
361
  }
351
362
  }
@@ -376,48 +387,161 @@ async function processProperties(
376
387
  }
377
388
  return { mMissingContext, propertyValues: propertyValues };
378
389
  }
390
+ function parseAggregation(oAggregation: Element) {
391
+ const oOutObjects: any = {};
392
+ if (oAggregation && oAggregation.children.length > 0) {
393
+ const children = oAggregation.children;
394
+ for (let childIdx = 0; childIdx < children.length; childIdx++) {
395
+ const childDefinition = children[childIdx];
396
+ let childKey = childDefinition.getAttribute("key") || childDefinition.getAttribute("id");
397
+ if (childKey) {
398
+ childKey = `InlineXML_${childKey}`;
399
+ childDefinition.setAttribute("key", childKey);
400
+ oOutObjects[childKey] = {
401
+ key: childKey,
402
+ position: {
403
+ placement: childDefinition.getAttribute("placement"),
404
+ anchor: childDefinition.getAttribute("anchor")
405
+ },
406
+ type: "Slot"
407
+ };
408
+ }
409
+ }
410
+ }
411
+ return oOutObjects;
412
+ }
379
413
 
380
414
  async function processChildren(
381
415
  oNode: Element,
382
416
  oVisitor: ICallback,
383
417
  oMetadata: ResolvedBuildingBlockMetadata,
384
418
  isPublic: boolean,
385
- propertyValues: Record<string, any>
419
+ propertyValues: Record<string, any>,
420
+ apiVersion?: number
386
421
  ) {
387
422
  const oAggregations: any = {};
388
423
  if (oNode.firstElementChild !== null) {
389
- // If there are aggregation we need to visit the childNodes first and foremost
390
- await oVisitor.visitChildNodes(oNode);
391
424
  let oFirstElementChild: Element | null = oNode.firstElementChild;
425
+ if (apiVersion === 2) {
426
+ while (oFirstElementChild !== null) {
427
+ const sChildName = oFirstElementChild.localName;
428
+ let sAggregationName = sChildName;
429
+ if (sAggregationName[0].toUpperCase() === sAggregationName[0]) {
430
+ // not a sub aggregation, go back to default Aggregation
431
+ sAggregationName = oMetadata.defaultAggregation || "";
432
+ }
433
+ const aggregationDefinition = oMetadata.aggregations[sAggregationName];
434
+ if (aggregationDefinition && !aggregationDefinition.slot) {
435
+ const parsedAggregation = parseAggregation(oFirstElementChild);
436
+ oAggregations[sAggregationName] = parsedAggregation;
437
+ for (const parsedAggregationKey in parsedAggregation) {
438
+ oMetadata.aggregations[parsedAggregationKey] = parsedAggregation[parsedAggregationKey];
439
+ }
440
+ }
441
+ oFirstElementChild = oFirstElementChild.nextElementSibling;
442
+ }
443
+ }
444
+
445
+ if (apiVersion !== 2) {
446
+ // If there are aggregation we need to visit the childNodes to resolve templating instructions
447
+ await oVisitor.visitChildNodes(oNode);
448
+ }
449
+ oFirstElementChild = oNode.firstElementChild;
392
450
  while (oFirstElementChild !== null) {
451
+ const oNextChild: Element | null = oFirstElementChild.nextElementSibling;
393
452
  const sChildName = oFirstElementChild.localName;
453
+ let sAggregationName = sChildName;
454
+ if (sAggregationName[0].toUpperCase() === sAggregationName[0]) {
455
+ // not a sub aggregation, go back to default Aggregation
456
+ sAggregationName = oMetadata.defaultAggregation || "";
457
+ }
394
458
  if (
395
- Object.keys(oMetadata.aggregations).indexOf(sChildName) !== -1 &&
396
- (!isPublic || oMetadata.aggregations[sChildName].isPublic)
459
+ Object.keys(oMetadata.aggregations).indexOf(sAggregationName) !== -1 &&
460
+ (!isPublic || oMetadata.aggregations[sAggregationName].isPublic)
397
461
  ) {
398
- oAggregations[oFirstElementChild.localName] = oFirstElementChild;
399
- } else if (Object.keys(oMetadata.properties).indexOf(sChildName) !== -1) {
462
+ if (apiVersion === 2) {
463
+ const aggregationDefinition = oMetadata.aggregations[sAggregationName];
464
+ if (!aggregationDefinition.slot && oFirstElementChild && oFirstElementChild.children.length > 0) {
465
+ await oVisitor.visitNode(oFirstElementChild);
466
+ let childDefinition = oFirstElementChild.firstElementChild;
467
+ while (childDefinition) {
468
+ const oNewChild = document.createElementNS(oNode.namespaceURI, childDefinition.getAttribute("key")!);
469
+ const nextChild = childDefinition.nextElementSibling;
470
+ oNewChild.appendChild(childDefinition);
471
+ oAggregations[childDefinition.getAttribute("key")!] = oNewChild;
472
+ childDefinition.removeAttribute("key");
473
+ childDefinition = nextChild;
474
+ }
475
+ } else if (aggregationDefinition.slot) {
476
+ if (sAggregationName !== sChildName) {
477
+ if (!oAggregations[sAggregationName]) {
478
+ const oNewChild = document.createElementNS(oNode.namespaceURI, sAggregationName);
479
+ oAggregations[sAggregationName] = oNewChild;
480
+ }
481
+ oAggregations[sAggregationName].appendChild(oFirstElementChild);
482
+ } else {
483
+ oAggregations[sAggregationName] = oFirstElementChild;
484
+ }
485
+ }
486
+ } else {
487
+ await oVisitor.visitNode(oFirstElementChild);
488
+ oAggregations[oFirstElementChild.localName] = oFirstElementChild;
489
+ }
490
+ } else if (Object.keys(oMetadata.properties).indexOf(sAggregationName) !== -1) {
491
+ await oVisitor.visitNode(oFirstElementChild);
400
492
  // Object Type properties
401
- propertyValues[sChildName] = {};
493
+ propertyValues[sAggregationName] = {};
402
494
  for (const attributeIndex of Object.keys(oFirstElementChild.attributes)) {
403
- propertyValues[sChildName][oFirstElementChild.attributes[attributeIndex as any].localName] =
495
+ propertyValues[sAggregationName][oFirstElementChild.attributes[attributeIndex as any].localName] =
404
496
  oFirstElementChild.attributes[attributeIndex as any].value;
405
497
  }
406
498
  }
407
499
 
408
- oFirstElementChild = oFirstElementChild.nextElementSibling;
500
+ oFirstElementChild = oNextChild;
409
501
  }
410
502
  }
411
503
  return oAggregations;
412
504
  }
413
505
 
506
+ function processSlots(
507
+ oAggregations: Record<string, any>,
508
+ oMetadataAggregations: Record<string, BuildingBlockAggregationDefinition>,
509
+ oNode: Element,
510
+ processCustomData: boolean = false
511
+ ) {
512
+ if (Object.keys(oAggregations).length > 0) {
513
+ Object.keys(oAggregations).forEach(function (sAggregationName: string) {
514
+ const oAggregationElement = oAggregations[sAggregationName];
515
+ if (oNode !== null && oNode !== undefined && oAggregationElement) {
516
+ const oNewChild = document.createElementNS(oNode.namespaceURI, sAggregationName);
517
+ let oElementChild = oAggregationElement.firstElementChild;
518
+ while (oElementChild) {
519
+ const oNextChild = oElementChild.nextElementSibling;
520
+ oNewChild.appendChild(oElementChild);
521
+ oElementChild = oNextChild;
522
+ }
523
+ if (sAggregationName !== "customData" && sAggregationName !== "dependents") {
524
+ const sSlotName =
525
+ (oMetadataAggregations[sAggregationName] && oMetadataAggregations[sAggregationName].slot) || sAggregationName;
526
+ const oTargetElement = oNode.querySelector(`slot[name='${sSlotName}']`) as Element;
527
+ if (oTargetElement) {
528
+ oTargetElement.replaceWith(...(oNewChild.children as any));
529
+ }
530
+ } else if (processCustomData && oNewChild.children.length > 0) {
531
+ oNode.appendChild(oNewChild);
532
+ }
533
+ }
534
+ });
535
+ }
536
+ }
537
+
414
538
  async function processBuildingBlock(
415
- buildingBLockDefinition: BuildingBlockDefinition,
539
+ buildingBlockDefinition: BuildingBlockDefinition,
416
540
  oNode: Element,
417
541
  oVisitor: ICallback,
418
542
  isPublic = false
419
543
  ) {
420
- const sFragmentName = buildingBLockDefinition.fragment || `${buildingBLockDefinition.namespace}.${buildingBLockDefinition.name}`;
544
+ const sFragmentName = buildingBlockDefinition.fragment || `${buildingBlockDefinition.namespace}.${buildingBlockDefinition.name}`;
421
545
 
422
546
  const sName = "this";
423
547
 
@@ -435,7 +559,7 @@ async function processBuildingBlock(
435
559
  Log.error(error);
436
560
  });
437
561
  }
438
- const oMetadata = prepareMetadata(buildingBLockDefinition.metadata, buildingBLockDefinition.isOpen);
562
+ const oMetadata = prepareMetadata(buildingBlockDefinition.metadata, buildingBlockDefinition.isOpen);
439
563
 
440
564
  //Inject storage for macros
441
565
  if (!oSettings[sFragmentName]) {
@@ -450,12 +574,20 @@ async function processBuildingBlock(
450
574
  isPublic,
451
575
  oVisitor,
452
576
  mContexts,
453
- oMetadataContexts
577
+ oMetadataContexts,
578
+ buildingBlockDefinition.apiVersion
454
579
  );
455
580
  const initialKeys = Object.keys(propertyValues);
456
581
  try {
457
582
  // Aggregation and complex type support
458
- const oAggregations = await processChildren(oNode, oVisitor, oMetadata, isPublic, propertyValues);
583
+ const oAggregations = await processChildren(
584
+ oNode,
585
+ oVisitor,
586
+ oMetadata,
587
+ isPublic,
588
+ propertyValues,
589
+ buildingBlockDefinition.apiVersion
590
+ );
459
591
  let oInstance: any;
460
592
  let oControlConfig = {};
461
593
 
@@ -464,9 +596,9 @@ async function processBuildingBlock(
464
596
  oControlConfig = oSettings.models.viewData.getProperty("/controlConfiguration");
465
597
  }
466
598
  let processedPropertyValues = propertyValues;
467
- if (isV1MacroDef(buildingBLockDefinition) && buildingBLockDefinition.create) {
468
- processedPropertyValues = buildingBLockDefinition.create.call(
469
- buildingBLockDefinition,
599
+ if (isV1MacroDef(buildingBlockDefinition) && buildingBlockDefinition.create) {
600
+ processedPropertyValues = buildingBlockDefinition.create.call(
601
+ buildingBlockDefinition,
470
602
  propertyValues,
471
603
  oControlConfig,
472
604
  oSettings,
@@ -483,22 +615,45 @@ async function processBuildingBlock(
483
615
  mContexts[sContextName] = processedPropertyValues[sContextName];
484
616
  }
485
617
  });
486
- } else if (buildingBLockDefinition.apiVersion === 2) {
618
+ } else if (buildingBlockDefinition.apiVersion === 2) {
487
619
  Object.keys(propertyValues).forEach((propName) => {
488
620
  const oData = propertyValues[propName];
489
621
  if (
490
622
  oData &&
491
623
  oData.isA &&
492
- oData.isA("sap.ui.model.Context") &&
624
+ oData.isA(SAP_UI_MODEL_CONTEXT) &&
493
625
  !oData.getModel().isA("sap.ui.model.odata.v4.ODataMetaModel")
494
626
  ) {
495
627
  propertyValues[propName] = oData.getObject();
496
628
  }
497
629
  });
498
- const BuildingBlockClass = buildingBLockDefinition as typeof BuildingBlockBase;
499
- oInstance = new BuildingBlockClass(propertyValues /*, oControlConfig, oSettings, oAggregations, isPublic*/);
630
+ const BuildingBlockClass = buildingBlockDefinition as typeof BuildingBlockBase;
631
+ propertyValues.isPublic = isPublic;
632
+
633
+ oInstance = new BuildingBlockClass(
634
+ { ...propertyValues, ...oAggregations },
635
+ oControlConfig,
636
+ oSettings
637
+ /*, oControlConfig, oSettings, oAggregations, isPublic*/
638
+ );
639
+ processedPropertyValues = oInstance.getProperties();
640
+ Object.keys(oMetadata.metadataContexts).forEach(function (sContextName: string) {
641
+ if (processedPropertyValues.hasOwnProperty(sContextName)) {
642
+ let targetObject = processedPropertyValues[sContextName];
643
+ if (typeof targetObject === "object" && !targetObject.getObject) {
644
+ const sAttributeValue = storeValue(targetObject);
645
+ const sContextPath = `${sAttributeValue}`;
646
+ oSettings.models.converterContext.setProperty(sContextPath, targetObject);
647
+ targetObject = oSettings.models.converterContext.createBindingContext(sContextPath);
648
+ delete myStore[sAttributeValue];
649
+ mContexts[sContextName] = targetObject;
650
+ } else if (!mContexts.hasOwnProperty(sContextName) && targetObject !== undefined) {
651
+ mContexts[sContextName] = targetObject;
652
+ }
653
+ }
654
+ });
500
655
  }
501
- const oAttributesModel: JSONModel = new AttributeModel(oNode, processedPropertyValues, buildingBLockDefinition);
656
+ const oAttributesModel: JSONModel = new AttributeModel(oNode, processedPropertyValues, buildingBlockDefinition);
502
657
  mContexts[sName] = oAttributesModel.createBindingContext("/");
503
658
 
504
659
  let oPreviousMacroInfo: any;
@@ -515,26 +670,34 @@ async function processBuildingBlock(
515
670
 
516
671
  const oContextVisitor = oVisitor.with(
517
672
  mContexts,
518
- buildingBLockDefinition.isOpen !== undefined ? !buildingBLockDefinition.isOpen : true
673
+ buildingBlockDefinition.isOpen !== undefined ? !buildingBlockDefinition.isOpen : true
519
674
  );
520
675
  const oParent = oNode.parentNode;
521
676
 
522
677
  let iChildIndex: number;
523
678
  let oPromise;
679
+ let processCustomData = true;
524
680
  if (oParent) {
525
681
  iChildIndex = Array.from(oParent.children).indexOf(oNode);
526
-
527
682
  if (
528
- (isV1MacroDef(buildingBLockDefinition) && buildingBLockDefinition.getTemplate) ||
529
- buildingBLockDefinition.apiVersion === 2
683
+ (isV1MacroDef(buildingBlockDefinition) && buildingBlockDefinition.getTemplate) ||
684
+ (buildingBlockDefinition.apiVersion === 2 && !buildingBlockDefinition.fragment)
530
685
  ) {
531
686
  let oTemplate;
532
687
  let addDefaultNamespace = false;
533
- if (buildingBLockDefinition.apiVersion === 2) {
688
+ if (buildingBlockDefinition.apiVersion === 2) {
534
689
  oTemplate = oInstance.getTemplate();
690
+ if (buildingBlockDefinition.isRuntime) {
691
+ for (const myStoreKey in myStore) {
692
+ const oData = myStore[myStoreKey];
693
+ const sContextPath = `${myStoreKey}`;
694
+ oSettings.models.converterContext.setProperty(sContextPath, oData);
695
+ delete myStore[myStoreKey];
696
+ }
697
+ }
535
698
  addDefaultNamespace = true;
536
- } else if (buildingBLockDefinition.getTemplate) {
537
- oTemplate = buildingBLockDefinition.getTemplate(processedPropertyValues);
699
+ } else if (buildingBlockDefinition.getTemplate) {
700
+ oTemplate = buildingBlockDefinition.getTemplate(processedPropertyValues);
538
701
  }
539
702
 
540
703
  let hasError = "";
@@ -554,23 +717,24 @@ async function processBuildingBlock(
554
717
 
555
718
  if (oTemplate.localName === "parsererror") {
556
719
  // If there is a parseerror while processing the XML it means the XML itself is malformed, as such we rerun the template process
557
- // 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
558
- Log.error(`Error while processing building block ${buildingBLockDefinition.name}`);
720
+ // Setting isTraceMode true will make it so that each xml` expression is checked for validity from XML perspective
721
+ // If an error is found it's returned instead of the normal fragment
722
+ Log.error(`Error while processing building block ${buildingBlockDefinition.name}`);
559
723
  try {
560
724
  isTraceMode = true;
561
725
  oTemplate = oInstance?.getTemplate
562
726
  ? oInstance.getTemplate()
563
- : (buildingBLockDefinition as any).getTemplate(processedPropertyValues);
727
+ : (buildingBlockDefinition as any).getTemplate(processedPropertyValues);
564
728
  oTemplate = parseXMLString(oTemplate, true);
565
729
  } finally {
566
730
  isTraceMode = false;
567
731
  }
568
732
  } else if (hasError.length > 0) {
569
733
  // If there is trailing text we create a standard error and display it.
570
- Log.error(`Error while processing building block ${buildingBLockDefinition.name}`);
734
+ Log.error(`Error while processing building block ${buildingBlockDefinition.name}`);
571
735
  const oErrorText = createErrorXML(
572
736
  [
573
- `Error while processing building block ${buildingBLockDefinition.name}`,
737
+ `Error while processing building block ${buildingBlockDefinition.name}`,
574
738
  `Trailing text was found in the XML: ${hasError}`
575
739
  ],
576
740
  oTemplate.outerHTML
@@ -579,6 +743,8 @@ async function processBuildingBlock(
579
743
  }
580
744
  oNode.replaceWith(oTemplate);
581
745
  oNode = oParent.children[iChildIndex];
746
+ processSlots(oAggregations, oMetadata.aggregations, oNode, processCustomData);
747
+ processCustomData = false;
582
748
  oPromise = oContextVisitor.visitNode(oNode);
583
749
  } else {
584
750
  oNode.remove();
@@ -590,32 +756,7 @@ async function processBuildingBlock(
590
756
 
591
757
  await oPromise;
592
758
  const oMacroElement = oParent.children[iChildIndex];
593
-
594
- if (Object.keys(oAggregations).length > 0) {
595
- Object.keys(oAggregations).forEach(function (sAggregationName: string) {
596
- const oAggregationElement = oAggregations[sAggregationName];
597
- if (oMacroElement !== null && oMacroElement !== undefined) {
598
- const oNewChild = document.createElementNS(oMacroElement.namespaceURI, sAggregationName);
599
- let oElementChild = oAggregationElement.firstElementChild;
600
- while (oElementChild) {
601
- const oNextChild = oElementChild.nextElementSibling;
602
- oNewChild.appendChild(oElementChild);
603
- oElementChild = oNextChild;
604
- }
605
- if (sAggregationName !== "customData" && sAggregationName !== "dependents") {
606
- const sSlotName =
607
- (oMetadata.aggregations[sAggregationName] && oMetadata.aggregations[sAggregationName].slot) ||
608
- sAggregationName;
609
- const oTargetElement = oMacroElement.querySelector("slot[name='" + sSlotName + "']") as Element;
610
- if (oTargetElement) {
611
- oTargetElement.replaceWith(...(oNewChild.children as any));
612
- }
613
- } else {
614
- oMacroElement.appendChild(oNewChild);
615
- }
616
- }
617
- });
618
- }
759
+ processSlots(oAggregations, oMetadata.aggregations, oMacroElement, processCustomData);
619
760
  if (oMacroElement) {
620
761
  const oRemainingSlots = oMacroElement.querySelectorAll("slot");
621
762
  oRemainingSlots.forEach(function (oSlotElement: any) {
@@ -638,7 +779,7 @@ async function processBuildingBlock(
638
779
  };
639
780
  for (const propertyName of initialKeys) {
640
781
  const propertyValue = propertyValues[propertyName];
641
- if (propertyValue && propertyValue.isA && propertyValue.isA("sap.ui.model.Context")) {
782
+ if (propertyValue && propertyValue.isA && propertyValue.isA(SAP_UI_MODEL_CONTEXT)) {
642
783
  traceDetails.initialProperties[propertyName] = {
643
784
  path: propertyValue.getPath(),
644
785
  value: propertyValue.getObject()
@@ -650,7 +791,7 @@ async function processBuildingBlock(
650
791
  for (const propertyName in propertyValues) {
651
792
  const propertyValue = propertyValues[propertyName];
652
793
  if (!initialKeys.includes(propertyName)) {
653
- if (propertyValue && propertyValue.isA && propertyValue.isA("sap.ui.model.Context")) {
794
+ if (propertyValue && propertyValue.isA && propertyValue.isA(SAP_UI_MODEL_CONTEXT)) {
654
795
  traceDetails.resolvedProperties[propertyName] = {
655
796
  path: propertyValue.getPath(),
656
797
  value: propertyValue.getObject()
@@ -663,7 +804,7 @@ async function processBuildingBlock(
663
804
  const errorAny = e as any;
664
805
  Log.error(errorAny, errorAny);
665
806
  const oError = createErrorXML(
666
- [`Error while processing building block ${buildingBLockDefinition.name}`, errorAny.stack],
807
+ [`Error while processing building block ${buildingBlockDefinition.name}`, errorAny.stack],
667
808
  oNode.outerHTML,
668
809
  traceDetails
669
810
  );
@@ -680,10 +821,12 @@ function addSingleContext(mContexts: any, oVisitor: any, oCtx: any, oMetadataCon
680
821
  try {
681
822
  let sContextPath = oCtx.path;
682
823
  if (oCtx.model != null) {
683
- sContextPath = oCtx.model + ">" + sContextPath;
824
+ sContextPath = `${oCtx.model}>${sContextPath}`;
684
825
  }
685
826
  const mSetting = oVisitor.getSettings();
686
- if (!mSetting.bindingContexts[oCtx.model] && mSetting.models[oCtx.model]) {
827
+ if (oCtx.model === "converterContext" && oCtx.path.length > 0) {
828
+ mContexts[sKey] = mSetting.models[oCtx.model].getContext(oCtx.path, mSetting.bindingContexts[oCtx.model]); // add the context to the visitor
829
+ } else if (!mSetting.bindingContexts[oCtx.model] && mSetting.models[oCtx.model]) {
687
830
  mContexts[sKey] = mSetting.models[oCtx.model].getContext(oCtx.path); // add the context to the visitor
688
831
  } else {
689
832
  mContexts[sKey] = oVisitor.getContext(sContextPath); // add the context to the visitor
@@ -720,7 +863,7 @@ export function registerBuildingBlock(buildingBlockDefinition: BuildingBlockDefi
720
863
  }
721
864
 
722
865
  function createErrorXML(errorMessages: string[], xmlFragment: string, additionalData?: object): string {
723
- const errorLabels = errorMessages.map((errorMessage) => xml`<m:Label text="${escapeXML(errorMessage)}"/>`);
866
+ const errorLabels = errorMessages.map((errorMessage) => xml`<m:Label text="${escapeXMLAttributeValue(errorMessage)}"/>`);
724
867
  let additionalText = "";
725
868
  if (additionalData) {
726
869
  additionalText = xml`<m:VBox>
@@ -742,7 +885,7 @@ function createErrorXML(errorMessages: string[], xmlFragment: string, additional
742
885
 
743
886
  const myStore: Record<string, any> = {};
744
887
  function storeValue(values: any) {
745
- const propertyUID = `uid--${uid()}`;
888
+ const propertyUID = `/uid--${uid()}`;
746
889
  myStore[propertyUID] = values;
747
890
  return propertyUID;
748
891
  }
@@ -760,6 +903,7 @@ function parseXMLString(xmlString: string, addDefaultNamespaces = false): Elemen
760
903
  xmlns:template="http://schemas.sap.com/sapui5/extension/sap.ui.core.template/1"
761
904
  xmlns:m="sap.m"
762
905
  xmlns:core="sap.ui.core"
906
+ xmlns:mdc="sap.ui.mdc"
763
907
  xmlns:customData="http://schemas.sap.com/sapui5/extension/sap.ui.core.CustomData/1">${xmlString}</template>`;
764
908
  }
765
909
  const xmlDocument = DOMParserInstance.parseFromString(xmlString, "text/xml");
@@ -794,7 +938,7 @@ function escapeXML(str: string): string {
794
938
  * @returns The escaped string.
795
939
  */
796
940
  function escapeXMLAttributeValue(val: string): string {
797
- return val.replace(/&/g, "&amp;").replace(/</g, "&lt;");
941
+ return val && val.replace(/&/g, "&amp;").replace(/</g, "&lt;");
798
942
  }
799
943
 
800
944
  /**
@@ -810,16 +954,22 @@ export const xml = (strings: TemplateStringsArray, ...values: any[]) => {
810
954
  for (i = 0; i < values.length; i++) {
811
955
  outStr += strings[i];
812
956
  // 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.
813
- if (Array.isArray(values[i])) {
814
- outStr += values[i].flat(5).join("").trim();
957
+ if (Array.isArray(values[i]) && values[i].length > 0 && typeof values[i][0] === "string") {
958
+ outStr += values[i].flat(5).join("\n").trim();
815
959
  } else if (values[i]?._type) {
816
- const compiledExpression = compileBinding(values[i]);
960
+ const compiledExpression = compileExpression(values[i]);
817
961
  outStr += compiledExpression !== undefined ? escapeXMLAttributeValue(compiledExpression) : undefined;
818
962
  } else if (values[i]?.getTemplate) {
819
963
  outStr += values[i].getTemplate();
820
964
  } else if (typeof values[i] === "object") {
821
- const propertyUId = storeValue(values[i]);
822
- outStr += `${propertyUId}`;
965
+ if (values[i].isA?.("sap.ui.model.Context")) {
966
+ outStr += values[i].getPath();
967
+ } else {
968
+ const propertyUId = storeValue(values[i]);
969
+ outStr += `${propertyUId}`;
970
+ }
971
+ } else if (values[i] && typeof values[i] === "string" && !values[i].startsWith("<") && !values[i].startsWith("&lt;")) {
972
+ outStr += escapeXMLAttributeValue(values[i]);
823
973
  } else {
824
974
  outStr += values[i];
825
975
  }