@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,12 +1,29 @@
1
1
  import Log from "sap/base/Log";
2
2
  import CommonUtils from "sap/fe/core/CommonUtils";
3
- import { BindingExpression, ExpressionOrPrimitive } from "sap/fe/core/helpers/BindingExpression";
3
+ import {
4
+ BindingToolkitExpression,
5
+ CompiledBindingToolkitExpression,
6
+ compileExpression,
7
+ constant,
8
+ ifElse,
9
+ not,
10
+ or,
11
+ pathInModel
12
+ } from "sap/fe/core/helpers/BindingToolkit";
4
13
  import FELibrary from "sap/fe/core/library";
5
- import PageController from "sap/fe/core/PageController";
6
- import { DataModelObjectPath, enhanceDataModelPath } from "sap/fe/core/templating/DataModelPathHelper";
7
- import { hasValueHelpWithFixedValues } from "sap/fe/core/templating/PropertyHelper";
14
+ import type PageController from "sap/fe/core/PageController";
15
+ import type { DataModelObjectPath } from "sap/fe/core/templating/DataModelPathHelper";
16
+ import { enhanceDataModelPath } from "sap/fe/core/templating/DataModelPathHelper";
17
+ import {
18
+ getAssociatedUnitProperty,
19
+ getAssociatedUnitPropertyPath,
20
+ hasCurrency,
21
+ hasUnit,
22
+ hasValueHelp,
23
+ hasValueHelpWithFixedValues
24
+ } from "sap/fe/core/templating/PropertyHelper";
8
25
  import { getTextBinding, setEditStyleProperties } from "sap/fe/macros/field/FieldTemplating";
9
- import { FieldProperties } from "sap/fe/macros/internal/Field.metadata";
26
+ import type { FieldProperties } from "sap/fe/macros/internal/Field.metadata";
10
27
  import Button from "sap/m/Button";
11
28
  import Dialog from "sap/m/Dialog";
12
29
  import MessageToast from "sap/m/MessageToast";
@@ -15,16 +32,17 @@ import Fragment from "sap/ui/core/Fragment";
15
32
  import XMLPreprocessor from "sap/ui/core/util/XMLPreprocessor";
16
33
  import XMLTemplateProcessor from "sap/ui/core/XMLTemplateProcessor";
17
34
  import EditMode from "sap/ui/mdc/enum/EditMode";
18
- import Table from "sap/ui/mdc/Table";
35
+ import type Table from "sap/ui/mdc/Table";
19
36
  import JSONModel from "sap/ui/model/json/JSONModel";
20
- import Context from "sap/ui/model/odata/v4/Context";
21
- import ODataListBinding from "sap/ui/model/odata/v4/ODataListBinding";
22
- import { CoreEx } from "types/extension_types";
23
- import Any, { AnyType } from "../controls/Any";
37
+ import type Context from "sap/ui/model/odata/v4/Context";
38
+ import type ODataListBinding from "sap/ui/model/odata/v4/ODataListBinding";
39
+ import type { CoreEx } from "types/extension_types";
40
+ import type { AnyType } from "../controls/Any";
41
+ import Any from "../controls/Any";
24
42
  import { convertMetaModelContext, getInvolvedDataModelObjects } from "../converters/MetaModelConverter";
25
43
  import { isReadOnlyExpression } from "../templating/FieldControlHelper";
26
44
  import { getEditMode, getRequiredExpression, isCollectionField } from "../templating/UIFormatters";
27
- import { InternalModelContext } from "./ModelHelper";
45
+ import type { InternalModelContext } from "./ModelHelper";
28
46
 
29
47
  /* This class contains helpers to be used for mass edit functionality */
30
48
  type TextArrangementInfo = {
@@ -47,9 +65,9 @@ const MassEditHelper = {
47
65
  * Initializes the value at final or deepest level path with a blank array.
48
66
  * Return an empty array pointing to the final or deepest level path.
49
67
  *
50
- * @param {string} sPath Property path
51
- * @param {Array} aValues Array instance where the default data needs to be added
52
- * @returns {Array}
68
+ * @param sPath Property path
69
+ * @param aValues Array instance where the default data needs to be added
70
+ * @returns The final path
53
71
  */
54
72
  initLastLevelOfPropertyPath: function (sPath: string, aValues: any /*, transCtx: Context */) {
55
73
  let aFinalPath: any;
@@ -63,7 +81,7 @@ const MassEditHelper = {
63
81
  sFullPath = sFullPath + sPropertyPath;
64
82
  index++;
65
83
  } else if (!aFinalPath[sPropertyPath]) {
66
- sFullPath = sFullPath + "/" + sPropertyPath;
84
+ sFullPath = `${sFullPath}/${sPropertyPath}`;
67
85
  if (sFullPath !== sPath) {
68
86
  aFinalPath[sPropertyPath] = {};
69
87
  aFinalPath = aFinalPath[sPropertyPath];
@@ -78,10 +96,10 @@ const MassEditHelper = {
78
96
  /**
79
97
  * Method to get unique values for given array values.
80
98
  *
81
- * @param {string} sValue Property value
82
- * @param {number} index Index of the property value
83
- * @param {Array} self Instance of the array
84
- * @returns {boolean}
99
+ * @param sValue Property value
100
+ * @param index Index of the property value
101
+ * @param self Instance of the array
102
+ * @returns The unique value
85
103
  */
86
104
  getUniqueValues: function (sValue: string, index: number, self: any[]) {
87
105
  if (sValue != undefined && sValue != null) {
@@ -93,9 +111,9 @@ const MassEditHelper = {
93
111
  * Gets the property value for a multi-level path (for example: _Materials/Material_Details gets the value of Material_Details under _Materials Object).
94
112
  * Returns the propertyValue, which can be of any type (string, number, etc..).
95
113
  *
96
- * @param {string} sDataPropertyPath Property path
97
- * @param {object} oValues Object of property values
98
- * @returns {*}
114
+ * @param sDataPropertyPath Property path
115
+ * @param oValues Object of property values
116
+ * @returns The property value
99
117
  */
100
118
  getValueForMultiLevelPath: function (sDataPropertyPath: string, oValues: any) {
101
119
  if (sDataPropertyPath && sDataPropertyPath.indexOf("/") > 0) {
@@ -115,9 +133,9 @@ const MassEditHelper = {
115
133
  * => If propertyValue for all selected contexts is empty, then < Leave Blank > is preselected.
116
134
  *
117
135
  *
118
- * @param {Array} aContexts Contexts for mass edit
119
- * @param {string} sDataPropertyPath Data property path
120
- * @returns {string}
136
+ * @param aContexts Contexts for mass edit
137
+ * @param sDataPropertyPath Data property path
138
+ * @returns The key path
121
139
  */
122
140
  getDefaultSelectionPathComboBox: function (aContexts: any[], sDataPropertyPath: string) {
123
141
  if (sDataPropertyPath && aContexts.length > 0) {
@@ -133,11 +151,11 @@ const MassEditHelper = {
133
151
  });
134
152
  const aUniquePropertyValues = aPropertyValues.filter(MassEditHelper.getUniqueValues);
135
153
  if (aUniquePropertyValues.length > 1) {
136
- return "Default/" + sDataPropertyPath;
154
+ return `Default/${sDataPropertyPath}`;
137
155
  } else if (aUniquePropertyValues.length === 0) {
138
- return "Empty/" + sDataPropertyPath;
156
+ return `Empty/${sDataPropertyPath}`;
139
157
  } else if (aUniquePropertyValues.length === 1) {
140
- return sDataPropertyPath + "/" + aUniquePropertyValues[0];
158
+ return `${sDataPropertyPath}/${aUniquePropertyValues[0]}`;
141
159
  }
142
160
  }
143
161
  },
@@ -145,9 +163,9 @@ const MassEditHelper = {
145
163
  /**
146
164
  * Checks hidden annotation value [both static and path based] for table's selected context.
147
165
  *
148
- * @param {*} hiddenValue Hidden annotation value / path for field
149
- * @param {Array} aContexts Contexts for mass edit
150
- * @returns {boolean}
166
+ * @param hiddenValue Hidden annotation value / path for field
167
+ * @param aContexts Contexts for mass edit
168
+ * @returns The hidden annotation value
151
169
  */
152
170
  getHiddenValueForContexts: function (hiddenValue: any, aContexts: any[]) {
153
171
  if (hiddenValue && hiddenValue.$Path) {
@@ -187,10 +205,10 @@ const MassEditHelper = {
187
205
  /**
188
206
  * Get text path for the mass edit field.
189
207
  *
190
- * @param {string} property Property path
191
- * @param {any} textBinding Text Binding Info
192
- * @param {string} displayMode Display mode
193
- * @returns {string | undefined} Text Property Path if it exists
208
+ * @param property Property path
209
+ * @param textBinding Text Binding Info
210
+ * @param displayMode Display mode
211
+ * @returns Text Property Path if it exists
194
212
  */
195
213
  getTextPath: function (property: string, textBinding: any, displayMode: string): string | undefined {
196
214
  let descriptionPath;
@@ -211,16 +229,16 @@ const MassEditHelper = {
211
229
  /**
212
230
  * Initializes a JSON Model for properties of dialog fields [label, visiblity, dataproperty, etc.].
213
231
  *
214
- * @param {object} oTable Instance of Table
215
- * @param {Array} aContexts Contexts for mass edit
216
- * @param {Array} aDataArray Array containing data related to the dialog used by both the static and the runtime model
217
- * @returns {object}
232
+ * @param oTable Instance of Table
233
+ * @param aContexts Contexts for mass edit
234
+ * @param aDataArray Array containing data related to the dialog used by both the static and the runtime model
235
+ * @returns The model
218
236
  */
219
237
  prepareDataForDialog: function (oTable: Table, aContexts: any[], aDataArray: any[]) {
220
238
  const oMetaModel = oTable && (oTable.getModel().getMetaModel() as any),
221
239
  sCurrentEntitySetName = oTable.data("metaPath"),
222
240
  aTableFields = MassEditHelper.getTableFields(oTable),
223
- oEntityTypeContext = oMetaModel.getContext(sCurrentEntitySetName + "/@"),
241
+ oEntityTypeContext = oMetaModel.getContext(`${sCurrentEntitySetName}/@`),
224
242
  oEntitySetContext = oMetaModel.getContext(sCurrentEntitySetName),
225
243
  oDataModelObjectPath = getInvolvedDataModelObjects(oEntityTypeContext);
226
244
 
@@ -235,28 +253,12 @@ const MassEditHelper = {
235
253
  aTableFields.forEach(function (oColumnInfo: any) {
236
254
  const sDataPropertyPath = oColumnInfo.dataProperty;
237
255
  if (sDataPropertyPath) {
238
- let oPropertyInfo = sDataPropertyPath && oMetaModel.getObject(sCurrentEntitySetName + "/" + sDataPropertyPath + "@");
239
- bValueHelpEnabled =
240
- sDataPropertyPath &&
241
- oMetaModel.getObject(sCurrentEntitySetName + "/" + sDataPropertyPath + "@") &&
242
- oMetaModel.getObject(sCurrentEntitySetName + "/" + sDataPropertyPath + "@")[
243
- "@com.sap.vocabularies.Common.v1.ValueList"
244
- ];
245
- sUnitPropertyPath =
246
- (oPropertyInfo && oPropertyInfo["@Org.OData.Measures.V1.Unit"] && oPropertyInfo["@Org.OData.Measures.V1.Unit"].$Path) ||
247
- (oPropertyInfo &&
248
- oPropertyInfo["@Org.OData.Measures.V1.ISOCurrency"] &&
249
- oPropertyInfo["@Org.OData.Measures.V1.ISOCurrency"].$Path);
256
+ let oPropertyInfo = sDataPropertyPath && oMetaModel.getObject(`${sCurrentEntitySetName}/${sDataPropertyPath}@`);
250
257
  sLabelText =
251
258
  oColumnInfo.label ||
252
259
  (oPropertyInfo && oPropertyInfo["@com.sap.vocabularies.Common.v1.Label"]) ||
253
260
  oColumnInfo.dataProperty;
254
- bValueHelpEnabledForUnit =
255
- sUnitPropertyPath &&
256
- oMetaModel.getObject(sCurrentEntitySetName + "/" + sUnitPropertyPath + "@") &&
257
- oMetaModel.getObject(sCurrentEntitySetName + "/" + sUnitPropertyPath + "@")[
258
- "@com.sap.vocabularies.Common.v1.ValueList"
259
- ];
261
+
260
262
  if (oDataModelObjectPath) {
261
263
  oDataModelObjectPath.targetObject = oDataModelObjectPath.targetEntityType.entityProperties.filter(function (
262
264
  oProperty: any
@@ -268,7 +270,7 @@ const MassEditHelper = {
268
270
  oTextBinding = getTextBinding(oDataModelObjectPath, {}, true) || {};
269
271
  const oFieldContext = oMetaModel.getContext(oColumnInfo.annotationPath),
270
272
  oDataFieldConverted = convertMetaModelContext(oFieldContext),
271
- oPropertyContext = oMetaModel.getContext(sCurrentEntitySetName + "/" + sDataPropertyPath + "@"),
273
+ oPropertyContext = oMetaModel.getContext(`${sCurrentEntitySetName}/${sDataPropertyPath}@`),
272
274
  oInterface = oPropertyContext && oPropertyContext.getInterface();
273
275
 
274
276
  let oDataModelPath = getInvolvedDataModelObjects(oFieldContext, oEntitySetContext);
@@ -287,7 +289,7 @@ const MassEditHelper = {
287
289
  return oInterface.getModel();
288
290
  },
289
291
  getPath: function () {
290
- return sCurrentEntitySetName + "/" + sDataPropertyPath;
292
+ return `${sCurrentEntitySetName}/${sDataPropertyPath}`;
291
293
  }
292
294
  };
293
295
  oPropertyInfo =
@@ -305,9 +307,16 @@ const MassEditHelper = {
305
307
  return;
306
308
  }
307
309
 
310
+ // ValueHelp properties
311
+ bValueHelpEnabled = hasValueHelp(oPropertyInfo);
312
+ sUnitPropertyPath =
313
+ ((hasCurrency(oPropertyInfo) || hasUnit(oPropertyInfo)) && getAssociatedUnitPropertyPath(oPropertyInfo)) || "";
314
+ const unitPropertyInfo = sUnitPropertyPath && getAssociatedUnitProperty(oPropertyInfo);
315
+ bValueHelpEnabledForUnit = unitPropertyInfo && hasValueHelp(unitPropertyInfo);
316
+
308
317
  // EditMode and InputType
309
318
  const propertyForFieldControl = oPropertyInfo && oPropertyInfo.Value ? oPropertyInfo.Value : oPropertyInfo;
310
- const expBinding = getEditMode(propertyForFieldControl, oDataModelPath, false, false, oDataFieldConverted, true);
319
+ const expBinding = getEditMode(propertyForFieldControl, oDataModelPath, false, false, oDataFieldConverted, constant(true));
311
320
  const editModeValues = Object.keys(EditMode);
312
321
  const editModeIsStatic = !!expBinding && editModeValues.includes(expBinding as EditMode);
313
322
  const editable = !!expBinding && ((editModeIsStatic && expBinding === EditMode.Editable) || !editModeIsStatic);
@@ -325,10 +334,11 @@ const MassEditHelper = {
325
334
  "label": sLabelText,
326
335
  "dataProperty": sDataPropertyPath,
327
336
  "isValueHelpEnabled": bValueHelpEnabled ? bValueHelpEnabled : false,
328
- "unitProperty": sUnitPropertyPath ? sUnitPropertyPath : false,
329
- "isValueHelpEnabledForUnit": bValueHelpEnabledForUnit ? bValueHelpEnabledForUnit : false,
330
- "propertyPathForValueHelp": sCurrentEntitySetName + "/" + sDataPropertyPath,
331
- "propertyPathForValueHelpUnit": sCurrentEntitySetName + "/" + sUnitPropertyPath,
337
+ "unitProperty": sUnitPropertyPath && !sDataPropertyPath.includes("/") ? sUnitPropertyPath : false,
338
+ "isValueHelpEnabledForUnit":
339
+ bValueHelpEnabledForUnit && !sUnitPropertyPath.includes("/") ? bValueHelpEnabledForUnit : false,
340
+ "propertyPathForValueHelp": `${sCurrentEntitySetName}/${sDataPropertyPath}`,
341
+ "propertyPathForValueHelpUnit": sUnitPropertyPath && `${sCurrentEntitySetName}/${sUnitPropertyPath}`,
332
342
  "isFieldRequired": getRequiredExpression(oPropertyInfo, oDataFieldConverted, true),
333
343
  "defaultSelectionPath": sDataPropertyPath
334
344
  ? MassEditHelper.getDefaultSelectionPathComboBox(aContexts, sDataPropertyPath)
@@ -385,53 +395,55 @@ const MassEditHelper = {
385
395
  ? oResourceBundle.getText("C_MASS_EDIT_SAVE_BUTTON_TEXT")
386
396
  : oResourceBundle.getText("C_MASS_EDIT_APPLY_BUTTON_TEXT"),
387
397
  "useValueHelpValue": "< Use Value Help >",
388
- "cancelButtonText": oResourceBundle.getText("C_MASS_EDIT_CANCEL_BUTTON_TEXT")
398
+ "cancelButtonText": oResourceBundle.getText("C_MASS_EDIT_CANCEL_BUTTON_TEXT"),
399
+ "noFields": oResourceBundle.getText("C_MASS_EDIT_NO_EDITABLE_FIELDS"),
400
+ "okButtonText": oResourceBundle.getText("C_COMMON_DIALOG_OK")
389
401
  };
390
402
  },
391
403
 
392
404
  /**
393
405
  * Adds a suffix to the 'keep existing' property of the comboBox.
394
406
  *
395
- * @param {string} sInputType InputType of the field
396
- * @returns {string}
407
+ * @param sInputType InputType of the field
408
+ * @returns The modified string
397
409
  */
398
- getSuffixForKeepExisiting: function (sInputType: string) {
399
- let sResult = "Values";
410
+ // getSuffixForKeepExisiting: function (sInputType: string) {
411
+ // let sResult = "Values";
400
412
 
401
- switch (sInputType) {
402
- //TODO - Add for other control types as well (Radio Button, Email, Input, MDC Fields, Image etc.)
403
- case "DatePicker":
404
- sResult = "Dates";
405
- break;
406
- case "CheckBox":
407
- sResult = "Settings";
408
- break;
409
- default:
410
- sResult = "Values";
411
- }
412
- return sResult;
413
- },
413
+ // switch (sInputType) {
414
+ // //TODO - Add for other control types as well (Radio Button, Email, Input, MDC Fields, Image etc.)
415
+ // case "DatePicker":
416
+ // sResult = "Dates";
417
+ // break;
418
+ // case "CheckBox":
419
+ // sResult = "Settings";
420
+ // break;
421
+ // default:
422
+ // sResult = "Values";
423
+ // }
424
+ // return sResult;
425
+ // },
414
426
 
415
427
  /**
416
428
  * Adds default values to the model [Keep Existing Values, Leave Blank].
417
429
  *
418
- * @param {Array} aValues Array instance where the default data needs to be added
419
- * @param {Array} aContexts Contexts for mass edit
420
- * @param {object} oDefaultValues Default values from Application Manifest
421
- * @param {object} oPropertyInfo Property information
422
- * @param {boolean} bUOMField
430
+ * @param aValues Array instance where the default data needs to be added
431
+ * @param oDefaultValues Default values from Application Manifest
432
+ * @param oPropertyInfo Property information
433
+ * @param bUOMField
423
434
  */
424
- setDefaultValuesToDialog: function (aValues: any, aContexts: any[], oDefaultValues: any, oPropertyInfo: any, bUOMField?: boolean) {
435
+ setDefaultValuesToDialog: function (aValues: any, oDefaultValues: any, oPropertyInfo: any, bUOMField?: boolean) {
425
436
  const sPropertyPath = bUOMField ? oPropertyInfo.unitProperty : oPropertyInfo.dataProperty,
426
437
  sInputType = oPropertyInfo.inputType,
427
438
  bPropertyRequired = oPropertyInfo.isFieldRequired;
428
- const sSuffixForKeepExisting = MassEditHelper.getSuffixForKeepExisiting(sInputType);
439
+ // const sSuffixForKeepExisting = MassEditHelper.getSuffixForKeepExisiting(sInputType);
440
+ const sSuffixForKeepExisting = "Values";
429
441
  aValues.defaultOptions = aValues.defaultOptions || [];
430
- //TODO - Add <<Use Value Help or control implmentation>> and related key by checking if value help is enabled for property or Unit.
431
- //TODO - Add option Apply to Empty Fields only for Both Value Help and controls.
432
- const bValueExistsForPropertyPath = aContexts.some(function (oSelectedContext: any) {
433
- return oSelectedContext.getObject(sPropertyPath);
434
- });
442
+ const selectOptionsExist = aValues.selectOptions && aValues.selectOptions.length > 0;
443
+ const keepEntry = {
444
+ text: `${oDefaultValues.keepExistingPrefix} ${sSuffixForKeepExisting} >`,
445
+ key: `Default/${sPropertyPath}`
446
+ };
435
447
 
436
448
  if (sInputType === "CheckBox") {
437
449
  const falseEntry = { text: "No", key: `${sPropertyPath}/false`, textInfo: { value: false } };
@@ -440,41 +452,38 @@ const MassEditHelper = {
440
452
  aValues.defaultOptions.unshift(falseEntry);
441
453
  aValues.unshift(truthyEntry);
442
454
  aValues.defaultOptions.unshift(truthyEntry);
443
- }
444
-
445
- if (oPropertyInfo.isValueHelpEnabled || (oPropertyInfo.isValueHelpEnabledForUnit && bUOMField)) {
446
- const vhdEntry = { text: oDefaultValues.useValueHelpValue, key: "UseValueHelpValue/" + sPropertyPath };
447
- aValues.unshift(vhdEntry);
448
- aValues.defaultOptions.unshift(vhdEntry);
449
- }
450
-
451
- if (bValueExistsForPropertyPath) {
452
- if (bPropertyRequired !== "true" && !bUOMField) {
453
- const clearEntry = { text: oDefaultValues.clearFieldValue, key: "ClearFieldValue/" + sPropertyPath };
454
- aValues.unshift(clearEntry);
455
- aValues.defaultOptions.unshift(clearEntry);
456
- }
455
+ aValues.unshift(keepEntry);
456
+ aValues.defaultOptions.unshift(keepEntry);
457
457
  } else {
458
- const emptyEntry = { text: oDefaultValues.leaveBlankValue, key: "Empty/" + sPropertyPath };
459
- aValues.unshift(emptyEntry);
460
- aValues.defaultOptions.unshift(emptyEntry);
458
+ if (oPropertyInfo.isValueHelpEnabled || (oPropertyInfo.isValueHelpEnabledForUnit && bUOMField)) {
459
+ const vhdEntry = { text: oDefaultValues.useValueHelpValue, key: `UseValueHelpValue/${sPropertyPath}` };
460
+ aValues.unshift(vhdEntry);
461
+ aValues.defaultOptions.unshift(vhdEntry);
462
+ }
463
+ if (selectOptionsExist) {
464
+ if (bPropertyRequired !== "true" && !bUOMField) {
465
+ const clearEntry = { text: oDefaultValues.clearFieldValue, key: `ClearFieldValue/${sPropertyPath}` };
466
+ aValues.unshift(clearEntry);
467
+ aValues.defaultOptions.unshift(clearEntry);
468
+ }
469
+ aValues.unshift(keepEntry);
470
+ aValues.defaultOptions.unshift(keepEntry);
471
+ } else {
472
+ const emptyEntry = { text: oDefaultValues.leaveBlankValue, key: `Default/${sPropertyPath}` };
473
+ aValues.unshift(emptyEntry);
474
+ aValues.defaultOptions.unshift(emptyEntry);
475
+ }
461
476
  }
462
- const keepEntry = {
463
- text: oDefaultValues.keepExistingPrefix + " " + sSuffixForKeepExisting + " >",
464
- key: "Default/" + sPropertyPath
465
- };
466
- aValues.unshift(keepEntry);
467
- aValues.defaultOptions.unshift(keepEntry);
468
477
  },
469
478
 
470
479
  /**
471
480
  * Get text arrangement info for a context property.
472
481
  *
473
- * @param {string} property Property Path
474
- * @param {string} descriptionPath Path to text association of the property
475
- * @param {string} displayMode Display mode of the property and text association
476
- * @param {Context} selectedContext Context to find the full text
477
- * @returns {TextArrangementInfo}
482
+ * @param property Property Path
483
+ * @param descriptionPath Path to text association of the property
484
+ * @param displayMode Display mode of the property and text association
485
+ * @param selectedContext Context to find the full text
486
+ * @returns The text arrangement
478
487
  */
479
488
  getTextArrangementInfo: function (
480
489
  property: string,
@@ -488,25 +497,25 @@ const MassEditHelper = {
488
497
  if (descriptionPath && property) {
489
498
  switch (displayMode) {
490
499
  case "Description":
491
- descriptionValue = selectedContext.getObject(descriptionPath);
500
+ descriptionValue = selectedContext.getObject(descriptionPath) || "";
492
501
  fullText = descriptionValue;
493
502
  break;
494
503
  case "Value":
495
- value = selectedContext.getObject(property);
504
+ value = selectedContext.getObject(property) || "";
496
505
  fullText = value;
497
506
  break;
498
507
  case "ValueDescription":
499
- value = selectedContext.getObject(property);
500
- descriptionValue = selectedContext.getObject(descriptionPath);
501
- fullText = value + " (" + descriptionValue + ")";
508
+ value = selectedContext.getObject(property) || "";
509
+ descriptionValue = selectedContext.getObject(descriptionPath) || "";
510
+ fullText = descriptionValue ? `${value} (${descriptionValue})` : value;
502
511
  break;
503
512
  case "DescriptionValue":
504
- value = selectedContext.getObject(property);
505
- descriptionValue = selectedContext.getObject(descriptionPath);
506
- fullText = descriptionValue + " (" + value + ")";
513
+ value = selectedContext.getObject(property) || "";
514
+ descriptionValue = selectedContext.getObject(descriptionPath) || "";
515
+ fullText = descriptionValue ? `${descriptionValue} (${value})` : value;
507
516
  break;
508
517
  default:
509
- Log.info("Display Property not applicable: " + property);
518
+ Log.info(`Display Property not applicable: ${property}`);
510
519
  break;
511
520
  }
512
521
  }
@@ -524,8 +533,8 @@ const MassEditHelper = {
524
533
  /**
525
534
  * Return the visibility valuue for the ManagedObject Any.
526
535
  *
527
- * @param {AnyType} any The ManagedObject Any to be used to calculate the visible value of the binding.
528
- * @returns {boolean} Returns true if the mass edit field is editable.
536
+ * @param any The ManagedObject Any to be used to calculate the visible value of the binding.
537
+ * @returns Returns true if the mass edit field is editable.
529
538
  */
530
539
  isEditable: function (any: AnyType): boolean {
531
540
  const binding = any.getBinding("any");
@@ -536,25 +545,25 @@ const MassEditHelper = {
536
545
  /**
537
546
  * Calculate and update the visibility of mass edit field on change of the ManagedObject Any binding.
538
547
  *
539
- * @param {JSONModel} oDialogDataModel Model to be used runtime.
540
- * @param {string} dataProperty Field name.
548
+ * @param oDialogDataModel Model to be used runtime.
549
+ * @param dataProperty Field name.
541
550
  */
542
551
  onContextEditableChange: function (oDialogDataModel: JSONModel, dataProperty: string): void {
543
- const objectsForVisibility = oDialogDataModel.getProperty("/values/" + dataProperty + "/objectsForVisibility") || [];
552
+ const objectsForVisibility = oDialogDataModel.getProperty(`/values/${dataProperty}/objectsForVisibility`) || [];
544
553
  const editable = objectsForVisibility.some(MassEditHelper.isEditable);
545
554
 
546
555
  if (editable) {
547
- oDialogDataModel.setProperty("/values/" + dataProperty + "/visible", editable);
556
+ oDialogDataModel.setProperty(`/values/${dataProperty}/visible`, editable);
548
557
  }
549
558
  },
550
559
 
551
560
  /**
552
561
  * Update Managed Object Any for visibility of the mass edit fields.
553
562
  *
554
- * @param {AnyType} mOToUse The ManagedObject Any to be used to calculate the visible value of the binding.
555
- * @param {JSONModel} oDialogDataModel Model to be used runtime.
556
- * @param {string} dataProperty Field name.
557
- * @param {any} values Values of the field.
563
+ * @param mOToUse The ManagedObject Any to be used to calculate the visible value of the binding.
564
+ * @param oDialogDataModel Model to be used runtime.
565
+ * @param dataProperty Field name.
566
+ * @param values Values of the field.
558
567
  */
559
568
  updateOnContextChange: function (mOToUse: AnyType, oDialogDataModel: JSONModel, dataProperty: string, values: any) {
560
569
  const binding = mOToUse.getBinding("any");
@@ -568,11 +577,11 @@ const MassEditHelper = {
568
577
  /**
569
578
  * Get bound object to calculate the visibility of contexts.
570
579
  *
571
- * @param {BindingExpression<boolean> | ExpressionOrPrimitive<boolean>} expBinding Binding String object.
572
- * @param {object} context Context the binding value.
573
- * @returns {AnyType} The ManagedObject Any to be used to calculate the visible value of the binding.
580
+ * @param expBinding Binding String object.
581
+ * @param context Context the binding value.
582
+ * @returns The ManagedObject Any to be used to calculate the visible value of the binding.
574
583
  */
575
- getBoundObject: function (expBinding: BindingExpression<string> | ExpressionOrPrimitive<string>, context: Context): AnyType {
584
+ getBoundObject: function (expBinding: CompiledBindingToolkitExpression, context: Context): AnyType {
576
585
  const mOToUse = new Any({ any: expBinding });
577
586
  const model = context.getModel();
578
587
  mOToUse.setModel(model);
@@ -584,15 +593,15 @@ const MassEditHelper = {
584
593
  /**
585
594
  * Get the visibility of the field.
586
595
  *
587
- * @param {BindingExpression<boolean> | ExpressionOrPrimitive<boolean>} expBinding Binding String object.
588
- * @param {JSONModel} oDialogDataModel Model to be used runtime.
589
- * @param {string} dataProperty Field name.
590
- * @param {any} values Values of the field.
591
- * @param {object} context Context the binding value.
592
- * @returns {boolean} Returns true if the mass edit field is editable.
596
+ * @param expBinding Binding String object.
597
+ * @param oDialogDataModel Model to be used runtime.
598
+ * @param dataProperty Field name.
599
+ * @param values Values of the field.
600
+ * @param context Context the binding value.
601
+ * @returns Returns true if the mass edit field is editable.
593
602
  */
594
603
  getFieldVisiblity: function (
595
- expBinding: BindingExpression<string> | ExpressionOrPrimitive<string>,
604
+ expBinding: CompiledBindingToolkitExpression,
596
605
  oDialogDataModel: JSONModel,
597
606
  dataProperty: string,
598
607
  values: any,
@@ -612,11 +621,11 @@ const MassEditHelper = {
612
621
  * => The model consists of values shown in the comboBox of the dialog (Leave Blank, Keep Existing Values, or any property value for the selected context, etc.)
613
622
  * => The model will capture runtime changes in the results property (the value entered in the comboBox).
614
623
  *
615
- * @param {Array} aContexts Contexts for mass edit
616
- * @param {Array} aDataArray Array containing data related to the dialog used by both the static and the runtime model
617
- * @param {object} oDefaultValues Default values from i18n
618
- * @param {Context} dialogContext Transient context for mass edit dialog.
619
- * @returns {object}
624
+ * @param aContexts Contexts for mass edit
625
+ * @param aDataArray Array containing data related to the dialog used by both the static and the runtime model
626
+ * @param oDefaultValues Default values from i18n
627
+ * @param dialogContext Transient context for mass edit dialog.
628
+ * @returns The runtime model
620
629
  */
621
630
  setRuntimeModelOnDialog: function (aContexts: any[], aDataArray: any[], oDefaultValues: any, dialogContext: Context) {
622
631
  const aValues: any[] = [];
@@ -628,27 +637,28 @@ const MassEditHelper = {
628
637
  "unitData": aUnitData,
629
638
  "results": aResults,
630
639
  "readablePropertyData": aReadOnlyFieldInfo,
631
- "selectedKey": undefined
640
+ "selectedKey": undefined,
641
+ "noFields": oDefaultValues.noFields
632
642
  };
633
643
  const oDialogDataModel = new JSONModel(oData);
634
- aDataArray.forEach(function (oData: any) {
644
+ aDataArray.forEach(function (oInData: any) {
635
645
  let oTextInfo;
636
646
  let sPropertyKey;
637
647
  let sUnitPropertyName;
638
648
  const oDistinctValueMap: any = {};
639
649
  const oDistinctUnitMap: any = {};
640
- if (oData.dataProperty && oData.dataProperty.indexOf("/") > -1) {
641
- const aFinalPath = MassEditHelper.initLastLevelOfPropertyPath(oData.dataProperty, aValues /*, dialogContext */);
642
- const aPropertyPaths = oData.dataProperty.split("/");
650
+ if (oInData.dataProperty && oInData.dataProperty.indexOf("/") > -1) {
651
+ const aFinalPath = MassEditHelper.initLastLevelOfPropertyPath(oInData.dataProperty, aValues /*, dialogContext */);
652
+ const aPropertyPaths = oInData.dataProperty.split("/");
643
653
 
644
654
  for (const context of aContexts) {
645
- const sMultiLevelPathValue = context.getObject(oData.dataProperty);
646
- sPropertyKey = oData.dataProperty + "/" + sMultiLevelPathValue;
655
+ const sMultiLevelPathValue = context.getObject(oInData.dataProperty);
656
+ sPropertyKey = `${oInData.dataProperty}/${sMultiLevelPathValue}`;
647
657
  if (!oDistinctValueMap[sPropertyKey] && aFinalPath[aPropertyPaths[aPropertyPaths.length - 1]]) {
648
658
  oTextInfo = MassEditHelper.getTextArrangementInfo(
649
- oData.dataProperty,
650
- oData.descriptionPath,
651
- oData.display,
659
+ oInData.dataProperty,
660
+ oInData.descriptionPath,
661
+ oInData.display,
652
662
  context
653
663
  );
654
664
  aFinalPath[aPropertyPaths[aPropertyPaths.length - 1]].push({
@@ -664,157 +674,166 @@ const MassEditHelper = {
664
674
  // }
665
675
 
666
676
  aFinalPath[aPropertyPaths[aPropertyPaths.length - 1]].textInfo = {
667
- descriptionPath: oData.descriptionPath,
668
- valuePath: oData.dataProperty,
669
- displayMode: oData.display
677
+ descriptionPath: oInData.descriptionPath,
678
+ valuePath: oInData.dataProperty,
679
+ displayMode: oInData.display
670
680
  };
671
681
  } else {
672
- aValues[oData.dataProperty] = aValues[oData.dataProperty] || [];
673
- aValues[oData.dataProperty]["selectOptions"] = aValues[oData.dataProperty]["selectOptions"] || [];
674
- if (oData.unitProperty) {
675
- aUnitData[oData.unitProperty] = aUnitData[oData.unitProperty] || [];
676
- aUnitData[oData.unitProperty]["selectOptions"] = aUnitData[oData.unitProperty]["selectOptions"] || [];
682
+ aValues[oInData.dataProperty] = aValues[oInData.dataProperty] || [];
683
+ aValues[oInData.dataProperty]["selectOptions"] = aValues[oInData.dataProperty]["selectOptions"] || [];
684
+ if (oInData.unitProperty) {
685
+ aUnitData[oInData.unitProperty] = aUnitData[oInData.unitProperty] || [];
686
+ aUnitData[oInData.unitProperty]["selectOptions"] = aUnitData[oInData.unitProperty]["selectOptions"] || [];
677
687
  }
678
688
  for (const context of aContexts) {
679
689
  const oDataObject = context.getObject();
680
- sPropertyKey = oData.dataProperty + "/" + oDataObject[oData.dataProperty];
681
- if (oData.dataProperty && oDataObject[oData.dataProperty] && !oDistinctValueMap[sPropertyKey]) {
682
- if (oData.inputType != "CheckBox") {
690
+ sPropertyKey = `${oInData.dataProperty}/${oDataObject[oInData.dataProperty]}`;
691
+ if (oInData.dataProperty && oDataObject[oInData.dataProperty] && !oDistinctValueMap[sPropertyKey]) {
692
+ if (oInData.inputType != "CheckBox") {
683
693
  oTextInfo = MassEditHelper.getTextArrangementInfo(
684
- oData.dataProperty,
685
- oData.descriptionPath,
686
- oData.display,
694
+ oInData.dataProperty,
695
+ oInData.descriptionPath,
696
+ oInData.display,
687
697
  context
688
698
  );
689
699
  const entry = {
690
- "text": (oTextInfo && oTextInfo.fullText) || oDataObject[oData.dataProperty],
700
+ "text": (oTextInfo && oTextInfo.fullText) || oDataObject[oInData.dataProperty],
691
701
  "key": sPropertyKey,
692
702
  "textInfo": oTextInfo
693
703
  };
694
- aValues[oData.dataProperty].push(entry);
695
- aValues[oData.dataProperty]["selectOptions"].push(entry);
704
+ aValues[oInData.dataProperty].push(entry);
705
+ aValues[oInData.dataProperty]["selectOptions"].push(entry);
696
706
  }
697
- oDistinctValueMap[sPropertyKey] = oDataObject[oData.dataProperty];
707
+ oDistinctValueMap[sPropertyKey] = oDataObject[oInData.dataProperty];
698
708
  }
699
- if (oData.unitProperty && oDataObject[oData.unitProperty]) {
700
- sUnitPropertyName = oData.unitProperty + "/" + oDataObject[oData.unitProperty];
709
+ if (oInData.unitProperty && oDataObject[oInData.unitProperty]) {
710
+ sUnitPropertyName = `${oInData.unitProperty}/${oDataObject[oInData.unitProperty]}`;
701
711
  if (!oDistinctUnitMap[sUnitPropertyName]) {
702
- if (oData.inputType != "CheckBox") {
712
+ if (oInData.inputType != "CheckBox") {
703
713
  oTextInfo = MassEditHelper.getTextArrangementInfo(
704
- oData.unitProperty,
705
- oData.descriptionPath,
706
- oData.display,
714
+ oInData.unitProperty,
715
+ oInData.descriptionPath,
716
+ oInData.display,
707
717
  context
708
718
  );
709
719
  const unitEntry = {
710
- "text": (oTextInfo && oTextInfo.fullText) || oDataObject[oData.unitProperty],
720
+ "text": (oTextInfo && oTextInfo.fullText) || oDataObject[oInData.unitProperty],
711
721
  "key": sUnitPropertyName,
712
722
  "textInfo": oTextInfo
713
723
  };
714
- aUnitData[oData.unitProperty].push(unitEntry);
715
- aUnitData[oData.unitProperty]["selectOptions"].push(unitEntry);
724
+ aUnitData[oInData.unitProperty].push(unitEntry);
725
+ aUnitData[oInData.unitProperty]["selectOptions"].push(unitEntry);
716
726
  }
717
- oDistinctUnitMap[sUnitPropertyName] = oDataObject[oData.unitProperty];
727
+ oDistinctUnitMap[sUnitPropertyName] = oDataObject[oInData.unitProperty];
718
728
  }
719
729
  }
720
730
  }
721
- aValues[oData.dataProperty].textInfo = {
722
- descriptionPath: oData.descriptionPath,
723
- valuePath: oData.dataProperty,
724
- displayMode: oData.display
731
+ aValues[oInData.dataProperty].textInfo = {
732
+ descriptionPath: oInData.descriptionPath,
733
+ valuePath: oInData.dataProperty,
734
+ displayMode: oInData.display
725
735
  };
726
- }
727
- if (Object.keys(oDistinctValueMap).length === 1) {
728
- dialogContext.setProperty(oData.dataProperty, sPropertyKey && oDistinctValueMap[sPropertyKey]);
729
- }
730
- if (Object.keys(oDistinctUnitMap).length === 1) {
731
- dialogContext.setProperty(oData.unitProperty, sUnitPropertyName && oDistinctUnitMap[sUnitPropertyName]);
736
+ if (Object.keys(oDistinctValueMap).length === 1) {
737
+ dialogContext.setProperty(oInData.dataProperty, sPropertyKey && oDistinctValueMap[sPropertyKey]);
738
+ }
739
+ if (Object.keys(oDistinctUnitMap).length === 1) {
740
+ dialogContext.setProperty(oInData.unitProperty, sUnitPropertyName && oDistinctUnitMap[sUnitPropertyName]);
741
+ }
732
742
  }
733
743
  });
734
- aDataArray.forEach(function (oData: any) {
744
+ aDataArray.forEach(function (oInData: any) {
735
745
  let values: any = {};
736
- if (oData.dataProperty.indexOf("/") > -1) {
737
- const sMultiLevelPropPathValue = MassEditHelper.getValueForMultiLevelPath(oData.dataProperty, aValues);
746
+ if (oInData.dataProperty.indexOf("/") > -1) {
747
+ const sMultiLevelPropPathValue = MassEditHelper.getValueForMultiLevelPath(oInData.dataProperty, aValues);
738
748
  if (!sMultiLevelPropPathValue) {
739
- sMultiLevelPropPathValue.push({ text: oDefaultValues.leaveBlankValue, key: "Empty/" + oData.dataProperty });
749
+ sMultiLevelPropPathValue.push({ text: oDefaultValues.leaveBlankValue, key: `Empty/${oInData.dataProperty}` });
740
750
  } else {
741
- MassEditHelper.setDefaultValuesToDialog(sMultiLevelPropPathValue, aContexts, oDefaultValues, oData);
751
+ MassEditHelper.setDefaultValuesToDialog(sMultiLevelPropPathValue, oDefaultValues, oInData);
742
752
  }
743
753
  values = sMultiLevelPropPathValue;
744
- } else if (aValues[oData.dataProperty]) {
745
- aValues[oData.dataProperty] = aValues[oData.dataProperty] || [];
746
- MassEditHelper.setDefaultValuesToDialog(aValues[oData.dataProperty], aContexts, oDefaultValues, oData);
747
- values = aValues[oData.dataProperty];
754
+ } else if (aValues[oInData.dataProperty]) {
755
+ aValues[oInData.dataProperty] = aValues[oInData.dataProperty] || [];
756
+ MassEditHelper.setDefaultValuesToDialog(aValues[oInData.dataProperty], oDefaultValues, oInData);
757
+ values = aValues[oInData.dataProperty];
748
758
  }
749
759
 
750
- if (aUnitData[oData.unitProperty] && aUnitData[oData.unitProperty].length) {
751
- MassEditHelper.setDefaultValuesToDialog(aUnitData[oData.unitProperty], aContexts, oDefaultValues, oData, true);
752
- aUnitData[oData.unitProperty].textInfo = {};
753
- aUnitData[oData.unitProperty].selectedKey = MassEditHelper.getDefaultSelectionPathComboBox(aContexts, oData.unitProperty);
754
- aUnitData[oData.unitProperty].inputType = oData.inputType;
760
+ if (aUnitData[oInData.unitProperty] && aUnitData[oInData.unitProperty].length) {
761
+ MassEditHelper.setDefaultValuesToDialog(aUnitData[oInData.unitProperty], oDefaultValues, oInData, true);
762
+ aUnitData[oInData.unitProperty].textInfo = {};
763
+ aUnitData[oInData.unitProperty].selectedKey = MassEditHelper.getDefaultSelectionPathComboBox(
764
+ aContexts,
765
+ oInData.unitProperty
766
+ );
767
+ aUnitData[oInData.unitProperty].inputType = oInData.inputType;
755
768
  } else if (
756
- (oData.dataProperty && aValues[oData.dataProperty] && !aValues[oData.dataProperty].length) ||
757
- (oData.unitProperty && aUnitData[oData.unitProperty] && !aUnitData[oData.unitProperty].length)
769
+ (oInData.dataProperty && aValues[oInData.dataProperty] && !aValues[oInData.dataProperty].length) ||
770
+ (oInData.unitProperty && aUnitData[oInData.unitProperty] && !aUnitData[oInData.unitProperty].length)
758
771
  ) {
759
772
  const bClearFieldOrBlankValueExists =
760
- aValues[oData.dataProperty] &&
761
- aValues[oData.dataProperty].some(function (obj: any) {
773
+ aValues[oInData.dataProperty] &&
774
+ aValues[oInData.dataProperty].some(function (obj: any) {
762
775
  return obj.text === "< Clear Values >" || obj.text === "< Leave Blank >";
763
776
  });
764
- if (oData.dataProperty && !bClearFieldOrBlankValueExists) {
765
- aValues[oData.dataProperty].push({ text: oDefaultValues.leaveBlankValue, key: "Empty/" + oData.dataProperty });
777
+ if (oInData.dataProperty && !bClearFieldOrBlankValueExists) {
778
+ aValues[oInData.dataProperty].push({ text: oDefaultValues.leaveBlankValue, key: `Empty/${oInData.dataProperty}` });
766
779
  }
767
780
  const bClearFieldOrBlankUnitValueExists =
768
- aUnitData[oData.unitProperty] &&
769
- aUnitData[oData.unitProperty].some(function (obj: any) {
781
+ aUnitData[oInData.unitProperty] &&
782
+ aUnitData[oInData.unitProperty].some(function (obj: any) {
770
783
  return obj.text === "< Clear Values >" || obj.text === "< Leave Blank >";
771
784
  });
772
- if (oData.unitProperty) {
785
+ if (oInData.unitProperty) {
773
786
  if (!bClearFieldOrBlankUnitValueExists) {
774
- aUnitData[oData.unitProperty].push({
787
+ aUnitData[oInData.unitProperty].push({
775
788
  text: oDefaultValues.leaveBlankValue,
776
- key: "Empty/" + oData.unitProperty
789
+ key: `Empty/${oInData.unitProperty}`
777
790
  });
778
791
  }
779
- aUnitData[oData.unitProperty].textInfo = {};
780
- aUnitData[oData.unitProperty].selectedKey = MassEditHelper.getDefaultSelectionPathComboBox(
792
+ aUnitData[oInData.unitProperty].textInfo = {};
793
+ aUnitData[oInData.unitProperty].selectedKey = MassEditHelper.getDefaultSelectionPathComboBox(
781
794
  aContexts,
782
- oData.unitProperty
795
+ oInData.unitProperty
783
796
  );
784
- aUnitData[oData.unitProperty].inputType = oData.inputType;
797
+ aUnitData[oInData.unitProperty].inputType = oInData.inputType;
785
798
  }
786
799
  }
787
- if (oData.isPropertyReadOnly && typeof oData.isPropertyReadOnly === "boolean") {
788
- aReadOnlyFieldInfo.push({ "property": oData.dataProperty, value: oData.isPropertyReadOnly, type: "Default" });
800
+ if (oInData.isPropertyReadOnly && typeof oInData.isPropertyReadOnly === "boolean") {
801
+ aReadOnlyFieldInfo.push({ "property": oInData.dataProperty, value: oInData.isPropertyReadOnly, type: "Default" });
789
802
  } else if (
790
- oData.isPropertyReadOnly &&
791
- oData.isPropertyReadOnly.operands &&
792
- oData.isPropertyReadOnly.operands[0] &&
793
- oData.isPropertyReadOnly.operands[0].operand1 &&
794
- oData.isPropertyReadOnly.operands[0].operand2
803
+ oInData.isPropertyReadOnly &&
804
+ oInData.isPropertyReadOnly.operands &&
805
+ oInData.isPropertyReadOnly.operands[0] &&
806
+ oInData.isPropertyReadOnly.operands[0].operand1 &&
807
+ oInData.isPropertyReadOnly.operands[0].operand2
795
808
  ) {
796
809
  // This needs to be refactored in accordance with the ReadOnlyExpression change
797
810
  aReadOnlyFieldInfo.push({
798
- "property": oData.dataProperty,
799
- propertyPath: oData.isPropertyReadOnly.operands[0].operand1.path,
800
- propertyValue: oData.isPropertyReadOnly.operands[0].operand2.value,
811
+ "property": oInData.dataProperty,
812
+ propertyPath: oInData.isPropertyReadOnly.operands[0].operand1.path,
813
+ propertyValue: oInData.isPropertyReadOnly.operands[0].operand2.value,
801
814
  type: "Path"
802
815
  });
803
816
  }
804
817
 
805
818
  // Setting visbility of the mass edit field.
806
- if (oData.editMode) {
819
+ if (oInData.editMode) {
807
820
  values.visible =
808
- oData.editMode === EditMode.Editable ||
821
+ oInData.editMode === EditMode.Editable ||
809
822
  aContexts.some(
810
- MassEditHelper.getFieldVisiblity.bind(MassEditHelper, oData.editMode, oDialogDataModel, oData.dataProperty, values)
823
+ MassEditHelper.getFieldVisiblity.bind(
824
+ MassEditHelper,
825
+ oInData.editMode,
826
+ oDialogDataModel,
827
+ oInData.dataProperty,
828
+ values
829
+ )
811
830
  );
812
831
  } else {
813
832
  values.visible = true;
814
833
  }
815
- values.selectedKey = MassEditHelper.getDefaultSelectionPathComboBox(aContexts, oData.dataProperty);
816
- values.inputType = oData.inputType;
817
- values.unitProperty = oData.unitProperty;
834
+ values.selectedKey = MassEditHelper.getDefaultSelectionPathComboBox(aContexts, oInData.dataProperty);
835
+ values.inputType = oInData.inputType;
836
+ values.unitProperty = oInData.unitProperty;
818
837
  });
819
838
 
820
839
  return oDialogDataModel;
@@ -822,9 +841,9 @@ const MassEditHelper = {
822
841
  /**
823
842
  * Gets transient context for dialog.
824
843
  *
825
- * @param {Table} table Instance of Table.
826
- * @param {Dialog} dialog Mass Edit Dialog.
827
- * @returns {object} Promise returning instance of dialog.
844
+ * @param table Instance of Table.
845
+ * @param dialog Mass Edit Dialog.
846
+ * @returns Promise returning instance of dialog.
828
847
  */
829
848
  getDialogContext: function (table: Table, dialog?: Dialog): Context {
830
849
  let transCtx: Context = (dialog && dialog.getBindingContext()) as Context;
@@ -853,10 +872,10 @@ const MassEditHelper = {
853
872
  /**
854
873
  * Create the mass edit dialog.
855
874
  *
856
- * @param {object} oTable Instance of Table
857
- * @param {Array} aContexts Contexts for mass edit
858
- * @param {object} oController Controller for the view
859
- * @returns {object} Promise returning instance of dialog.
875
+ * @param oTable Instance of Table
876
+ * @param aContexts Contexts for mass edit
877
+ * @param oController Controller for the view
878
+ * @returns Promise returning instance of dialog.
860
879
  */
861
880
  createDialog: function (oTable: Table, aContexts: any[], oController: PageController) {
862
881
  const sFragmentName = "sap/fe/core/controls/massEdit/MassEditDialog",
@@ -883,30 +902,31 @@ const MassEditHelper = {
883
902
  }
884
903
  )
885
904
  )
886
- .then(function (oFragment: any) {
887
- return Fragment.load({ definition: oFragment }).then(function (oDialogContent: any) {
905
+ .then(function (oCreatedFragment: any) {
906
+ return Fragment.load({ definition: oCreatedFragment }).then(function (oDialogContent: any) {
888
907
  const DraftStatus = FELibrary.DraftStatus;
889
908
  const oDialog = new Dialog({
909
+ resizable: true,
890
910
  title: oDefaultValues.massEditTitle,
891
911
  content: [oDialogContent],
892
912
  afterOpen: MassEditHelper.onDialogOpen,
893
913
  beginButton: new Button({
894
- text: oDefaultValues.applyButtonText,
914
+ text: MassEditHelper.helpers.getExpBindingForApplyButtonTxt(oDefaultValues, oDataFieldModel.getObject("/")),
895
915
  type: "Emphasized",
896
916
  press: function (oEvent: any) {
897
917
  (oController.getView()?.getBindingContext("internal") as InternalModelContext)?.setProperty(
898
918
  "skipPatchHandlers",
899
919
  true
900
920
  );
901
- const oDialog = oEvent.getSource().getParent();
902
- const oModel = oDialog.getModel("fieldsInfo");
921
+ const oInDialog = oEvent.getSource().getParent();
922
+ const oModel = oInDialog.getModel("fieldsInfo");
903
923
  const aResults = oModel.getProperty("/results");
904
924
  const aPropertyReadableInfo = oModel.getProperty("/readablePropertyData");
905
925
  const changePromise: any[] = [];
906
926
  let bReadOnlyField = false;
907
927
  let groupId;
908
928
  //let index = 0;
909
- let errorValues: any[] = [];
929
+ const errorValues: any[] = [];
910
930
  aContexts.forEach(function (oSelectedContext: any, idx: number) {
911
931
  aResults.forEach(function (oResult: any) {
912
932
  //TODO - Add save implementation for Value Help.
@@ -928,7 +948,7 @@ const MassEditHelper = {
928
948
  }
929
949
  });
930
950
  }
931
- groupId = "$auto." + idx;
951
+ groupId = `$auto.${idx}`;
932
952
  //index += 1;
933
953
  oController._editFlow.setDraftStatus(DraftStatus.Saving);
934
954
  //let promiseCount = 0;
@@ -948,14 +968,15 @@ const MassEditHelper = {
948
968
  });
949
969
  });
950
970
 
971
+ // eslint-disable-next-line promise/catch-or-return
951
972
  (Promise as any).allSettled(changePromise).then(function () {
952
973
  const oListBinding = oTable.getRowBinding();
953
974
  const oExtensionAPI = oController && (oController.getExtensionAPI() as any);
954
975
  return oExtensionAPI.refresh(oListBinding.getPath()).then(function () {
955
- let subtitleColumn = CommonUtils.getMessageColumn(oTable);
956
- let messages = sap.ui.getCore().getMessageManager().getMessageModel().getData();
957
- let boundTransitionErrorContexts = [] as any;
958
- messages.forEach(function (message: any, idx: any) {
976
+ const subtitleColumn = CommonUtils.getMessageColumn(oTable);
977
+ const messages = sap.ui.getCore().getMessageManager().getMessageModel().getData();
978
+ const boundTransitionErrorContexts = [] as any;
979
+ messages.forEach(function (message: any) {
959
980
  const messageTargets = message.getTargets();
960
981
  if (
961
982
  messageTargets &&
@@ -963,7 +984,7 @@ const MassEditHelper = {
963
984
  messageTargets[0].length &&
964
985
  message.persistent === true
965
986
  ) {
966
- let boundTransitionErrorContext = aContexts.find(function (oContext: any) {
987
+ const boundTransitionErrorContext = aContexts.find(function (oContext: any) {
967
988
  return message.getTarget().indexOf(oContext.getPath()) !== -1;
968
989
  });
969
990
  boundTransitionErrorContexts.push(boundTransitionErrorContext);
@@ -972,27 +993,29 @@ const MassEditHelper = {
972
993
  : undefined;
973
994
  }
974
995
  });
975
- if (boundTransitionErrorContexts.length === 0 && errorValues.length === 0) {
996
+ if (
997
+ aResults.length > 0 &&
998
+ boundTransitionErrorContexts.length === 0 &&
999
+ errorValues.length === 0
1000
+ ) {
976
1001
  oController._editFlow.setDraftStatus(DraftStatus.Saved);
977
1002
  const successToast = oResourceBundle.getText("C_MASS_EDIT_SUCCESS_TOAST");
978
1003
  MessageToast.show(successToast);
979
- } else {
980
- if (
981
- errorValues.length + boundTransitionErrorContexts.length <
982
- (oTable as any).getSelectedContexts().length
983
- ) {
984
- oController._editFlow.setDraftStatus(DraftStatus.Saved);
985
- } else if (
986
- errorValues.length + boundTransitionErrorContexts.length ===
987
- (oTable as any).getSelectedContexts().length
988
- ) {
989
- oController._editFlow.setDraftStatus(DraftStatus.Clear);
990
- }
1004
+ } else if (
1005
+ errorValues.length + boundTransitionErrorContexts.length <
1006
+ (oTable as any).getSelectedContexts().length
1007
+ ) {
1008
+ oController._editFlow.setDraftStatus(DraftStatus.Saved);
1009
+ } else if (
1010
+ errorValues.length + boundTransitionErrorContexts.length ===
1011
+ (oTable as any).getSelectedContexts().length
1012
+ ) {
1013
+ oController._editFlow.setDraftStatus(DraftStatus.Clear);
991
1014
  }
992
1015
  oController._editFlow.getMessageHandler().showMessages();
993
- if (oDialog.isOpen()) {
994
- oDialog.close();
995
- oDialog.destroy();
1016
+ if (oInDialog.isOpen()) {
1017
+ oInDialog.close();
1018
+ oInDialog.destroy();
996
1019
  (oController.getView()?.getBindingContext("internal") as InternalModelContext)?.setProperty(
997
1020
  "skipPatchHandlers",
998
1021
  false
@@ -1004,10 +1027,11 @@ const MassEditHelper = {
1004
1027
  }),
1005
1028
  endButton: new Button({
1006
1029
  text: oDefaultValues.cancelButtonText,
1030
+ visible: MassEditHelper.helpers.hasEditableFieldsBinding(oDataFieldModel.getObject("/"), true) as any,
1007
1031
  press: function (oEvent: any) {
1008
- const oDialog = oEvent.getSource().getParent();
1009
- oDialog.close();
1010
- oDialog.destroy();
1032
+ const oInDialog = oEvent.getSource().getParent();
1033
+ oInDialog.close();
1034
+ oInDialog.destroy();
1011
1035
  }
1012
1036
  })
1013
1037
  });
@@ -1020,6 +1044,30 @@ const MassEditHelper = {
1020
1044
  })
1021
1045
  .catch(reject);
1022
1046
  });
1047
+ },
1048
+
1049
+ helpers: {
1050
+ getBindingExpForHasEditableFields: (fields: any, editable: boolean) => {
1051
+ const totalExp = fields.reduce(
1052
+ (expression: any, field: any) =>
1053
+ or(
1054
+ expression,
1055
+ pathInModel("/values/" + field.dataProperty + "/visible", "fieldsInfo") as BindingToolkitExpression<boolean>
1056
+ ),
1057
+ constant(false)
1058
+ );
1059
+ return editable ? totalExp : not(totalExp);
1060
+ },
1061
+
1062
+ getExpBindingForApplyButtonTxt: (defaultValues: any, fields: boolean) => {
1063
+ const editableExp = MassEditHelper.helpers.getBindingExpForHasEditableFields(fields, true);
1064
+ const totalExp = ifElse(editableExp, constant(defaultValues.applyButtonText), constant(defaultValues.okButtonText));
1065
+ return compileExpression(totalExp);
1066
+ },
1067
+
1068
+ hasEditableFieldsBinding: (fields: any, editable: boolean) => {
1069
+ return compileExpression(MassEditHelper.helpers.getBindingExpForHasEditableFields(fields, editable));
1070
+ }
1023
1071
  }
1024
1072
  };
1025
1073