@sapui5/sap.fe.core 1.97.0 → 1.100.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (306) hide show
  1. package/package.json +7 -4
  2. package/src/sap/fe/core/.library +1 -1
  3. package/src/sap/fe/core/AnnotationHelper.js +309 -405
  4. package/src/sap/fe/core/AnnotationHelper.ts +315 -0
  5. package/src/sap/fe/core/AppComponent.js +389 -397
  6. package/src/sap/fe/core/AppComponent.ts +403 -0
  7. package/src/sap/fe/core/AppStateHandler.js +198 -181
  8. package/src/sap/fe/core/AppStateHandler.ts +171 -0
  9. package/src/sap/fe/core/BaseController.js +83 -58
  10. package/src/sap/fe/core/BaseController.ts +68 -0
  11. package/src/sap/fe/core/BusyLocker.js +105 -121
  12. package/src/sap/fe/core/BusyLocker.ts +98 -0
  13. package/src/sap/fe/core/CommonUtils.js +2164 -2379
  14. package/src/sap/fe/core/CommonUtils.ts +2177 -0
  15. package/src/sap/fe/core/ExtensionAPI.js +279 -266
  16. package/src/sap/fe/core/ExtensionAPI.ts +250 -0
  17. package/src/sap/fe/core/PageController.js +218 -125
  18. package/src/sap/fe/core/PageController.ts +129 -0
  19. package/src/sap/fe/core/RouterProxy.js +924 -807
  20. package/src/sap/fe/core/RouterProxy.ts +840 -0
  21. package/src/sap/fe/core/Synchronization.js +41 -35
  22. package/src/sap/fe/core/Synchronization.ts +29 -0
  23. package/src/sap/fe/core/TemplateComponent.js +173 -155
  24. package/src/sap/fe/core/TemplateComponent.ts +173 -0
  25. package/src/sap/fe/core/TemplateModel.js +79 -54
  26. package/src/sap/fe/core/TemplateModel.ts +63 -0
  27. package/src/sap/fe/core/TransactionHelper.js +1560 -1579
  28. package/src/sap/fe/core/TransactionHelper.ts +1717 -0
  29. package/src/sap/fe/core/actions/collaboration/ActivitySync.js +392 -0
  30. package/src/sap/fe/core/actions/collaboration/ActivitySync.ts +355 -0
  31. package/src/sap/fe/core/actions/collaboration/CollaborationCommon.js +136 -0
  32. package/src/sap/fe/core/actions/collaboration/CollaborationCommon.ts +119 -0
  33. package/src/sap/fe/core/actions/collaboration/Manage.js +262 -0
  34. package/src/sap/fe/core/actions/collaboration/Manage.ts +244 -0
  35. package/src/sap/fe/core/actions/collaboration/ManageDialog.fragment.xml +103 -0
  36. package/src/sap/fe/core/actions/collaboration/UserDetails.fragment.xml +13 -0
  37. package/src/sap/fe/core/actions/draft.js +521 -581
  38. package/src/sap/fe/core/actions/draft.ts +566 -0
  39. package/src/sap/fe/core/actions/messageHandling.js +564 -511
  40. package/src/sap/fe/core/actions/messageHandling.ts +552 -0
  41. package/src/sap/fe/core/actions/nonDraft.js +17 -19
  42. package/src/sap/fe/core/actions/nonDraft.ts +12 -0
  43. package/src/sap/fe/core/actions/operations.js +1093 -1211
  44. package/src/sap/fe/core/actions/operations.ts +1192 -0
  45. package/src/sap/fe/core/actions/sticky.js +114 -104
  46. package/src/sap/fe/core/actions/sticky.ts +119 -0
  47. package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.js +70 -66
  48. package/src/sap/fe/core/controllerextensions/ControllerExtensionMetadata.ts +65 -0
  49. package/src/sap/fe/core/controllerextensions/EditFlow.js +1594 -1701
  50. package/src/sap/fe/core/controllerextensions/EditFlow.ts +1672 -0
  51. package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.js +80 -54
  52. package/src/sap/fe/core/controllerextensions/IntentBasedNavigation.ts +61 -0
  53. package/src/sap/fe/core/controllerextensions/InternalEditFlow.js +719 -505
  54. package/src/sap/fe/core/controllerextensions/InternalEditFlow.ts +783 -0
  55. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.js +797 -813
  56. package/src/sap/fe/core/controllerextensions/InternalIntentBasedNavigation.ts +803 -0
  57. package/src/sap/fe/core/controllerextensions/InternalRouting.js +1005 -973
  58. package/src/sap/fe/core/controllerextensions/InternalRouting.ts +978 -0
  59. package/src/sap/fe/core/controllerextensions/KPIManagement.js +530 -476
  60. package/src/sap/fe/core/controllerextensions/KPIManagement.ts +137 -46
  61. package/src/sap/fe/core/controllerextensions/MassEdit.js +144 -0
  62. package/src/sap/fe/core/controllerextensions/MassEdit.ts +156 -0
  63. package/src/sap/fe/core/controllerextensions/MessageHandler.js +234 -232
  64. package/src/sap/fe/core/controllerextensions/MessageHandler.ts +225 -0
  65. package/src/sap/fe/core/controllerextensions/PageReady.js +302 -337
  66. package/src/sap/fe/core/controllerextensions/PageReady.ts +23 -17
  67. package/src/sap/fe/core/controllerextensions/Paginator.js +189 -148
  68. package/src/sap/fe/core/controllerextensions/Paginator.ts +163 -0
  69. package/src/sap/fe/core/controllerextensions/Placeholder.js +158 -146
  70. package/src/sap/fe/core/controllerextensions/Placeholder.ts +151 -0
  71. package/src/sap/fe/core/controllerextensions/Routing.js +145 -106
  72. package/src/sap/fe/core/controllerextensions/Routing.ts +132 -0
  73. package/src/sap/fe/core/controllerextensions/RoutingListener.js +8 -6
  74. package/src/sap/fe/core/controllerextensions/RoutingListener.ts +3 -0
  75. package/src/sap/fe/core/controllerextensions/Share.js +220 -244
  76. package/src/sap/fe/core/controllerextensions/Share.ts +231 -0
  77. package/src/sap/fe/core/controllerextensions/SideEffects.js +593 -634
  78. package/src/sap/fe/core/controllerextensions/SideEffects.ts +29 -27
  79. package/src/sap/fe/core/controllerextensions/ViewState.js +789 -806
  80. package/src/sap/fe/core/controllerextensions/ViewState.ts +805 -0
  81. package/src/sap/fe/core/controls/ActionParameterDialog.fragment.xml +4 -3
  82. package/src/sap/fe/core/controls/ActionPartial.fragment.xml +2 -2
  83. package/src/sap/fe/core/controls/CommandExecution.js +68 -66
  84. package/src/sap/fe/core/controls/CommandExecution.ts +72 -0
  85. package/src/sap/fe/core/controls/ConditionalWrapper.js +91 -75
  86. package/src/sap/fe/core/controls/ConditionalWrapper.ts +83 -0
  87. package/src/sap/fe/core/controls/CustomQuickViewPage.js +131 -125
  88. package/src/sap/fe/core/controls/CustomQuickViewPage.ts +126 -0
  89. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.js +105 -110
  90. package/src/sap/fe/core/controls/DataLossOrDraftDiscard/DataLossOrDraftDiscardHandler.ts +101 -0
  91. package/src/sap/fe/core/controls/FieldWrapper.js +122 -140
  92. package/src/sap/fe/core/controls/FieldWrapper.ts +115 -0
  93. package/src/sap/fe/core/controls/FilterBar.js +163 -159
  94. package/src/sap/fe/core/controls/FilterBar.ts +143 -0
  95. package/src/sap/fe/core/controls/FormElementWrapper.js +46 -44
  96. package/src/sap/fe/core/controls/FormElementWrapper.ts +40 -0
  97. package/src/sap/fe/core/controls/MultiValueParameterDelegate.js +38 -42
  98. package/src/sap/fe/core/controls/MultiValueParameterDelegate.ts +31 -0
  99. package/src/sap/fe/core/controls/NonComputedVisibleKeyFieldsDialog.fragment.xml +2 -1
  100. package/src/sap/fe/core/controls/filterbar/FilterContainer.js +127 -116
  101. package/src/sap/fe/core/controls/filterbar/FilterContainer.ts +98 -0
  102. package/src/sap/fe/core/controls/filterbar/VisualFilter.js +242 -255
  103. package/src/sap/fe/core/controls/filterbar/VisualFilter.ts +245 -0
  104. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.js +151 -141
  105. package/src/sap/fe/core/controls/filterbar/VisualFilterContainer.ts +125 -0
  106. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.js +336 -322
  107. package/src/sap/fe/core/controls/filterbar/utils/VisualFilterUtils.ts +337 -0
  108. package/src/sap/fe/core/controls/massEdit/MassEditDialog.fragment.xml +106 -0
  109. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.js +79 -0
  110. package/src/sap/fe/core/controls/massEdit/MassEditHandlers.ts +70 -0
  111. package/src/sap/fe/core/converters/ConverterContext.js +348 -367
  112. package/src/sap/fe/core/converters/ConverterContext.ts +33 -19
  113. package/src/sap/fe/core/converters/ManifestSettings.js +12 -1
  114. package/src/sap/fe/core/converters/ManifestSettings.ts +16 -1
  115. package/src/sap/fe/core/converters/ManifestWrapper.js +354 -354
  116. package/src/sap/fe/core/converters/ManifestWrapper.ts +34 -6
  117. package/src/sap/fe/core/converters/MetaModelConverter.js +72 -9
  118. package/src/sap/fe/core/converters/MetaModelConverter.ts +75 -16
  119. package/src/sap/fe/core/converters/TemplateConverter.js +1 -1
  120. package/src/sap/fe/core/converters/TemplateConverter.ts +4 -3
  121. package/src/sap/fe/core/converters/annotations/DataField.js +28 -14
  122. package/src/sap/fe/core/converters/annotations/DataField.ts +38 -14
  123. package/src/sap/fe/core/converters/common/AnnotationConverter.js +33 -21
  124. package/src/sap/fe/core/converters/controls/Common/Action.js +11 -2
  125. package/src/sap/fe/core/converters/controls/Common/Action.ts +8 -2
  126. package/src/sap/fe/core/converters/controls/Common/Chart.js +5 -3
  127. package/src/sap/fe/core/converters/controls/Common/Chart.ts +11 -3
  128. package/src/sap/fe/core/converters/controls/Common/DataVisualization.js +3 -3
  129. package/src/sap/fe/core/converters/controls/Common/DataVisualization.ts +2 -2
  130. package/src/sap/fe/core/converters/controls/Common/Form.js +21 -11
  131. package/src/sap/fe/core/converters/controls/Common/Form.ts +28 -6
  132. package/src/sap/fe/core/converters/controls/Common/KPI.js +69 -4
  133. package/src/sap/fe/core/converters/controls/Common/KPI.ts +75 -2
  134. package/src/sap/fe/core/converters/controls/Common/Table.js +507 -408
  135. package/src/sap/fe/core/converters/controls/Common/Table.ts +618 -500
  136. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.js +592 -0
  137. package/src/sap/fe/core/converters/controls/Common/table/StandardActions.ts +718 -0
  138. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.js +465 -59
  139. package/src/sap/fe/core/converters/controls/ListReport/FilterBar.ts +462 -72
  140. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.js +2 -2
  141. package/src/sap/fe/core/converters/controls/ListReport/VisualFilters.ts +1 -1
  142. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.js +17 -9
  143. package/src/sap/fe/core/converters/controls/ObjectPage/SubSection.ts +24 -9
  144. package/src/sap/fe/core/converters/helpers/Aggregation.js +118 -121
  145. package/src/sap/fe/core/converters/helpers/Aggregation.ts +28 -5
  146. package/src/sap/fe/core/converters/helpers/BindingHelper.js +20 -6
  147. package/src/sap/fe/core/converters/helpers/BindingHelper.ts +16 -4
  148. package/src/sap/fe/core/converters/helpers/ConfigurableObject.js +12 -1
  149. package/src/sap/fe/core/converters/helpers/ConfigurableObject.ts +11 -0
  150. package/src/sap/fe/core/converters/helpers/IssueManager.js +7 -1
  151. package/src/sap/fe/core/converters/helpers/IssueManager.ts +6 -0
  152. package/src/sap/fe/core/converters/helpers/Key.js +42 -57
  153. package/src/sap/fe/core/converters/helpers/Key.ts +1 -1
  154. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.js +28 -7
  155. package/src/sap/fe/core/converters/objectPage/HeaderAndFooterAction.ts +23 -6
  156. package/src/sap/fe/core/converters/templates/ListReportConverter.js +20 -7
  157. package/src/sap/fe/core/converters/templates/ListReportConverter.ts +36 -14
  158. package/src/sap/fe/core/converters/templates/ObjectPageConverter.js +7 -5
  159. package/src/sap/fe/core/converters/templates/ObjectPageConverter.ts +5 -1
  160. package/src/sap/fe/core/designtime/AppComponent.designtime.js +93 -90
  161. package/src/sap/fe/core/designtime/AppComponent.designtime.ts +91 -0
  162. package/src/sap/fe/core/formatters/CollaborationFormatter.js +104 -0
  163. package/src/sap/fe/core/formatters/CollaborationFormatter.ts +60 -0
  164. package/src/sap/fe/core/formatters/CriticalityFormatter.js +1 -1
  165. package/src/sap/fe/core/formatters/CriticalityFormatter.ts +1 -1
  166. package/src/sap/fe/core/formatters/FPMFormatter.js +1 -1
  167. package/src/sap/fe/core/formatters/FPMFormatter.ts +4 -10
  168. package/src/sap/fe/core/formatters/KPIFormatter.js +1 -1
  169. package/src/sap/fe/core/formatters/KPIFormatter.ts +3 -1
  170. package/src/sap/fe/core/formatters/TableFormatter.js +91 -29
  171. package/src/sap/fe/core/formatters/TableFormatter.ts +94 -28
  172. package/src/sap/fe/core/formatters/ValueFormatter.js +30 -5
  173. package/src/sap/fe/core/formatters/ValueFormatter.ts +30 -7
  174. package/src/sap/fe/core/fpm/Component.js +51 -54
  175. package/src/sap/fe/core/fpm/Component.ts +48 -0
  176. package/src/sap/fe/core/helpers/AppStartupHelper.js +373 -0
  177. package/src/sap/fe/core/helpers/AppStartupHelper.ts +417 -0
  178. package/src/sap/fe/core/helpers/BindingExpression.js +489 -442
  179. package/src/sap/fe/core/helpers/BindingExpression.ts +486 -469
  180. package/src/sap/fe/core/helpers/ClassSupport.js +212 -76
  181. package/src/sap/fe/core/helpers/ClassSupport.ts +198 -71
  182. package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.js +64 -59
  183. package/src/sap/fe/core/helpers/DynamicAnnotationPathHelper.ts +52 -0
  184. package/src/sap/fe/core/helpers/EditState.js +81 -84
  185. package/src/sap/fe/core/helpers/EditState.ts +81 -0
  186. package/src/sap/fe/core/helpers/ExcelFormatHelper.js +62 -48
  187. package/src/sap/fe/core/helpers/ExcelFormatHelper.ts +49 -0
  188. package/src/sap/fe/core/helpers/FPMHelper.js +52 -56
  189. package/src/sap/fe/core/helpers/FPMHelper.ts +62 -0
  190. package/src/sap/fe/core/helpers/KeepAliveHelper.js +4 -5
  191. package/src/sap/fe/core/helpers/KeepAliveHelper.ts +10 -10
  192. package/src/sap/fe/core/helpers/MassEditHelper.js +604 -0
  193. package/src/sap/fe/core/helpers/MassEditHelper.ts +699 -0
  194. package/src/sap/fe/core/helpers/ModelHelper.js +253 -225
  195. package/src/sap/fe/core/helpers/ModelHelper.ts +250 -0
  196. package/src/sap/fe/core/helpers/PasteHelper.js +210 -132
  197. package/src/sap/fe/core/helpers/PasteHelper.ts +196 -0
  198. package/src/sap/fe/core/helpers/SemanticDateOperators.js +336 -313
  199. package/src/sap/fe/core/helpers/SemanticDateOperators.ts +334 -0
  200. package/src/sap/fe/core/helpers/SemanticKeyHelper.js +66 -67
  201. package/src/sap/fe/core/helpers/SemanticKeyHelper.ts +73 -0
  202. package/src/sap/fe/core/helpers/StableIdHelper.js +4 -7
  203. package/src/sap/fe/core/helpers/StableIdHelper.ts +2 -6
  204. package/src/sap/fe/core/jsx-runtime/jsx.js +1 -1
  205. package/src/sap/fe/core/jsx-runtime/jsx.ts +1 -1
  206. package/src/sap/fe/core/library.js +427 -425
  207. package/src/sap/fe/core/library.support.js +23 -27
  208. package/src/sap/fe/core/library.support.ts +23 -0
  209. package/src/sap/fe/core/library.ts +420 -0
  210. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.js +64 -0
  211. package/src/sap/fe/core/manifestMerger/ChangePageConfiguration.ts +69 -0
  212. package/src/sap/fe/core/messagebundle.properties +78 -13
  213. package/src/sap/fe/core/messagebundle_ar.properties +58 -7
  214. package/src/sap/fe/core/messagebundle_bg.properties +58 -7
  215. package/src/sap/fe/core/messagebundle_ca.properties +58 -7
  216. package/src/sap/fe/core/messagebundle_cs.properties +59 -8
  217. package/src/sap/fe/core/messagebundle_cy.properties +58 -7
  218. package/src/sap/fe/core/messagebundle_da.properties +58 -7
  219. package/src/sap/fe/core/messagebundle_de.properties +58 -7
  220. package/src/sap/fe/core/messagebundle_el.properties +58 -7
  221. package/src/sap/fe/core/messagebundle_en.properties +57 -6
  222. package/src/sap/fe/core/messagebundle_en_GB.properties +57 -6
  223. package/src/sap/fe/core/messagebundle_en_US_sappsd.properties +61 -6
  224. package/src/sap/fe/core/messagebundle_en_US_saprigi.properties +58 -7
  225. package/src/sap/fe/core/messagebundle_en_US_saptrc.properties +58 -7
  226. package/src/sap/fe/core/messagebundle_es.properties +58 -7
  227. package/src/sap/fe/core/messagebundle_es_MX.properties +58 -7
  228. package/src/sap/fe/core/messagebundle_et.properties +58 -7
  229. package/src/sap/fe/core/messagebundle_fi.properties +60 -9
  230. package/src/sap/fe/core/messagebundle_fr.properties +64 -13
  231. package/src/sap/fe/core/messagebundle_fr_CA.properties +59 -8
  232. package/src/sap/fe/core/messagebundle_hi.properties +58 -7
  233. package/src/sap/fe/core/messagebundle_hr.properties +58 -7
  234. package/src/sap/fe/core/messagebundle_hu.properties +59 -8
  235. package/src/sap/fe/core/messagebundle_id.properties +61 -10
  236. package/src/sap/fe/core/messagebundle_it.properties +58 -7
  237. package/src/sap/fe/core/messagebundle_iw.properties +58 -7
  238. package/src/sap/fe/core/messagebundle_ja.properties +58 -7
  239. package/src/sap/fe/core/messagebundle_kk.properties +58 -7
  240. package/src/sap/fe/core/messagebundle_ko.properties +58 -7
  241. package/src/sap/fe/core/messagebundle_lt.properties +58 -7
  242. package/src/sap/fe/core/messagebundle_lv.properties +59 -8
  243. package/src/sap/fe/core/messagebundle_ms.properties +58 -7
  244. package/src/sap/fe/core/messagebundle_nl.properties +58 -7
  245. package/src/sap/fe/core/messagebundle_no.properties +58 -7
  246. package/src/sap/fe/core/messagebundle_pl.properties +58 -7
  247. package/src/sap/fe/core/messagebundle_pt.properties +59 -8
  248. package/src/sap/fe/core/messagebundle_pt_PT.properties +58 -7
  249. package/src/sap/fe/core/messagebundle_ro.properties +58 -7
  250. package/src/sap/fe/core/messagebundle_ru.properties +58 -7
  251. package/src/sap/fe/core/messagebundle_sh.properties +58 -7
  252. package/src/sap/fe/core/messagebundle_sk.properties +58 -7
  253. package/src/sap/fe/core/messagebundle_sl.properties +58 -7
  254. package/src/sap/fe/core/messagebundle_sv.properties +59 -8
  255. package/src/sap/fe/core/messagebundle_th.properties +58 -7
  256. package/src/sap/fe/core/messagebundle_tr.properties +60 -9
  257. package/src/sap/fe/core/messagebundle_uk.properties +58 -7
  258. package/src/sap/fe/core/messagebundle_vi.properties +58 -7
  259. package/src/sap/fe/core/messagebundle_zh_CN.properties +58 -7
  260. package/src/sap/fe/core/messagebundle_zh_TW.properties +58 -7
  261. package/src/sap/fe/core/services/AsyncComponentServiceFactory.js +45 -71
  262. package/src/sap/fe/core/services/AsyncComponentServiceFactory.ts +3 -1
  263. package/src/sap/fe/core/services/CacheHandlerServiceFactory.js +231 -202
  264. package/src/sap/fe/core/services/CacheHandlerServiceFactory.ts +212 -0
  265. package/src/sap/fe/core/services/EnvironmentServiceFactory.js +67 -92
  266. package/src/sap/fe/core/services/EnvironmentServiceFactory.ts +10 -6
  267. package/src/sap/fe/core/services/NavigationServiceFactory.js +351 -300
  268. package/src/sap/fe/core/services/NavigationServiceFactory.ts +313 -0
  269. package/src/sap/fe/core/services/ResourceModelServiceFactory.js +114 -81
  270. package/src/sap/fe/core/services/ResourceModelServiceFactory.ts +83 -0
  271. package/src/sap/fe/core/services/RoutingServiceFactory.js +927 -1152
  272. package/src/sap/fe/core/services/RoutingServiceFactory.ts +898 -0
  273. package/src/sap/fe/core/services/ShellServicesFactory.js +649 -707
  274. package/src/sap/fe/core/services/ShellServicesFactory.ts +52 -15
  275. package/src/sap/fe/core/services/SideEffectsServiceFactory.js +569 -637
  276. package/src/sap/fe/core/services/SideEffectsServiceFactory.ts +78 -102
  277. package/src/sap/fe/core/services/TemplatedViewServiceFactory.js +429 -478
  278. package/src/sap/fe/core/services/TemplatedViewServiceFactory.ts +460 -0
  279. package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.js +10 -8
  280. package/src/sap/fe/core/services/view/TemplatingErrorPage.controller.ts +8 -0
  281. package/src/sap/fe/core/support/AnnotationIssue.support.js +15 -3
  282. package/src/sap/fe/core/support/AnnotationIssue.support.ts +16 -2
  283. package/src/sap/fe/core/support/CollectionFacetUnsupportedLevel.support.js +2 -2
  284. package/src/sap/fe/core/support/CollectionFacetUnsupportedLevel.support.ts +1 -1
  285. package/src/sap/fe/core/support/CommonHelper.js +1 -1
  286. package/src/sap/fe/core/support/CommonHelper.ts +1 -1
  287. package/src/sap/fe/core/support/Diagnostics.js +36 -48
  288. package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.js +38 -0
  289. package/src/sap/fe/core/support/InvalidAnnotationColumnKey.support.ts +18 -0
  290. package/src/sap/fe/core/templating/DataModelPathHelper.js +97 -127
  291. package/src/sap/fe/core/templating/DataModelPathHelper.ts +112 -135
  292. package/src/sap/fe/core/templating/DisplayModeFormatter.js +114 -0
  293. package/src/sap/fe/core/templating/DisplayModeFormatter.ts +86 -0
  294. package/src/sap/fe/core/templating/FieldControlHelper.js +8 -8
  295. package/src/sap/fe/core/templating/FieldControlHelper.ts +25 -7
  296. package/src/sap/fe/core/templating/FilterHelper.js +140 -78
  297. package/src/sap/fe/core/templating/FilterHelper.ts +149 -78
  298. package/src/sap/fe/core/templating/PropertyHelper.js +3 -3
  299. package/src/sap/fe/core/templating/PropertyHelper.ts +2 -2
  300. package/src/sap/fe/core/templating/UIFormatters.js +76 -135
  301. package/src/sap/fe/core/templating/UIFormatters.ts +76 -99
  302. package/src/sap/fe/core/type/Email.js +1 -1
  303. package/src/sap/fe/core/type/Email.ts +4 -6
  304. package/ui5.yaml +0 -3
  305. package/src/sap/fe/core/controls/filterbar.d.js +0 -8
  306. package/src/sap/fe/core/controls/filterbar.d.ts +0 -0
@@ -0,0 +1,718 @@
1
+ import ConverterContext from "../../../ConverterContext";
2
+ import {
3
+ and,
4
+ annotationExpression,
5
+ bindingExpression,
6
+ BindingExpression,
7
+ compileBinding,
8
+ constant,
9
+ equal,
10
+ length,
11
+ Expression,
12
+ greaterOrEqual,
13
+ ifElse,
14
+ isBinding,
15
+ isConstant,
16
+ not,
17
+ notEqual,
18
+ or,
19
+ greaterThan,
20
+ formatResult
21
+ } from "sap/fe/core/helpers/BindingExpression";
22
+ import { CreationMode, TemplateType, ViewPathConfiguration } from "../../../ManifestSettings";
23
+ import { singletonPathVisitor, UI } from "../../../helpers/BindingHelper";
24
+ import { PropertyAnnotationValue } from "@sap-ux/vocabularies-types";
25
+ import { getTargetObjectPath, isPathDeletable, isPathInsertable, isPathUpdatable } from "sap/fe/core/templating/DataModelPathHelper";
26
+ import { TableControlConfiguration } from "../Table";
27
+ import tableFormatters from "sap/fe/core/formatters/TableFormatter";
28
+
29
+ enum AnnotationHiddenProperty {
30
+ CreateHidden = "CreateHidden",
31
+ DeleteHidden = "DeleteHidden",
32
+ UpdateHidden = "UpdateHidden"
33
+ }
34
+
35
+ export type StandardActionConfigType = {
36
+ isTemplated?: BindingExpression<boolean>;
37
+ visible: BindingExpression<boolean>;
38
+ enabled: BindingExpression<boolean>;
39
+ };
40
+
41
+ type ExpressionRestrictionsType = {
42
+ expression: Expression<boolean>;
43
+ navigationExpression: Expression<boolean>;
44
+ };
45
+ type StandardActionsRestrictionsType = Record<string, ExpressionRestrictionsType>;
46
+
47
+ export type StandardActionsContext = {
48
+ collectionPath: string;
49
+ hiddenAnnotation: {
50
+ create: Expression<boolean>;
51
+ "delete": Expression<boolean>;
52
+ update: Expression<boolean>;
53
+ };
54
+ creationMode: CreationMode;
55
+ isDraftOrStickySupported: boolean;
56
+ isViewWithMultipleVisualizations: boolean;
57
+ newAction?: {
58
+ name?: string;
59
+ available?: Expression<boolean>;
60
+ };
61
+ tableManifestConfiguration: TableControlConfiguration;
62
+ restrictions: StandardActionsRestrictionsType;
63
+ };
64
+
65
+ /**
66
+ * Generates the context for the standard actions.
67
+ *
68
+ * @param {ConverterContext} converterContext
69
+ * @param {NavigationSettingsConfiguration} creationMode
70
+ * @param {TableControlConfiguration} tableManifestConfiguration
71
+ * @param {ViewPathConfiguration} viewConfiguration
72
+ * @returns The context for table actions
73
+ */
74
+ export function generateStandardActionsContext(
75
+ converterContext: ConverterContext,
76
+ creationMode: CreationMode,
77
+ tableManifestConfiguration: TableControlConfiguration,
78
+ viewConfiguration?: ViewPathConfiguration
79
+ ): StandardActionsContext {
80
+ return {
81
+ collectionPath: getTargetObjectPath(converterContext.getDataModelObjectPath()),
82
+ hiddenAnnotation: {
83
+ create: isActionAnnotatedHidden(converterContext, AnnotationHiddenProperty.CreateHidden),
84
+ "delete": isActionAnnotatedHidden(converterContext, AnnotationHiddenProperty.DeleteHidden),
85
+ update: isActionAnnotatedHidden(converterContext, AnnotationHiddenProperty.UpdateHidden)
86
+ },
87
+ creationMode: creationMode,
88
+ isDraftOrStickySupported: isDraftOrStickySupported(converterContext),
89
+ isViewWithMultipleVisualizations: viewConfiguration
90
+ ? converterContext.getManifestWrapper().hasMultipleVisualizations(viewConfiguration)
91
+ : false,
92
+ newAction: getNewAction(converterContext),
93
+ tableManifestConfiguration: tableManifestConfiguration,
94
+ restrictions: getRestrictions(converterContext)
95
+ };
96
+ }
97
+
98
+ /**
99
+ * Checks if draft is supported.
100
+ *
101
+ * @param {ConverterContext} converterContext
102
+ * @returns {boolean}
103
+ */
104
+ export function isDraftSupported(converterContext: ConverterContext): boolean {
105
+ const currentEntitySet = converterContext.getEntitySet();
106
+ const bIsDraftRoot = currentEntitySet && currentEntitySet.annotations?.Common?.DraftRoot ? true : false;
107
+ const bIsDraftNode = currentEntitySet && currentEntitySet.annotations?.Common?.DraftNode ? true : false;
108
+ const bIsDraftParentEntityForContainment =
109
+ converterContext.getDataModelObjectPath().targetObject?.containsTarget &&
110
+ (converterContext.getDataModelObjectPath().startingEntitySet?.annotations?.Common?.DraftRoot ||
111
+ converterContext.getDataModelObjectPath().startingEntitySet?.annotations?.Common?.DraftNode)
112
+ ? true
113
+ : false;
114
+
115
+ return bIsDraftRoot || bIsDraftNode || (!converterContext.getEntitySet() && bIsDraftParentEntityForContainment);
116
+ }
117
+
118
+ /**
119
+ * Checks if sticky or draft is supported.
120
+ *
121
+ * @param {ConverterContext} converterContext
122
+ * @returns {boolean}
123
+ */
124
+ export function isDraftOrStickySupported(converterContext: ConverterContext): boolean {
125
+ const bIsDraftSupported = isDraftSupported(converterContext);
126
+ const bIsStickySessionSupported = converterContext.getDataModelObjectPath().startingEntitySet?.annotations?.Session
127
+ ?.StickySessionSupported
128
+ ? true
129
+ : false;
130
+
131
+ return bIsDraftSupported || bIsStickySessionSupported;
132
+ }
133
+
134
+ /**
135
+ * Gets the configured newAction into annotation.
136
+ *
137
+ * @param {ConverterContext} converterContext
138
+ * @returns {any}
139
+ */
140
+ export function getNewAction(converterContext: ConverterContext): any {
141
+ const currentEntitySet = converterContext.getEntitySet();
142
+ const newActionName: BindingExpression<string> = (
143
+ currentEntitySet?.annotations?.Common?.DraftRoot?.NewAction ||
144
+ currentEntitySet?.annotations?.Session?.StickySessionSupported?.NewAction
145
+ )?.toString();
146
+ if (newActionName) {
147
+ let availableProperty: any = converterContext?.getEntityType().actions[newActionName]?.annotations?.Core?.OperationAvailable;
148
+ availableProperty = availableProperty !== undefined ? availableProperty : true;
149
+ return {
150
+ name: newActionName,
151
+ available: annotationExpression(availableProperty)
152
+ };
153
+ }
154
+ return undefined;
155
+ }
156
+
157
+ /**
158
+ * Gets the binding expression for the action visibility configured into annotation.
159
+ *
160
+ * @param {ConverterContext} converterContext
161
+ * @param {string} sAnnotationTerm
162
+ * @param {boolean} bWithNavigationPath
163
+ * @returns {Expression<boolean>}
164
+ */
165
+ export function isActionAnnotatedHidden(
166
+ converterContext: ConverterContext,
167
+ sAnnotationTerm: string,
168
+ bWithNavigationPath = true
169
+ ): Expression<boolean> {
170
+ const currentEntitySet = converterContext.getEntitySet();
171
+ const dataModelObjectPath = converterContext.getDataModelObjectPath();
172
+ // Consider only the last level of navigation. The others are already considered in the element binding of the page.
173
+ const visitedNavigationPaths =
174
+ dataModelObjectPath.navigationProperties.length > 0 && bWithNavigationPath
175
+ ? [dataModelObjectPath.navigationProperties[dataModelObjectPath.navigationProperties.length - 1].name]
176
+ : [];
177
+ const actionAnnotationValue =
178
+ ((currentEntitySet?.annotations.UI as any)?.[sAnnotationTerm] as PropertyAnnotationValue<boolean>) || false;
179
+
180
+ return currentEntitySet
181
+ ? annotationExpression(actionAnnotationValue, visitedNavigationPaths, undefined, (path: string) =>
182
+ singletonPathVisitor(path, converterContext.getConvertedTypes(), visitedNavigationPaths)
183
+ )
184
+ : constant(false);
185
+ }
186
+
187
+ /**
188
+ * Gets the annotated restrictions for the actions.
189
+ *
190
+ * @param {ConverterContext} converterContext
191
+ * @returns {StandardActionsRestrictionsType}
192
+ */
193
+ export function getRestrictions(converterContext: ConverterContext): StandardActionsRestrictionsType {
194
+ const dataModelObjectPath = converterContext.getDataModelObjectPath();
195
+ const restrictionsDef = [
196
+ {
197
+ key: "isInsertable",
198
+ "function": isPathInsertable
199
+ },
200
+ {
201
+ key: "isUpdatable",
202
+ "function": isPathUpdatable
203
+ },
204
+ {
205
+ key: "isDeletable",
206
+ "function": isPathDeletable
207
+ }
208
+ ];
209
+ const result: Record<string, ExpressionRestrictionsType> = {};
210
+ restrictionsDef.forEach(function(def) {
211
+ const defFunction = def["function"];
212
+ result[def.key] = {
213
+ expression: defFunction.apply(null, [
214
+ dataModelObjectPath,
215
+ {
216
+ pathVisitor: (path: string, navigationPaths: string[]) =>
217
+ singletonPathVisitor(path, converterContext.getConvertedTypes(), navigationPaths)
218
+ }
219
+ ]),
220
+ navigationExpression: defFunction.apply(null, [
221
+ dataModelObjectPath,
222
+ {
223
+ ignoreTargetCollection: true,
224
+ authorizeUnresolvable: true,
225
+ pathVisitor: (path: string, navigationPaths: string[]) =>
226
+ singletonPathVisitor(path, converterContext.getConvertedTypes(), navigationPaths)
227
+ }
228
+ ])
229
+ };
230
+ });
231
+ return result;
232
+ }
233
+
234
+ /**
235
+ * Checks if templating for insert/update actions is mandatory.
236
+ *
237
+ * @param {StandardActionsContext} standardActionsContext
238
+ * @param {boolean} isDraftOrSticky
239
+ * @param {boolean} isCreateAlwaysHidden
240
+ * @returns {boolean}
241
+ */
242
+ export function getInsertUpdateActionsTemplating(
243
+ standardActionsContext: StandardActionsContext,
244
+ isDraftOrSticky: boolean,
245
+ isCreateAlwaysHidden: boolean
246
+ ): boolean {
247
+ return (isDraftOrSticky || standardActionsContext.creationMode === CreationMode.External) && !isCreateAlwaysHidden;
248
+ }
249
+
250
+ /**
251
+ * Gets the binding expressions for the properties of the action Create.
252
+ *
253
+ * @param {ConverterContext} converterContext
254
+ * @param {StandardActionsContext} standardActionsContext
255
+ * @returns {StandardActionConfigType}
256
+ */
257
+ export function getStandardActionCreate(
258
+ converterContext: ConverterContext,
259
+ standardActionsContext: StandardActionsContext
260
+ ): StandardActionConfigType {
261
+ const createVisibility = getCreateVisibility(converterContext, standardActionsContext);
262
+ return {
263
+ isTemplated: compileBinding(getCreateTemplating(standardActionsContext, createVisibility)),
264
+ visible: compileBinding(createVisibility),
265
+ enabled: compileBinding(getCreateEnablement(converterContext, standardActionsContext, createVisibility))
266
+ };
267
+ }
268
+
269
+ /**
270
+ * Gets the binding expressions for the properties of the action Delete.
271
+ *
272
+ * @param {ConverterContext} converterContext
273
+ * @param {StandardActionsContext} standardActionsContext
274
+ * @returns {StandardActionConfigType}
275
+ */
276
+ export function getStandardActionDelete(
277
+ converterContext: ConverterContext,
278
+ standardActionsContext: StandardActionsContext
279
+ ): StandardActionConfigType {
280
+ const deleteVisibility = getDeleteVisibility(converterContext, standardActionsContext);
281
+
282
+ return {
283
+ isTemplated: compileBinding(getDefaultTemplating(deleteVisibility)),
284
+ visible: compileBinding(deleteVisibility),
285
+ enabled: compileBinding(getDeleteEnablement(converterContext, standardActionsContext, deleteVisibility))
286
+ };
287
+ }
288
+
289
+ /**
290
+ * @param converterContext
291
+ * @param standardActionsContext
292
+ * @returns StandardActionConfigType
293
+ */
294
+ export function getCreationRow(
295
+ converterContext: ConverterContext,
296
+ standardActionsContext: StandardActionsContext
297
+ ): StandardActionConfigType {
298
+ const creationRowVisibility = getCreateVisibility(converterContext, standardActionsContext, true);
299
+
300
+ return {
301
+ isTemplated: compileBinding(getCreateTemplating(standardActionsContext, creationRowVisibility, true)),
302
+ visible: compileBinding(creationRowVisibility),
303
+ enabled: compileBinding(getCreationRowEnablement(converterContext, standardActionsContext, creationRowVisibility))
304
+ };
305
+ }
306
+
307
+ /**
308
+ * Gets the binding expressions for the properties of the action Paste.
309
+ *
310
+ * @param {ConverterContext} converterContext
311
+ * @param {StandardActionsContext} standardActionsContext
312
+ * @param {boolean} isInsertUpdateActionsTemplated
313
+ * @returns {StandardActionConfigType}
314
+ */
315
+ export function getStandardActionPaste(
316
+ converterContext: ConverterContext,
317
+ standardActionsContext: StandardActionsContext,
318
+ isInsertUpdateActionsTemplated: boolean
319
+ ): StandardActionConfigType {
320
+ const createVisibility = getCreateVisibility(converterContext, standardActionsContext);
321
+ const createEnablement = getCreateEnablement(converterContext, standardActionsContext, createVisibility);
322
+ const pasteVisibility = getPasteVisibility(converterContext, standardActionsContext, createVisibility, isInsertUpdateActionsTemplated);
323
+ return {
324
+ visible: compileBinding(pasteVisibility),
325
+ enabled: compileBinding(getPasteEnablement(pasteVisibility, createEnablement))
326
+ };
327
+ }
328
+
329
+ /**
330
+ * Gets the binding expressions for the properties of the action MassEdit.
331
+ *
332
+ * @param {ConverterContext} converterContext
333
+ * @param {StandardActionsContext} standardActionsContext
334
+ * @returns {StandardActionConfigType}
335
+ */
336
+ export function getStandardActionMassEdit(
337
+ converterContext: ConverterContext,
338
+ standardActionsContext: StandardActionsContext
339
+ ): StandardActionConfigType {
340
+ const massEditVisibility = getMassEditVisibility(converterContext, standardActionsContext);
341
+
342
+ return {
343
+ isTemplated: compileBinding(getDefaultTemplating(massEditVisibility)),
344
+ visible: compileBinding(massEditVisibility),
345
+ enabled: compileBinding(getMassEditEnablement(converterContext, standardActionsContext, massEditVisibility))
346
+ };
347
+ }
348
+
349
+ /**
350
+ * Gets the binding expression for the templating of the action Create.
351
+ *
352
+ * @param {StandardActionsContext} standardActionsContext
353
+ * @param {Expression<boolean>} createVisibility
354
+ * @param {boolean} isForCreationRow
355
+ * @returns {Expression<boolean> }
356
+ */
357
+ export function getCreateTemplating(
358
+ standardActionsContext: StandardActionsContext,
359
+ createVisibility: Expression<boolean>,
360
+ isForCreationRow = false
361
+ ): Expression<boolean> {
362
+ //Templating of Create Button is not done:
363
+ // - If Button is never visible(covered the External create button, new Action)
364
+ // - or CreationMode is on CreationRow for Create Button
365
+ // - or CreationMode is not on CreationRow for CreationRow Button
366
+
367
+ return and(
368
+ //XNOR gate
369
+ or(
370
+ and(isForCreationRow, standardActionsContext.creationMode === CreationMode.CreationRow),
371
+ and(!isForCreationRow, standardActionsContext.creationMode !== CreationMode.CreationRow)
372
+ ),
373
+ or(not(isConstant(createVisibility)), createVisibility)
374
+ );
375
+ }
376
+
377
+ /**
378
+ * Gets the binding expression for the templating of the non-Create actions.
379
+ *
380
+ * @param {Expression<boolean>} actionVisibility
381
+ * @returns {Expression<boolean> }
382
+ */
383
+ export function getDefaultTemplating(actionVisibility: Expression<boolean>): Expression<boolean> {
384
+ return or(not(isConstant(actionVisibility)), actionVisibility);
385
+ }
386
+
387
+ /**
388
+ * Gets the binding expression for the property visible of the action Create.
389
+ *
390
+ * @param {ConverterContext} converterContext
391
+ * @param {StandardActionsContext} standardActionsContext
392
+ * @param {boolean} isForCreationRow
393
+ * @returns {Expression<boolean> }
394
+ */
395
+ export function getCreateVisibility(
396
+ converterContext: ConverterContext,
397
+ standardActionsContext: StandardActionsContext,
398
+ isForCreationRow = false
399
+ ): Expression<boolean> {
400
+ const isInsertable = standardActionsContext.restrictions.isInsertable.expression;
401
+ const isCreateHidden = isForCreationRow
402
+ ? isActionAnnotatedHidden(converterContext, AnnotationHiddenProperty.CreateHidden, false)
403
+ : standardActionsContext.hiddenAnnotation.create;
404
+ const newAction = standardActionsContext.newAction;
405
+
406
+ //Create Button is visible:
407
+ // - If the creation mode is external
408
+ // - If we're on the list report and create is not hidden
409
+ // - Otherwise this depends on the value of the the UI.IsEditable
410
+ // - Otherwise
411
+ // - If we're on the list report ->
412
+ // - If UI.CreateHidden points to a property path -> provide a negated binding to this path
413
+ // - Otherwise, create is visible
414
+ // - Otherwise
415
+ // - This depends on the value of the the UI.IsEditable
416
+ return ifElse(
417
+ standardActionsContext.creationMode === CreationMode.External,
418
+ and(not(isCreateHidden), or(converterContext.getTemplateType() === TemplateType.ListReport, UI.IsEditable)),
419
+ ifElse(
420
+ or(
421
+ and(isConstant(newAction?.available), equal(newAction?.available, false)),
422
+ and(isConstant(isInsertable), equal(isInsertable, false), !newAction),
423
+ and(isConstant(isCreateHidden), equal(isCreateHidden, true)),
424
+ standardActionsContext.isViewWithMultipleVisualizations,
425
+ converterContext.getTemplateType() === TemplateType.AnalyticalListPage
426
+ ),
427
+ false,
428
+ ifElse(
429
+ converterContext.getTemplateType() === TemplateType.ListReport,
430
+ or(not(isBinding(isCreateHidden)), not(isCreateHidden)),
431
+ and(not(isCreateHidden), UI.IsEditable)
432
+ )
433
+ )
434
+ );
435
+ }
436
+
437
+ /**
438
+ * Gets the binding expression for the property visible of the action Delete.
439
+ *
440
+ * @param {ConverterContext} converterContext
441
+ * @param {StandardActionsContext} standardActionsContext
442
+ * @returns {Expression<boolean> }
443
+ */
444
+ export function getDeleteVisibility(
445
+ converterContext: ConverterContext,
446
+ standardActionsContext: StandardActionsContext
447
+ ): Expression<boolean> {
448
+ const isDeleteHidden = standardActionsContext.hiddenAnnotation.delete;
449
+ const pathDeletableExpression = standardActionsContext.restrictions.isDeletable.expression;
450
+
451
+ //Delete Button is visible:
452
+ // Prerequisites:
453
+ // - If we're not on multiple visualizations configuration or ALP
454
+ //
455
+ // - If restrictions on deletable set to false -> not visible
456
+ // - Otherwise
457
+ // - If UI.DeleteHidden is true -> not visible
458
+ // - Otherwise
459
+ // - If we're on OP -> depending of the editMode and restrictions on deletable
460
+ // - Otherwise
461
+ // - If UI.DeleteHidden points to a property path -> provide a negated binding to this path
462
+ // - Otherwise, delete is visible
463
+
464
+ return ifElse(
465
+ or(standardActionsContext.isViewWithMultipleVisualizations, converterContext.getTemplateType() === TemplateType.AnalyticalListPage),
466
+ false,
467
+ ifElse(
468
+ and(isConstant(pathDeletableExpression), equal(pathDeletableExpression, false)),
469
+ false,
470
+ ifElse(
471
+ and(isConstant(isDeleteHidden), equal(isDeleteHidden, constant(true))),
472
+ false,
473
+ ifElse(
474
+ converterContext.getTemplateType() !== TemplateType.ListReport,
475
+ and(not(isDeleteHidden), equal(bindingExpression("/editMode", "ui"), "Editable")),
476
+ not(and(isBinding(isDeleteHidden), isDeleteHidden))
477
+ )
478
+ )
479
+ )
480
+ );
481
+ }
482
+
483
+ /**
484
+ * Gets the binding expression for the property visible of the action Paste.
485
+ *
486
+ * @param {ConverterContext} converterContext
487
+ * @param {StandardActionsContext} standardActionsContext
488
+ * @param {Expression<boolean>} createVisibility
489
+ * @param {boolean} isInsertUpdateActionsTemplated
490
+ * @returns {Expression<boolean> }
491
+ */
492
+ export function getPasteVisibility(
493
+ converterContext: ConverterContext,
494
+ standardActionsContext: StandardActionsContext,
495
+ createVisibility: Expression<boolean>,
496
+ isInsertUpdateActionsTemplated: boolean
497
+ ): Expression<boolean> {
498
+ // If Create is visible, enablePaste is not disabled into manifest and we are on OP/blocks outside Fiori elements templates
499
+ // Then button will be visible according to insertable restrictions and create visibility
500
+ // Otherwise it's not visible
501
+ return and(
502
+ notEqual(standardActionsContext.tableManifestConfiguration.enablePaste, false),
503
+ createVisibility,
504
+ isInsertUpdateActionsTemplated,
505
+ [TemplateType.ListReport, TemplateType.AnalyticalListPage].indexOf(converterContext.getTemplateType()) === -1,
506
+ standardActionsContext.restrictions.isInsertable.expression
507
+ );
508
+ }
509
+
510
+ /**
511
+ * Gets the binding expression for the property visible of the action MassEdit.
512
+ *
513
+ * @param {ConverterContext} converterContext
514
+ * @param {StandardActionsContext} standardActionsContext
515
+ * @returns {Expression<boolean> }
516
+ */
517
+ export function getMassEditVisibility(
518
+ converterContext: ConverterContext,
519
+ standardActionsContext: StandardActionsContext
520
+ ): Expression<boolean> {
521
+ const isUpdateHidden = standardActionsContext.hiddenAnnotation.update,
522
+ pathUpdatableExpression = standardActionsContext.restrictions.isUpdatable.expression,
523
+ bMassEditEnabledInManifest: boolean = standardActionsContext.tableManifestConfiguration?.enableMassEdit || false;
524
+ const templateBindingExpression =
525
+ converterContext.getTemplateType() === TemplateType.ObjectPage
526
+ ? equal(UI.IsEditable, true)
527
+ : converterContext.getTemplateType() === TemplateType.ListReport;
528
+ //MassEdit is visible
529
+ // If
530
+ // - there is no static restrictions set to false
531
+ // - and enableMassEdit is not set to false into the manifest
532
+ // - and the selectionMode is relevant
533
+ // Then MassEdit is always visible in LR or dynamically visible in OP according to ui>Editable and hiddenAnnotation
534
+ // Button is hidden for all other cases
535
+ return and(
536
+ not(and(isConstant(pathUpdatableExpression), equal(pathUpdatableExpression, false))),
537
+ bMassEditEnabledInManifest,
538
+ templateBindingExpression,
539
+ not(isUpdateHidden)
540
+ );
541
+ }
542
+
543
+ /**
544
+ * Gets the binding expression for the property enabled of the creationRow.
545
+ *
546
+ * @param {ConverterContext} converterContext
547
+ * @param {StandardActionsContext} standardActionsContext
548
+ * @param {Expression<boolean>} creationRowVisibility
549
+ * @returns {Expression<boolean> }
550
+ */
551
+ export function getCreationRowEnablement(
552
+ converterContext: ConverterContext,
553
+ standardActionsContext: StandardActionsContext,
554
+ creationRowVisibility: Expression<boolean>
555
+ ): Expression<boolean> {
556
+ const restrictionsInsertable = isPathInsertable(converterContext.getDataModelObjectPath(), {
557
+ ignoreTargetCollection: true,
558
+ authorizeUnresolvable: true,
559
+ pathVisitor: (path: string, navigationPaths: string[]) => {
560
+ if (path.indexOf("/") === 0) {
561
+ path = singletonPathVisitor(path, converterContext.getConvertedTypes(), navigationPaths);
562
+ return path;
563
+ }
564
+ const navigationProperties = converterContext.getDataModelObjectPath().navigationProperties;
565
+ if (navigationProperties) {
566
+ const partner = navigationProperties[navigationProperties.length - 1].partner;
567
+ if (partner) {
568
+ path = `${partner}/${path}`;
569
+ }
570
+ }
571
+ return path;
572
+ }
573
+ });
574
+ const isInsertable =
575
+ restrictionsInsertable._type === "Unresolvable"
576
+ ? isPathInsertable(converterContext.getDataModelObjectPath(), {
577
+ pathVisitor: (path: string) => singletonPathVisitor(path, converterContext.getConvertedTypes(), [])
578
+ })
579
+ : restrictionsInsertable;
580
+
581
+ return and(
582
+ creationRowVisibility,
583
+ isInsertable,
584
+ or(
585
+ !standardActionsContext.tableManifestConfiguration.disableAddRowButtonForEmptyData,
586
+ formatResult([bindingExpression("creationRowFieldValidity", "internal")], tableFormatters.validateCreationRowFields)
587
+ )
588
+ );
589
+ }
590
+
591
+ /**
592
+ * Gets the binding expression for the property enabled of the action Create.
593
+ *
594
+ * @param {ConverterContext} converterContext
595
+ * @param {StandardActionsContext} standardActionsContext
596
+ * @param {Expression<boolean>} createVisibility
597
+ * @returns {Expression<boolean> }
598
+ */
599
+ export function getCreateEnablement(
600
+ converterContext: ConverterContext,
601
+ standardActionsContext: StandardActionsContext,
602
+ createVisibility: Expression<boolean>
603
+ ): Expression<boolean> {
604
+ const isInsertable = standardActionsContext.restrictions.isInsertable.expression;
605
+ const CollectionType = converterContext.resolveAbsolutePath<any>(standardActionsContext.collectionPath).target?._type;
606
+ return and(
607
+ createVisibility,
608
+ or(
609
+ CollectionType === "EntitySet",
610
+ and(
611
+ isInsertable,
612
+ or(converterContext.getTemplateType() !== TemplateType.ObjectPage, equal(bindingExpression("/editMode", "ui"), "Editable"))
613
+ )
614
+ )
615
+ );
616
+ }
617
+
618
+ /**
619
+ * Gets the binding expression for the property enabled of the action Delete.
620
+ *
621
+ * @param {ConverterContext} converterContext
622
+ * @param {StandardActionsContext} standardActionsContext
623
+ * @param {Expression<boolean>} deleteVisibility
624
+ * @returns {Expression<boolean> }
625
+ */
626
+ export function getDeleteEnablement(
627
+ converterContext: ConverterContext,
628
+ standardActionsContext: StandardActionsContext,
629
+ deleteVisibility: Expression<boolean>
630
+ ): Expression<boolean> {
631
+ const isDeletable = standardActionsContext.restrictions.isDeletable.expression;
632
+ const isOnlyDynamicOnCurrentEntity =
633
+ !isConstant(isDeletable) && standardActionsContext.restrictions.isDeletable.navigationExpression._type === "Unresolvable";
634
+ const numberOfSelectedContexts = bindingExpression("numberOfSelectedContexts", "internal");
635
+ const numberOfDeletableContexts = bindingExpression("deletableContexts", "internal");
636
+ const numberOfUnSavedContexts = bindingExpression("unSavedContexts", "internal");
637
+
638
+ return and(
639
+ deleteVisibility,
640
+ ifElse(
641
+ or(converterContext.getTemplateType() !== TemplateType.ObjectPage, isOnlyDynamicOnCurrentEntity),
642
+ and(
643
+ or(
644
+ and(notEqual(numberOfDeletableContexts, undefined), greaterThan(length(numberOfDeletableContexts), 0)),
645
+ and(notEqual(numberOfUnSavedContexts, undefined), greaterThan(length(numberOfUnSavedContexts), 0))
646
+ ),
647
+ bindingExpression("deleteEnabled", "internal")
648
+ ),
649
+ and(notEqual(numberOfSelectedContexts, 0), isDeletable)
650
+ )
651
+ );
652
+ }
653
+
654
+ /**
655
+ * Gets the binding expression for the property enabled of the action Paste.
656
+ *
657
+ * @param {Expression<boolean>} pasteVisibility
658
+ * @param {Expression<boolean>} createEnablement
659
+ * @returns {Expression<boolean> }
660
+ */
661
+ export function getPasteEnablement(pasteVisibility: Expression<boolean>, createEnablement: Expression<boolean>): Expression<boolean> {
662
+ return and(pasteVisibility, createEnablement);
663
+ }
664
+
665
+ /**
666
+ * Gets the binding expression for the property enabled of the action MassEdit.
667
+ *
668
+ * @param {ConverterContext} converterContext
669
+ * @param {StandardActionsContext} standardActionsContext
670
+ * @param {Expression<boolean>} massEditVisibility
671
+ * @returns {Expression<boolean> }
672
+ */
673
+ export function getMassEditEnablement(
674
+ converterContext: ConverterContext,
675
+ standardActionsContext: StandardActionsContext,
676
+ massEditVisibility: Expression<boolean>
677
+ ): Expression<boolean> {
678
+ const pathUpdatableExpression = standardActionsContext.restrictions.isUpdatable.expression;
679
+ const isOnlyDynamicOnCurrentEntity: any =
680
+ !isConstant(pathUpdatableExpression) &&
681
+ standardActionsContext.restrictions.isUpdatable.navigationExpression._type === "Unresolvable";
682
+ const numberOfSelectedContexts = greaterOrEqual(bindingExpression("numberOfSelectedContexts", "internal"), 1);
683
+ const numberOfUpdatableContexts = greaterOrEqual(length(bindingExpression("updatableContexts", "internal")), 1);
684
+ const bIsDraftSupported = isDraftSupported(converterContext);
685
+ const bDisplayMode = isInDisplayMode(converterContext);
686
+
687
+ // numberOfUpdatableContexts needs to be added to the binding in case
688
+ // 1. Update is dependent on current entity property (isOnlyDynamicOnCurrentEntity is true).
689
+ // 2. The table is read only and draft enabled(like LR), in this case only active contexts can be mass edited.
690
+ // So, update depends on 'IsActiveEntity' value which needs to be checked runtime.
691
+ const runtimeBinding = ifElse(
692
+ or(and(bDisplayMode, bIsDraftSupported), isOnlyDynamicOnCurrentEntity),
693
+ and(numberOfSelectedContexts, numberOfUpdatableContexts),
694
+ and(numberOfSelectedContexts)
695
+ );
696
+
697
+ return and(massEditVisibility, ifElse(isOnlyDynamicOnCurrentEntity, runtimeBinding, and(runtimeBinding, pathUpdatableExpression)));
698
+ }
699
+
700
+ /**
701
+ * Tells if the table in template is in display mode.
702
+ *
703
+ * @param {ConverterContext} converterContext
704
+ * @param {ViewPathConfiguration} viewConfiguration
705
+ * @returns {boolean}
706
+ */
707
+ export function isInDisplayMode(converterContext: ConverterContext, viewConfiguration?: ViewPathConfiguration): boolean {
708
+ const templateType = converterContext.getTemplateType();
709
+ if (
710
+ templateType === TemplateType.ListReport ||
711
+ templateType === TemplateType.AnalyticalListPage ||
712
+ (viewConfiguration && converterContext.getManifestWrapper().hasMultipleVisualizations(viewConfiguration))
713
+ ) {
714
+ return true;
715
+ }
716
+ // updatable will be handled at the property level
717
+ return false;
718
+ }