@sapui5/sap.fe.core 1.102.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 (311) 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 +62 -26
  4. package/src/sap/fe/core/AppComponent.ts +56 -40
  5. package/src/sap/fe/core/AppStateHandler.js +10 -10
  6. package/src/sap/fe/core/AppStateHandler.ts +9 -9
  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 +236 -109
  10. package/src/sap/fe/core/CommonUtils.ts +252 -136
  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/BuildingBlockRuntime.js +8 -8
  22. package/src/sap/fe/core/buildingBlocks/BuildingBlockRuntime.ts +11 -10
  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/controllerextensions/EditFlow.js +129 -118
  26. package/src/sap/fe/core/controllerextensions/EditFlow.ts +154 -141
  27. package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +9 -9
  28. package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.ts +10 -10
  29. package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +31 -26
  30. package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +34 -35
  31. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +70 -70
  32. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +77 -77
  33. package/src/sap/fe/core/controllerextensions/InternalRouting.js +84 -78
  34. package/src/sap/fe/core/controllerextensions/InternalRouting.ts +105 -101
  35. package/src/sap/fe/core/controllerextensions/KPIManagement.js +66 -68
  36. package/src/sap/fe/core/controllerextensions/KPIManagement.ts +106 -123
  37. package/src/sap/fe/core/controllerextensions/MassEdit.js +8 -8
  38. package/src/sap/fe/core/controllerextensions/MassEdit.ts +19 -26
  39. package/src/sap/fe/core/controllerextensions/MessageHandler.js +20 -12
  40. package/src/sap/fe/core/controllerextensions/MessageHandler.ts +29 -14
  41. package/src/sap/fe/core/controllerextensions/PageReady.js +97 -25
  42. package/src/sap/fe/core/controllerextensions/PageReady.ts +94 -34
  43. package/src/sap/fe/core/controllerextensions/Paginator.js +21 -22
  44. package/src/sap/fe/core/controllerextensions/Paginator.ts +24 -25
  45. package/src/sap/fe/core/controllerextensions/Placeholder.js +4 -6
  46. package/src/sap/fe/core/controllerextensions/Placeholder.ts +12 -14
  47. package/src/sap/fe/core/controllerextensions/Routing.js +10 -11
  48. package/src/sap/fe/core/controllerextensions/Routing.ts +12 -13
  49. package/src/sap/fe/core/controllerextensions/Share.js +22 -22
  50. package/src/sap/fe/core/controllerextensions/Share.ts +30 -29
  51. package/src/sap/fe/core/controllerextensions/SideEffects.js +46 -50
  52. package/src/sap/fe/core/controllerextensions/SideEffects.ts +56 -60
  53. package/src/sap/fe/core/controllerextensions/ViewState.js +65 -62
  54. package/src/sap/fe/core/controllerextensions/ViewState.ts +68 -63
  55. package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.js +5 -5
  56. package/src/sap/fe/core/controllerextensions/collaboration/ActivityBase.ts +8 -7
  57. package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.js +6 -6
  58. package/src/sap/fe/core/controllerextensions/collaboration/ActivitySync.ts +12 -17
  59. package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.js +2 -2
  60. package/src/sap/fe/core/controllerextensions/collaboration/CollaborationCommon.ts +4 -4
  61. package/src/sap/fe/core/controllerextensions/collaboration/Manage.js +7 -9
  62. package/src/sap/fe/core/controllerextensions/collaboration/Manage.ts +18 -19
  63. package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.js +184 -137
  64. package/src/sap/fe/core/controllerextensions/editFlow/TransactionHelper.ts +253 -206
  65. package/src/sap/fe/core/controllerextensions/editFlow/draft.js +113 -121
  66. package/src/sap/fe/core/controllerextensions/editFlow/draft.ts +148 -158
  67. package/src/sap/fe/core/controllerextensions/editFlow/operations.js +198 -148
  68. package/src/sap/fe/core/controllerextensions/editFlow/operations.ts +223 -159
  69. package/src/sap/fe/core/controllerextensions/editFlow/sticky.js +24 -26
  70. package/src/sap/fe/core/controllerextensions/editFlow/sticky.ts +35 -33
  71. package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.js +78 -44
  72. package/src/sap/fe/core/controllerextensions/messageHandler/messageHandling.ts +90 -60
  73. package/src/sap/fe/core/controllerextensions/routing/RouterProxy.js +52 -55
  74. package/src/sap/fe/core/controllerextensions/routing/RouterProxy.ts +55 -58
  75. package/src/sap/fe/core/controls/Any.js +9 -5
  76. package/src/sap/fe/core/controls/Any.ts +10 -4
  77. package/src/sap/fe/core/controls/CommandExecution.js +11 -25
  78. package/src/sap/fe/core/controls/CommandExecution.ts +11 -25
  79. package/src/sap/fe/core/controls/ConditionalWrapper.js +2 -2
  80. package/src/sap/fe/core/controls/ConditionalWrapper.ts +3 -3
  81. package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.js +22 -22
  82. package/src/sap/fe/core/controls/CustomFilterFieldContentWrapper.ts +25 -24
  83. package/src/sap/fe/core/controls/CustomQuickViewPage.js +2 -2
  84. package/src/sap/fe/core/controls/CustomQuickViewPage.ts +2 -2
  85. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +3 -3
  86. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +5 -5
  87. package/src/sap/fe/core/controls/FieldWrapper.js +2 -2
  88. package/src/sap/fe/core/controls/FieldWrapper.ts +3 -3
  89. package/src/sap/fe/core/controls/FileWrapper.js +2 -2
  90. package/src/sap/fe/core/controls/FileWrapper.ts +11 -11
  91. package/src/sap/fe/core/controls/FilterBar.js +6 -2
  92. package/src/sap/fe/core/controls/FilterBar.ts +13 -9
  93. package/src/sap/fe/core/controls/FormElementWrapper.js +1 -1
  94. package/src/sap/fe/core/controls/FormElementWrapper.ts +2 -2
  95. package/src/sap/fe/core/controls/MassEditSelect.js +1 -1
  96. package/src/sap/fe/core/controls/MassEditSelect.ts +0 -4
  97. package/src/sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog.fragment.xml +3 -3
  98. package/src/sap/fe/core/controls/filterbar/VisualFilter.js +16 -12
  99. package/src/sap/fe/core/controls/filterbar/VisualFilter.ts +20 -22
  100. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +3 -3
  101. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.ts +8 -8
  102. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +47 -47
  103. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +52 -52
  104. package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +8 -2
  105. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +89 -88
  106. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +107 -106
  107. package/src/sap/fe/core/converters/ConverterContext.js +26 -33
  108. package/src/sap/fe/core/converters/ConverterContext.ts +51 -60
  109. package/src/sap/fe/core/converters/ManifestSettings.js +1 -1
  110. package/src/sap/fe/core/converters/ManifestSettings.ts +14 -14
  111. package/src/sap/fe/core/converters/ManifestWrapper.js +59 -45
  112. package/src/sap/fe/core/converters/ManifestWrapper.ts +55 -45
  113. package/src/sap/fe/core/converters/MetaModelConverter.js +50 -32
  114. package/src/sap/fe/core/converters/MetaModelConverter.ts +145 -127
  115. package/src/sap/fe/core/converters/TemplateConverter.js +21 -20
  116. package/src/sap/fe/core/converters/TemplateConverter.ts +27 -24
  117. package/src/sap/fe/core/converters/annotations/DataField.js +54 -34
  118. package/src/sap/fe/core/converters/annotations/DataField.ts +97 -75
  119. package/src/sap/fe/core/converters/common/AnnotationConverter.js +1911 -1495
  120. package/src/sap/fe/core/converters/controls/Common/Action.js +50 -41
  121. package/src/sap/fe/core/converters/controls/Common/Action.ts +56 -46
  122. package/src/sap/fe/core/converters/controls/Common/Chart.js +14 -14
  123. package/src/sap/fe/core/converters/controls/Common/Chart.ts +23 -26
  124. package/src/sap/fe/core/converters/controls/Common/Criticality.js +3 -3
  125. package/src/sap/fe/core/converters/controls/Common/Criticality.ts +4 -4
  126. package/src/sap/fe/core/converters/controls/Common/DataVisualization.js +28 -28
  127. package/src/sap/fe/core/converters/controls/Common/DataVisualization.ts +40 -36
  128. package/src/sap/fe/core/converters/controls/Common/Form.js +25 -27
  129. package/src/sap/fe/core/converters/controls/Common/Form.ts +37 -45
  130. package/src/sap/fe/core/converters/controls/Common/KPI.js +11 -11
  131. package/src/sap/fe/core/converters/controls/Common/KPI.ts +35 -39
  132. package/src/sap/fe/core/converters/controls/Common/Table.js +174 -183
  133. package/src/sap/fe/core/converters/controls/Common/Table.ts +237 -250
  134. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +119 -119
  135. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +144 -141
  136. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +45 -41
  137. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +64 -57
  138. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +28 -26
  139. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +46 -43
  140. package/src/sap/fe/core/converters/controls/ObjectPage/Avatar.js +9 -9
  141. package/src/sap/fe/core/converters/controls/ObjectPage/Avatar.ts +14 -13
  142. package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.js +67 -64
  143. package/src/sap/fe/core/converters/controls/ObjectPage/HeaderFacet.ts +69 -66
  144. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +73 -72
  145. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +98 -96
  146. package/src/sap/fe/core/converters/helpers/Aggregation.js +2 -4
  147. package/src/sap/fe/core/converters/helpers/Aggregation.ts +10 -13
  148. package/src/sap/fe/core/converters/helpers/BindingHelper.js +31 -31
  149. package/src/sap/fe/core/converters/helpers/BindingHelper.ts +30 -29
  150. package/src/sap/fe/core/converters/helpers/ConfigurableObject.js +4 -4
  151. package/src/sap/fe/core/converters/helpers/ConfigurableObject.ts +9 -9
  152. package/src/sap/fe/core/converters/helpers/ID.js +46 -46
  153. package/src/sap/fe/core/converters/helpers/ID.ts +25 -25
  154. package/src/sap/fe/core/converters/helpers/Key.js +7 -7
  155. package/src/sap/fe/core/converters/helpers/Key.ts +7 -7
  156. package/src/sap/fe/core/converters/helpers/SelectionVariantHelper.js +1 -1
  157. package/src/sap/fe/core/converters/helpers/SelectionVariantHelper.ts +4 -4
  158. package/src/sap/fe/core/converters/objectPage/FormMenuActions.js +6 -6
  159. package/src/sap/fe/core/converters/objectPage/FormMenuActions.ts +10 -10
  160. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +46 -62
  161. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +54 -82
  162. package/src/sap/fe/core/converters/templates/ListReportConverter.js +30 -29
  163. package/src/sap/fe/core/converters/templates/ListReportConverter.ts +40 -40
  164. package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +39 -38
  165. package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +52 -61
  166. package/src/sap/fe/core/designtime/AppComponent.designtime.js +4 -4
  167. package/src/sap/fe/core/designtime/AppComponent.designtime.ts +4 -4
  168. package/src/sap/fe/core/formatters/CollaborationFormatter.js +2 -2
  169. package/src/sap/fe/core/formatters/CollaborationFormatter.ts +3 -3
  170. package/src/sap/fe/core/formatters/FPMFormatter.js +5 -5
  171. package/src/sap/fe/core/formatters/FPMFormatter.ts +10 -10
  172. package/src/sap/fe/core/formatters/KPIFormatter.js +7 -7
  173. package/src/sap/fe/core/formatters/KPIFormatter.ts +10 -10
  174. package/src/sap/fe/core/formatters/StandardFormatter.js +89 -0
  175. package/src/sap/fe/core/formatters/StandardFormatter.ts +64 -0
  176. package/src/sap/fe/core/formatters/TableFormatter.js +11 -11
  177. package/src/sap/fe/core/formatters/TableFormatter.ts +12 -12
  178. package/src/sap/fe/core/formatters/ValueFormatter.js +8 -8
  179. package/src/sap/fe/core/formatters/ValueFormatter.ts +9 -9
  180. package/src/sap/fe/core/helpers/AppStartupHelper.js +15 -15
  181. package/src/sap/fe/core/helpers/AppStartupHelper.ts +37 -40
  182. package/src/sap/fe/core/helpers/BindingToolkit.js +1809 -0
  183. package/src/sap/fe/core/helpers/{BindingExpression.ts → BindingToolkit.ts} +365 -264
  184. package/src/sap/fe/core/helpers/ClassSupport.js +20 -11
  185. package/src/sap/fe/core/helpers/ClassSupport.ts +14 -10
  186. package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +2 -2
  187. package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.ts +1 -1
  188. package/src/sap/fe/core/helpers/EditState.js +1 -6
  189. package/src/sap/fe/core/helpers/EditState.ts +5 -10
  190. package/src/sap/fe/core/helpers/ExcelFormatHelper.js +2 -2
  191. package/src/sap/fe/core/helpers/ExcelFormatHelper.ts +4 -4
  192. package/src/sap/fe/core/helpers/FPMHelper.js +1 -1
  193. package/src/sap/fe/core/helpers/FPMHelper.ts +2 -2
  194. package/src/sap/fe/core/helpers/KeepAliveHelper.js +31 -31
  195. package/src/sap/fe/core/helpers/KeepAliveHelper.ts +52 -56
  196. package/src/sap/fe/core/helpers/MassEditHelper.js +281 -254
  197. package/src/sap/fe/core/helpers/MassEditHelper.ts +337 -289
  198. package/src/sap/fe/core/helpers/ModelHelper.js +25 -25
  199. package/src/sap/fe/core/helpers/ModelHelper.ts +34 -32
  200. package/src/sap/fe/core/helpers/PasteHelper.js +3 -10
  201. package/src/sap/fe/core/helpers/PasteHelper.ts +20 -25
  202. package/src/sap/fe/core/helpers/SemanticDateOperators.js +1 -1
  203. package/src/sap/fe/core/helpers/SemanticDateOperators.ts +11 -11
  204. package/src/sap/fe/core/helpers/SemanticKeyHelper.js +3 -3
  205. package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +8 -8
  206. package/src/sap/fe/core/helpers/StableIdHelper.js +12 -12
  207. package/src/sap/fe/core/helpers/StableIdHelper.ts +12 -12
  208. package/src/sap/fe/core/jsx-runtime/jsx.js +1 -1
  209. package/src/sap/fe/core/jsx-runtime/jsx.ts +8 -8
  210. package/src/sap/fe/core/library.js +42 -3
  211. package/src/sap/fe/core/library.ts +38 -0
  212. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +3 -3
  213. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +2 -2
  214. package/src/sap/fe/core/messagebundle.properties +49 -35
  215. package/src/sap/fe/core/messagebundle_ar.properties +13 -5
  216. package/src/sap/fe/core/messagebundle_bg.properties +13 -5
  217. package/src/sap/fe/core/messagebundle_ca.properties +13 -5
  218. package/src/sap/fe/core/messagebundle_cs.properties +13 -5
  219. package/src/sap/fe/core/messagebundle_cy.properties +14 -6
  220. package/src/sap/fe/core/messagebundle_da.properties +13 -5
  221. package/src/sap/fe/core/messagebundle_de.properties +15 -7
  222. package/src/sap/fe/core/messagebundle_el.properties +14 -6
  223. package/src/sap/fe/core/messagebundle_en.properties +9 -1
  224. package/src/sap/fe/core/messagebundle_en_GB.properties +11 -3
  225. package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +7 -1
  226. package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +9 -1
  227. package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +44 -85
  228. package/src/sap/fe/core/messagebundle_es.properties +13 -5
  229. package/src/sap/fe/core/messagebundle_es_MX.properties +13 -5
  230. package/src/sap/fe/core/messagebundle_et.properties +13 -5
  231. package/src/sap/fe/core/messagebundle_fi.properties +14 -6
  232. package/src/sap/fe/core/messagebundle_fr.properties +14 -6
  233. package/src/sap/fe/core/messagebundle_fr_CA.properties +14 -6
  234. package/src/sap/fe/core/messagebundle_hi.properties +14 -6
  235. package/src/sap/fe/core/messagebundle_hr.properties +14 -6
  236. package/src/sap/fe/core/messagebundle_hu.properties +13 -5
  237. package/src/sap/fe/core/messagebundle_id.properties +13 -5
  238. package/src/sap/fe/core/messagebundle_it.properties +33 -25
  239. package/src/sap/fe/core/messagebundle_iw.properties +13 -5
  240. package/src/sap/fe/core/messagebundle_ja.properties +14 -6
  241. package/src/sap/fe/core/messagebundle_kk.properties +13 -5
  242. package/src/sap/fe/core/messagebundle_ko.properties +13 -5
  243. package/src/sap/fe/core/messagebundle_lt.properties +13 -5
  244. package/src/sap/fe/core/messagebundle_lv.properties +14 -6
  245. package/src/sap/fe/core/messagebundle_ms.properties +13 -5
  246. package/src/sap/fe/core/messagebundle_nl.properties +13 -5
  247. package/src/sap/fe/core/messagebundle_no.properties +13 -5
  248. package/src/sap/fe/core/messagebundle_pl.properties +13 -5
  249. package/src/sap/fe/core/messagebundle_pt.properties +13 -5
  250. package/src/sap/fe/core/messagebundle_pt_PT.properties +14 -6
  251. package/src/sap/fe/core/messagebundle_ro.properties +13 -5
  252. package/src/sap/fe/core/messagebundle_ru.properties +13 -5
  253. package/src/sap/fe/core/messagebundle_sh.properties +13 -5
  254. package/src/sap/fe/core/messagebundle_sk.properties +13 -5
  255. package/src/sap/fe/core/messagebundle_sl.properties +17 -9
  256. package/src/sap/fe/core/messagebundle_sv.properties +14 -6
  257. package/src/sap/fe/core/messagebundle_th.properties +13 -5
  258. package/src/sap/fe/core/messagebundle_tr.properties +13 -5
  259. package/src/sap/fe/core/messagebundle_uk.properties +13 -5
  260. package/src/sap/fe/core/messagebundle_vi.properties +13 -5
  261. package/src/sap/fe/core/messagebundle_zh_CN.properties +14 -6
  262. package/src/sap/fe/core/messagebundle_zh_TW.properties +13 -5
  263. package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +2 -2
  264. package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +5 -5
  265. package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +2 -2
  266. package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +14 -14
  267. package/src/sap/fe/core/services/EnvironmentServiceFactory.js +1 -1
  268. package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +3 -2
  269. package/src/sap/fe/core/services/NavigationServiceFactory.js +53 -44
  270. package/src/sap/fe/core/services/NavigationServiceFactory.ts +54 -46
  271. package/src/sap/fe/core/services/ResourceModelServiceFactory.js +2 -2
  272. package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +4 -4
  273. package/src/sap/fe/core/services/RoutingServiceFactory.js +55 -55
  274. package/src/sap/fe/core/services/RoutingServiceFactory.ts +67 -65
  275. package/src/sap/fe/core/services/ShellServicesFactory.js +72 -76
  276. package/src/sap/fe/core/services/ShellServicesFactory.ts +76 -82
  277. package/src/sap/fe/core/services/SideEffectsServiceFactory.js +61 -61
  278. package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +102 -92
  279. package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +20 -15
  280. package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +26 -21
  281. package/src/sap/fe/core/support/CommonHelper.js +3 -2
  282. package/src/sap/fe/core/support/CommonHelper.ts +9 -13
  283. package/src/sap/fe/core/support/Diagnostics.js +1 -1
  284. package/src/sap/fe/core/support/Diagnostics.ts +5 -5
  285. package/src/sap/fe/core/templating/CommonFormatters.js +84 -0
  286. package/src/sap/fe/core/templating/CommonFormatters.ts +86 -0
  287. package/src/sap/fe/core/templating/CriticalityFormatters.js +31 -31
  288. package/src/sap/fe/core/templating/CriticalityFormatters.ts +42 -40
  289. package/src/sap/fe/core/templating/DataFieldFormatters.js +8 -8
  290. package/src/sap/fe/core/templating/DataFieldFormatters.ts +13 -10
  291. package/src/sap/fe/core/templating/DataModelPathHelper.js +16 -15
  292. package/src/sap/fe/core/templating/DataModelPathHelper.ts +42 -32
  293. package/src/sap/fe/core/templating/DisplayModeFormatter.js +1 -1
  294. package/src/sap/fe/core/templating/DisplayModeFormatter.ts +2 -3
  295. package/src/sap/fe/core/templating/EntitySetHelper.js +7 -7
  296. package/src/sap/fe/core/templating/EntitySetHelper.ts +6 -8
  297. package/src/sap/fe/core/templating/FieldControlHelper.js +35 -34
  298. package/src/sap/fe/core/templating/FieldControlHelper.ts +29 -46
  299. package/src/sap/fe/core/templating/FilterHelper.js +10 -9
  300. package/src/sap/fe/core/templating/FilterHelper.ts +13 -13
  301. package/src/sap/fe/core/templating/FilterTemplating.js +1 -1
  302. package/src/sap/fe/core/templating/FilterTemplating.ts +3 -3
  303. package/src/sap/fe/core/templating/PropertyFormatters.js +7 -7
  304. package/src/sap/fe/core/templating/PropertyFormatters.ts +21 -19
  305. package/src/sap/fe/core/templating/PropertyHelper.js +25 -25
  306. package/src/sap/fe/core/templating/PropertyHelper.ts +25 -26
  307. package/src/sap/fe/core/templating/UIFormatters.js +148 -93
  308. package/src/sap/fe/core/templating/UIFormatters.ts +196 -124
  309. package/src/sap/fe/core/type/Email.js +2 -2
  310. package/src/sap/fe/core/type/Email.ts +2 -2
  311. package/src/sap/fe/core/helpers/BindingExpression.js +0 -1732
@@ -1,31 +1,29 @@
1
- import { NavigationProperty, Property } from "@sap-ux/annotation-converter";
2
- import { DataFieldAbstractTypes } from "@sap-ux/vocabularies-types";
3
- import { PathAnnotationExpression } from "@sap-ux/vocabularies-types/types/Edm";
4
- import { UIAnnotationTypes } from "@sap-ux/vocabularies-types/types/generated/UI";
1
+ import type { NavigationProperty, PathAnnotationExpression, Property } from "@sap-ux/vocabularies-types";
2
+ import type { DataFieldAbstractTypes } from "@sap-ux/vocabularies-types/vocabularies/UI";
3
+ import { UIAnnotationTypes } from "@sap-ux/vocabularies-types/vocabularies/UI";
5
4
  import { singletonPathVisitor, UI } from "sap/fe/core/converters/helpers/BindingHelper";
6
5
  import { convertMetaModelContext, getInvolvedDataModelObjects } from "sap/fe/core/converters/MetaModelConverter";
7
6
  import valueFormatters from "sap/fe/core/formatters/ValueFormatter";
7
+ import type { BindingToolkitExpression, CompiledBindingToolkitExpression, PathInModelExpression } from "sap/fe/core/helpers/BindingToolkit";
8
8
  import {
9
9
  addTypeInformation,
10
10
  and,
11
- annotationExpression,
12
- bindingExpression,
13
- BindingExpression,
14
- BindingExpressionExpression,
15
- compileBinding,
11
+ compileExpression,
16
12
  constant,
17
13
  equal,
18
- Expression,
19
- ExpressionOrPrimitive,
20
14
  formatResult,
15
+ getExpressionFromAnnotation,
21
16
  ifElse,
22
17
  isConstant,
23
18
  isTruthy,
24
19
  not,
25
- or
26
- } from "sap/fe/core/helpers/BindingExpression";
20
+ notEqual,
21
+ or,
22
+ pathInModel
23
+ } from "sap/fe/core/helpers/BindingToolkit";
27
24
  import {
28
25
  DataModelObjectPath,
26
+ getContextRelativeTargetObjectPath,
29
27
  getPathRelativeLocation,
30
28
  getTargetObjectPath,
31
29
  isPathUpdatable
@@ -47,7 +45,7 @@ import {
47
45
  isPathExpression,
48
46
  isProperty
49
47
  } from "sap/fe/core/templating/PropertyHelper";
50
- import Context from "sap/ui/model/odata/v4/Context";
48
+ import type Context from "sap/ui/model/odata/v4/Context";
51
49
 
52
50
  // Import-export method used by the converter to use them in the templating through the UIFormatters.
53
51
  export type DisplayMode = DisplayModeFormatter.DisplayMode;
@@ -90,28 +88,41 @@ export type configType = {
90
88
  export const getDisplayMode = function (oDataModelObjectPath: DataModelObjectPath): DisplayMode {
91
89
  return DisplayModeFormatter.getDisplayMode(oDataModelObjectPath.targetObject, oDataModelObjectPath);
92
90
  };
93
-
91
+ export const getEditableExpressionAsObject = function (
92
+ oPropertyPath: PropertyOrPath<Property>,
93
+ oDataFieldConverted: any = null,
94
+ oDataModelObjectPath: DataModelObjectPath,
95
+ isEditable: BindingToolkitExpression<boolean> = UI.IsEditable
96
+ ): BindingToolkitExpression<boolean> {
97
+ return getEditableExpression(
98
+ oPropertyPath,
99
+ oDataFieldConverted,
100
+ oDataModelObjectPath,
101
+ true,
102
+ isEditable
103
+ ) as BindingToolkitExpression<boolean>;
104
+ };
94
105
  /**
95
106
  * Create the expression to generate an "editable" boolean value.
96
107
  *
97
- * @param {PropertyPath} oPropertyPath The input property
98
- * @param {object} oDataFieldConverted The DataFieldConverted object to read the fieldControl annotation
99
- * @param {DataModelObjectPath} oDataModelObjectPath The path to this property object
100
- * @param {boolean} bAsObject Whether or not this should be returned as an object or a binding string
101
- * @param {boolean} isEditable Whether or not UI.IsEditable be considered.
102
- * @returns {string} The binding expression used to determine if a property is editable or not
108
+ * @param oPropertyPath The input property
109
+ * @param oDataFieldConverted The DataFieldConverted object to read the fieldControl annotation
110
+ * @param oDataModelObjectPath The path to this property object
111
+ * @param bAsObject Whether or not this should be returned as an object or a binding string
112
+ * @param isEditable Whether or not UI.IsEditable be considered.
113
+ * @returns The binding expression used to determine if a property is editable or not
103
114
  */
104
115
  export const getEditableExpression = function (
105
116
  oPropertyPath: PropertyOrPath<Property>,
106
117
  oDataFieldConverted: any = null,
107
118
  oDataModelObjectPath: DataModelObjectPath,
108
119
  bAsObject: boolean = false,
109
- isEditable: ExpressionOrPrimitive<boolean> = UI.IsEditable
110
- ): BindingExpression<boolean> | ExpressionOrPrimitive<boolean> {
120
+ isEditable: BindingToolkitExpression<boolean> = UI.IsEditable
121
+ ): CompiledBindingToolkitExpression | BindingToolkitExpression<boolean> {
111
122
  if (!oPropertyPath || typeof oPropertyPath === "string") {
112
- return compileBinding(false);
123
+ return compileExpression(false);
113
124
  }
114
- let dataFieldEditableExpression: BindingExpression<boolean> | ExpressionOrPrimitive<boolean> = true;
125
+ let dataFieldEditableExpression: BindingToolkitExpression<boolean> = constant(true);
115
126
  if (oDataFieldConverted !== null) {
116
127
  dataFieldEditableExpression = ifElse(isNonEditableExpression(oDataFieldConverted), false, isEditable);
117
128
  }
@@ -146,38 +157,46 @@ export const getEditableExpression = function (
146
157
  if (bAsObject) {
147
158
  return and(editableExpression, dataFieldEditableExpression);
148
159
  }
149
- return compileBinding(and(editableExpression, dataFieldEditableExpression));
160
+ return compileExpression(and(editableExpression, dataFieldEditableExpression));
150
161
  };
151
162
 
152
- export const getCollaborationExpression = function (dataModelObjectPath: DataModelObjectPath, formatter: any): BindingExpression<any> {
163
+ export const getCollaborationExpression = function (
164
+ dataModelObjectPath: DataModelObjectPath,
165
+ formatter: any
166
+ ): BindingToolkitExpression<any> {
153
167
  const objectPath = getTargetObjectPath(dataModelObjectPath);
154
- const activityExpression = bindingExpression("/collaboration/activities" + objectPath, "internal");
168
+ const activityExpression = pathInModel(`/collaboration/activities${objectPath}`, "internal");
155
169
  const keys = dataModelObjectPath?.targetEntityType?.keys;
156
- const keysExpressions: BindingExpressionExpression<any>[] = [];
170
+ const keysExpressions: BindingToolkitExpression<any>[] = [];
157
171
  keys?.forEach(function (key) {
158
- const keyExpression = bindingExpression(key.name) as BindingExpressionExpression<any>;
172
+ const keyExpression = pathInModel(key.name);
159
173
  keysExpressions.push(keyExpression);
160
174
  });
161
175
  return formatResult([activityExpression, ...keysExpressions], formatter);
162
176
  };
163
-
177
+ export const getEnabledExpressionAsObject = function (
178
+ oPropertyPath: PropertyOrPath<Property>,
179
+ oDataFieldConverted?: any
180
+ ): BindingToolkitExpression<boolean> {
181
+ return getEnabledExpression(oPropertyPath, oDataFieldConverted, true) as BindingToolkitExpression<boolean>;
182
+ };
164
183
  /**
165
184
  * Create the expression to generate an "enabled" boolean value.
166
185
  *
167
- * @param {PropertyPath} oPropertyPath The input property
168
- * @param {any} oDataFieldConverted The DataFieldConverted Object to read the fieldControl annotation
169
- * @param {boolean} bAsObject Whether or not this should be returned as an object or a binding string
170
- * @returns {string} The binding expression to determine if a property is enabled or not
186
+ * @param oPropertyPath The input property
187
+ * @param oDataFieldConverted The DataFieldConverted Object to read the fieldControl annotation
188
+ * @param bAsObject Whether or not this should be returned as an object or a binding string
189
+ * @returns The binding expression to determine if a property is enabled or not
171
190
  */
172
191
  export const getEnabledExpression = function (
173
192
  oPropertyPath: PropertyOrPath<Property>,
174
193
  oDataFieldConverted?: any,
175
194
  bAsObject: boolean = false
176
- ): BindingExpression<boolean> | ExpressionOrPrimitive<boolean> {
195
+ ): CompiledBindingToolkitExpression | BindingToolkitExpression<boolean> {
177
196
  if (!oPropertyPath || typeof oPropertyPath === "string") {
178
- return compileBinding(true);
197
+ return compileExpression(true);
179
198
  }
180
- let dataFieldEnabledExpression: BindingExpression<boolean> | ExpressionOrPrimitive<boolean> = true;
199
+ let dataFieldEnabledExpression: BindingToolkitExpression<boolean> = constant(true);
181
200
  if (oDataFieldConverted !== null) {
182
201
  dataFieldEnabledExpression = ifElse(isDisabledExpression(oDataFieldConverted), false, true);
183
202
  }
@@ -189,19 +208,19 @@ export const getEnabledExpression = function (
189
208
  if (bAsObject) {
190
209
  return and(enabledExpression, dataFieldEnabledExpression);
191
210
  }
192
- return compileBinding(and(enabledExpression, dataFieldEnabledExpression));
211
+ return compileExpression(and(enabledExpression, dataFieldEnabledExpression));
193
212
  };
194
213
 
195
214
  /**
196
215
  * Create the expression to generate an "editMode" enum value.
197
216
  *
198
- * @param {PropertyPath} oPropertyPath The input property
199
- * @param {DataModelObjectPath} oDataModelObjectPath The list of data model objects that are involved to reach that property
200
- * @param {boolean} bMeasureReadOnly Whether we should set UoM / currency field mode to read only
201
- * @param {boolean} bAsObject Whether we should return this as an expression or as a string
202
- * @param {object} oDataFieldConverted The dataField object
203
- * @param {boolean} isEditable Whether or not UI.IsEditable be considered.
204
- * @returns {BindingExpression<string> | ExpressionOrPrimitive<string>} The binding expression representing the current property edit mode, compliant with the MDC Field definition of editMode.
217
+ * @param oPropertyPath The input property
218
+ * @param oDataModelObjectPath The list of data model objects that are involved to reach that property
219
+ * @param bMeasureReadOnly Whether we should set UoM / currency field mode to read only
220
+ * @param bAsObject Whether we should return this as an expression or as a string
221
+ * @param oDataFieldConverted The dataField object
222
+ * @param isEditable Whether or not UI.IsEditable be considered.
223
+ * @returns The binding expression representing the current property edit mode, compliant with the MDC Field definition of editMode.
205
224
  */
206
225
  export const getEditMode = function (
207
226
  oPropertyPath: PropertyOrPath<Property>,
@@ -209,8 +228,8 @@ export const getEditMode = function (
209
228
  bMeasureReadOnly: boolean = false,
210
229
  bAsObject: boolean = false,
211
230
  oDataFieldConverted: any = null,
212
- isEditable: ExpressionOrPrimitive<boolean> = UI.IsEditable
213
- ): BindingExpression<string> | ExpressionOrPrimitive<string> {
231
+ isEditable: BindingToolkitExpression<boolean> = UI.IsEditable
232
+ ): CompiledBindingToolkitExpression | BindingToolkitExpression<string> {
214
233
  if (!oPropertyPath || typeof oPropertyPath === "string") {
215
234
  return "Display";
216
235
  }
@@ -221,18 +240,12 @@ export const getEditMode = function (
221
240
  // If there is an associated unit, and it has a field control also use consider the following
222
241
  // if the unit field control is readonly -> EditableReadOnly
223
242
  // otherwise -> Editable
224
- const editableExpression = getEditableExpression(
225
- oPropertyPath,
226
- oDataFieldConverted,
227
- oDataModelObjectPath,
228
- true,
229
- isEditable
230
- ) as ExpressionOrPrimitive<boolean>;
243
+ const editableExpression = getEditableExpressionAsObject(oPropertyPath, oDataFieldConverted, oDataModelObjectPath, isEditable);
231
244
 
232
- const enabledExpression = getEnabledExpression(oPropertyPath, oDataFieldConverted, true) as ExpressionOrPrimitive<boolean>;
245
+ const enabledExpression = getEnabledExpressionAsObject(oPropertyPath, oDataFieldConverted);
233
246
  const associatedCurrencyProperty = getAssociatedCurrencyProperty(oProperty);
234
247
  const unitProperty = associatedCurrencyProperty || getAssociatedUnitProperty(oProperty);
235
- let resultExpression: ExpressionOrPrimitive<string> = "Editable";
248
+ let resultExpression: BindingToolkitExpression<string> = constant("Editable");
236
249
  if (unitProperty) {
237
250
  resultExpression = ifElse(
238
251
  or(isReadOnlyExpression(unitProperty), isComputed(unitProperty), bMeasureReadOnly),
@@ -256,54 +269,56 @@ export const getEditMode = function (
256
269
  if (bAsObject) {
257
270
  return editModeExpression;
258
271
  }
259
- return compileBinding(editModeExpression);
272
+ return compileExpression(editModeExpression);
260
273
  };
261
274
 
262
- export const hasValidAnalyticalCurrencyOrUnit = function (oPropertyDataModelObjectPath: DataModelObjectPath): BindingExpression<string> {
275
+ export const hasValidAnalyticalCurrencyOrUnit = function (
276
+ oPropertyDataModelObjectPath: DataModelObjectPath
277
+ ): CompiledBindingToolkitExpression {
263
278
  const oPropertyDefinition = oPropertyDataModelObjectPath.targetObject as Property;
264
279
  const currency = oPropertyDefinition.annotations?.Measures?.ISOCurrency;
265
280
  const measure = currency ? currency : oPropertyDefinition.annotations?.Measures?.Unit;
266
281
  if (measure) {
267
- return compileBinding(or(isTruthy(annotationExpression(measure) as Expression<string>), not(UI.IsTotal)));
282
+ return compileExpression(or(isTruthy(getExpressionFromAnnotation(measure) as BindingToolkitExpression<string>), not(UI.IsTotal)));
268
283
  } else {
269
- return compileBinding(constant(true));
284
+ return compileExpression(constant(true));
270
285
  }
271
286
  };
272
287
 
273
288
  export const ifUnitEditable = function (
274
289
  oPropertyPath: PropertyOrPath<Property>,
275
- sEditableValue: ExpressionOrPrimitive<string>,
276
- sNonEditableValue: ExpressionOrPrimitive<string>
277
- ): BindingExpression<string> {
290
+ sEditableValue: BindingToolkitExpression<string> | string,
291
+ sNonEditableValue: BindingToolkitExpression<string> | string
292
+ ): CompiledBindingToolkitExpression {
278
293
  const oProperty = (isPathExpression(oPropertyPath) && oPropertyPath.$target) || (oPropertyPath as Property);
279
294
  const unitProperty = getAssociatedCurrencyProperty(oProperty) || getAssociatedUnitProperty(oProperty);
280
295
  if (!unitProperty) {
281
- return compileBinding(sNonEditableValue);
296
+ return compileExpression(sNonEditableValue);
282
297
  }
283
298
  const editableExpression = and(not(isReadOnlyExpression(unitProperty)), not(isComputed(unitProperty)));
284
- return compileBinding(ifElse(editableExpression, sEditableValue, sNonEditableValue));
299
+ return compileExpression(ifElse(editableExpression, sEditableValue, sNonEditableValue));
285
300
  };
286
301
 
287
302
  export const getFieldDisplay = function (
288
303
  oPropertyPath: PropertyOrPath<Property>,
289
304
  sTargetDisplayMode: string,
290
- oComputedEditMode: ExpressionOrPrimitive<string>
291
- ): BindingExpression<string> {
305
+ oComputedEditMode: BindingToolkitExpression<string>
306
+ ): CompiledBindingToolkitExpression {
292
307
  const oProperty = (isPathExpression(oPropertyPath) && oPropertyPath.$target) || (oPropertyPath as Property);
293
308
 
294
309
  return hasValueHelp(oProperty)
295
- ? compileBinding(sTargetDisplayMode)
296
- : compileBinding(ifElse(equal(oComputedEditMode, "Editable"), "Value", sTargetDisplayMode));
310
+ ? compileExpression(sTargetDisplayMode)
311
+ : compileExpression(ifElse(equal(oComputedEditMode, "Editable"), "Value", sTargetDisplayMode));
297
312
  };
298
313
 
299
314
  export const formatWithTypeInformation = function (
300
315
  oProperty: Property,
301
- propertyBindingExpression: Expression<string>,
316
+ propertyBindingExpression: BindingToolkitExpression<string>,
302
317
  ignoreConstraints?: boolean
303
- ): Expression<string> {
304
- const outExpression: BindingExpressionExpression<any> = propertyBindingExpression as BindingExpressionExpression<any>;
318
+ ): BindingToolkitExpression<string> {
319
+ const outExpression: PathInModelExpression<any> = propertyBindingExpression as PathInModelExpression<any>;
305
320
  if (oProperty._type === "Property") {
306
- const oTargetMapping = EDM_TYPE_MAPPING[(oProperty as Property).type];
321
+ const oTargetMapping = EDM_TYPE_MAPPING[oProperty.type];
307
322
  if (oTargetMapping) {
308
323
  outExpression.type = oTargetMapping.type;
309
324
  if (oTargetMapping.constraints && !ignoreConstraints) {
@@ -403,7 +418,7 @@ export const getTypeConfig = function (oProperty: Property | DataFieldAbstractTy
403
418
  isDigitSequence:
404
419
  propertyTypeConfig.type === "sap.ui.model.odata.type.String" &&
405
420
  oTargetMapping.constraints?.["@com.sap.vocabularies.Common.v1.IsDigitSequence"] &&
406
- (oProperty as Property).annotations?.Common?.IsDigitSequence
421
+ oProperty.annotations?.Common?.IsDigitSequence
407
422
  ? true
408
423
  : undefined,
409
424
  V4: oTargetMapping.constraints?.$V4 ? true : undefined
@@ -427,9 +442,10 @@ export const getTypeConfig = function (oProperty: Property | DataFieldAbstractTy
427
442
 
428
443
  export const getBindingWithUnitOrCurrency = function (
429
444
  oPropertyDataModelPath: DataModelObjectPath,
430
- propertyBindingExpression: Expression<string>,
431
- ignoreUnitConstraint?: boolean
432
- ): Expression<string> {
445
+ propertyBindingExpression: BindingToolkitExpression<string>,
446
+ ignoreUnitConstraint?: boolean,
447
+ formatOptions?: any
448
+ ): BindingToolkitExpression<string> {
433
449
  const oPropertyDefinition = oPropertyDataModelPath.targetObject as Property;
434
450
  let unit = oPropertyDefinition.annotations?.Measures?.Unit;
435
451
  const relativeLocation = getPathRelativeLocation(
@@ -445,20 +461,53 @@ export const getBindingWithUnitOrCurrency = function (
445
461
  const unitBindingExpression = (unit as any).$target
446
462
  ? formatWithTypeInformation(
447
463
  (unit as any).$target,
448
- annotationExpression(unit, relativeLocation) as Expression<string>,
464
+ getExpressionFromAnnotation(unit, relativeLocation) as BindingToolkitExpression<string>,
449
465
  ignoreUnitConstraint
450
466
  )
451
- : (annotationExpression(unit, relativeLocation) as Expression<string>);
467
+ : (getExpressionFromAnnotation(unit, relativeLocation) as BindingToolkitExpression<string>);
452
468
 
453
- return addTypeInformation([propertyBindingExpression, unitBindingExpression], complexType);
469
+ return addTypeInformation([propertyBindingExpression, unitBindingExpression], complexType, undefined, formatOptions);
454
470
  };
455
471
 
472
+ export const getBindingForUnitOrCurrency = function (
473
+ oPropertyDataModelPath: DataModelObjectPath
474
+ ): BindingToolkitExpression<string> | string {
475
+ const oPropertyDefinition = oPropertyDataModelPath.targetObject as Property;
476
+
477
+ let unit = oPropertyDefinition.annotations?.Measures?.Unit;
478
+ if (unit?.toString() === "%") {
479
+ return constant("%");
480
+ }
481
+ const relativeLocation = getPathRelativeLocation(
482
+ oPropertyDataModelPath.contextLocation,
483
+ oPropertyDataModelPath.navigationProperties
484
+ ).map((np) => np.name);
485
+
486
+ const complexType = unit ? "sap.ui.model.odata.type.Unit" : "sap.ui.model.odata.type.Currency";
487
+ unit = unit ? unit : oPropertyDefinition.annotations?.Measures?.ISOCurrency;
488
+ const unitBindingExpression = (unit as any).$target
489
+ ? formatWithTypeInformation(
490
+ (unit as any).$target,
491
+ getExpressionFromAnnotation(unit, relativeLocation) as BindingToolkitExpression<string>
492
+ )
493
+ : (getExpressionFromAnnotation(unit, relativeLocation) as BindingToolkitExpression<string>);
494
+
495
+ let propertyBindingExpression = pathInModel(
496
+ getContextRelativeTargetObjectPath(oPropertyDataModelPath)
497
+ ) as BindingToolkitExpression<string>;
498
+ propertyBindingExpression = formatWithTypeInformation(oPropertyDefinition, propertyBindingExpression, true);
499
+ return addTypeInformation([propertyBindingExpression, unitBindingExpression], complexType, undefined, {
500
+ parseKeepsEmptyString: true,
501
+ emptyString: "",
502
+ showNumber: false
503
+ });
504
+ };
456
505
  export const getBindingWithTimezone = function (
457
506
  oPropertyDataModelPath: DataModelObjectPath,
458
- propertyBindingExpression: Expression<string>,
507
+ propertyBindingExpression: BindingToolkitExpression<string>,
459
508
  ignoreUnitConstraint?: boolean,
460
509
  hideTimezoneForEmptyValues?: boolean
461
- ): Expression<string> {
510
+ ): BindingToolkitExpression<string> {
462
511
  const oPropertyDefinition = oPropertyDataModelPath.targetObject as Property;
463
512
  const timezone = oPropertyDefinition.annotations?.Common?.Timezone;
464
513
  const relativeLocation = getPathRelativeLocation(
@@ -471,10 +520,10 @@ export const getBindingWithTimezone = function (
471
520
  const unitBindingExpression = (timezone as any).$target
472
521
  ? formatWithTypeInformation(
473
522
  (timezone as any).$target,
474
- annotationExpression(timezone, relativeLocation) as Expression<string>,
523
+ getExpressionFromAnnotation(timezone, relativeLocation) as BindingToolkitExpression<string>,
475
524
  ignoreUnitConstraint
476
525
  )
477
- : (annotationExpression(timezone, relativeLocation) as Expression<string>);
526
+ : (getExpressionFromAnnotation(timezone, relativeLocation) as BindingToolkitExpression<string>);
478
527
  let formatOptions;
479
528
  if (hideTimezoneForEmptyValues) {
480
529
  formatOptions = {
@@ -485,19 +534,19 @@ export const getBindingWithTimezone = function (
485
534
  };
486
535
 
487
536
  export const getAlignmentExpression = function (
488
- oComputedEditMode: Expression<string>,
537
+ oComputedEditMode: BindingToolkitExpression<string>,
489
538
  sAlignDisplay: string = "Begin",
490
539
  sAlignEdit: string = "Begin"
491
- ): BindingExpression<string> | Expression<string> {
492
- return compileBinding(ifElse(equal(oComputedEditMode, "Display"), sAlignDisplay, sAlignEdit));
540
+ ): CompiledBindingToolkitExpression | BindingToolkitExpression<string> {
541
+ return compileExpression(ifElse(equal(oComputedEditMode, "Display"), sAlignDisplay, sAlignEdit));
493
542
  };
494
543
 
495
544
  /**
496
545
  * Formatter helper to retrieve the converterContext from the metamodel context.
497
546
  *
498
- * @param {Context} oContext The original metamodel context
499
- * @param {ComputedAnnotationInterface} oInterface The current templating context
500
- * @returns {object} The ConverterContext representing that object
547
+ * @param oContext The original metamodel context
548
+ * @param oInterface The current templating context
549
+ * @returns The ConverterContext representing that object
501
550
  */
502
551
  export const getConverterContext = function (oContext: MetaModelContext, oInterface: ComputedAnnotationInterface): object | null {
503
552
  if (oInterface && oInterface.context) {
@@ -510,9 +559,9 @@ getConverterContext.requiresIContext = true;
510
559
  /**
511
560
  * Formatter helper to retrieve the data model objects that are involved from the metamodel context.
512
561
  *
513
- * @param {Context} oContext The original ODataMetaModel context
514
- * @param {ComputedAnnotationInterface} oInterface The current templating context
515
- * @returns {object[]} An array of entitysets and navproperties that are involved to get to a specific object in the metamodel
562
+ * @param oContext The original ODataMetaModel context
563
+ * @param oInterface The current templating context
564
+ * @returns An array of entitysets and navproperties that are involved to get to a specific object in the metamodel
516
565
  */
517
566
  export const getDataModelObjectPath = function (
518
567
  oContext: MetaModelContext,
@@ -525,16 +574,6 @@ export const getDataModelObjectPath = function (
525
574
  };
526
575
  getDataModelObjectPath.requiresIContext = true;
527
576
 
528
- /**
529
- * Retrieves the expressionBinding created out of a binding expression.
530
- *
531
- * @param {Expression<any>} expression The expression which needs to be compiled
532
- * @returns {BindingExpression<string>} The expression-binding string
533
- */
534
- export const getExpressionBinding = function (expression: Expression<any>): BindingExpression<string> {
535
- return compileBinding(expression);
536
- };
537
-
538
577
  export const isCollectionField = function (oDataModelPath: DataModelObjectPath): boolean {
539
578
  if (oDataModelPath.navigationProperties?.length) {
540
579
  const hasOneToManyNavigation =
@@ -558,39 +597,71 @@ export const isCollectionField = function (oDataModelPath: DataModelObjectPath):
558
597
  }
559
598
  return false;
560
599
  };
561
-
600
+ export const getRequiredExpressionAsObject = function (
601
+ oPropertyPath: PropertyOrPath<Property>,
602
+ oDataFieldConverted?: any,
603
+ forceEditMode: boolean = false
604
+ ): BindingToolkitExpression<boolean> {
605
+ return getRequiredExpression(oPropertyPath, oDataFieldConverted, forceEditMode, true) as BindingToolkitExpression<boolean>;
606
+ };
562
607
  export const getRequiredExpression = function (
563
608
  oPropertyPath: PropertyOrPath<Property>,
564
609
  oDataFieldConverted?: any,
565
610
  forceEditMode: boolean = false,
566
- bAsObject: boolean = false
567
- ): BindingExpression<boolean> | ExpressionOrPrimitive<boolean> {
611
+ bAsObject: boolean = false,
612
+ oRequiredProperties: any = {}
613
+ ): CompiledBindingToolkitExpression | BindingToolkitExpression<boolean> {
614
+ let returnExpression: BindingToolkitExpression<boolean>;
615
+ const aRequiredPropertiesFromInsertRestrictions = oRequiredProperties.requiredPropertiesFromInsertRestrictions || [];
616
+ const aRequiredPropertiesFromUpdateRestrictions = oRequiredProperties.requiredPropertiesFromUpdateRestrictions || [];
568
617
  if (!oPropertyPath || typeof oPropertyPath === "string") {
569
- return compileBinding(false);
570
- }
571
-
572
- let dataFieldRequiredExpression: BindingExpression<boolean> | ExpressionOrPrimitive<boolean> = true;
573
- if (oDataFieldConverted !== null) {
574
- dataFieldRequiredExpression = isRequiredExpression(oDataFieldConverted);
618
+ returnExpression = constant(false);
619
+ } else {
620
+ let dataFieldRequiredExpression: BindingToolkitExpression<boolean> = constant(true);
621
+ if (oDataFieldConverted !== null) {
622
+ dataFieldRequiredExpression = isRequiredExpression(oDataFieldConverted);
623
+ }
624
+ let requiredPropertyFromInsertRestrictionsExpression: BindingToolkitExpression<boolean> = constant(false);
625
+ let requiredPropertyFromUpdateRestrictionsExpression: BindingToolkitExpression<boolean> = constant(false);
626
+
627
+ const oProperty: Property = (isPathExpression(oPropertyPath) && oPropertyPath.$target) || (oPropertyPath as Property);
628
+ // Enablement depends on the field control expression
629
+ // If the Field control is statically in Inapplicable (disabled) -> not enabled
630
+ const requiredExpression = isRequiredExpression(oProperty);
631
+ const editMode = forceEditMode || UI.IsEditable;
632
+ if (
633
+ aRequiredPropertiesFromInsertRestrictions.length &&
634
+ aRequiredPropertiesFromInsertRestrictions.includes((oPropertyPath as any).name)
635
+ ) {
636
+ requiredPropertyFromInsertRestrictionsExpression = and(constant(true), UI.IsCreateMode);
637
+ }
638
+ if (
639
+ aRequiredPropertiesFromUpdateRestrictions.length &&
640
+ aRequiredPropertiesFromUpdateRestrictions.includes((oPropertyPath as any).name)
641
+ ) {
642
+ requiredPropertyFromUpdateRestrictionsExpression = and(constant(true), notEqual(UI.IsCreateMode, true));
643
+ }
644
+ returnExpression = or(
645
+ and(or(requiredExpression, dataFieldRequiredExpression), editMode),
646
+ requiredPropertyFromInsertRestrictionsExpression,
647
+ requiredPropertyFromUpdateRestrictionsExpression
648
+ );
575
649
  }
576
650
 
577
- const oProperty: Property = (isPathExpression(oPropertyPath) && oPropertyPath.$target) || (oPropertyPath as Property);
578
- // Enablement depends on the field control expression
579
- // If the Field control is statically in Inapplicable (disabled) -> not enabled
580
- const requiredExpression = isRequiredExpression(oProperty);
581
- const editMode = forceEditMode || UI.IsEditable;
582
651
  if (bAsObject) {
583
- return and(or(requiredExpression, dataFieldRequiredExpression), editMode);
652
+ return returnExpression;
584
653
  }
585
- return compileBinding(and(or(requiredExpression, dataFieldRequiredExpression), editMode));
654
+ return compileExpression(returnExpression);
586
655
  };
587
656
 
588
- export const getRequiredExpressionForConnectedDataField = function (dataFieldObjectPath: DataModelObjectPath): BindingExpression<string> {
657
+ export const getRequiredExpressionForConnectedDataField = function (
658
+ dataFieldObjectPath: DataModelObjectPath
659
+ ): CompiledBindingToolkitExpression {
589
660
  const data = dataFieldObjectPath?.targetObject?.$target?.Data;
590
661
  const keys: Array<string> = Object.keys(data);
591
662
  const dataFields = [];
592
663
  let propertyPath;
593
- const isRequiredExpressions: (BindingExpression<boolean> | ExpressionOrPrimitive<boolean>)[] | undefined = [];
664
+ const isRequiredExpressions: (CompiledBindingToolkitExpression | BindingToolkitExpression<boolean>)[] | undefined = [];
594
665
  for (const key of keys) {
595
666
  if (data[key]["$Type"] && data[key]["$Type"].indexOf("DataField") > -1) {
596
667
  dataFields.push(data[key]);
@@ -624,8 +695,9 @@ export const getRequiredExpressionForConnectedDataField = function (dataFieldObj
624
695
  }
625
696
  }
626
697
  break;
698
+ // no default
627
699
  }
628
- isRequiredExpressions.push(getRequiredExpression(propertyPath, dataField, false, true));
700
+ isRequiredExpressions.push(getRequiredExpressionAsObject(propertyPath, dataField, false));
629
701
  }
630
- return compileBinding(or(...(isRequiredExpressions as ExpressionOrPrimitive<boolean>[])));
702
+ return compileExpression(or(...(isRequiredExpressions as BindingToolkitExpression<boolean>[])));
631
703
  };
@@ -2,7 +2,7 @@
2
2
  * SAP UI development toolkit for HTML5 (SAPUI5)
3
3
  * (c) Copyright 2009-2021 SAP SE. All rights reserved
4
4
  */
5
- sap.ui.define(["sap/ui/core/Core", "sap/ui/model/odata/type/String", "sap/ui/model/ValidateException", "sap/fe/core/helpers/ClassSupport"], function (Core, ODataStringType, ValidateException, ClassSupport) {
5
+ sap.ui.define(["sap/fe/core/helpers/ClassSupport", "sap/ui/core/Core", "sap/ui/model/odata/type/String", "sap/ui/model/ValidateException"], function (ClassSupport, Core, ODataStringType, ValidateException) {
6
6
  "use strict";
7
7
 
8
8
  var _dec, _class;
@@ -35,4 +35,4 @@ sap.ui.define(["sap/ui/core/Core", "sap/ui/model/odata/type/String", "sap/ui/mod
35
35
  }(ODataStringType)) || _class);
36
36
  return EmailType;
37
37
  }, false);
38
- //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkVtYWlsLnRzIl0sIm5hbWVzIjpbImVtYWlsVzNDUmVnZXhwIiwiRW1haWxUeXBlIiwiZGVmaW5lVUk1Q2xhc3MiLCJ2YWxpZGF0ZVZhbHVlIiwic1ZhbHVlIiwidGVzdCIsIlZhbGlkYXRlRXhjZXB0aW9uIiwiQ29yZSIsImdldExpYnJhcnlSZXNvdXJjZUJ1bmRsZSIsImdldFRleHQiLCJPRGF0YVN0cmluZ1R5cGUiXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7Ozs7Ozs7Ozs7OztBQUlBLE1BQU1BLGNBQWMsR0FBRyxxRUFBdkI7TUFFTUMsUyxXQURMQyxjQUFjLENBQUMsd0JBQUQsQzs7Ozs7Ozs7O1dBRWRDLGEsR0FBQSx1QkFBY0MsTUFBZCxFQUE4QjtBQUM3QixVQUFJLENBQUNKLGNBQWMsQ0FBQ0ssSUFBZixDQUFvQkQsTUFBcEIsQ0FBTCxFQUFrQztBQUNqQyxjQUFNLElBQUlFLGlCQUFKLENBQXVCQyxJQUFELENBQWlCQyx3QkFBakIsQ0FBMEMsYUFBMUMsRUFBeURDLE9BQXpELENBQWlFLDJCQUFqRSxDQUF0QixDQUFOO0FBQ0E7O0FBQ0QsaUNBQU1OLGFBQU4sWUFBb0JDLE1BQXBCO0FBQ0EsSzs7O0lBTnNCTSxlO1NBUVRULFMiLCJzb3VyY2VSb290IjoiLiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCBDb3JlIGZyb20gXCJzYXAvdWkvY29yZS9Db3JlXCI7XG5pbXBvcnQgT0RhdGFTdHJpbmdUeXBlIGZyb20gXCJzYXAvdWkvbW9kZWwvb2RhdGEvdHlwZS9TdHJpbmdcIjtcbmltcG9ydCB7IENvcmVFeCB9IGZyb20gXCJ0eXBlcy9leHRlbnNpb25fdHlwZXNcIjtcbmltcG9ydCBWYWxpZGF0ZUV4Y2VwdGlvbiBmcm9tIFwic2FwL3VpL21vZGVsL1ZhbGlkYXRlRXhjZXB0aW9uXCI7XG5pbXBvcnQgeyBkZWZpbmVVSTVDbGFzcyB9IGZyb20gXCJzYXAvZmUvY29yZS9oZWxwZXJzL0NsYXNzU3VwcG9ydFwiO1xuXG5jb25zdCBlbWFpbFczQ1JlZ2V4cCA9IC9eW2EtekEtWjAtOS4hIyQlJuKAmSorLz0/Xl9ge3x9fi1dK0BbYS16QS1aMC05LV0rKD86LlthLXpBLVowLTktXSspKiQvO1xuQGRlZmluZVVJNUNsYXNzKFwic2FwLmZlLmNvcmUudHlwZS5FbWFpbFwiKVxuY2xhc3MgRW1haWxUeXBlIGV4dGVuZHMgT0RhdGFTdHJpbmdUeXBlIHtcblx0dmFsaWRhdGVWYWx1ZShzVmFsdWU6IHN0cmluZykge1xuXHRcdGlmICghZW1haWxXM0NSZWdleHAudGVzdChzVmFsdWUpKSB7XG5cdFx0XHR0aHJvdyBuZXcgVmFsaWRhdGVFeGNlcHRpb24oKENvcmUgYXMgQ29yZUV4KS5nZXRMaWJyYXJ5UmVzb3VyY2VCdW5kbGUoXCJzYXAuZmUuY29yZVwiKS5nZXRUZXh0KFwiVF9FTUFJTFRZUEVfSU5WQUxJRF9WQUxVRVwiKSk7XG5cdFx0fVxuXHRcdHN1cGVyLnZhbGlkYXRlVmFsdWUoc1ZhbHVlKTtcblx0fVxufVxuZXhwb3J0IGRlZmF1bHQgRW1haWxUeXBlO1xuIl19
38
+ //# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIkVtYWlsLnRzIl0sIm5hbWVzIjpbImVtYWlsVzNDUmVnZXhwIiwiRW1haWxUeXBlIiwiZGVmaW5lVUk1Q2xhc3MiLCJ2YWxpZGF0ZVZhbHVlIiwic1ZhbHVlIiwidGVzdCIsIlZhbGlkYXRlRXhjZXB0aW9uIiwiQ29yZSIsImdldExpYnJhcnlSZXNvdXJjZUJ1bmRsZSIsImdldFRleHQiLCJPRGF0YVN0cmluZ1R5cGUiXSwibWFwcGluZ3MiOiI7QUFBQTtBQUNBO0FBQ0E7Ozs7Ozs7Ozs7OztBQUlBLE1BQU1BLGNBQWMsR0FBRyxxRUFBdkI7TUFFTUMsUyxXQURMQyxjQUFjLENBQUMsd0JBQUQsQzs7Ozs7Ozs7O1dBRWRDLGEsR0FBQSx1QkFBY0MsTUFBZCxFQUE4QjtBQUM3QixVQUFJLENBQUNKLGNBQWMsQ0FBQ0ssSUFBZixDQUFvQkQsTUFBcEIsQ0FBTCxFQUFrQztBQUNqQyxjQUFNLElBQUlFLGlCQUFKLENBQXVCQyxJQUFELENBQWlCQyx3QkFBakIsQ0FBMEMsYUFBMUMsRUFBeURDLE9BQXpELENBQWlFLDJCQUFqRSxDQUF0QixDQUFOO0FBQ0E7O0FBQ0QsaUNBQU1OLGFBQU4sWUFBb0JDLE1BQXBCO0FBQ0EsSzs7O0lBTnNCTSxlO1NBUVRULFMiLCJzb3VyY2VSb290IjoiLiIsInNvdXJjZXNDb250ZW50IjpbImltcG9ydCB7IGRlZmluZVVJNUNsYXNzIH0gZnJvbSBcInNhcC9mZS9jb3JlL2hlbHBlcnMvQ2xhc3NTdXBwb3J0XCI7XG5pbXBvcnQgQ29yZSBmcm9tIFwic2FwL3VpL2NvcmUvQ29yZVwiO1xuaW1wb3J0IE9EYXRhU3RyaW5nVHlwZSBmcm9tIFwic2FwL3VpL21vZGVsL29kYXRhL3R5cGUvU3RyaW5nXCI7XG5pbXBvcnQgVmFsaWRhdGVFeGNlcHRpb24gZnJvbSBcInNhcC91aS9tb2RlbC9WYWxpZGF0ZUV4Y2VwdGlvblwiO1xuaW1wb3J0IHR5cGUgeyBDb3JlRXggfSBmcm9tIFwidHlwZXMvZXh0ZW5zaW9uX3R5cGVzXCI7XG5cbmNvbnN0IGVtYWlsVzNDUmVnZXhwID0gL15bYS16QS1aMC05LiEjJCUm4oCZKisvPT9eX2B7fH1+LV0rQFthLXpBLVowLTktXSsoPzouW2EtekEtWjAtOS1dKykqJC87XG5AZGVmaW5lVUk1Q2xhc3MoXCJzYXAuZmUuY29yZS50eXBlLkVtYWlsXCIpXG5jbGFzcyBFbWFpbFR5cGUgZXh0ZW5kcyBPRGF0YVN0cmluZ1R5cGUge1xuXHR2YWxpZGF0ZVZhbHVlKHNWYWx1ZTogc3RyaW5nKSB7XG5cdFx0aWYgKCFlbWFpbFczQ1JlZ2V4cC50ZXN0KHNWYWx1ZSkpIHtcblx0XHRcdHRocm93IG5ldyBWYWxpZGF0ZUV4Y2VwdGlvbigoQ29yZSBhcyBDb3JlRXgpLmdldExpYnJhcnlSZXNvdXJjZUJ1bmRsZShcInNhcC5mZS5jb3JlXCIpLmdldFRleHQoXCJUX0VNQUlMVFlQRV9JTlZBTElEX1ZBTFVFXCIpKTtcblx0XHR9XG5cdFx0c3VwZXIudmFsaWRhdGVWYWx1ZShzVmFsdWUpO1xuXHR9XG59XG5leHBvcnQgZGVmYXVsdCBFbWFpbFR5cGU7XG4iXX0=
@@ -1,8 +1,8 @@
1
+ import { defineUI5Class } from "sap/fe/core/helpers/ClassSupport";
1
2
  import Core from "sap/ui/core/Core";
2
3
  import ODataStringType from "sap/ui/model/odata/type/String";
3
- import { CoreEx } from "types/extension_types";
4
4
  import ValidateException from "sap/ui/model/ValidateException";
5
- import { defineUI5Class } from "sap/fe/core/helpers/ClassSupport";
5
+ import type { CoreEx } from "types/extension_types";
6
6
 
7
7
  const emailW3CRegexp = /^[a-zA-Z0-9.!#$%&’*+/=?^_`{|}~-]+@[a-zA-Z0-9-]+(?:.[a-zA-Z0-9-]+)*$/;
8
8
  @defineUI5Class("sap.fe.core.type.Email")