@sapui5/sap.ushell 1.126.1 → 1.127.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 (401) hide show
  1. package/package.json +1 -1
  2. package/src/main/js/sap/ushell/.library +1 -1
  3. package/src/main/js/sap/ushell/Fiori20Adapter.js +1 -1
  4. package/src/main/js/sap/ushell/Fiori20AdapterTest.js +1 -1
  5. package/src/main/js/sap/ushell/NWBCInterface.js +1 -1
  6. package/src/main/js/sap/ushell/SessionHandler.js +2 -2
  7. package/src/main/js/sap/ushell/TechnicalParameters.js +1 -1
  8. package/src/main/js/sap/ushell/URLTemplateProcessor.js +1 -1
  9. package/src/main/js/sap/ushell/Ui5NativeServiceFactory.js +1 -1
  10. package/src/main/js/sap/ushell/Ui5ServiceFactory.js +1 -1
  11. package/src/main/js/sap/ushell/User.js +7 -7
  12. package/src/main/js/sap/ushell/UserActivityLog.js +8 -13
  13. package/src/main/js/sap/ushell/_Config/utils.js +18 -0
  14. package/src/main/js/sap/ushell/_URLTemplateProcessor/DefinitionParameterSetBuilder.js +1 -1
  15. package/src/main/js/sap/ushell/_URLTemplateProcessor/DependencyGraph.js +1 -1
  16. package/src/main/js/sap/ushell/_URLTemplateProcessor/Functions.js +1 -1
  17. package/src/main/js/sap/ushell/_URLTemplateProcessor/Resolvers.js +1 -1
  18. package/src/main/js/sap/ushell/_URLTemplateProcessor/TemplateParameterParser.js +1 -1
  19. package/src/main/js/sap/ushell/_URLTemplateProcessor/utils.js +1 -1
  20. package/src/main/js/sap/ushell/adapters/cdm/ClientSideTargetResolutionAdapter.js +1 -1
  21. package/src/main/js/sap/ushell/adapters/cdm/CommonDataModelAdapter.js +1 -1
  22. package/src/main/js/sap/ushell/adapters/cdm/ConfigurationDefaultsAdapter.js +1 -1
  23. package/src/main/js/sap/ushell/adapters/cdm/ContainerAdapter.js +28 -9
  24. package/src/main/js/sap/ushell/adapters/cdm/LaunchPageAdapter.js +1 -1
  25. package/src/main/js/sap/ushell/adapters/cdm/PagesCommonDataModelAdapter.js +4 -3
  26. package/src/main/js/sap/ushell/adapters/cdm/PersonalizationAdapter.js +1 -1
  27. package/src/main/js/sap/ushell/adapters/cdm/PersonalizationV2Adapter.js +1 -1
  28. package/src/main/js/sap/ushell/adapters/cdm/Ui5ComponentLoaderAdapter.js +1 -1
  29. package/src/main/js/sap/ushell/adapters/cdm/_LaunchPage/modifyHome.js +1 -1
  30. package/src/main/js/sap/ushell/adapters/cdm/_LaunchPage/readCatalogs.js +1 -1
  31. package/src/main/js/sap/ushell/adapters/cdm/_LaunchPage/readHome.js +1 -1
  32. package/src/main/js/sap/ushell/adapters/cdm/_LaunchPage/uri.transform.js +1 -1
  33. package/src/main/js/sap/ushell/adapters/cdm/util/AppForInbound.js +1 -1
  34. package/src/main/js/sap/ushell/adapters/cdm/util/cdmSiteUtils.js +1 -1
  35. package/src/main/js/sap/ushell/adapters/cdm/v3/AdapterBase.js +1 -1
  36. package/src/main/js/sap/ushell/adapters/cdm/v3/FlpLaunchPageAdapter.js +1 -1
  37. package/src/main/js/sap/ushell/adapters/cdm/v3/LaunchPageAdapter.js +1 -1
  38. package/src/main/js/sap/ushell/adapters/cdm/v3/StaticGroupsAdapter.js +1 -1
  39. package/src/main/js/sap/ushell/adapters/cdm/v3/_LaunchPage/readApplications.js +1 -1
  40. package/src/main/js/sap/ushell/adapters/cdm/v3/_LaunchPage/readCatalogs.js +1 -1
  41. package/src/main/js/sap/ushell/adapters/cdm/v3/_LaunchPage/readHome.js +1 -1
  42. package/src/main/js/sap/ushell/adapters/cdm/v3/_LaunchPage/readPages.js +1 -1
  43. package/src/main/js/sap/ushell/adapters/cdm/v3/_LaunchPage/readUtils.js +1 -1
  44. package/src/main/js/sap/ushell/adapters/cdm/v3/_LaunchPage/readVisualizations.js +1 -1
  45. package/src/main/js/sap/ushell/adapters/cdm/v3/utilsCdm.js +6 -1
  46. package/src/main/js/sap/ushell/adapters/cep/NavTargetResolutionAdapter.js +1 -1
  47. package/src/main/js/sap/ushell/adapters/cep/NavTargetResolutionInternalAdapter.js +1 -1
  48. package/src/main/js/sap/ushell/adapters/cep/SearchCEPAdapter.js +1 -1
  49. package/src/main/js/sap/ushell/adapters/cflp/UserDefaultParameterPersistenceAdapter.js +1 -1
  50. package/src/main/js/sap/ushell/adapters/local/AdapterContainer.js +1 -1
  51. package/src/main/js/sap/ushell/adapters/local/AppStateAdapter.js +1 -1
  52. package/src/main/js/sap/ushell/adapters/local/ClientSideTargetResolutionAdapter.js +1 -1
  53. package/src/main/js/sap/ushell/adapters/local/ContainerAdapter.js +1 -1
  54. package/src/main/js/sap/ushell/adapters/local/FlpLaunchPageAdapter.js +1 -1
  55. package/src/main/js/sap/ushell/adapters/local/LaunchPageAdapter.js +1 -1
  56. package/src/main/js/sap/ushell/adapters/local/NavTargetResolutionAdapter.js +1 -1
  57. package/src/main/js/sap/ushell/adapters/local/NavTargetResolutionInternalAdapter.js +1 -1
  58. package/src/main/js/sap/ushell/adapters/local/PageBuildingAdapter.js +1 -1
  59. package/src/main/js/sap/ushell/adapters/local/PagePersistenceAdapter.js +1 -1
  60. package/src/main/js/sap/ushell/adapters/local/PersonalizationAdapter.js +1 -1
  61. package/src/main/js/sap/ushell/adapters/local/PersonalizationV2Adapter.js +1 -1
  62. package/src/main/js/sap/ushell/adapters/local/SearchAdapter.js +1 -1
  63. package/src/main/js/sap/ushell/adapters/local/SearchCEPAdapter.js +1 -1
  64. package/src/main/js/sap/ushell/adapters/local/SupportTicketAdapter.js +1 -1
  65. package/src/main/js/sap/ushell/adapters/local/Ui5ComponentLoaderAdapter.js +1 -1
  66. package/src/main/js/sap/ushell/adapters/local/UserDefaultParameterPersistenceAdapter.js +1 -1
  67. package/src/main/js/sap/ushell/adapters/local/UserInfoAdapter.js +1 -1
  68. package/src/main/js/sap/ushell/appRuntime/neo/AppInfoService.js +1 -0
  69. package/src/main/js/sap/ushell/appRuntime/neo/AppRuntimeNeo.js +1 -0
  70. package/src/main/js/sap/ushell/appRuntime/neo/ProxyAppUtils.js +1 -0
  71. package/src/main/js/sap/ushell/appRuntime/ui5/AppRuntime.js +6 -0
  72. package/src/main/js/sap/ushell/appRuntime/ui5/renderers/fiori2/Renderer.js +19 -0
  73. package/src/main/js/sap/ushell/appRuntime/ui5/renderers/fiori2/RendererExtensions.js +1 -1
  74. package/src/main/js/sap/ushell/appRuntime/ui5/services/AppConfiguration.js +1 -1
  75. package/src/main/js/sap/ushell/appRuntime/ui5/services/AppLifeCycle.js +51 -0
  76. package/src/main/js/sap/ushell/appRuntime/ui5/services/AppState.js +1 -1
  77. package/src/main/js/sap/ushell/appRuntime/ui5/services/Bookmark.js +1 -1
  78. package/src/main/js/sap/ushell/appRuntime/ui5/services/BookmarkV2.js +6 -6
  79. package/src/main/js/sap/ushell/appRuntime/ui5/services/CommonDataModel.js +1 -1
  80. package/src/main/js/sap/ushell/appRuntime/ui5/services/Container.js +1 -1
  81. package/src/main/js/sap/ushell/appRuntime/ui5/services/CrossApplicationNavigation.js +1 -1
  82. package/src/main/js/sap/ushell/appRuntime/ui5/services/Extension/Item.js +1 -1
  83. package/src/main/js/sap/ushell/appRuntime/ui5/services/Extension.js +1 -1
  84. package/src/main/js/sap/ushell/appRuntime/ui5/services/FrameBoundExtension.js +1 -1
  85. package/src/main/js/sap/ushell/appRuntime/ui5/services/LaunchPage.js +1 -1
  86. package/src/main/js/sap/ushell/appRuntime/ui5/services/MessageBroker.js +1 -1
  87. package/src/main/js/sap/ushell/appRuntime/ui5/services/NavTargetResolution.js +1 -1
  88. package/src/main/js/sap/ushell/appRuntime/ui5/services/NavTargetResolutionInternal.js +1 -1
  89. package/src/main/js/sap/ushell/appRuntime/ui5/services/Navigation.js +1 -1
  90. package/src/main/js/sap/ushell/appRuntime/ui5/services/ReferenceResolver.js +1 -1
  91. package/src/main/js/sap/ushell/appRuntime/ui5/services/ShellNavigation.js +1 -1
  92. package/src/main/js/sap/ushell/appRuntime/ui5/services/ShellNavigationInternal.js +1 -1
  93. package/src/main/js/sap/ushell/appRuntime/ui5/services/ShellUIService.js +1 -1
  94. package/src/main/js/sap/ushell/appRuntime/ui5/services/UserInfo.js +1 -1
  95. package/src/main/js/sap/ushell/appRuntime/ui5/services/adapters/Ui5ComponentLoaderAdapter.js +1 -1
  96. package/src/main/js/sap/ushell/bootstrap/_SchedulingAgent/FLPScheduler.js +47 -16
  97. package/src/main/js/sap/ushell/bootstrap/_SchedulingAgent/StepConfiguration.json +10 -3
  98. package/src/main/js/sap/ushell/bootstrap/_SchedulingAgent/logger.js +1 -1
  99. package/src/main/js/sap/ushell/bootstrap/_SchedulingAgent/state.js +1 -1
  100. package/src/main/js/sap/ushell/bootstrap/common/common.configure.ui5.js +9 -0
  101. package/src/main/js/sap/ushell/bootstrap/common/common.configure.ui5datetimeformat.js +1 -1
  102. package/src/main/js/sap/ushell/bootstrap/common/common.create.configcontract.core.js +13 -33
  103. package/src/main/js/sap/ushell/bootstrap/sandbox2.js +1 -1
  104. package/src/main/js/sap/ushell/components/_HeaderManager/ShellHeader.controller.js +135 -8
  105. package/src/main/js/sap/ushell/components/_HomepageManager/DashboardLoadingManager.js +1 -1
  106. package/src/main/js/sap/ushell/components/_HomepageManager/PagingManager.js +1 -1
  107. package/src/main/js/sap/ushell/components/_HomepageManager/PersistentPageOperationAdapter.js +1 -1
  108. package/src/main/js/sap/ushell/components/_HomepageManager/TransientPageOperationAdapter.js +1 -1
  109. package/src/main/js/sap/ushell/components/appfinder/AppFinder.controller.js +0 -6
  110. package/src/main/js/sap/ushell/components/appfinder/Component.js +1 -1
  111. package/src/main/js/sap/ushell/components/appfinder/manifest.json +1 -1
  112. package/src/main/js/sap/ushell/components/applicationIntegration/AppLifeCycle.js +74 -72
  113. package/src/main/js/sap/ushell/components/applicationIntegration/application/Application.js +1 -1
  114. package/src/main/js/sap/ushell/components/applicationIntegration/application/BlueBoxHandler.js +1 -1
  115. package/src/main/js/sap/ushell/components/applicationIntegration/application/PostMessageAPI.js +35 -18
  116. package/src/main/js/sap/ushell/components/applicationIntegration/configuration/AppMeta.js +42 -27
  117. package/src/main/js/sap/ushell/components/applicationIntegration/relatedServices/RelatedServices.js +1 -1
  118. package/src/main/js/sap/ushell/components/container/ApplicationContainer.js +1 -1
  119. package/src/main/js/sap/ushell/components/contentFinder/Component.js +19 -12
  120. package/src/main/js/sap/ushell/components/contentFinder/controller/AppSearch.controller.js +24 -5
  121. package/src/main/js/sap/ushell/components/contentFinder/controller/ContentFinderDialog.controller.js +1 -1
  122. package/src/main/js/sap/ushell/components/contentFinder/controller/WidgetGallery.controller.js +1 -1
  123. package/src/main/js/sap/ushell/components/contentFinder/manifest.json +1 -1
  124. package/src/main/js/sap/ushell/components/contentFinder/model/formatter.js +47 -7
  125. package/src/main/js/sap/ushell/components/contentFinder/view/AppSearch.view.xml +7 -6
  126. package/src/main/js/sap/ushell/components/contentFinder/view/AppSearchBox.fragment.xml +5 -4
  127. package/src/main/js/sap/ushell/components/contentFinder/view/AppSearchCategoryTree.view.xml +34 -22
  128. package/src/main/js/sap/ushell/components/contentFinderStandalone/Component.js +7 -6
  129. package/src/main/js/sap/ushell/components/contentFinderStandalone/controller/ContentFinderStandalone.controller.js +3 -1
  130. package/src/main/js/sap/ushell/components/contentFinderStandalone/manifest.json +1 -1
  131. package/src/main/js/sap/ushell/components/contentFinderStandalone/manifestAppSearch.json +1 -1
  132. package/src/main/js/sap/ushell/components/factsheet/Component.js +1 -1
  133. package/src/main/js/sap/ushell/components/homepage/ActionMode.js +1 -1
  134. package/src/main/js/sap/ushell/components/homepage/Component.js +1 -1
  135. package/src/main/js/sap/ushell/components/homepage/DashboardContent.view.js +1 -1
  136. package/src/main/js/sap/ushell/components/homepage/DashboardGroupsBox.js +29 -24
  137. package/src/main/js/sap/ushell/components/homepage/DashboardUIActions.js +1 -1
  138. package/src/main/js/sap/ushell/components/homepage/manifest.json +1 -1
  139. package/src/main/js/sap/ushell/components/pages/ActionMode.js +1 -1
  140. package/src/main/js/sap/ushell/components/pages/Component.js +10 -3
  141. package/src/main/js/sap/ushell/components/pages/MyHomeImport.js +1 -1
  142. package/src/main/js/sap/ushell/components/pages/controller/PageRuntime.controller.js +26 -5
  143. package/src/main/js/sap/ushell/components/pages/manifest.json +1 -1
  144. package/src/main/js/sap/ushell/components/runtimeSwitcher/Component.js +3 -2
  145. package/src/main/js/sap/ushell/components/runtimeSwitcher/controller/RuntimeSwitcher.controller.js +1 -1
  146. package/src/main/js/sap/ushell/components/runtimeSwitcher/manifest.json +1 -1
  147. package/src/main/js/sap/ushell/components/shell/MenuBar/manifest.json +1 -1
  148. package/src/main/js/sap/ushell/components/shell/NavigationBarMenu/controller/NavigationBarMenu.controller.js +19 -3
  149. package/src/main/js/sap/ushell/components/shell/NavigationBarMenu/manifest.json +1 -1
  150. package/src/main/js/sap/ushell/components/shell/NavigationBarMenu/view/NavigationBarMenu.view.xml +1 -0
  151. package/src/main/js/sap/ushell/components/shell/Notifications/Component.js +24 -22
  152. package/src/main/js/sap/ushell/components/shell/Notifications/Notifications.controller.js +1 -1
  153. package/src/main/js/sap/ushell/components/shell/PostLoadingHeaderEnhancement/Component.js +80 -17
  154. package/src/main/js/sap/ushell/components/shell/ProductSwitch/Component.js +1 -1
  155. package/src/main/js/sap/ushell/components/shell/Search/manifest.json +1 -1
  156. package/src/main/js/sap/ushell/components/shell/SearchCEP/Component.js +1 -1
  157. package/src/main/js/sap/ushell/components/shell/SearchCEP/SearchProviders/FrequentActivityProvider.js +1 -1
  158. package/src/main/js/sap/ushell/components/shell/SearchCEP/SearchProviders/RecentSearchProvider.js +1 -1
  159. package/src/main/js/sap/ushell/components/shell/SearchCEP/SearchProviders/SearchProvider.js +1 -1
  160. package/src/main/js/sap/ushell/components/shell/SearchCEP/SearchProviders/SearchServiceProvider.js +1 -1
  161. package/src/main/js/sap/ushell/components/shell/Settings/Component.js +12 -16
  162. package/src/main/js/sap/ushell/components/shell/Settings/UserSettings.controller.js +9 -4
  163. package/src/main/js/sap/ushell/components/shell/Settings/UserSettings.view.xml +9 -9
  164. package/src/main/js/sap/ushell/components/shell/UserActionsMenu/Component.js +3 -45
  165. package/src/main/js/sap/ushell/components/shell/UserActionsMenu/UserActionsMenu.controller.js +31 -23
  166. package/src/main/js/sap/ushell/components/shell/UserActionsMenu/UserActionsMenuPopover.fragment.xml +7 -2
  167. package/src/main/js/sap/ushell/components/shell/UserImage/Component.js +3 -3
  168. package/src/main/js/sap/ushell/components/tiles/applauncher/StaticTile.controller.js +0 -4
  169. package/src/main/js/sap/ushell/components/tiles/applauncherdynamic/DynamicTile.controller.js +0 -1
  170. package/src/main/js/sap/ushell/components/tiles/indicatorcomparison/ComparisonTile.controller.js +1 -1
  171. package/src/main/js/sap/ushell/components/visualizationOrganizer/Component.js +1 -1
  172. package/src/main/js/sap/ushell/components/workPageBuilder/Component.js +2 -1
  173. package/src/main/js/sap/ushell/components/workPageBuilder/controller/WorkPageBuilder.accessibility.js +1 -1
  174. package/src/main/js/sap/ushell/components/workPageBuilder/controller/WorkPageBuilder.controller.js +1939 -1946
  175. package/src/main/js/sap/ushell/components/workPageBuilder/controls/WorkPage.js +1 -1
  176. package/src/main/js/sap/ushell/components/workPageBuilder/controls/WorkPageButton.js +1 -1
  177. package/src/main/js/sap/ushell/components/workPageBuilder/controls/WorkPageCell.js +1 -1
  178. package/src/main/js/sap/ushell/components/workPageBuilder/controls/WorkPageColumn.js +1 -1
  179. package/src/main/js/sap/ushell/components/workPageBuilder/controls/WorkPageColumnResizer.js +1 -1
  180. package/src/main/js/sap/ushell/components/workPageBuilder/controls/WorkPageRow.js +1 -1
  181. package/src/main/js/sap/ushell/components/workPageBuilder/manifest.json +1 -1
  182. package/src/main/js/sap/ushell/components/workPageRuntime/Component.js +3 -2
  183. package/src/main/js/sap/ushell/components/workPageRuntime/controller/WorkPageRuntime.controller.js +1 -1
  184. package/src/main/js/sap/ushell/components/workPageRuntime/manifest.json +1 -1
  185. package/src/main/js/sap/ushell/designtime/ApplicationContainer.designtime.js +1 -1
  186. package/src/main/js/sap/ushell/library.js +1 -1
  187. package/src/main/js/sap/ushell/navigationMode.js +1 -1
  188. package/src/main/js/sap/ushell/performance/ShellAnalytics.js +15 -12
  189. package/src/main/js/sap/ushell/performance/StatisticalRecord.js +1 -1
  190. package/src/main/js/sap/ushell/plugins/appwarmup/Component.js +1 -1
  191. package/src/main/js/sap/ushell/renderer/AccessKeysHandler.js +31 -9
  192. package/src/main/js/sap/ushell/renderer/Renderer.js +303 -287
  193. package/src/main/js/sap/ushell/renderer/Shell.controller.js +99 -101
  194. package/src/main/js/sap/ushell/renderer/Shell.view.js +110 -89
  195. package/src/main/js/sap/ushell/renderer/allMyApps/AllMyApps.controller.js +29 -15
  196. package/src/main/js/sap/ushell/renderer/allMyApps/AllMyApps.view.xml +2 -2
  197. package/src/main/js/sap/ushell/renderer/resources/resources.properties +2 -0
  198. package/src/main/js/sap/ushell/renderer/search/searchComponent/manifest.json +1 -1
  199. package/src/main/js/sap/ushell/renderers/fiori2/History.js +1 -0
  200. package/src/main/js/sap/ushell/renderers/fiori2/LogonFrameProvider.js +1 -0
  201. package/src/main/js/sap/ushell/renderers/fiori2/Shell.view.js +108 -87
  202. package/src/main/js/sap/ushell/renderers/fiori2/allMyApps/AllMyAppsManager.js +1 -0
  203. package/src/main/js/sap/ushell/services/AppLifeCycle.js +1 -1
  204. package/src/main/js/sap/ushell/services/AppState.js +1 -1
  205. package/src/main/js/sap/ushell/services/Bookmark.js +1 -1
  206. package/src/main/js/sap/ushell/services/BookmarkV2.js +1 -1
  207. package/src/main/js/sap/ushell/services/ClientSideTargetResolution.js +1 -1
  208. package/src/main/js/sap/ushell/services/CommonDataModel.js +2 -15
  209. package/src/main/js/sap/ushell/services/Configuration.js +1 -1
  210. package/src/main/js/sap/ushell/services/ConfigurationDefaults.js +1 -1
  211. package/src/main/js/sap/ushell/services/ContentExtensionAdapterFactory.js +1 -1
  212. package/src/main/js/sap/ushell/services/CrossApplicationNavigation.js +1 -1
  213. package/src/main/js/sap/ushell/services/DarkModeSupport.js +11 -5
  214. package/src/main/js/sap/ushell/services/Extension/Item.js +4 -4
  215. package/src/main/js/sap/ushell/services/Extension.js +36 -2
  216. package/src/main/js/sap/ushell/services/FlpLaunchPage.js +1 -1
  217. package/src/main/js/sap/ushell/services/FrameBoundExtension/FloatingContainer.js +1 -1
  218. package/src/main/js/sap/ushell/services/FrameBoundExtension/Footer.js +1 -1
  219. package/src/main/js/sap/ushell/services/FrameBoundExtension/Item.js +4 -4
  220. package/src/main/js/sap/ushell/services/FrameBoundExtension/SidePane.js +18 -2
  221. package/src/main/js/sap/ushell/services/FrameBoundExtension/ToolArea.js +20 -2
  222. package/src/main/js/sap/ushell/services/FrameBoundExtension.js +96 -2
  223. package/src/main/js/sap/ushell/services/LaunchPage.js +1 -1
  224. package/src/main/js/sap/ushell/services/Menu.js +1 -1
  225. package/src/main/js/sap/ushell/services/Message.js +1 -1
  226. package/src/main/js/sap/ushell/services/MessageBroker.js +1 -1
  227. package/src/main/js/sap/ushell/services/MessageInternal.js +13 -8
  228. package/src/main/js/sap/ushell/services/Navigation/compatibility.js +1 -1
  229. package/src/main/js/sap/ushell/services/Navigation/utils.js +1 -1
  230. package/src/main/js/sap/ushell/services/Navigation.js +1 -1
  231. package/src/main/js/sap/ushell/services/NavigationDataProvider.js +1 -1
  232. package/src/main/js/sap/ushell/services/PageBuilding.js +1 -1
  233. package/src/main/js/sap/ushell/services/PagePersistence.js +1 -1
  234. package/src/main/js/sap/ushell/services/PageReferencing.js +1 -1
  235. package/src/main/js/sap/ushell/services/Pages.js +4 -3
  236. package/src/main/js/sap/ushell/services/Personalization.js +1 -1
  237. package/src/main/js/sap/ushell/services/PersonalizationV2.js +1 -1
  238. package/src/main/js/sap/ushell/services/PluginManager.js +1 -1
  239. package/src/main/js/sap/ushell/services/ReferenceResolver.js +1 -1
  240. package/src/main/js/sap/ushell/services/Search.js +1 -1
  241. package/src/main/js/sap/ushell/services/SearchCEP.js +1 -1
  242. package/src/main/js/sap/ushell/services/SearchableContent.js +6 -5
  243. package/src/main/js/sap/ushell/services/ShellNavigation.js +1 -1
  244. package/src/main/js/sap/ushell/services/SmartNavigation.js +1 -1
  245. package/src/main/js/sap/ushell/services/SpaceContent.js +1 -1
  246. package/src/main/js/sap/ushell/services/UITracer.js +1 -1
  247. package/src/main/js/sap/ushell/services/URLShortening.js +1 -1
  248. package/src/main/js/sap/ushell/services/URLTemplate.js +1 -1
  249. package/src/main/js/sap/ushell/services/Ui5ComponentLoader.js +3 -3
  250. package/src/main/js/sap/ushell/services/UserDefaultParameterPersistence.js +1 -1
  251. package/src/main/js/sap/ushell/services/UserDefaultParameters.js +1 -1
  252. package/src/main/js/sap/ushell/services/UserInfo.js +1 -1
  253. package/src/main/js/sap/ushell/services/UserRecents.js +1 -1
  254. package/src/main/js/sap/ushell/services/VisualizationDataProvider.js +1 -1
  255. package/src/main/js/sap/ushell/services/VisualizationInstantiation.js +1 -1
  256. package/src/main/js/sap/ushell/services/_AppState/AppStatePersistencyMethod.js +1 -1
  257. package/src/main/js/sap/ushell/services/_ClientSideTargetResolution/Formatter.js +1 -1
  258. package/src/main/js/sap/ushell/services/_ClientSideTargetResolution/InboundIndex.js +1 -1
  259. package/src/main/js/sap/ushell/services/_ClientSideTargetResolution/InboundProvider.js +1 -1
  260. package/src/main/js/sap/ushell/services/_ClientSideTargetResolution/PrelaunchOperations.js +1 -1
  261. package/src/main/js/sap/ushell/services/_ClientSideTargetResolution/Search.js +1 -1
  262. package/src/main/js/sap/ushell/services/_ClientSideTargetResolution/StagedLogger.js +1 -1
  263. package/src/main/js/sap/ushell/services/_ClientSideTargetResolution/SystemContext.js +1 -1
  264. package/src/main/js/sap/ushell/services/_ClientSideTargetResolution/Utils.js +1 -1
  265. package/src/main/js/sap/ushell/services/_ClientSideTargetResolution/VirtualInbounds.js +1 -1
  266. package/src/main/js/sap/ushell/services/_ClientSideTargetResolution/XAppStateProcessing.js +1 -1
  267. package/src/main/js/sap/ushell/services/_CommonDataModel/SiteConverter.js +1 -1
  268. package/src/main/js/sap/ushell/services/_CommonDataModel/vizTypeDefaults/VizTypeDefaults.js +1 -1
  269. package/src/main/js/sap/ushell/services/_ContentExtensionAdapterFactory/ContentExtensionAdapterConfig.js +2 -2
  270. package/src/main/js/sap/ushell/services/_ContentExtensionAdapterFactory/FeaturedGroupConfig.js +1 -1
  271. package/src/main/js/sap/ushell/services/_CrossApplicationNavigation/utils.js +1 -1
  272. package/src/main/js/sap/ushell/services/_MessageBroker/MessageBrokerEngine.js +1 -1
  273. package/src/main/js/sap/ushell/services/_PageReferencing/PageReferencer.js +1 -1
  274. package/src/main/js/sap/ushell/services/_Personalization/VariantSetAdapter.js +1 -0
  275. package/src/main/js/sap/ushell/services/_Personalization/WindowAdapter.js +1 -0
  276. package/src/main/js/sap/ushell/services/_Personalization/WindowAdapterContainer.js +1 -0
  277. package/src/main/js/sap/ushell/services/_Personalization/constants.js +1 -0
  278. package/src/main/js/sap/ushell/services/_Personalization/constants.private.js +1 -0
  279. package/src/main/js/sap/ushell/services/_Personalization/utils.js +1 -0
  280. package/src/main/js/sap/ushell/services/_PluginManager/Extensions.js +1 -1
  281. package/src/main/js/sap/ushell/services/_PluginManager/HeaderExtensions.js +2 -2
  282. package/src/main/js/sap/ushell/services/_PluginManager/MenuExtensions.js +1 -1
  283. package/src/main/js/sap/ushell/services/_Ui5ComponentLoader/utils.js +1 -1
  284. package/src/main/js/sap/ushell/state/BaseState.js +79 -0
  285. package/src/main/js/sap/ushell/state/ControlManager.js +209 -0
  286. package/src/main/js/sap/ushell/state/CurrentState.js +180 -0
  287. package/src/main/js/sap/ushell/state/KeepAlive.js +75 -0
  288. package/src/main/js/sap/ushell/state/ShellModel.js +112 -0
  289. package/src/main/js/sap/ushell/state/StateManager/LaunchpadState.js +40 -0
  290. package/src/main/js/sap/ushell/state/StateManager/Operation.js +42 -0
  291. package/src/main/js/sap/ushell/state/StateManager/ShellMode.js +86 -0
  292. package/src/main/js/sap/ushell/state/StateManager.js +648 -0
  293. package/src/main/js/sap/ushell/state/StateRules.js +295 -0
  294. package/src/main/js/sap/ushell/state/StrategyFactory/DefaultStrategy.js +74 -0
  295. package/src/main/js/sap/ushell/state/StrategyFactory/FloatingActionsStrategy.js +78 -0
  296. package/src/main/js/sap/ushell/state/StrategyFactory/HeadEndItemsStrategy.js +130 -0
  297. package/src/main/js/sap/ushell/state/StrategyFactory/HeadItemsStrategy.js +104 -0
  298. package/src/main/js/sap/ushell/state/StrategyFactory/SidePaneStrategy.js +78 -0
  299. package/src/main/js/sap/ushell/state/StrategyFactory/SubHeaderStrategy.js +78 -0
  300. package/src/main/js/sap/ushell/state/StrategyFactory/UserActionsStrategy.js +60 -0
  301. package/src/main/js/sap/ushell/state/StrategyFactory.js +168 -0
  302. package/src/main/js/sap/ushell/support/plugins/flpConfig/FlpConfigurationPlugin.js +1 -1
  303. package/src/main/js/sap/ushell/themes/base/UserSettings.less +1 -5
  304. package/src/main/js/sap/ushell/themes/base/WorkPageCell.less +45 -49
  305. package/src/main/js/sap/ushell/themes/sap_belize_base/UserSettings.less +1 -5
  306. package/src/main/js/sap/ushell/themes/sap_bluecrystal_base/UserSettings.less +1 -5
  307. package/src/main/js/sap/ushell/themes/sap_hcb/base_ActionMode.less +107 -0
  308. package/src/main/js/sap/ushell/themes/sap_hcb/base_AddBookmarkButton.less +37 -0
  309. package/src/main/js/sap/ushell/themes/sap_hcb/base_AnchorItem.less +81 -0
  310. package/src/main/js/sap/ushell/themes/sap_hcb/base_AnchorNavigationBar.less +86 -0
  311. package/src/main/js/sap/ushell/themes/sap_hcb/base_AppearanceView.less +213 -0
  312. package/src/main/js/sap/ushell/themes/sap_hcb/base_ApplicationContainer.less +37 -0
  313. package/src/main/js/sap/ushell/themes/sap_hcb/base_Catalog.less +387 -0
  314. package/src/main/js/sap/ushell/themes/sap_hcb/base_ContactSupport.less +12 -0
  315. package/src/main/js/sap/ushell/themes/sap_hcb/base_ContentFinder.less +26 -0
  316. package/src/main/js/sap/ushell/themes/sap_hcb/base_CustomGroupHeaderListItem.less +10 -0
  317. package/src/main/js/sap/ushell/themes/sap_hcb/base_Dashboard.less +66 -0
  318. package/src/main/js/sap/ushell/themes/sap_hcb/base_DynamicTile.less +114 -0
  319. package/src/main/js/sap/ushell/themes/sap_hcb/base_Factsheet.less +225 -0
  320. package/src/main/js/sap/ushell/themes/sap_hcb/base_FloatingContainer.less +125 -0
  321. package/src/main/js/sap/ushell/themes/sap_hcb/base_FlpSettings.less +83 -0
  322. package/src/main/js/sap/ushell/themes/sap_hcb/base_GroupList.less +68 -0
  323. package/src/main/js/sap/ushell/themes/sap_hcb/base_GroupListItem.less +54 -0
  324. package/src/main/js/sap/ushell/themes/sap_hcb/base_IconFonts.less +21 -0
  325. package/src/main/js/sap/ushell/themes/sap_hcb/base_ImageTile.less +23 -0
  326. package/src/main/js/sap/ushell/themes/sap_hcb/base_LoadingDialog.less +47 -0
  327. package/src/main/js/sap/ushell/themes/sap_hcb/base_MenuBar.less +23 -0
  328. package/src/main/js/sap/ushell/themes/sap_hcb/base_Notifications.less +135 -0
  329. package/src/main/js/sap/ushell/themes/sap_hcb/base_Page.less +49 -0
  330. package/src/main/js/sap/ushell/themes/sap_hcb/base_PictureTile.less +119 -0
  331. package/src/main/js/sap/ushell/themes/sap_hcb/base_PictureViewer.less +25 -0
  332. package/src/main/js/sap/ushell/themes/sap_hcb/base_PlusTile.less +38 -0
  333. package/src/main/js/sap/ushell/themes/sap_hcb/base_QuickAccess.less +18 -0
  334. package/src/main/js/sap/ushell/themes/sap_hcb/base_RightFloatingContainerItem.less +82 -0
  335. package/src/main/js/sap/ushell/themes/sap_hcb/base_SearchCEP.less +121 -0
  336. package/src/main/js/sap/ushell/themes/sap_hcb/base_SearchFLP.less +10 -0
  337. package/src/main/js/sap/ushell/themes/sap_hcb/base_Section.less +60 -0
  338. package/src/main/js/sap/ushell/themes/sap_hcb/base_ShellAppTitle.less +207 -0
  339. package/src/main/js/sap/ushell/themes/sap_hcb/base_ShellFloatingAction.less +61 -0
  340. package/src/main/js/sap/ushell/themes/sap_hcb/base_ShellFloatingActions.less +14 -0
  341. package/src/main/js/sap/ushell/themes/sap_hcb/base_ShellHeader.less +389 -0
  342. package/src/main/js/sap/ushell/themes/sap_hcb/base_ShellLayout.less +168 -0
  343. package/src/main/js/sap/ushell/themes/sap_hcb/base_SidePane.less +8 -0
  344. package/src/main/js/sap/ushell/themes/sap_hcb/base_StaticTile.less +9 -0
  345. package/src/main/js/sap/ushell/themes/sap_hcb/base_SubHeader.less +3 -0
  346. package/src/main/js/sap/ushell/themes/sap_hcb/base_SysInfoBar.less +164 -0
  347. package/src/main/js/sap/ushell/themes/sap_hcb/base_TargetMappingConfiguration.less +8 -0
  348. package/src/main/js/sap/ushell/themes/sap_hcb/base_Tile.less +223 -0
  349. package/src/main/js/sap/ushell/themes/sap_hcb/base_TileBase.less +152 -0
  350. package/src/main/js/sap/ushell/themes/sap_hcb/base_TileContainer.less +495 -0
  351. package/src/main/js/sap/ushell/themes/sap_hcb/base_TilePlaceholder.less +75 -0
  352. package/src/main/js/sap/ushell/themes/sap_hcb/base_TileState.less +62 -0
  353. package/src/main/js/sap/ushell/themes/sap_hcb/base_ToolAreaItem.less +85 -0
  354. package/src/main/js/sap/ushell/themes/sap_hcb/base_UserActionsMenu.less +23 -0
  355. package/src/main/js/sap/ushell/themes/sap_hcb/base_UserConsentDialog.less +52 -0
  356. package/src/main/js/sap/ushell/themes/sap_hcb/base_UserSettings.less +109 -0
  357. package/src/main/js/sap/ushell/themes/sap_hcb/base_ViewPortContainer.less +28 -0
  358. package/src/main/js/sap/ushell/themes/sap_hcb/base_WorkPage.less +58 -0
  359. package/src/main/js/sap/ushell/themes/sap_hcb/base_WorkPageButton.less +60 -0
  360. package/src/main/js/sap/ushell/themes/sap_hcb/base_WorkPageCell.less +144 -0
  361. package/src/main/js/sap/ushell/themes/sap_hcb/base_WorkPageColumn.less +39 -0
  362. package/src/main/js/sap/ushell/themes/sap_hcb/base_WorkPageColumnResizer.less +128 -0
  363. package/src/main/js/sap/ushell/themes/sap_hcb/base_WorkPageRow.less +987 -0
  364. package/src/main/js/sap/ushell/themes/sap_hcb/base_shared.less +40 -0
  365. package/src/main/js/sap/ushell/themes/sap_hcb/library.source.less +70 -1
  366. package/src/main/js/sap/ushell/ui/ShellHeader.fragment.xml +17 -11
  367. package/src/main/js/sap/ushell/ui/ShellHeader.js +10 -3
  368. package/src/main/js/sap/ushell/ui/cards/FrequentActivitiesExtension.js +0 -4
  369. package/src/main/js/sap/ushell/ui/cards/RecentActivitiesExtension.js +1 -5
  370. package/src/main/js/sap/ushell/ui/footerbar/AddBookmarkButton.js +19 -5
  371. package/src/main/js/sap/ushell/ui/footerbar/ContactSupportDialog.controller.js +9 -3
  372. package/src/main/js/sap/ushell/ui/footerbar/SendAsEmailButton.js +5 -5
  373. package/src/main/js/sap/ushell/ui/launchpad/ExtendedChangeDetection.js +1 -1
  374. package/src/main/js/sap/ushell/ui/launchpad/Section.js +1 -1
  375. package/src/main/js/sap/ushell/ui/launchpad/TileContainer.js +17 -12
  376. package/src/main/js/sap/ushell/ui/launchpad/section/CompactArea.js +1 -1
  377. package/src/main/js/sap/ushell/ui/shell/ShellAppTitle.js +50 -35
  378. package/src/main/js/sap/ushell/ui/shell/ToolAreaItem.js +2 -2
  379. package/src/main/js/sap/ushell/ui/utils.js +1 -1
  380. package/src/main/js/sap/ushell/ui5service/ShellUIService.js +1 -1
  381. package/src/main/js/sap/ushell/ui5service/UserStatus.js +1 -1
  382. package/src/main/js/sap/ushell/utils/UrlShortening.js +1 -1
  383. package/src/main/js/sap/ushell/utils/WindowUtils.js +3 -3
  384. package/src/main/js/sap/ushell/utils/workpage/DestinationResolver.js +89 -0
  385. package/src/main/js/sap/ushell/utils/workpage/WorkPageHost.js +51 -47
  386. package/src/main/js/sap/ushell/utils/workpage/WorkPageService.js +32 -1
  387. package/src/main/js/sap/ushell/utils/workpage/WorkPageVizInstantiation.js +1 -1
  388. package/src/main/js/sap/ushell/utils.js +26 -2
  389. package/src/test/js/sap/ushell/bootstrap/sandbox.js +1 -1
  390. package/src/main/js/sap/ushell/bootstrap/common/common.load.ui5theme.js +0 -67
  391. package/src/main/js/sap/ushell/components/HeaderManager.js +0 -547
  392. package/src/main/js/sap/ushell/components/StateHelper.js +0 -70
  393. package/src/main/js/sap/ushell/components/_HeaderManager/AddHeadEndItemsStrategy.js +0 -105
  394. package/src/main/js/sap/ushell/components/_HeaderManager/AddHeadItemsStrategy.js +0 -75
  395. package/src/main/js/sap/ushell/components/_HeaderManager/ControlManager.js +0 -70
  396. package/src/main/js/sap/ushell/components/_HeaderManager/ExtendApplicationPropertyStrategy.js +0 -18
  397. package/src/main/js/sap/ushell/components/_HeaderManager/PropertyStrategiesFactory.js +0 -58
  398. package/src/main/js/sap/ushell/components/_HeaderManager/RemoveItemsStrategy.js +0 -46
  399. package/src/main/js/sap/ushell/components/_HeaderManager/SetHeadPropertyStrategy.js +0 -19
  400. package/src/main/js/sap/ushell/components/applicationIntegration/elements/model.js +0 -1309
  401. package/src/main/js/sap/ushell/components/applicationIntegration/relatedShellElements/RelatedShellElements.js +0 -363
@@ -2,7 +2,7 @@
2
2
 
3
3
  /**
4
4
  * @file WorkPageBuilder controller for WorkPageBuilder view
5
- * @version 1.126.1
5
+ * @version 1.127.0
6
6
  */
7
7
  sap.ui.define([
8
8
  "sap/base/Log",
@@ -60,7 +60,7 @@ sap.ui.define([
60
60
  "use strict";
61
61
 
62
62
  // shortcut for sap.ui.core.ValueState
63
- var ValueState = coreLibrary.ValueState;
63
+ var ValueState = coreLibrary.ValueState;
64
64
 
65
65
  // PR: Provider, CO: (Content) Administrator, PG: Page Administrator, US: End User
66
66
  // US is commented for now, because we do not have personalization yet.
@@ -88,2038 +88,2031 @@ sap.ui.define([
88
88
  */
89
89
  return Controller.extend("sap.ushell.components.workPageBuilder.controller.WorkPageBuilder", /** @lends sap.ushell.components.workPageBuilder.controller.WorkPageBuilder.prototype */ {
90
90
 
91
- onInit: async function () {
92
- var oWorkPage = this.byId("workPage");
93
- this._fnDeleteRowHandler = this.deleteRow.bind(this);
94
- this._fnDeleteCellHandler = this.deleteCell.bind(this);
95
- this._fnSaveCardConfiguration = this._onSaveCardEditor.bind(this);
96
- this._fnResetCardConfiguration = this._onResetCardConfigurations.bind(this);
97
-
98
- this.oModel = new JSONModel({
99
- maxColumns: MAX_COLUMNS_PER_ROW,
100
- editMode: false,
101
- previewMode: false,
102
- loaded: false,
103
- navigationDisabled: false,
104
- showFooter: false,
105
- showPageTitle: true,
106
- data: {
107
- workPage: null,
108
- visualizations: [],
109
- usedVisualizations: []
110
- }
111
- });
112
- this.oModel.setSizeLimit(Infinity);
113
- this._saveHost();
114
-
115
- oWorkPage.bindElement({
116
- path: "/data/workPage"
117
- });
118
-
119
- this.oWorkPageBuilderAccessibility = new WorkPageBuilderAccessibility();
120
- this.oWorkPageVizInstantiation = await WorkPageVizInstantiation.getInstance();
121
-
122
- this.getView().setModel(this.oModel);
123
-
124
- WorkPageBuilderLayoutHelper.register(oWorkPage);
125
- this.getView().setModel(WorkPageBuilderLayoutHelper.getModel(), "viewSettings");
126
- },
127
-
128
- onExit: function () {
129
- WorkPageBuilderLayoutHelper.deregister();
130
-
131
- if (this.oContentFinderPromise) {
132
- this.oContentFinderPromise.then((oComponent) => {
133
- oComponent.destroy();
134
- });
135
- }
136
-
137
- if (this.oCardEditorDialogPromise) {
138
- this.oCardEditorDialogPromise.then((oDialog) => {
139
- oDialog.destroy();
140
- });
141
- }
142
- if (this.oCardResetDialogPromise) {
143
- this.oCardResetDialogPromise.then((oDialog) => {
144
- oDialog.destroy();
145
- });
146
- }
147
- if (this.oDeleteCell) {
148
- this.oDeleteCell.then((oDialog) => {
149
- oDialog.destroy();
150
- });
91
+ onInit: async function () {
92
+ var oWorkPage = this.byId("workPage");
93
+ this._fnDeleteRowHandler = this.deleteRow.bind(this);
94
+ this._fnDeleteCellHandler = this.deleteCell.bind(this);
95
+ this._fnSaveCardConfiguration = this._onSaveCardEditor.bind(this);
96
+ this._fnResetCardConfiguration = this._onResetCardConfigurations.bind(this);
97
+
98
+ this.oModel = new JSONModel({
99
+ maxColumns: MAX_COLUMNS_PER_ROW,
100
+ editMode: false,
101
+ previewMode: false,
102
+ loaded: false,
103
+ navigationDisabled: false,
104
+ showFooter: false,
105
+ showPageTitle: true,
106
+ data: {
107
+ workPage: null,
108
+ visualizations: [],
109
+ usedVisualizations: []
151
110
  }
111
+ });
112
+ this.oModel.setSizeLimit(Infinity);
113
+ this._saveHost();
152
114
 
153
- if (this.oLoadDeleteDialog) {
154
- this.oLoadDeleteDialog.then((oDialog) => {
155
- oDialog.destroy();
156
- });
157
- }
158
- },
159
-
160
- /**
161
- * Handler for the "borderReached" event of the GridContainer.
162
- * Calculates which GridContainer in the given direction is the nearest to the currently focused one.
163
- * Afterwards shifts the focus to the found GridContainer. If none is found nothing happens and the focus stays with the current one.
164
- *
165
- * @param {sap.base.Event} oEvent The "borderReached" event of the GridContainer
166
- */
167
- onGridContainerBorderReached: function (oEvent) {
168
- var oWorkPage = this.byId("workPage");
169
- this.oWorkPageBuilderAccessibility._handleBorderReached(oEvent, oWorkPage);
170
- },
171
-
172
- /**
173
- * Handler for the "addColumn" event of the WorkPageColumn.
174
- * Creates an empty column on the left or the right of the event source and calculates
175
- * the new width of the neighboring columns.
176
- *
177
- * @param {sap.base.Event} oEvent The "addColumn" event.
178
- */
179
- onAddColumn: function (oEvent) {
180
- var oModel = this.getView().getModel();
181
- var oColumnControl = oEvent.getSource();
182
- var oRow = oColumnControl.getParent();
183
- var iColumnIndex = oRow.indexOfAggregation("columns", oColumnControl);
184
- var sRowBindingContextPath = oRow.getBindingContext().getPath();
185
- var sColumnPath = sRowBindingContextPath + "/columns/";
186
- var sColumnColumnWidthPath = oColumnControl.getBindingContext().getPath() + "/descriptor/value/columnWidth";
187
- var aColumnsData = oModel.getProperty(sColumnPath);
188
- var iColumnCount = aColumnsData.length;
189
- var bAddToLeft = oEvent.getParameter("left");
190
- if (iColumnCount >= MAX_COLUMNS_PER_ROW) {
191
- return;
192
- }
193
- var iColumnWidth = oColumnControl.getProperty("columnWidth");
194
- var iColSize = Math.floor(iColumnWidth / 2) >= MIN_GRID_COLUMN_WIDTH ? Math.floor(iColumnWidth / 2) : MIN_GRID_COLUMN_WIDTH;
195
- var iModulo = iColSize % 2;
196
- oModel.setProperty(sColumnColumnWidthPath, iColSize + iModulo);
115
+ oWorkPage.bindElement({
116
+ path: "/data/workPage"
117
+ });
197
118
 
198
- var iIndex = oRow.indexOfAggregation("columns", oColumnControl) + (bAddToLeft === true ? 0 : 1);
199
- var oNewColumn = this._createEmptyColumn(iColSize - iModulo);
119
+ this.oWorkPageBuilderAccessibility = new WorkPageBuilderAccessibility();
120
+ this.oWorkPageVizInstantiation = await WorkPageVizInstantiation.getInstance();
200
121
 
201
- // Insert the new column by creating a new array to avoid mutation of the original array.
202
- var aNewColumnsData = [aColumnsData.slice(0, iIndex), oNewColumn, aColumnsData.slice(iIndex)].flat();
122
+ this.getView().setModel(this.oModel);
203
123
 
204
- var iTotalColumns = aNewColumnsData.reduce(function (iAccumulator, oSingleColumn) {
205
- return iAccumulator + this._getColumnWidth(oSingleColumn);
206
- }.bind(this), 0);
124
+ WorkPageBuilderLayoutHelper.register(oWorkPage);
125
+ this.getView().setModel(WorkPageBuilderLayoutHelper.getModel(), "viewSettings");
126
+ },
207
127
 
208
- if (iTotalColumns > MAX_GRID_COLUMN_WIDTH) {
209
- this._calculateColWidths(aNewColumnsData, iColumnIndex, iTotalColumns);
210
- }
211
- oModel.setProperty(sColumnPath, aNewColumnsData);
212
- this.getOwnerComponent().fireEvent("workPageEdited");
213
- },
214
-
215
- /**
216
- * Sets the focus on the first item in the first GridContainer on the WorkPage.
217
- *
218
- * @param {sap.base.Event} oEvent The afterRendering event.
219
- * @since 1.116.0
220
- * @private
221
- */
222
- focusFirstItem: function (oEvent) {
223
- var oWorkPage = oEvent.getSource();
224
- this.oWorkPageBuilderAccessibility.focusFirstItem(oWorkPage);
225
- },
226
-
227
- /**
228
- * Set the editMode to true or false
229
- * @param {boolean} bEditMode true or false
230
- *
231
- * @private
232
- * @since 1.109.0
233
- */
234
- setEditMode: function (bEditMode) {
235
- this.oModel.setProperty("/editMode", !!bEditMode);
236
- },
237
-
238
- /**
239
- * Set the previewMode to true or false
240
- * @param {boolean} bPreviewMode true or false
241
- *
242
- * @private
243
- * @since 1.116.0
244
- */
245
- setPreviewMode: function (bPreviewMode) {
246
- this.oModel.setProperty("/previewMode", !!bPreviewMode);
247
- },
248
-
249
- /**
250
- * Get the previewMode property from the model
251
- * @returns {boolean} the previewMode property value
252
- * @private
253
- * @since 1.116.0
254
- */
255
- getPreviewMode: function () {
256
- return this.oModel.getProperty("/previewMode");
257
- },
258
-
259
- /**
260
- * Get the editMode property from the model
261
- * @returns {boolean} the editMode property value
262
- * @private
263
- * @since 1.109.0
264
- */
265
- getEditMode: function () {
266
- return this.oModel.getProperty("/editMode");
267
- },
268
-
269
- /**
270
- * Set the showFooter property to true or false
271
- * @param {boolean} bVisible true or false
272
- *
273
- * @private
274
- * @since 1.110.0
275
- */
276
- setShowFooter: function (bVisible) {
277
- this.oModel.setProperty("/showFooter", !!bVisible);
278
- },
279
-
280
- /**
281
- * Set the showPageTitle property to true or false
282
- * @param {boolean} bVisible true or false
283
- *
284
- * @private
285
- * @since 1.116.0
286
- */
287
- setShowPageTitle: function (bVisible) {
288
- this.oModel.setProperty("/showPageTitle", !!bVisible);
289
- },
290
-
291
- /**
292
- * Set the model data with the WorkPage data
293
- * @param {{workPage: object, usedVisualizations: object[]}} oPageData WorkPage data object
294
- *
295
- * @private
296
- * @since 1.109.0
297
- */
298
- setPageData: function (oPageData) {
299
- var oMappedVisualizations = {};
300
- var aUsedVisualizations = ObjectPath.get("workPage.usedVisualizations.nodes", oPageData);
301
- var oWorkPageContents = ObjectPath.get("workPage.contents", oPageData);
302
-
303
- if (aUsedVisualizations && aUsedVisualizations.length > 0) {
304
- // create a map for the usedVisualizations using the id as a key.
305
- oMappedVisualizations = aUsedVisualizations.reduce(function (oAcc, oViz) {
306
- oAcc[oViz.id] = oViz;
307
- return oAcc;
308
- }, {});
309
- }
128
+ onExit: function () {
129
+ WorkPageBuilderLayoutHelper.deregister();
310
130
 
311
- this.oModel.setProperty("/data/usedVisualizations", oMappedVisualizations);
312
- this.oModel.setProperty("/data/workPage", oWorkPageContents);
313
- this.oModel.setProperty("/loaded", true);
314
- },
315
-
316
- /**
317
- * Get the WorkPage data from the model.
318
- * It must also include the usedVisualizations array, because of the reuse scenario.
319
- * It is necessary that the same data structure is returned that is put into setPageData.
320
- *
321
- * @returns {{workPage: {contents: object, usedVisualizations: {nodes: object[]} }}} The WorkPage data to save.
322
- * @private
323
- * @since 1.109.0
324
- */
325
- getPageData: function () {
326
- var oMappedVisualizations = this.oModel.getProperty("/data/usedVisualizations") || {};
327
- return {
328
- workPage: {
329
- contents: this.oModel.getProperty("/data/workPage"),
330
- usedVisualizations: {
331
- nodes: Object.values(oMappedVisualizations)
332
- }
333
- }
334
- };
335
- },
336
-
337
- /**
338
- * Set the paginated visualization data for the ContentFinder.
339
- *
340
- * @param {{visualizations: {nodes: object[]}}} oVizNodes an Array of Visualizations' objects
341
- * @returns {Promise} A promise resolving when the data has been set to the contentFinder
342
- *
343
- * @private
344
- * @since 1.115.0
345
- */
346
- setVisualizationData: function (oVizNodes) {
347
- return this.oContentFinderPromise.then(function (oContentFinder) {
348
- oContentFinder.setVisualizationData(oVizNodes);
131
+ if (this.oContentFinderPromise) {
132
+ this.oContentFinderPromise.then((oComponent) => {
133
+ oComponent.destroy();
349
134
  });
350
- },
351
-
352
- /**
353
- * Called if the amount of grid columns in the GridContainer of a WorkPageCell changes.
354
- * Sets all the cards in the cell to the new amount of columns.
355
- *
356
- * @param {sap.base.Event} oEvent The gridColumnsChange event.
357
- */
358
- onGridColumnsChange: function (oEvent) {
359
- var iColumnCount = oEvent.getParameter("columns");
360
- var oCell = oEvent.getSource();
361
-
362
- oCell.getWidgets().filter(function (oItem) {
363
- return oItem.isA("sap.ui.integration.widgets.Card");
364
- }).forEach(function (oCard) {
365
- oCard.setLayoutData(new GridContainerItemLayoutData({
366
- columns: iColumnCount,
367
- minRows: 1
368
- }));
135
+ }
136
+
137
+ if (this.oCardEditorDialogPromise) {
138
+ this.oCardEditorDialogPromise.then((oDialog) => {
139
+ oDialog.destroy();
369
140
  });
370
- },
371
-
372
- /**
373
- * Handler for the "removeColumn" event of the WorkPageColumn.
374
- * Removes the column that issues the event and calculates the width of the remaining columns.
375
- *
376
- * @param {sap.base.Event} oEvent The "removeColumn" event.
377
- */
378
- onDeleteColumn: function (oEvent) {
379
- var oModel = this.getView().getModel();
380
- var oColumn = oEvent.getSource();
381
- var iColumnWidth = oColumn.getColumnWidth();
382
- var oRow = oColumn.getParent();
383
- var iColumnIndex = oRow.indexOfAggregation("columns", oColumn);
384
- var sRowBindingContextPath = oRow.getBindingContext().getPath();
385
- var sColumnPath = sRowBindingContextPath + "/columns/";
386
- var aColumns = oModel.getProperty(sColumnPath);
387
-
388
- // filter out the column at the iColumnIndex instead of splicing to avoid mutation of the original array.
389
- var aNewColumns = aColumns.filter(function (oCol, iIndex) {
390
- return iIndex !== iColumnIndex;
141
+ }
142
+ if (this.oCardResetDialogPromise) {
143
+ this.oCardResetDialogPromise.then((oDialog) => {
144
+ oDialog.destroy();
391
145
  });
392
-
393
- // split the columnWidth among remaining cols
394
- var iLoopCount = (iColumnWidth / 2);
395
- var iIndex = iColumnIndex - 1 < 0 ? iColumnIndex : iColumnIndex - 1;
396
- while (iLoopCount > 0) {
397
- var oCurrentColumn = aNewColumns[iIndex];
398
- this._setColumnWidth(oCurrentColumn, (this._getColumnWidth(oCurrentColumn)) + STEP_SIZE);
399
- iIndex = ++iIndex >= aNewColumns.length ? 0 : iIndex++;
400
- iLoopCount--;
401
- }
402
-
403
- oModel.setProperty(sColumnPath, aNewColumns);
404
- // Invalidate row to render correct css class for amount of columns.
405
- oRow.invalidate();
406
- this.getOwnerComponent().fireEvent("workPageEdited");
407
- },
408
-
409
- /**
410
- * Handler for the "Add Row" button on an empty WorkPage.
411
- * Creates an array with an empty row and sets it to the model.
412
- *
413
- */
414
- onAddFirstRow: function () {
415
- var sRowsPath = "/data/workPage/rows/";
416
- this.getView().getModel().setProperty(sRowsPath, [this._createEmptyRow()]);
417
- this.getOwnerComponent().fireEvent("workPageEdited");
418
- },
419
-
420
- /**
421
- * Handler for the "Add Row" button on a WorkPageRow.
422
- * Creates a new empty row and adds it to the existing rows.
423
- *
424
- * @param {sap.base.Event} oEvent The "addRow" event.
425
- */
426
- onAddRow: function (oEvent) {
427
- var oModel = this.getView().getModel();
428
- var oRow = oEvent.getSource();
429
- var oPage = this.byId("workPage");
430
- var sRowsPath = "/data/workPage/rows/";
431
- var aRows = oModel.getProperty(sRowsPath);
432
- var oNewRow = this._createEmptyRow();
433
-
434
- var iIndex = oPage.indexOfAggregation("rows", oRow) + (oEvent.getParameter("bottom") === true ? 1 : 0);
435
-
436
- // Insert the new row into the array by creating a new array to avoid mutation.
437
- var aNewRows = [aRows.slice(0, iIndex), oNewRow, aRows.slice(iIndex)].flat();
438
-
439
- oModel.setProperty(sRowsPath, aNewRows);
440
- this.getOwnerComponent().fireEvent("workPageEdited");
441
- },
442
-
443
- /**
444
- * Handler for the "columnResized" event issued by the WorkPageColumn.
445
- * Calculates the required resize steps left or right and updates the model accordingly.
446
- *
447
- * @param {sap.base.Event} oEvent The "columnResized" event.
448
- */
449
- onResize: function (oEvent) {
450
- var iDiff = oEvent.getParameter("posXDiff");
451
- var oColumn = oEvent.getSource();
452
- var oRow = oColumn.getParent();
453
- var iSingleColumnWidthPx = oRow.getSingleColumnWidth();
454
-
455
- if (iSingleColumnWidthPx <= 0) { return; }
456
-
457
- var bRtl = Localization.getRTL();
458
- var fDeltaFromOrigin = iDiff / iSingleColumnWidthPx;
459
-
460
- if (fDeltaFromOrigin > -1 && fDeltaFromOrigin < 1) { return; }
461
-
462
- var iColumnsDelta = fDeltaFromOrigin < 0 ? Math.floor(iDiff / iSingleColumnWidthPx) : Math.ceil(iDiff / iSingleColumnWidthPx);
463
- var sDragDirection = iColumnsDelta >= 0 ? "right" : "left";
464
- var iFlexStep = sDragDirection === "right" ? STEP_SIZE : -STEP_SIZE;
465
- var iRightColumnIndex = oRow.indexOfAggregation("columns", oColumn);
466
- var iLeftColumnIndex = iRightColumnIndex - 1;
467
- var aColumnFlexValues = oRow.getColumnFlexValues();
468
-
469
- iFlexStep = bRtl ? iFlexStep : -iFlexStep;
470
-
471
- if (!this._resizeAllowed(
472
- aColumnFlexValues.length,
473
- aColumnFlexValues[iLeftColumnIndex],
474
- aColumnFlexValues[iRightColumnIndex],
475
- iFlexStep
476
- )) {
477
- return;
478
- }
479
-
480
- aColumnFlexValues[iLeftColumnIndex] -= iFlexStep;
481
- aColumnFlexValues[iRightColumnIndex] += iFlexStep;
482
-
483
- oRow.setGridLayoutString(aColumnFlexValues);
484
- this._updateModelWithColumnWidths(oRow, iLeftColumnIndex, iRightColumnIndex, aColumnFlexValues[iLeftColumnIndex], aColumnFlexValues[iRightColumnIndex]);
485
- },
486
-
487
- /**
488
- * Checks if WorkPageColumn resize is allowed based on the given input parameters.
489
- *
490
- * @param {int} iColumnCount The count of WorkPageColumns in this row.
491
- * @param {int} iLeftFlex The old flex value of the left column.
492
- * @param {int} iRightFlex The old flex value of the right column.
493
- * @param {int} iFlexStep The step to decrease / increase both columns.
494
- * @returns {boolean} The result.
495
- * @private
496
- * @since 1.118.0
497
- */
498
- _resizeAllowed: function (iColumnCount, iLeftFlex, iRightFlex, iFlexStep) {
499
- var oViewSettingsModel = this.getView().getModel("viewSettings");
500
- var iColumnMinFlex = oViewSettingsModel.getProperty("/currentBreakpoint/columnMinFlex");
501
-
502
- // resize to left would result in too small column on the left
503
- if (iLeftFlex - iFlexStep < iColumnMinFlex) { return false; }
504
-
505
- // resize to right would result in too small column on the right
506
- if (iRightFlex + iFlexStep < iColumnMinFlex) { return false; }
507
-
508
- var iMaxColumnsPerRow = oViewSettingsModel.getProperty("/currentBreakpoint/maxColumnsPerRow");
509
-
510
- // no resize allowed if there is a line break for WorkPageRows
511
- if (iColumnCount > iMaxColumnsPerRow) { return false; }
512
-
513
- return true;
514
- },
515
-
516
- /**
517
- * Handler for the "columnResizeCompleted" event issued by the WorkPageColumn.
518
- * Fires the "workPageEdited" event to indicate that there was a data change.
519
- *
520
- */
521
- onResizeCompleted: function () {
522
- this.getOwnerComponent().fireEvent("workPageEdited");
523
- },
524
-
525
- /**
526
- * Handler for the "press" event in the WorkPageCell OverflowToolbar button.
527
- * Opens a confirmation dialog for widgets, except cards.
528
- *
529
- * @param {sap.base.Event} oEvent The button click event.
530
- * @returns {Promise} A promise resolving when the dialog was opened or the card was deleted.
531
- */
532
- onDeleteCell: function (oEvent) {
533
- var oCell = oEvent.getSource().getParent().getParent();
534
-
535
- // No dialog is shown if the ell contains only a card.
536
- var aWidgets = oCell.getWidgets();
537
- if (aWidgets?.[0] && aWidgets.length === 1 && aWidgets[0].isA("sap.ui.integration.widgets.Card")) {
538
- return this.deleteCell(oEvent, {
539
- cell: oCell,
540
- dialog: false
541
- });
542
- }
543
-
544
- // Show dialog for all other widgets.
545
- if (!this.oDeleteCell) {
546
- var oRootView = this.getOwnerComponent().getRootControl();
547
- this.oDeleteCell = Fragment.load({
548
- id: oRootView.createId("cellDeleteDialog"),
549
- name: "sap.ushell.components.workPageBuilder.view.WorkPageCellDeleteDialog",
550
- controller: this
551
- }).then(function (oDialog) {
552
- oDialog.setModel(this.getView().getModel("i18n"), "i18n");
553
- return oDialog;
554
- }.bind(this));
555
- }
556
-
557
- return this.oDeleteCell.then(function (oDialog) {
558
- oDialog.getBeginButton().detachEvent("press", this._fnDeleteCellHandler);
559
- oDialog.getBeginButton().attachEvent("press", {
560
- cell: oCell,
561
- dialog: true
562
- }, this._fnDeleteCellHandler);
563
- oDialog.open();
564
- }.bind(this));
565
- },
566
-
567
- /**
568
- * Deletes the cell from the model.
569
- *
570
- * @param {sap.base.Event} oEvent The button click event.
571
- */
572
-
573
- /**
574
- * Deletes the provided cell.
575
- *
576
- * @param {sap.base.Event} oEvent The "press" event.
577
- * @param {object} cellData Object containing the cell to delete.
578
- * @param {sap.ushell.components.workPageBuilder.controls.WorkPageCell} cellData.cell The cell to delete.
579
- * @param {boolean} cellData.dialog True if a dialog is shown to confirm the deletion.
580
- * @returns {Promise} A promise resolving when the cell has been deleted.
581
- */
582
- deleteCell: function (oEvent, cellData) {
583
- var oCell = cellData.cell;
584
- var oModel = this.getView().getModel();
585
- var oColumn = oCell.getParent();
586
- var iCellIndex = oColumn.indexOfAggregation("cells", oCell);
587
- var sCellsPath = oColumn.getBindingContext().getPath() + "/cells";
588
- var aCells = oModel.getProperty(sCellsPath);
589
-
590
- // Filter out the cell at iCellIndex instead of splicing to avoid mutation of the original array.
591
- var aNewCells = aCells.filter(function (oOriginalCell, iIndex) {
592
- return iIndex !== iCellIndex;
146
+ }
147
+ if (this.oDeleteCell) {
148
+ this.oDeleteCell.then((oDialog) => {
149
+ oDialog.destroy();
593
150
  });
151
+ }
594
152
 
595
- oModel.setProperty(sCellsPath, aNewCells);
596
- this.getOwnerComponent().fireEvent("workPageEdited");
597
- if (cellData.dialog) {
598
- return this.oDeleteCell.then(function (oDialog) {
599
- oDialog.close();
600
- });
601
- }
602
- return Promise.resolve();
603
- },
604
-
605
- /**
606
- * Handler for the "deleteVisualization" event issued by the VizInstance.
607
- * Deletes the visualization from the model.
608
- *
609
- * @param {sap.ushell.ui.launchpad.VizInstanceCdm|sap.ushell.ui.launchpad.VizInstanceLink} oVizInstance the viz instance.
610
- */
611
- _deleteVisualization: function (oVizInstance) {
612
- var oCell = oVizInstance.getParent().getParent();
613
- var oVizInstanceContext = oVizInstance.getBindingContext();
614
- var sVizInstancePath = oVizInstanceContext.getPath();
615
- var oModel = this.getView().getModel();
616
- var sWidgetsPath = sVizInstancePath.substring(0, sVizInstancePath.lastIndexOf("/"));
617
- var iWidgetIndex = oCell.indexOfAggregation("widgets", oVizInstance);
618
- var aWidgets = oModel.getProperty(sWidgetsPath);
619
-
620
- // Filter out the widget at iWidgetIndex instead of splicing to avoid mutation of the original array.
621
- var aNewWidgets = aWidgets.filter(function (oWidget, iIndex) {
622
- return iIndex !== iWidgetIndex;
153
+ if (this.oLoadDeleteDialog) {
154
+ this.oLoadDeleteDialog.then((oDialog) => {
155
+ oDialog.destroy();
623
156
  });
157
+ }
158
+ },
159
+
160
+ /**
161
+ * Handler for the "borderReached" event of the GridContainer.
162
+ * Calculates which GridContainer in the given direction is the nearest to the currently focused one.
163
+ * Afterwards shifts the focus to the found GridContainer. If none is found nothing happens and the focus stays with the current one.
164
+ *
165
+ * @param {sap.base.Event} oEvent The "borderReached" event of the GridContainer
166
+ */
167
+ onGridContainerBorderReached: function (oEvent) {
168
+ var oWorkPage = this.byId("workPage");
169
+ this.oWorkPageBuilderAccessibility._handleBorderReached(oEvent, oWorkPage);
170
+ },
171
+
172
+ /**
173
+ * Handler for the "addColumn" event of the WorkPageColumn.
174
+ * Creates an empty column on the left or the right of the event source and calculates
175
+ * the new width of the neighboring columns.
176
+ *
177
+ * @param {sap.base.Event} oEvent The "addColumn" event.
178
+ */
179
+ onAddColumn: function (oEvent) {
180
+ var oModel = this.getView().getModel();
181
+ var oColumnControl = oEvent.getSource();
182
+ var oRow = oColumnControl.getParent();
183
+ var iColumnIndex = oRow.indexOfAggregation("columns", oColumnControl);
184
+ var sRowBindingContextPath = oRow.getBindingContext().getPath();
185
+ var sColumnPath = sRowBindingContextPath + "/columns/";
186
+ var sColumnColumnWidthPath = oColumnControl.getBindingContext().getPath() + "/descriptor/value/columnWidth";
187
+ var aColumnsData = oModel.getProperty(sColumnPath);
188
+ var iColumnCount = aColumnsData.length;
189
+ var bAddToLeft = oEvent.getParameter("left");
190
+ if (iColumnCount >= MAX_COLUMNS_PER_ROW) {
191
+ return;
192
+ }
193
+ var iColumnWidth = oColumnControl.getProperty("columnWidth");
194
+ var iColSize = Math.floor(iColumnWidth / 2) >= MIN_GRID_COLUMN_WIDTH ? Math.floor(iColumnWidth / 2) : MIN_GRID_COLUMN_WIDTH;
195
+ var iModulo = iColSize % 2;
196
+ oModel.setProperty(sColumnColumnWidthPath, iColSize + iModulo);
624
197
 
625
- oModel.setProperty(sWidgetsPath, aNewWidgets);
626
- this.getOwnerComponent().fireEvent("workPageEdited");
627
- },
628
-
629
- /**
630
- * Handler for the "change" event of the edit title input.
631
- * Set the dirty flag
632
- */
633
- onEditTitle: function () {
634
- this.getOwnerComponent().fireEvent("workPageEdited");
635
- },
636
-
637
- /**
638
- * Handler for the "addWidget" event of the ContentFinderDialog.
639
- * Set the dirty flag
640
- */
641
- onWidgetAdded: function () {
642
- this.getOwnerComponent().fireEvent("workPageEdited");
643
- },
644
-
645
- /**
646
- * Returns an array of WidgetGroups to set then in the Content Finder's widget gallery
647
- *
648
- * @since 1.113.0
649
- * @returns {object[]} the WidgetGroups array
650
- * @private
651
- */
652
- _getWidgetGroups: function () {
653
- var oResourceBundle = this.getView().getModel("i18n").getResourceBundle();
654
-
655
- var aWidgetGroups = [{
656
- id: "applicationWidgets",
657
- widgets: [{
658
- id: "widgets-tiles",
659
- title: oResourceBundle.getText("ContentFinder.Widgets.Tiles.Title"),
660
- description: oResourceBundle.getText("ContentFinder.Widgets.Tiles.Description"),
661
- icon: "sap-icon://header",
662
- target: "appSearch_tiles"
663
- }, {
664
- id: "widgets-cards",
665
- title: oResourceBundle.getText("ContentFinder.Widgets.Cards.Title"),
666
- description: oResourceBundle.getText("ContentFinder.Widgets.Cards.Description"),
667
- icon: "sap-icon://card",
668
- target: "appSearch_cards"
669
- }]
670
- }];
671
-
672
- return aWidgetGroups;
673
- },
674
-
675
-
676
- /**
677
- * Create the ContentFinder Component
678
- * @returns {Promise} A Promise that resolves the ContentFinderComponent
679
- *
680
- * @since 1.113.0
681
- * @private
682
- */
683
- createContentFinderComponent: function () {
684
- this.oContentFinderPromise = Component.create({
685
- id: this.getOwnerComponent().createId("workPageContentFinder"),
686
- name: "sap.ushell.components.contentFinder"
687
- });
198
+ var iIndex = oRow.indexOfAggregation("columns", oColumnControl) + (bAddToLeft === true ? 0 : 1);
199
+ var oNewColumn = this._createEmptyColumn(iColSize - iModulo);
688
200
 
689
- return this.oContentFinderPromise;
690
- },
691
-
692
- /**
693
- * Open ContentFinder's WidgetGallery view.
694
- *
695
- * @param {sap.base.Event} oEvent The "addWidget" event.
696
- * @returns {Promise} When resolved, opens the ContentFinder dialog.
697
- *
698
- * @since 1.113.0
699
- * @public
700
- */
701
- openWidgetGallery: function (oEvent) {
702
- var oSource = oEvent.getSource(); //WorkPageColumn
703
-
704
- if (!this.oContentFinderPromise) {
705
- this.oContentFinderPromise = this.createContentFinderComponent();
706
- }
201
+ // Insert the new column by creating a new array to avoid mutation of the original array.
202
+ var aNewColumnsData = [aColumnsData.slice(0, iIndex), oNewColumn, aColumnsData.slice(iIndex)].flat();
707
203
 
708
- return this.oContentFinderPromise.then(function (oContentFinderComponent) {
709
- oContentFinderComponent.setWidgetGroups(this._getWidgetGroups());
710
- oContentFinderComponent.attachVisualizationsAdded(oSource, this._onAddVisualization, this);
711
- oContentFinderComponent.attachVisualizationFilterApplied(oSource, function (oAppliedEvent) {
712
- this.getOwnerComponent().fireEvent("visualizationFilterApplied", oAppliedEvent.getParameters());
713
- }, this);
714
- oContentFinderComponent.show("widgetGallery");
715
- }.bind(this));
716
- },
717
-
718
- /**
719
- * Open ContentFinder's AppSearch view
720
- * @param {sap.base.Event} oEvent The "addApplications" event
721
- * @returns {Promise} Promise that resolves the ContentFinder Component
722
- *
723
- * @since 1.113.0
724
- * @public
725
- */
726
- openTilesAppSearch: function (oEvent) {
727
- var oSource = oEvent.getSource().getParent().getParent(); //WorkPageCell
728
-
729
- if (!this.oContentFinderPromise) {
730
- this.oContentFinderPromise = this.createContentFinderComponent();
731
- }
204
+ var iTotalColumns = aNewColumnsData.reduce(function (iAccumulator, oSingleColumn) {
205
+ return iAccumulator + this._getColumnWidth(oSingleColumn);
206
+ }.bind(this), 0);
732
207
 
733
- return this.oContentFinderPromise.then(function (oContentFinderComponent) {
734
- oContentFinderComponent.setContextData({ restrictedVisualizations: this._getRestrictedVisualizationIds(oSource) });
735
- oContentFinderComponent.setRestrictedMode(true);
736
- oContentFinderComponent.attachVisualizationsAdded(oSource, this._onAddVisualization, this);
737
- oContentFinderComponent.attachVisualizationFilterApplied(oSource, function (oAppliedEvent) {
738
- this.getOwnerComponent().fireEvent("visualizationFilterApplied", oAppliedEvent.getParameters());
739
- }, this);
740
- oContentFinderComponent.show("appSearch_tiles");
741
- }.bind(this));
742
- },
743
-
744
-
745
- /**
746
- * Returns an array of Widget's VizRefIds. The Widgets are contained in the WorkPageCell
747
- *
748
- * @param {sap.ushell.components.workPageBuilder.controls.WorkPageCell} oCell The WorkPageCell control.
749
- * @returns {string[]} The VizRefIds array
750
- *
751
- * @since 1.113.0
752
- * @private
753
- */
754
- _getRestrictedVisualizationIds: function (oCell) {
755
- return oCell.getWidgets().map(function (oWidget) {
756
- if (oWidget.isA("sap.ushell.ui.launchpad.VizInstanceCdm")) {
757
- return oWidget.getProperty("vizRefId");
758
- }
759
- });
760
- },
761
-
762
- /**
763
- * Add Visualization to the WorkPageColum or WorkPageCell
764
- * @param {sap.base.Event} oEvent The "addApplications" event.
765
- * @param {sap.ushell.components.workPageBuilder.controls.WorkPageCell|sap.ushell.components.workPageBuilder.controls.WorkPageColumn} oSource The WorkPageColumn or WorkPageCell control
766
- *
767
- * @since 1.113.0
768
- * @private
769
- */
770
- _onAddVisualization: function (oEvent, oSource) {
771
- const oModel = this.getView().getModel();
772
- var aSelectedVisualizations = oEvent.getParameter("visualizations");
773
-
774
- if (aSelectedVisualizations.length > 0) {
775
- aSelectedVisualizations.forEach(function (oVisualization) {
776
- var sVizSelectedItemPath = "/data/usedVisualizations/" + oVisualization.id;
777
- if (!oModel.getProperty(sVizSelectedItemPath)) {
778
- oModel.setProperty(sVizSelectedItemPath, oVisualization.vizData);
779
- }
780
- });
781
-
782
- var aWidgetData = this._instantiateWidgetData(aSelectedVisualizations);
208
+ if (iTotalColumns > MAX_GRID_COLUMN_WIDTH) {
209
+ this._calculateColWidths(aNewColumnsData, iColumnIndex, iTotalColumns);
210
+ }
211
+ oModel.setProperty(sColumnPath, aNewColumnsData);
212
+ this.getOwnerComponent().fireEvent("workPageEdited");
213
+ },
214
+
215
+ /**
216
+ * Sets the focus on the first item in the first GridContainer on the WorkPage.
217
+ *
218
+ * @param {sap.base.Event} oEvent The afterRendering event.
219
+ * @since 1.116.0
220
+ * @private
221
+ */
222
+ focusFirstItem: function (oEvent) {
223
+ var oWorkPage = oEvent.getSource();
224
+ this.oWorkPageBuilderAccessibility.focusFirstItem(oWorkPage);
225
+ },
226
+
227
+ /**
228
+ * Set the editMode to true or false
229
+ * @param {boolean} bEditMode true or false
230
+ *
231
+ * @private
232
+ * @since 1.109.0
233
+ */
234
+ setEditMode: function (bEditMode) {
235
+ this.oModel.setProperty("/editMode", !!bEditMode);
236
+ },
237
+
238
+ /**
239
+ * Set the previewMode to true or false
240
+ * @param {boolean} bPreviewMode true or false
241
+ *
242
+ * @private
243
+ * @since 1.116.0
244
+ */
245
+ setPreviewMode: function (bPreviewMode) {
246
+ this.oModel.setProperty("/previewMode", !!bPreviewMode);
247
+ },
248
+
249
+ /**
250
+ * Get the previewMode property from the model
251
+ * @returns {boolean} the previewMode property value
252
+ * @private
253
+ * @since 1.116.0
254
+ */
255
+ getPreviewMode: function () {
256
+ return this.oModel.getProperty("/previewMode");
257
+ },
258
+
259
+ /**
260
+ * Get the editMode property from the model
261
+ * @returns {boolean} the editMode property value
262
+ * @private
263
+ * @since 1.109.0
264
+ */
265
+ getEditMode: function () {
266
+ return this.oModel.getProperty("/editMode");
267
+ },
268
+
269
+ /**
270
+ * Set the showFooter property to true or false
271
+ * @param {boolean} bVisible true or false
272
+ *
273
+ * @private
274
+ * @since 1.110.0
275
+ */
276
+ setShowFooter: function (bVisible) {
277
+ this.oModel.setProperty("/showFooter", !!bVisible);
278
+ },
279
+
280
+ /**
281
+ * Set the showPageTitle property to true or false
282
+ * @param {boolean} bVisible true or false
283
+ *
284
+ * @private
285
+ * @since 1.116.0
286
+ */
287
+ setShowPageTitle: function (bVisible) {
288
+ this.oModel.setProperty("/showPageTitle", !!bVisible);
289
+ },
290
+
291
+ /**
292
+ * Set the model data with the WorkPage data
293
+ * @param {{workPage: object, usedVisualizations: object[]}} oPageData WorkPage data object
294
+ *
295
+ * @private
296
+ * @since 1.109.0
297
+ */
298
+ setPageData: function (oPageData) {
299
+ var oMappedVisualizations = {};
300
+ var aUsedVisualizations = ObjectPath.get("workPage.usedVisualizations.nodes", oPageData);
301
+ var oWorkPageContents = ObjectPath.get("workPage.contents", oPageData);
302
+
303
+ if (aUsedVisualizations && aUsedVisualizations.length > 0) {
304
+ // create a map for the usedVisualizations using the id as a key.
305
+ oMappedVisualizations = aUsedVisualizations.reduce(function (oAcc, oViz) {
306
+ oAcc[oViz.id] = oViz;
307
+ return oAcc;
308
+ }, {});
309
+ }
783
310
 
784
- if (oSource.isA("sap.ushell.components.workPageBuilder.controls.WorkPageCell")) {
785
- this._setCellData(oSource, aWidgetData);
786
- }
787
- if (oSource.isA("sap.ushell.components.workPageBuilder.controls.WorkPageColumn")) {
788
- this._setColumnData(oSource, aWidgetData);
311
+ this.oModel.setProperty("/data/usedVisualizations", oMappedVisualizations);
312
+ this.oModel.setProperty("/data/workPage", oWorkPageContents);
313
+ this.oModel.setProperty("/loaded", true);
314
+ },
315
+
316
+ /**
317
+ * Get the WorkPage data from the model.
318
+ * It must also include the usedVisualizations array, because of the reuse scenario.
319
+ * It is necessary that the same data structure is returned that is put into setPageData.
320
+ *
321
+ * @returns {{workPage: {contents: object, usedVisualizations: {nodes: object[]} }}} The WorkPage data to save.
322
+ * @private
323
+ * @since 1.109.0
324
+ */
325
+ getPageData: function () {
326
+ var oMappedVisualizations = this.oModel.getProperty("/data/usedVisualizations") || {};
327
+ return {
328
+ workPage: {
329
+ contents: this.oModel.getProperty("/data/workPage"),
330
+ usedVisualizations: {
331
+ nodes: Object.values(oMappedVisualizations)
789
332
  }
790
333
  }
334
+ };
335
+ },
336
+
337
+ /**
338
+ * Set the paginated visualization data for the ContentFinder.
339
+ *
340
+ * @param {{visualizations: {nodes: object[]}}} oVizNodes an Array of Visualizations' objects
341
+ * @returns {Promise} A promise resolving when the data has been set to the contentFinder
342
+ *
343
+ * @private
344
+ * @since 1.115.0
345
+ */
346
+ setVisualizationData: function (oVizNodes) {
347
+ return this.oContentFinderPromise.then(function (oContentFinder) {
348
+ oContentFinder.setVisualizationData(oVizNodes);
349
+ });
350
+ },
351
+
352
+ /**
353
+ * Called if the amount of grid columns in the GridContainer of a WorkPageCell changes.
354
+ * Sets all the cards in the cell to the new amount of columns.
355
+ *
356
+ * @param {sap.base.Event} oEvent The gridColumnsChange event.
357
+ */
358
+ onGridColumnsChange: function (oEvent) {
359
+ var iColumnCount = oEvent.getParameter("columns");
360
+ var oCell = oEvent.getSource();
361
+
362
+ oCell.getWidgets().filter(function (oItem) {
363
+ return oItem.isA("sap.ui.integration.widgets.Card");
364
+ }).forEach(function (oCard) {
365
+ oCard.setLayoutData(new GridContainerItemLayoutData({
366
+ columns: iColumnCount,
367
+ minRows: 1
368
+ }));
369
+ });
370
+ },
371
+
372
+ /**
373
+ * Handler for the "removeColumn" event of the WorkPageColumn.
374
+ * Removes the column that issues the event and calculates the width of the remaining columns.
375
+ *
376
+ * @param {sap.base.Event} oEvent The "removeColumn" event.
377
+ */
378
+ onDeleteColumn: function (oEvent) {
379
+ var oModel = this.getView().getModel();
380
+ var oColumn = oEvent.getSource();
381
+ var iColumnWidth = oColumn.getColumnWidth();
382
+ var oRow = oColumn.getParent();
383
+ var iColumnIndex = oRow.indexOfAggregation("columns", oColumn);
384
+ var sRowBindingContextPath = oRow.getBindingContext().getPath();
385
+ var sColumnPath = sRowBindingContextPath + "/columns/";
386
+ var aColumns = oModel.getProperty(sColumnPath);
387
+
388
+ // filter out the column at the iColumnIndex instead of splicing to avoid mutation of the original array.
389
+ var aNewColumns = aColumns.filter(function (oCol, iIndex) {
390
+ return iIndex !== iColumnIndex;
391
+ });
392
+
393
+ // split the columnWidth among remaining cols
394
+ var iLoopCount = (iColumnWidth / 2);
395
+ var iIndex = iColumnIndex - 1 < 0 ? iColumnIndex : iColumnIndex - 1;
396
+ while (iLoopCount > 0) {
397
+ var oCurrentColumn = aNewColumns[iIndex];
398
+ this._setColumnWidth(oCurrentColumn, (this._getColumnWidth(oCurrentColumn)) + STEP_SIZE);
399
+ iIndex = ++iIndex >= aNewColumns.length ? 0 : iIndex++;
400
+ iLoopCount--;
401
+ }
791
402
 
792
- },
793
-
794
- /**
795
- * For each selected visualization in the ContentFinder, instantiate the initial WidgetData
796
- * @param {object[]} aSelectedVisualizations The ContentFinder's selected visualizations
797
- * @returns {object[]} The WidgetData array
798
- *
799
- * @since 1.113.0
800
- * @private
801
- */
802
- _instantiateWidgetData: function (aSelectedVisualizations) {
803
- var aIds = [];
804
- var sId;
805
-
806
- return aSelectedVisualizations.map(function (oTile) {
807
- sId = this._generateUniqueId(aIds);
808
- aIds = aIds.concat([sId]);
809
- return {
810
- id: sId,
811
- visualization: {
812
- id: oTile.vizData.id
813
- }
814
- };
815
- }.bind(this));
816
- },
817
-
818
- /**
819
- * Add Widgets into the WorkPageCell's Widgets aggregation
820
- * @param {sap.ushell.components.workPageBuilder.controls.WorkPageCell} oCell The WorkPageCell control.
821
- * @param {object[]} aWidgetData The WidgetData array
822
- *
823
- * @since 1.113.0
824
- * @private
825
- */
826
- _setCellData: function (oCell, aWidgetData) {
827
- const oModel = this.getView().getModel();
828
- var sCellPath = oCell.getBindingContext().getPath();
829
- var oCellData = Object.assign({}, oModel.getProperty(sCellPath));
830
-
831
- oCellData.widgets = oCellData.widgets.concat(aWidgetData);
832
-
833
- oModel.setProperty(sCellPath, oCellData);
834
- this.onWidgetAdded();
835
- },
836
-
837
- /**
838
- * Add Widgets into WorkPageColumn's Cell aggregation
839
- * @param {sap.ushell.components.workPageBuilder.controls.WorkPageColumn} oColumn The WorkPageCell control.
840
- * @param {object[]} aWidgetData The WidgetData array
841
- * @param {int|undefined} iPosition The position where the new Cell should be placed. Defaults to the end if undefined
842
- *
843
- * @since 1.113.0
844
- * @private
845
- */
846
- _setColumnData: function (oColumn, aWidgetData, iPosition) {
847
- const oModel = this.getView().getModel();
848
- let sColumnPath = oColumn.getBindingContext().getPath();
849
- let oColumnData = Object.assign({}, oModel.getProperty(sColumnPath));
850
- let oNewCellData = {
851
- id: this._generateUniqueId(),
852
- descriptor: {
853
- value: {},
854
- schemaVersion: "3.2.0"
855
- },
856
- widgets: aWidgetData.concat([])
857
- };
858
-
859
- if (!oColumnData.cells) {
860
- oColumnData.cells = [];
861
- }
403
+ oModel.setProperty(sColumnPath, aNewColumns);
404
+ // Invalidate row to render correct css class for amount of columns.
405
+ oRow.invalidate();
406
+ this.getOwnerComponent().fireEvent("workPageEdited");
407
+ },
408
+
409
+ /**
410
+ * Handler for the "Add Row" button on an empty WorkPage.
411
+ * Creates an array with an empty row and sets it to the model.
412
+ *
413
+ */
414
+ onAddFirstRow: function () {
415
+ var sRowsPath = "/data/workPage/rows/";
416
+ this.getView().getModel().setProperty(sRowsPath, [this._createEmptyRow()]);
417
+ this.getOwnerComponent().fireEvent("workPageEdited");
418
+ },
419
+
420
+ /**
421
+ * Handler for the "Add Row" button on a WorkPageRow.
422
+ * Creates a new empty row and adds it to the existing rows.
423
+ *
424
+ * @param {sap.base.Event} oEvent The "addRow" event.
425
+ */
426
+ onAddRow: function (oEvent) {
427
+ var oModel = this.getView().getModel();
428
+ var oRow = oEvent.getSource();
429
+ var oPage = this.byId("workPage");
430
+ var sRowsPath = "/data/workPage/rows/";
431
+ var aRows = oModel.getProperty(sRowsPath);
432
+ var oNewRow = this._createEmptyRow();
433
+
434
+ var iIndex = oPage.indexOfAggregation("rows", oRow) + (oEvent.getParameter("bottom") === true ? 1 : 0);
435
+
436
+ // Insert the new row into the array by creating a new array to avoid mutation.
437
+ var aNewRows = [aRows.slice(0, iIndex), oNewRow, aRows.slice(iIndex)].flat();
438
+
439
+ oModel.setProperty(sRowsPath, aNewRows);
440
+ this.getOwnerComponent().fireEvent("workPageEdited");
441
+ },
442
+
443
+ /**
444
+ * Handler for the "columnResized" event issued by the WorkPageColumn.
445
+ * Calculates the required resize steps left or right and updates the model accordingly.
446
+ *
447
+ * @param {sap.base.Event} oEvent The "columnResized" event.
448
+ */
449
+ onResize: function (oEvent) {
450
+ var iDiff = oEvent.getParameter("posXDiff");
451
+ var oColumn = oEvent.getSource();
452
+ var oRow = oColumn.getParent();
453
+ var iSingleColumnWidthPx = oRow.getSingleColumnWidth();
454
+
455
+ if (iSingleColumnWidthPx <= 0) { return; }
456
+
457
+ var bRtl = Localization.getRTL();
458
+ var fDeltaFromOrigin = iDiff / iSingleColumnWidthPx;
459
+
460
+ if (fDeltaFromOrigin > -1 && fDeltaFromOrigin < 1) { return; }
461
+
462
+ var iColumnsDelta = fDeltaFromOrigin < 0 ? Math.floor(iDiff / iSingleColumnWidthPx) : Math.ceil(iDiff / iSingleColumnWidthPx);
463
+ var sDragDirection = iColumnsDelta >= 0 ? "right" : "left";
464
+ var iFlexStep = sDragDirection === "right" ? STEP_SIZE : -STEP_SIZE;
465
+ var iRightColumnIndex = oRow.indexOfAggregation("columns", oColumn);
466
+ var iLeftColumnIndex = iRightColumnIndex - 1;
467
+ var aColumnFlexValues = oRow.getColumnFlexValues();
468
+
469
+ iFlexStep = bRtl ? iFlexStep : -iFlexStep;
470
+
471
+ if (!this._resizeAllowed(
472
+ aColumnFlexValues.length,
473
+ aColumnFlexValues[iLeftColumnIndex],
474
+ aColumnFlexValues[iRightColumnIndex],
475
+ iFlexStep
476
+ )) {
477
+ return;
478
+ }
862
479
 
863
- if (iPosition === undefined || iPosition > oColumnData.cells.length) {
864
- iPosition = oColumnData.cells.length;
865
- }
480
+ aColumnFlexValues[iLeftColumnIndex] -= iFlexStep;
481
+ aColumnFlexValues[iRightColumnIndex] += iFlexStep;
482
+
483
+ oRow.setGridLayoutString(aColumnFlexValues);
484
+ this._updateModelWithColumnWidths(oRow, iLeftColumnIndex, iRightColumnIndex, aColumnFlexValues[iLeftColumnIndex], aColumnFlexValues[iRightColumnIndex]);
485
+ },
486
+
487
+ /**
488
+ * Checks if WorkPageColumn resize is allowed based on the given input parameters.
489
+ *
490
+ * @param {int} iColumnCount The count of WorkPageColumns in this row.
491
+ * @param {int} iLeftFlex The old flex value of the left column.
492
+ * @param {int} iRightFlex The old flex value of the right column.
493
+ * @param {int} iFlexStep The step to decrease / increase both columns.
494
+ * @returns {boolean} The result.
495
+ * @private
496
+ * @since 1.118.0
497
+ */
498
+ _resizeAllowed: function (iColumnCount, iLeftFlex, iRightFlex, iFlexStep) {
499
+ var oViewSettingsModel = this.getView().getModel("viewSettings");
500
+ var iColumnMinFlex = oViewSettingsModel.getProperty("/currentBreakpoint/columnMinFlex");
501
+
502
+ // resize to left would result in too small column on the left
503
+ if (iLeftFlex - iFlexStep < iColumnMinFlex) { return false; }
504
+
505
+ // resize to right would result in too small column on the right
506
+ if (iRightFlex + iFlexStep < iColumnMinFlex) { return false; }
507
+
508
+ var iMaxColumnsPerRow = oViewSettingsModel.getProperty("/currentBreakpoint/maxColumnsPerRow");
509
+
510
+ // no resize allowed if there is a line break for WorkPageRows
511
+ if (iColumnCount > iMaxColumnsPerRow) { return false; }
512
+
513
+ return true;
514
+ },
515
+
516
+ /**
517
+ * Handler for the "columnResizeCompleted" event issued by the WorkPageColumn.
518
+ * Fires the "workPageEdited" event to indicate that there was a data change.
519
+ *
520
+ */
521
+ onResizeCompleted: function () {
522
+ this.getOwnerComponent().fireEvent("workPageEdited");
523
+ },
524
+
525
+ /**
526
+ * Handler for the "press" event in the WorkPageCell OverflowToolbar button.
527
+ * Opens a confirmation dialog for widgets, except cards.
528
+ *
529
+ * @param {sap.base.Event} oEvent The button click event.
530
+ * @returns {Promise} A promise resolving when the dialog was opened or the card was deleted.
531
+ */
532
+ onDeleteCell: function (oEvent) {
533
+ var oCell = oEvent.getSource().getParent().getParent();
534
+
535
+ // No dialog is shown if the ell contains only a card.
536
+ var aWidgets = oCell.getWidgets();
537
+ if (aWidgets?.[0] && aWidgets.length === 1 && aWidgets[0].isA("sap.ui.integration.widgets.Card")) {
538
+ return this.deleteCell(oEvent, {
539
+ cell: oCell,
540
+ dialog: false
541
+ });
542
+ }
866
543
 
867
- let aCellCopy = oColumnData.cells.concat([]);
868
- aCellCopy.splice(iPosition, 0, oNewCellData);
869
- oColumnData.cells = aCellCopy;
870
-
871
- oModel.setProperty(sColumnPath, oColumnData);
872
- this.onWidgetAdded();
873
- },
874
-
875
- /**
876
- * Handler for the "press" event in the WorkPageRow OverflowToolbar button.
877
- * Opens a confirmation dialog.
878
- * @returns {Promise} A promise resolving when the dialog was opened.
879
- * @param {sap.base.Event} oEvent The "deleteRow" event.
880
- */
881
- onDeleteRow: function (oEvent) {
544
+ // Show dialog for all other widgets.
545
+ if (!this.oDeleteCell) {
882
546
  var oRootView = this.getOwnerComponent().getRootControl();
883
- var oWorkPageRowContext = oEvent.getSource().getBindingContext();
884
-
885
- if (!this.oLoadDeleteDialog) {
886
- this.oLoadDeleteDialog = Fragment.load({
887
- id: oRootView.createId("rowDeleteDialog"),
888
- name: "sap.ushell.components.workPageBuilder.view.WorkPageRowDeleteDialog",
889
- controller: this
890
- }).then(function (oDialog) {
891
- oDialog.setModel(this.getView().getModel("i18n"), "i18n");
892
- return oDialog;
893
- }.bind(this));
894
- }
895
-
896
- return this.oLoadDeleteDialog.then(function (oDialog) {
897
- oDialog.getBeginButton().detachEvent("press", this._fnDeleteRowHandler);
898
- oDialog.getBeginButton().attachEvent("press", {
899
- rowContext: oWorkPageRowContext
900
- }, this._fnDeleteRowHandler);
901
- oDialog.open();
547
+ this.oDeleteCell = Fragment.load({
548
+ id: oRootView.createId("cellDeleteDialog"),
549
+ name: "sap.ushell.components.workPageBuilder.view.WorkPageCellDeleteDialog",
550
+ controller: this
551
+ }).then(function (oDialog) {
552
+ oDialog.setModel(this.getView().getModel("i18n"), "i18n");
553
+ return oDialog;
902
554
  }.bind(this));
903
- },
904
-
905
- /**
906
- * Deletes the row with the context given in oRowData.
907
- *
908
- * @returns {Promise} A promise resolving when the row has been deleted.
909
- *
910
- * @param {sap.base.Event} oEvent The "press" event.
911
- * @param {object} oRowData Object containing the WorkPageRow context to delete.
912
- */
913
- deleteRow: function (oEvent, oRowData) {
914
- var oModel = this.getView().getModel();
915
- var oWorkPageRowContext = oRowData.rowContext;
916
- var aRows = oModel.getProperty("/data/workPage/rows");
917
- var oRowContextData = oWorkPageRowContext.getObject();
918
-
919
- // Filter out the row with the given id to avoid mutation of the original array.
920
- var aFilteredRows = aRows.filter(function (oRow) {
921
- return oRow.id !== oRowContextData.id;
922
- });
555
+ }
923
556
 
924
- oModel.setProperty("/data/workPage/rows", aFilteredRows);
925
- this.getOwnerComponent().fireEvent("workPageEdited");
926
- return this.oLoadDeleteDialog.then(function (oDialog) {
927
- oDialog.close();
928
- });
929
- },
930
-
931
- /**
932
- * Called when the "Cancel" button is pressed on the RowDelete dialog.
933
- * @returns {Promise} A promise resolving when the dialog has been closed
934
- */
935
- onRowDeleteCancel: function () {
936
- return this.oLoadDeleteDialog.then(function (oDialog) {
937
- oDialog.close();
938
- });
939
- },
940
-
941
- /**
942
- * Called when the "Cancel" button is pressed on the cell delete dialog.
943
- *
944
- * @returns {Promise} A promise resolving when the dialog has been closed
945
- */
946
- onCellDeleteCancel: function () {
557
+ return this.oDeleteCell.then(function (oDialog) {
558
+ oDialog.getBeginButton().detachEvent("press", this._fnDeleteCellHandler);
559
+ oDialog.getBeginButton().attachEvent("press", {
560
+ cell: oCell,
561
+ dialog: true
562
+ }, this._fnDeleteCellHandler);
563
+ oDialog.open();
564
+ }.bind(this));
565
+ },
566
+
567
+ /**
568
+ * Deletes the cell from the model.
569
+ *
570
+ * @param {sap.base.Event} oEvent The button click event.
571
+ */
572
+
573
+ /**
574
+ * Deletes the provided cell.
575
+ *
576
+ * @param {sap.base.Event} oEvent The "press" event.
577
+ * @param {object} cellData Object containing the cell to delete.
578
+ * @param {sap.ushell.components.workPageBuilder.controls.WorkPageCell} cellData.cell The cell to delete.
579
+ * @param {boolean} cellData.dialog True if a dialog is shown to confirm the deletion.
580
+ * @returns {Promise} A promise resolving when the cell has been deleted.
581
+ */
582
+ deleteCell: function (oEvent, cellData) {
583
+ var oCell = cellData.cell;
584
+ var oModel = this.getView().getModel();
585
+ var oColumn = oCell.getParent();
586
+ var iCellIndex = oColumn.indexOfAggregation("cells", oCell);
587
+ var sCellsPath = oColumn.getBindingContext().getPath() + "/cells";
588
+ var aCells = oModel.getProperty(sCellsPath);
589
+
590
+ // Filter out the cell at iCellIndex instead of splicing to avoid mutation of the original array.
591
+ var aNewCells = aCells.filter(function (oOriginalCell, iIndex) {
592
+ return iIndex !== iCellIndex;
593
+ });
594
+
595
+ oModel.setProperty(sCellsPath, aNewCells);
596
+ this.getOwnerComponent().fireEvent("workPageEdited");
597
+ if (cellData.dialog) {
947
598
  return this.oDeleteCell.then(function (oDialog) {
948
599
  oDialog.close();
949
600
  });
950
- },
951
-
952
- /**
953
- * Returns a GenericTile control instance to render in error case.
954
- *
955
- * @returns {sap.m.GenericTile} A GenericTile with state: failed
956
- * @private
957
- */
958
- _createErrorTile: function () {
959
- return new VizInstanceCdm({
960
- state: LoadState.Failed
961
- })
962
- .attachPress(this.onVisualizationPress, this)
963
- .bindEditable("/editMode")
964
- .bindSizeBehavior("viewSettings>/currentBreakpoint/sizeBehavior")
965
- .setLayoutData(new GridContainerItemLayoutData({
966
- columns: 2,
967
- rows: 2
968
- }));
969
- },
970
-
971
- /**
972
- * Creates a widget based on the given widgetContext.
973
- *
974
- * @param {string} sWidgetId The id for the widget.
975
- * @param {sap.ui.model.Context} oWidgetContext The widget context.
976
- * @returns {sap.ushell.ui.launchpad.VizInstance|sap.m.GenericTile|sap.ui.integration.widgets.Card} The resulting control.
977
- */
978
- widgetFactory: function (sWidgetId, oWidgetContext) {
979
- var sVizId = oWidgetContext.getProperty("visualization/id");
980
-
981
- if (!sVizId) {
982
- Log.error("No vizId found in widget context.");
983
- return this._createErrorTile();
984
- }
601
+ }
602
+ return Promise.resolve();
603
+ },
604
+
605
+ /**
606
+ * Handler for the "deleteVisualization" event issued by the VizInstance.
607
+ * Deletes the visualization from the model.
608
+ *
609
+ * @param {sap.ushell.ui.launchpad.VizInstanceCdm|sap.ushell.ui.launchpad.VizInstanceLink} oVizInstance the viz instance.
610
+ */
611
+ _deleteVisualization: function (oVizInstance) {
612
+ var oCell = oVizInstance.getParent().getParent();
613
+ var oVizInstanceContext = oVizInstance.getBindingContext();
614
+ var sVizInstancePath = oVizInstanceContext.getPath();
615
+ var oModel = this.getView().getModel();
616
+ var sWidgetsPath = sVizInstancePath.substring(0, sVizInstancePath.lastIndexOf("/"));
617
+ var iWidgetIndex = oCell.indexOfAggregation("widgets", oVizInstance);
618
+ var aWidgets = oModel.getProperty(sWidgetsPath);
619
+
620
+ // Filter out the widget at iWidgetIndex instead of splicing to avoid mutation of the original array.
621
+ var aNewWidgets = aWidgets.filter(function (oWidget, iIndex) {
622
+ return iIndex !== iWidgetIndex;
623
+ });
624
+
625
+ oModel.setProperty(sWidgetsPath, aNewWidgets);
626
+ this.getOwnerComponent().fireEvent("workPageEdited");
627
+ },
628
+
629
+ /**
630
+ * Handler for the "change" event of the edit title input.
631
+ * Set the dirty flag
632
+ */
633
+ onEditTitle: function () {
634
+ this.getOwnerComponent().fireEvent("workPageEdited");
635
+ },
636
+
637
+ /**
638
+ * Handler for the "addWidget" event of the ContentFinderDialog.
639
+ * Set the dirty flag
640
+ */
641
+ onWidgetAdded: function () {
642
+ this.getOwnerComponent().fireEvent("workPageEdited");
643
+ },
644
+
645
+ /**
646
+ * Returns an array of WidgetGroups to set then in the Content Finder's widget gallery
647
+ *
648
+ * @since 1.113.0
649
+ * @returns {object[]} the WidgetGroups array
650
+ * @private
651
+ */
652
+ _getWidgetGroups: function () {
653
+ var oResourceBundle = this.getView().getModel("i18n").getResourceBundle();
654
+
655
+ var aWidgetGroups = [{
656
+ id: "applicationWidgets",
657
+ widgets: [{
658
+ id: "widgets-tiles",
659
+ title: oResourceBundle.getText("ContentFinder.Widgets.Tiles.Title"),
660
+ description: oResourceBundle.getText("ContentFinder.Widgets.Tiles.Description"),
661
+ icon: "sap-icon://header",
662
+ target: "appSearch_tiles"
663
+ }, {
664
+ id: "widgets-cards",
665
+ title: oResourceBundle.getText("ContentFinder.Widgets.Cards.Title"),
666
+ description: oResourceBundle.getText("ContentFinder.Widgets.Cards.Description"),
667
+ icon: "sap-icon://card",
668
+ target: "appSearch_cards"
669
+ }]
670
+ }];
671
+
672
+ return aWidgetGroups;
673
+ },
674
+
675
+
676
+ /**
677
+ * Create the ContentFinder Component
678
+ * @returns {Promise} A Promise that resolves the ContentFinderComponent
679
+ *
680
+ * @since 1.113.0
681
+ * @private
682
+ */
683
+ createContentFinderComponent: function () {
684
+ this.oContentFinderPromise = Component.create({
685
+ id: this.getOwnerComponent().createId("workPageContentFinder"),
686
+ name: "sap.ushell.components.contentFinder"
687
+ });
688
+
689
+ return this.oContentFinderPromise;
690
+ },
691
+
692
+ /**
693
+ * Open ContentFinder's WidgetGallery view.
694
+ *
695
+ * @param {sap.base.Event} oEvent The "addWidget" event.
696
+ * @returns {Promise} When resolved, opens the ContentFinder dialog.
697
+ *
698
+ * @since 1.113.0
699
+ * @public
700
+ */
701
+ openWidgetGallery: function (oEvent) {
702
+ var oSource = oEvent.getSource(); //WorkPageColumn
703
+
704
+ if (!this.oContentFinderPromise) {
705
+ this.oContentFinderPromise = this.createContentFinderComponent();
706
+ }
985
707
 
986
- var oVizData = this.getView().getModel().getProperty("/data/usedVisualizations/" + sVizId);
708
+ return this.oContentFinderPromise.then(function (oContentFinderComponent) {
709
+ oContentFinderComponent.setWidgetGroups(this._getWidgetGroups());
710
+ oContentFinderComponent.attachVisualizationsAdded(oSource, this._onAddVisualization, this);
711
+ oContentFinderComponent.attachVisualizationFilterApplied(oSource, function (oAppliedEvent) {
712
+ this.getOwnerComponent().fireEvent("visualizationFilterApplied", oAppliedEvent.getParameters());
713
+ }, this);
714
+ oContentFinderComponent.show("widgetGallery");
715
+ }.bind(this));
716
+ },
717
+
718
+ /**
719
+ * Open ContentFinder's AppSearch view
720
+ * @param {sap.base.Event} oEvent The "addApplications" event
721
+ * @returns {Promise} Promise that resolves the ContentFinder Component
722
+ *
723
+ * @since 1.113.0
724
+ * @public
725
+ */
726
+ openTilesAppSearch: function (oEvent) {
727
+ var oSource = oEvent.getSource().getParent().getParent(); //WorkPageCell
728
+
729
+ if (!this.oContentFinderPromise) {
730
+ this.oContentFinderPromise = this.createContentFinderComponent();
731
+ }
987
732
 
988
- if (!oVizData || !oVizData.type) {
989
- Log.error("No viz or vizType found for vizId " + sVizId);
990
- return this._createErrorTile();
733
+ return this.oContentFinderPromise.then(function (oContentFinderComponent) {
734
+ oContentFinderComponent.setContextData({ restrictedVisualizations: this._getRestrictedVisualizationIds(oSource) });
735
+ oContentFinderComponent.setRestrictedMode(true);
736
+ oContentFinderComponent.attachVisualizationsAdded(oSource, this._onAddVisualization, this);
737
+ oContentFinderComponent.attachVisualizationFilterApplied(oSource, function (oAppliedEvent) {
738
+ this.getOwnerComponent().fireEvent("visualizationFilterApplied", oAppliedEvent.getParameters());
739
+ }, this);
740
+ oContentFinderComponent.show("appSearch_tiles");
741
+ }.bind(this));
742
+ },
743
+
744
+
745
+ /**
746
+ * Returns an array of Widget's VizRefIds. The Widgets are contained in the WorkPageCell
747
+ *
748
+ * @param {sap.ushell.components.workPageBuilder.controls.WorkPageCell} oCell The WorkPageCell control.
749
+ * @returns {string[]} The VizRefIds array
750
+ *
751
+ * @since 1.113.0
752
+ * @private
753
+ */
754
+ _getRestrictedVisualizationIds: function (oCell) {
755
+ return oCell.getWidgets().map(function (oWidget) {
756
+ if (oWidget.isA("sap.ushell.ui.launchpad.VizInstanceCdm")) {
757
+ return oWidget.getProperty("vizRefId");
991
758
  }
759
+ });
760
+ },
761
+
762
+ /**
763
+ * Add Visualization to the WorkPageColum or WorkPageCell
764
+ * @param {sap.base.Event} oEvent The "addApplications" event.
765
+ * @param {sap.ushell.components.workPageBuilder.controls.WorkPageCell|sap.ushell.components.workPageBuilder.controls.WorkPageColumn} oSource The WorkPageColumn or WorkPageCell control
766
+ *
767
+ * @since 1.113.0
768
+ * @private
769
+ */
770
+ _onAddVisualization: function (oEvent, oSource) {
771
+ const oModel = this.getView().getModel();
772
+ var aSelectedVisualizations = oEvent.getParameter("visualizations");
773
+
774
+ if (aSelectedVisualizations.length > 0) {
775
+ aSelectedVisualizations.forEach(function (oVisualization) {
776
+ var sVizSelectedItemPath = "/data/usedVisualizations/" + oVisualization.id;
777
+ if (!oModel.getProperty(sVizSelectedItemPath)) {
778
+ oModel.setProperty(sVizSelectedItemPath, oVisualization.vizData);
779
+ }
780
+ });
992
781
 
993
- var aWidgetConfigurations = oWidgetContext.getProperty("configurations") || [];
994
- var aVizConfigurations = oVizData.configurations || [];
995
- var aMergedAndSortedConfigurations = this._getMergedAndSortedConfigurations(aWidgetConfigurations, aVizConfigurations);
996
- var sWidgetContextPath = oWidgetContext.getPath();
997
-
998
- switch (oVizData.type) {
999
- case "sap.card":
1000
- return this._createCard(oVizData, aWidgetConfigurations, aMergedAndSortedConfigurations, sWidgetContextPath);
1001
- case "sap.ushell.StaticAppLauncher":
1002
- case "sap.ushell.DynamicAppLauncher":
1003
- return this._createVizInstance(oVizData);
1004
- default:
1005
- Log.error("Unknown type for widget " + oVizData.type);
1006
- return this._createErrorTile();
782
+ var aWidgetData = this._instantiateWidgetData(aSelectedVisualizations);
783
+
784
+ if (oSource.isA("sap.ushell.components.workPageBuilder.controls.WorkPageCell")) {
785
+ this._setCellData(oSource, aWidgetData);
1007
786
  }
1008
- },
1009
-
1010
- /**
1011
- * @typedef {object} Configuration A configuration entry.
1012
- * @property {string} id the id of the configuration entry.
1013
- * @property {string} level the level of the configuration entry.
1014
- * @property {object} settings map of values that the configuration entry overrides.
1015
- */
1016
-
1017
- /**
1018
- * Group the widget configurations and the visualization configurations by level and then merge settings for each level.
1019
- * The widget configurations override the viz configurations.
1020
- *
1021
- * @since 1.114.0
1022
- * @param {Configuration[]} aWidgetConfigurations The widget configuration items.
1023
- * @param {Configuration[]} aVizConfigurations The viz configuration items.
1024
- * @returns {object[]} The merged array of configurations, sorted by level.
1025
- * @private
1026
- */
1027
- _getMergedAndSortedConfigurations: function (aWidgetConfigurations, aVizConfigurations) {
1028
- // No configurations -> return
1029
- if (aWidgetConfigurations.length === 0 && aVizConfigurations.length === 0) {
1030
- return [];
787
+ if (oSource.isA("sap.ushell.components.workPageBuilder.controls.WorkPageColumn")) {
788
+ this._setColumnData(oSource, aWidgetData);
1031
789
  }
790
+ }
1032
791
 
1033
- // First, widget configurations and viz configurations are merged for each level in CONFIGURATION_LEVELS
1034
- // Second, the merged configurations are sorted
1035
- var oConfigurations = CONFIGURATION_LEVELS.reduce(function (oMergedConfigurations, sLevel) {
1036
- var oWidgetConfigByLevel = aWidgetConfigurations.find(function (oWidgetConfig) {
1037
- return oWidgetConfig.level === sLevel;
1038
- });
1039
- var oVizConfigByLevel = aVizConfigurations.find(function (oVizConfig) {
1040
- return oVizConfig.level === sLevel;
1041
- });
1042
-
1043
- var oMergedConfigurationsByLevel = deepExtend({}, oVizConfigByLevel, oWidgetConfigByLevel);
1044
-
1045
- if (Object.keys(oMergedConfigurationsByLevel).length > 0) {
1046
- oMergedConfigurations[sLevel] = oMergedConfigurationsByLevel;
792
+ },
793
+
794
+ /**
795
+ * For each selected visualization in the ContentFinder, instantiate the initial WidgetData
796
+ * @param {object[]} aSelectedVisualizations The ContentFinder's selected visualizations
797
+ * @returns {object[]} The WidgetData array
798
+ *
799
+ * @since 1.113.0
800
+ * @private
801
+ */
802
+ _instantiateWidgetData: function (aSelectedVisualizations) {
803
+ var aIds = [];
804
+ var sId;
805
+
806
+ return aSelectedVisualizations.map(function (oTile) {
807
+ sId = this._generateUniqueId(aIds);
808
+ aIds = aIds.concat([sId]);
809
+ return {
810
+ id: sId,
811
+ visualization: {
812
+ id: oTile.vizData.id
1047
813
  }
814
+ };
815
+ }.bind(this));
816
+ },
817
+
818
+ /**
819
+ * Add Widgets into the WorkPageCell's Widgets aggregation
820
+ * @param {sap.ushell.components.workPageBuilder.controls.WorkPageCell} oCell The WorkPageCell control.
821
+ * @param {object[]} aWidgetData The WidgetData array
822
+ *
823
+ * @since 1.113.0
824
+ * @private
825
+ */
826
+ _setCellData: function (oCell, aWidgetData) {
827
+ const oModel = this.getView().getModel();
828
+ var sCellPath = oCell.getBindingContext().getPath();
829
+ var oCellData = Object.assign({}, oModel.getProperty(sCellPath));
830
+
831
+ oCellData.widgets = oCellData.widgets.concat(aWidgetData);
832
+
833
+ oModel.setProperty(sCellPath, oCellData);
834
+ this.onWidgetAdded();
835
+ },
836
+
837
+ /**
838
+ * Add Widgets into WorkPageColumn's Cell aggregation
839
+ * @param {sap.ushell.components.workPageBuilder.controls.WorkPageColumn} oColumn The WorkPageCell control.
840
+ * @param {object[]} aWidgetData The WidgetData array
841
+ * @param {int|undefined} iPosition The position where the new Cell should be placed. Defaults to the end if undefined
842
+ *
843
+ * @since 1.113.0
844
+ * @private
845
+ */
846
+ _setColumnData: function (oColumn, aWidgetData, iPosition) {
847
+ const oModel = this.getView().getModel();
848
+ const sColumnPath = oColumn.getBindingContext().getPath();
849
+ const oColumnData = Object.assign({}, oModel.getProperty(sColumnPath));
850
+ const oNewCellData = {
851
+ id: this._generateUniqueId(),
852
+ descriptor: {
853
+ value: {},
854
+ schemaVersion: "3.2.0"
855
+ },
856
+ widgets: aWidgetData.concat([])
857
+ };
858
+
859
+ if (!oColumnData.cells) {
860
+ oColumnData.cells = [];
861
+ }
1048
862
 
1049
- return oMergedConfigurations;
1050
- }, {});
863
+ if (iPosition === undefined || iPosition > oColumnData.cells.length) {
864
+ iPosition = oColumnData.cells.length;
865
+ }
1051
866
 
1052
- return this._sortConfigurations(Object.values(oConfigurations));
1053
- },
867
+ const aCellCopy = oColumnData.cells.concat([]);
868
+ aCellCopy.splice(iPosition, 0, oNewCellData);
869
+ oColumnData.cells = aCellCopy;
870
+
871
+ oModel.setProperty(sColumnPath, oColumnData);
872
+ this.onWidgetAdded();
873
+ },
874
+
875
+ /**
876
+ * Handler for the "press" event in the WorkPageRow OverflowToolbar button.
877
+ * Opens a confirmation dialog.
878
+ * @returns {Promise} A promise resolving when the dialog was opened.
879
+ * @param {sap.base.Event} oEvent The "deleteRow" event.
880
+ */
881
+ onDeleteRow: function (oEvent) {
882
+ var oRootView = this.getOwnerComponent().getRootControl();
883
+ var oWorkPageRowContext = oEvent.getSource().getBindingContext();
884
+
885
+ if (!this.oLoadDeleteDialog) {
886
+ this.oLoadDeleteDialog = Fragment.load({
887
+ id: oRootView.createId("rowDeleteDialog"),
888
+ name: "sap.ushell.components.workPageBuilder.view.WorkPageRowDeleteDialog",
889
+ controller: this
890
+ }).then(function (oDialog) {
891
+ oDialog.setModel(this.getView().getModel("i18n"), "i18n");
892
+ return oDialog;
893
+ }.bind(this));
894
+ }
895
+
896
+ return this.oLoadDeleteDialog.then(function (oDialog) {
897
+ oDialog.getBeginButton().detachEvent("press", this._fnDeleteRowHandler);
898
+ oDialog.getBeginButton().attachEvent("press", {
899
+ rowContext: oWorkPageRowContext
900
+ }, this._fnDeleteRowHandler);
901
+ oDialog.open();
902
+ }.bind(this));
903
+ },
904
+
905
+ /**
906
+ * Deletes the row with the context given in oRowData.
907
+ *
908
+ * @returns {Promise} A promise resolving when the row has been deleted.
909
+ *
910
+ * @param {sap.base.Event} oEvent The "press" event.
911
+ * @param {object} oRowData Object containing the WorkPageRow context to delete.
912
+ */
913
+ deleteRow: function (oEvent, oRowData) {
914
+ var oModel = this.getView().getModel();
915
+ var oWorkPageRowContext = oRowData.rowContext;
916
+ var aRows = oModel.getProperty("/data/workPage/rows");
917
+ var oRowContextData = oWorkPageRowContext.getObject();
918
+
919
+ // Filter out the row with the given id to avoid mutation of the original array.
920
+ var aFilteredRows = aRows.filter(function (oRow) {
921
+ return oRow.id !== oRowContextData.id;
922
+ });
923
+
924
+ oModel.setProperty("/data/workPage/rows", aFilteredRows);
925
+ this.getOwnerComponent().fireEvent("workPageEdited");
926
+ return this.oLoadDeleteDialog.then(function (oDialog) {
927
+ oDialog.close();
928
+ });
929
+ },
930
+
931
+ /**
932
+ * Called when the "Cancel" button is pressed on the RowDelete dialog.
933
+ * @returns {Promise} A promise resolving when the dialog has been closed
934
+ */
935
+ onRowDeleteCancel: function () {
936
+ return this.oLoadDeleteDialog.then(function (oDialog) {
937
+ oDialog.close();
938
+ });
939
+ },
940
+
941
+ /**
942
+ * Called when the "Cancel" button is pressed on the cell delete dialog.
943
+ *
944
+ * @returns {Promise} A promise resolving when the dialog has been closed
945
+ */
946
+ onCellDeleteCancel: function () {
947
+ return this.oDeleteCell.then(function (oDialog) {
948
+ oDialog.close();
949
+ });
950
+ },
951
+
952
+ /**
953
+ * Returns a GenericTile control instance to render in error case.
954
+ *
955
+ * @returns {sap.m.GenericTile} A GenericTile with state: failed
956
+ * @private
957
+ */
958
+ _createErrorTile: function () {
959
+ return new VizInstanceCdm({
960
+ state: LoadState.Failed
961
+ })
962
+ .attachPress(this.onVisualizationPress, this)
963
+ .bindEditable("/editMode")
964
+ .bindSizeBehavior("viewSettings>/currentBreakpoint/sizeBehavior")
965
+ .setLayoutData(new GridContainerItemLayoutData({
966
+ columns: 2,
967
+ rows: 2
968
+ }));
969
+ },
970
+
971
+ /**
972
+ * Creates a widget based on the given widgetContext.
973
+ *
974
+ * @param {string} sWidgetId The id for the widget.
975
+ * @param {sap.ui.model.Context} oWidgetContext The widget context.
976
+ * @returns {sap.ushell.ui.launchpad.VizInstance|sap.m.GenericTile|sap.ui.integration.widgets.Card} The resulting control.
977
+ */
978
+ widgetFactory: function (sWidgetId, oWidgetContext) {
979
+ var sVizId = oWidgetContext.getProperty("visualization/id");
980
+
981
+ if (!sVizId) {
982
+ Log.error("No vizId found in widget context.");
983
+ return this._createErrorTile();
984
+ }
1054
985
 
986
+ var oVizData = this.getView().getModel().getProperty("/data/usedVisualizations/" + sVizId);
1055
987
 
1056
- /**
1057
- * Sort the widget's configuration by level: PR: Provider, CO: (Content) Administrator, PG: Page Administrator, US: End User
1058
- *
1059
- * @since 1.114.0
1060
- * @param {Configuration[]} aConfigurations The configurations.
1061
- * @returns {Configuration[]} The configurations sorted by level.
1062
- * @private
1063
- */
988
+ if (!oVizData || !oVizData.type) {
989
+ Log.error("No viz or vizType found for vizId " + sVizId);
990
+ return this._createErrorTile();
991
+ }
1064
992
 
1065
- _sortConfigurations: function (aConfigurations) {
1066
- var oSortedConfigurations = aConfigurations && aConfigurations.sort(function (oWidgetConfigA, oWidgetConfigB) {
1067
- return CONFIGURATION_LEVELS.indexOf(oWidgetConfigA.level) - CONFIGURATION_LEVELS.indexOf(oWidgetConfigB.level);
1068
- });
993
+ var aWidgetConfigurations = oWidgetContext.getProperty("configurations") || [];
994
+ var aVizConfigurations = oVizData.configurations || [];
995
+ var aMergedAndSortedConfigurations = this._getMergedAndSortedConfigurations(aWidgetConfigurations, aVizConfigurations);
996
+ var sWidgetContextPath = oWidgetContext.getPath();
997
+
998
+ switch (oVizData.type) {
999
+ case "sap.card":
1000
+ return this._createCard(oVizData, aWidgetConfigurations, aMergedAndSortedConfigurations, sWidgetContextPath);
1001
+ case "sap.ushell.StaticAppLauncher":
1002
+ case "sap.ushell.DynamicAppLauncher":
1003
+ return this._createVizInstance(oVizData);
1004
+ default:
1005
+ Log.error("Unknown type for widget " + oVizData.type);
1006
+ return this._createErrorTile();
1007
+ }
1008
+ },
1009
+
1010
+ /**
1011
+ * @typedef {object} Configuration A configuration entry.
1012
+ * @property {string} id the id of the configuration entry.
1013
+ * @property {string} level the level of the configuration entry.
1014
+ * @property {object} settings map of values that the configuration entry overrides.
1015
+ */
1016
+
1017
+ /**
1018
+ * Group the widget configurations and the visualization configurations by level and then merge settings for each level.
1019
+ * The widget configurations override the viz configurations.
1020
+ *
1021
+ * @since 1.114.0
1022
+ * @param {Configuration[]} aWidgetConfigurations The widget configuration items.
1023
+ * @param {Configuration[]} aVizConfigurations The viz configuration items.
1024
+ * @returns {object[]} The merged array of configurations, sorted by level.
1025
+ * @private
1026
+ */
1027
+ _getMergedAndSortedConfigurations: function (aWidgetConfigurations, aVizConfigurations) {
1028
+ // No configurations -> return
1029
+ if (aWidgetConfigurations.length === 0 && aVizConfigurations.length === 0) {
1030
+ return [];
1031
+ }
1069
1032
 
1070
- // PR —> CO —> PG —> US
1071
- return oSortedConfigurations.map(function (oWidgetConfiguration) {
1072
- return oWidgetConfiguration.settings.value;
1033
+ // First, widget configurations and viz configurations are merged for each level in CONFIGURATION_LEVELS
1034
+ // Second, the merged configurations are sorted
1035
+ var oConfigurations = CONFIGURATION_LEVELS.reduce(function (oMergedConfigurations, sLevel) {
1036
+ var oWidgetConfigByLevel = aWidgetConfigurations.find(function (oWidgetConfig) {
1037
+ return oWidgetConfig.level === sLevel;
1073
1038
  });
1074
- },
1075
-
1076
- /**
1077
- * Creates a VizInstance with given vizData using the VizInstantiation service.
1078
- *
1079
- * @since 1.110.0
1080
- * @param {object} oVizData VisualizationData for the visualization.
1081
- * @returns {sap.ushell.ui.launchpad.VizInstance|sap.m.GenericTile} The CDM VizInstance.
1082
- * @private
1083
- */
1084
- _createVizInstance: function (oVizData) {
1085
-
1086
- const oExtendedVizData = deepExtend({}, oVizData, {
1087
- preview: this.oModel.getProperty("/previewMode")
1039
+ var oVizConfigByLevel = aVizConfigurations.find(function (oVizConfig) {
1040
+ return oVizConfig.level === sLevel;
1088
1041
  });
1089
1042
 
1090
- if (this.oModel.getProperty("/navigationDisabled") && oExtendedVizData._siteData) {
1091
- delete oExtendedVizData._siteData.target;
1092
- delete oExtendedVizData._siteData.targetURL;
1093
- }
1094
-
1095
- var oVizInstance = this.oWorkPageVizInstantiation.createVizInstance(oExtendedVizData);
1043
+ var oMergedConfigurationsByLevel = deepExtend({}, oVizConfigByLevel, oWidgetConfigByLevel);
1096
1044
 
1097
- if (!oVizInstance) {
1098
- Log.error("No VizInstance was created.");
1099
- return this._createErrorTile();
1045
+ if (Object.keys(oMergedConfigurationsByLevel).length > 0) {
1046
+ oMergedConfigurations[sLevel] = oMergedConfigurationsByLevel;
1100
1047
  }
1101
1048
 
1102
- return oVizInstance
1103
- .setActive(true)
1104
- .bindPreview("/previewMode")
1105
- .attachPress(this.onVisualizationPress, this)
1106
- .bindEditable("/editMode")
1107
- .bindSizeBehavior("viewSettings>/currentBreakpoint/sizeBehavior")
1108
- .bindClickable({
1109
- path: "/navigationDisabled",
1110
- formatter: function (bValue) {
1111
- return !bValue;
1112
- }
1113
- })
1114
- .setLayoutData(new GridContainerItemLayoutData(oVizInstance.getLayout()));
1115
- },
1116
-
1117
- /**
1118
- * Returns the aria label for a WorkPageRow (section).
1119
- *
1120
- * If there is a title, the title will be returned in a translated string.
1121
- * If there is no tile, the translated string for unnamed sections will be returned, including the position of the section.
1122
- *
1123
- * @param {string} sId The section dom id.
1124
- * @param {object[]} aRows The rows array of the work page.
1125
- * @param {string} sTitle The title of the section.
1126
- * @returns {string} The string to be used as aria-label attribute.
1127
- */
1128
- formatRowAriaLabel: function (sId, aRows = [], sTitle) {
1129
- const i18nBundle = this.getView().getModel("i18n").getResourceBundle();
1130
-
1131
- if (sTitle) { return i18nBundle.getText("WorkPage.Row.Named.AriaLabel", [sTitle]); }
1132
-
1133
- const iIndex = aRows.findIndex((oRow) => oRow.id === sId);
1134
- if (iIndex < 0) { return ""; }
1135
-
1136
- return i18nBundle.getText("WorkPage.Row.Unnamed.AriaLabel", [iIndex + 1]);
1137
- },
1138
-
1139
- /**
1140
- * Seeks the dataSource in the available dataSources.
1141
- *
1142
- * @param {object} oDataSources The available dataSources.
1143
- * @param {object} oIndicatorDataSource The indicator dataSource.
1144
- * @returns {object|null} The dataSource if found.
1145
- * @private
1146
- */
1147
- _getDataSource: function (oDataSources, oIndicatorDataSource) {
1148
- if (!oIndicatorDataSource || !oDataSources) {
1149
- return;
1150
- }
1151
- return oDataSources[oIndicatorDataSource.dataSource];
1152
- },
1153
-
1154
- /**
1155
- * Called if a vizInstance was pressed and proceeds to delete it from the data.
1156
- *
1157
- * @param {sap.base.Event} oEvent The press event.
1158
- */
1159
- onVisualizationPress: function (oEvent) {
1160
- var sScope = oEvent.getParameter("scope");
1161
- var sAction = oEvent.getParameter("action");
1162
-
1163
- if (sScope === "Actions" && sAction === "Remove") {
1164
- this._deleteVisualization(oEvent.getSource());
1165
- }
1166
- },
1167
-
1168
- /**
1169
- * Creates a new Card.
1170
- *
1171
- * @since 1.110.0
1172
- * @param {object} oViz The visualization data. Defaults to {}.
1173
- * @param {Configuration[]} aWidgetConfigurations The configurations on widget level. Defaults to [].
1174
- * @param {object[]} aManifestChangesToApply The configurations to apply to the card. Defaults. to [].
1175
- * @param {string} sWidgetContextPath The widget configurations path. Defaults to "".
1176
- * @returns {sap.ui.integration.widgets.Card} The card instance.
1177
- * @private
1178
- */
1179
- _createCard: function (oViz = {}, aWidgetConfigurations = [], aManifestChangesToApply = [], sWidgetContextPath = "") {
1180
- var oOptions = {};
1181
- var bHasDescriptor = oViz.descriptor && oViz.descriptor.value && oViz.descriptor.value["sap.card"];
1182
- var bHasDescriptorResources = oViz.descriptorResources && (oViz.descriptorResources.baseUrl || oViz.descriptorResources.descriptorPath);
1183
- var bPgLevelConfigurationsExist = aWidgetConfigurations.some(function (oConfig) { return oConfig.level === "PG"; });
1184
- var bIsConfigurable;
1185
-
1186
- if (!bHasDescriptor && !bHasDescriptorResources) {
1187
- Log.error("No descriptor or descriptorResources for Card");
1188
- return new Card().setLayoutData(new GridContainerItemLayoutData({
1189
- columns: 2,
1190
- rows: 2
1191
- }));
1192
- }
1049
+ return oMergedConfigurations;
1050
+ }, {});
1051
+
1052
+ return this._sortConfigurations(Object.values(oConfigurations));
1053
+ },
1054
+
1055
+
1056
+ /**
1057
+ * Sort the widget's configuration by level: PR: Provider, CO: (Content) Administrator, PG: Page Administrator, US: End User
1058
+ *
1059
+ * @since 1.114.0
1060
+ * @param {Configuration[]} aConfigurations The configurations.
1061
+ * @returns {Configuration[]} The configurations sorted by level.
1062
+ * @private
1063
+ */
1064
+
1065
+ _sortConfigurations: function (aConfigurations) {
1066
+ var oSortedConfigurations = aConfigurations && aConfigurations.sort(function (oWidgetConfigA, oWidgetConfigB) {
1067
+ return CONFIGURATION_LEVELS.indexOf(oWidgetConfigA.level) - CONFIGURATION_LEVELS.indexOf(oWidgetConfigB.level);
1068
+ });
1069
+
1070
+ // PR —> CO —> PG —> US
1071
+ return oSortedConfigurations.map(function (oWidgetConfiguration) {
1072
+ return oWidgetConfiguration.settings.value;
1073
+ });
1074
+ },
1075
+
1076
+ /**
1077
+ * Creates a VizInstance with given vizData using the VizInstantiation service.
1078
+ *
1079
+ * @since 1.110.0
1080
+ * @param {object} oVizData VisualizationData for the visualization.
1081
+ * @returns {sap.ushell.ui.launchpad.VizInstance|sap.m.GenericTile} The CDM VizInstance.
1082
+ * @private
1083
+ */
1084
+ _createVizInstance: function (oVizData) {
1085
+
1086
+ const oExtendedVizData = deepExtend({}, oVizData, {
1087
+ preview: this.oModel.getProperty("/previewMode")
1088
+ });
1089
+
1090
+ if (this.oModel.getProperty("/navigationDisabled") && oExtendedVizData._siteData) {
1091
+ delete oExtendedVizData._siteData.target;
1092
+ delete oExtendedVizData._siteData.targetURL;
1093
+ }
1193
1094
 
1194
- if (bHasDescriptor) {
1195
- oOptions.manifest = oViz.descriptor.value;
1196
- bIsConfigurable = !!ObjectPath.get(["descriptor", "value", "sap.card", "configuration"], oViz);
1095
+ var oVizInstance = this.oWorkPageVizInstantiation.createVizInstance(oExtendedVizData);
1197
1096
 
1198
- if (bHasDescriptorResources) {
1199
- oOptions.baseUrl = oViz.descriptorResources.baseUrl + oViz.descriptorResources.descriptorPath;
1200
- }
1201
- } else if (bHasDescriptorResources) {
1202
- oOptions.manifest = oViz.descriptorResources.baseUrl + oViz.descriptorResources.descriptorPath;
1097
+ if (!oVizInstance) {
1098
+ Log.error("No VizInstance was created.");
1099
+ return this._createErrorTile();
1100
+ }
1203
1101
 
1204
- if (!oOptions.manifest.endsWith(".json")) {
1205
- oOptions.manifest += "/manifest.json";
1102
+ return oVizInstance
1103
+ .setActive(true)
1104
+ .bindPreview("/previewMode")
1105
+ .attachPress(this.onVisualizationPress, this)
1106
+ .bindEditable("/editMode")
1107
+ .bindSizeBehavior("viewSettings>/currentBreakpoint/sizeBehavior")
1108
+ .bindClickable({
1109
+ path: "/navigationDisabled",
1110
+ formatter: function (bValue) {
1111
+ return !bValue;
1206
1112
  }
1207
- }
1113
+ })
1114
+ .setLayoutData(new GridContainerItemLayoutData(oVizInstance.getLayout()));
1115
+ },
1116
+
1117
+ /**
1118
+ * Returns the aria label for a WorkPageRow (section).
1119
+ *
1120
+ * If there is a title, the title will be returned in a translated string.
1121
+ * If there is no tile, the translated string for unnamed sections will be returned, including the position of the section.
1122
+ *
1123
+ * @param {string} sId The section dom id.
1124
+ * @param {object[]} aRows The rows array of the work page.
1125
+ * @param {string} sTitle The title of the section.
1126
+ * @returns {string} The string to be used as aria-label attribute.
1127
+ */
1128
+ formatRowAriaLabel: function (sId, aRows = [], sTitle) {
1129
+ const i18nBundle = this.getView().getModel("i18n").getResourceBundle();
1130
+
1131
+ if (sTitle) { return i18nBundle.getText("WorkPage.Row.Named.AriaLabel", [sTitle]); }
1132
+
1133
+ const iIndex = aRows.findIndex((oRow) => oRow.id === sId);
1134
+ if (iIndex < 0) { return ""; }
1135
+
1136
+ return i18nBundle.getText("WorkPage.Row.Unnamed.AriaLabel", [iIndex + 1]);
1137
+ },
1138
+
1139
+ /**
1140
+ * Seeks the dataSource in the available dataSources.
1141
+ *
1142
+ * @param {object} oDataSources The available dataSources.
1143
+ * @param {object} oIndicatorDataSource The indicator dataSource.
1144
+ * @returns {object|null} The dataSource if found.
1145
+ * @private
1146
+ */
1147
+ _getDataSource: function (oDataSources, oIndicatorDataSource) {
1148
+ if (!oIndicatorDataSource || !oDataSources) {
1149
+ return;
1150
+ }
1151
+ return oDataSources[oIndicatorDataSource.dataSource];
1152
+ },
1153
+
1154
+ /**
1155
+ * Called if a vizInstance was pressed and proceeds to delete it from the data.
1156
+ *
1157
+ * @param {sap.base.Event} oEvent The press event.
1158
+ */
1159
+ onVisualizationPress: function (oEvent) {
1160
+ var sScope = oEvent.getParameter("scope");
1161
+ var sAction = oEvent.getParameter("action");
1162
+
1163
+ if (sScope === "Actions" && sAction === "Remove") {
1164
+ this._deleteVisualization(oEvent.getSource());
1165
+ }
1166
+ },
1167
+
1168
+ /**
1169
+ * Creates a new Card.
1170
+ *
1171
+ * @since 1.110.0
1172
+ * @param {object} oViz The visualization data. Defaults to {}.
1173
+ * @param {Configuration[]} aWidgetConfigurations The configurations on widget level. Defaults to [].
1174
+ * @param {object[]} aManifestChangesToApply The configurations to apply to the card. Defaults. to [].
1175
+ * @param {string} sWidgetContextPath The widget configurations path. Defaults to "".
1176
+ * @returns {sap.ui.integration.widgets.Card} The card instance.
1177
+ * @private
1178
+ */
1179
+ _createCard: function (oViz = {}, aWidgetConfigurations = [], aManifestChangesToApply = [], sWidgetContextPath = "") {
1180
+ var oOptions = {};
1181
+ var bHasDescriptor = oViz.descriptor && oViz.descriptor.value && oViz.descriptor.value["sap.card"];
1182
+ var bHasDescriptorResources = oViz.descriptorResources && (oViz.descriptorResources.baseUrl || oViz.descriptorResources.descriptorPath);
1183
+ var bPgLevelConfigurationsExist = aWidgetConfigurations.some(function (oConfig) { return oConfig.level === "PG"; });
1184
+ var bIsConfigurable;
1185
+
1186
+ if (!bHasDescriptor && !bHasDescriptorResources) {
1187
+ Log.error("No descriptor or descriptorResources for Card");
1188
+ return new Card().setLayoutData(new GridContainerItemLayoutData({
1189
+ columns: 2,
1190
+ rows: 2
1191
+ }));
1192
+ }
1208
1193
 
1209
- oOptions.referenceId = "";
1210
- if (oViz.id) {
1211
- var iProviderPrefixIndex = oViz.id.indexOf("_");
1212
- if (iProviderPrefixIndex > 0) {
1213
- var sProvider = oViz.id.substring(0, iProviderPrefixIndex);
1214
- oOptions.referenceId = sProvider;
1215
- }
1216
- }
1194
+ if (bHasDescriptor) {
1195
+ oOptions.manifest = oViz.descriptor.value;
1196
+ bIsConfigurable = !!ObjectPath.get(["descriptor", "value", "sap.card", "configuration"], oViz);
1217
1197
 
1218
- // Ensure trailing slash for base url
1219
- if (oOptions.baseUrl && oOptions.baseUrl.substr(-1) !== "/") {
1220
- oOptions.baseUrl += "/";
1198
+ if (bHasDescriptorResources) {
1199
+ oOptions.baseUrl = oViz.descriptorResources.baseUrl + oViz.descriptorResources.descriptorPath;
1221
1200
  }
1201
+ } else if (bHasDescriptorResources) {
1202
+ oOptions.manifest = oViz.descriptorResources.baseUrl + oViz.descriptorResources.descriptorPath;
1222
1203
 
1223
- var oCard = new Card(oOptions);
1224
-
1225
- if (bIsConfigurable) {
1226
- var oConfigureActionDefinition = this._createCardConfigurationActionDefinition(
1227
- oCard,
1228
- sWidgetContextPath,
1229
- this._openCardConfigurationEditor.bind(this)
1230
- );
1231
- oCard.addActionDefinition(oConfigureActionDefinition);
1204
+ if (!oOptions.manifest.endsWith(".json")) {
1205
+ oOptions.manifest += "/manifest.json";
1232
1206
  }
1207
+ }
1233
1208
 
1234
- if (bPgLevelConfigurationsExist) {
1235
- var oResetActionDefinition = this._createCardResetActionDefinition(
1236
- aWidgetConfigurations,
1237
- sWidgetContextPath,
1238
- this._openResetCardConfigurationDialog.bind(this)
1239
- );
1240
- oCard.addActionDefinition(oResetActionDefinition);
1241
- }
1209
+ oOptions.referenceId = oViz?.provider?.id;
1242
1210
 
1243
- return oCard
1244
- .setModel(this.oModel, "workPageModel")
1245
- .bindProperty("previewMode", {
1246
- path: "workPageModel>/previewMode",
1247
- formatter: function (bValue) {
1248
- return bValue ? CardPreviewMode.MockData : CardPreviewMode.Off;
1249
- }
1250
- })
1251
- .setManifestChanges(aManifestChangesToApply)
1252
- .addStyleClass("workpageCellWidget")
1253
- .setHost(this.oHost)
1254
- .setLayoutData(new GridContainerItemLayoutData({
1255
- columns: 16,
1256
- minRows: 1
1257
- }));
1258
- },
1259
-
1260
- /**
1261
- * Create an ActionDefinition to enable the user to configure the card with the CardEditor.
1262
- *
1263
- * @since 1.114.0
1264
- * @param {sap.ui.integration.widgets.Card} oCard The card to configure.
1265
- * @param {string} sWidgetContextPath The card to configure.
1266
- * @param {function} fnOnPress Handler function, called when the ActionDefinition button is pressed.
1267
- *
1268
- * @returns {sap.ui.integration.ActionDefinition} The ActionDefinition item.
1269
- * @private
1270
- */
1271
- _createCardConfigurationActionDefinition: function (oCard, sWidgetContextPath, fnOnPress) {
1272
- const sActionDefinitionText = this.getView().getModel("i18n").getResourceBundle().getText("WorkPage.Card.ActionDefinition.Configure");
1273
- const oActionDefinition = new ActionDefinition({
1274
- type: "Custom",
1275
- visible: "{/editMode}",
1276
- buttonType: "Transparent",
1277
- text: sActionDefinitionText
1278
- });
1279
-
1280
- oActionDefinition.setModel(this.oModel);
1281
- oActionDefinition.attachPress({
1282
- card: oCard,
1283
- widgetContextPath: sWidgetContextPath
1284
- }, fnOnPress);
1285
- return oActionDefinition;
1286
- },
1287
-
1288
- /**
1289
- * Create an ActionDefinition to enable the user to reset the card when some configuration was made.
1290
- *
1291
- * @since 1.117.0
1292
- * @param {Configuration[]} aWidgetConfigurations The widget configuration items.
1293
- * @param {string} sWidgetContextPath The path of the card data in the model.
1294
- * @param {function} fnOnPress Handler function, called when the ActionDefinition button is pressed.
1295
- *
1296
- * @returns {sap.ui.integration.ActionDefinition} The ActionDefinition item.
1297
- * @private
1298
- */
1299
- _createCardResetActionDefinition: function (aWidgetConfigurations, sWidgetContextPath, fnOnPress) {
1300
- const sActionDefinitionText = this.getView().getModel("i18n").getResourceBundle().getText("WorkPage.Card.ActionDefinition.Reset");
1301
- const oActionDefinition = new ActionDefinition({
1302
- type: "Custom",
1303
- visible: "{/editMode}",
1304
- buttonType: "Transparent",
1305
- text: sActionDefinitionText
1306
- });
1211
+ // Ensure trailing slash for base url
1212
+ if (oOptions.baseUrl && oOptions.baseUrl.substr(-1) !== "/") {
1213
+ oOptions.baseUrl += "/";
1214
+ }
1307
1215
 
1308
- oActionDefinition.setModel(this.oModel);
1309
- oActionDefinition.attachPress({
1310
- widgetContextPath: sWidgetContextPath,
1311
- widgetConfigurations: aWidgetConfigurations
1312
- }, fnOnPress);
1313
- return oActionDefinition;
1314
- },
1315
-
1316
- /**
1317
- * Adds the CardEditor into the Dialog and opens it.
1318
- *
1319
- * @since 1.113.0
1320
- * @param {sap.base.Event} oEvent The event object.
1321
- * @param {{card: sap.ui.integration.widgets.Card, widgetContextPath: string}} oContextData The context data.
1322
- * @returns {Promise} Promise that will resolve the Dialog
1323
- * @private
1324
- */
1325
- _openCardConfigurationEditor: function (oEvent, oContextData) {
1326
- if (!this.oCardEditorDialogPromise) {
1327
- this.oCardEditorDialogPromise = this._createCardEditorDialog(oContextData.card);
1328
- }
1216
+ var oCard = new Card(oOptions);
1329
1217
 
1330
- var oCardEditorPromise = this._createCardEditor(oContextData.card);
1331
-
1332
- return Promise.all([oCardEditorPromise, this.oCardEditorDialogPromise]).then(function (aInstances) {
1333
- this.oCardEditorDialog = aInstances[1];
1334
- this.oCardEditorDialog.removeAllContent();
1335
- this.oCardEditorDialog.getBeginButton()
1336
- .detachPress(this._fnSaveCardConfiguration)
1337
- .attachPress(oContextData.widgetContextPath, this._fnSaveCardConfiguration);
1338
- this._setCardDialogTitle(this.oCardEditorDialog, oContextData.card);
1339
- this.oCardEditorDialog.addContent(aInstances[0]);
1340
- this.oCardEditorDialog.open();
1341
- }.bind(this));
1342
- },
1343
-
1344
-
1345
- /**
1346
- * Opens the card reset dialog and attaches the reset button handler.
1347
- *
1348
- * @since 1.117.0
1349
- * @param {sap.base.Event} oEvent The press event.
1350
- * @param { {
1351
- * card: sap.ui.integration.widgets.Card,
1352
- * widgetContextPath: string,
1353
- * widgetConfigurations: Configuration[],
1354
- * vizConfigurations: Configuration[]
1355
- * } } oContextData The required context data.
1356
- * @returns {Promise} A promise resolving when the card dialog was opened.
1357
- * @private
1358
- */
1359
- _openResetCardConfigurationDialog: function (oEvent, oContextData) {
1360
- if (!this.oCardResetDialogPromise) {
1361
- this.oCardResetDialogPromise = this._createResetCardConfigurationDialog();
1362
- }
1218
+ if (bIsConfigurable) {
1219
+ var oConfigureActionDefinition = this._createCardConfigurationActionDefinition(
1220
+ oCard,
1221
+ sWidgetContextPath,
1222
+ this._openCardConfigurationEditor.bind(this)
1223
+ );
1224
+ oCard.addActionDefinition(oConfigureActionDefinition);
1225
+ }
1363
1226
 
1364
- return this.oCardResetDialogPromise.then(function (oCardResetDialog) {
1365
- this.oCardResetDialog = oCardResetDialog;
1366
- this.getView().addDependent(this.oCardResetDialog);
1367
- this.oCardResetDialog.getBeginButton()
1368
- .detachPress(this._fnResetCardConfiguration)
1369
- .attachPress(oContextData, this._fnResetCardConfiguration);
1370
- this.oCardResetDialog.open();
1371
- }.bind(this));
1372
- },
1373
-
1374
- /**
1375
- *
1376
- * @param {sap.base.Event} oEvent The press event.
1377
- * @param {{ widgetContextPath: string, widgetConfigurations: Configuration[] }} oContextData The context data object.
1378
- * @since 1.117.0
1379
- * @private
1380
- */
1381
- _onResetCardConfigurations: function (oEvent, oContextData) {
1382
- var oDialog = oEvent.getSource().getParent();
1383
- var aWidgetConfigurations = oContextData.widgetConfigurations;
1384
- var sWidgetConfigurationsPath = oContextData.widgetContextPath + "/configurations";
1385
- var aRemainingConfigurations = aWidgetConfigurations.filter(function (oConfig) {
1386
- return oConfig.level !== "PG";
1387
- });
1227
+ if (bPgLevelConfigurationsExist) {
1228
+ var oResetActionDefinition = this._createCardResetActionDefinition(
1229
+ aWidgetConfigurations,
1230
+ sWidgetContextPath,
1231
+ this._openResetCardConfigurationDialog.bind(this)
1232
+ );
1233
+ oCard.addActionDefinition(oResetActionDefinition);
1234
+ }
1388
1235
 
1389
- this.oModel.setProperty(sWidgetConfigurationsPath, aRemainingConfigurations);
1236
+ return oCard
1237
+ .setModel(this.oModel, "workPageModel")
1238
+ .bindProperty("previewMode", {
1239
+ path: "workPageModel>/previewMode",
1240
+ formatter: function (bValue) {
1241
+ return bValue ? CardPreviewMode.MockData : CardPreviewMode.Off;
1242
+ }
1243
+ })
1244
+ .setManifestChanges(aManifestChangesToApply)
1245
+ .addStyleClass("workpageCellWidget")
1246
+ .setHost(this.oHost)
1247
+ .setLayoutData(new GridContainerItemLayoutData({
1248
+ columns: 16,
1249
+ minRows: 1
1250
+ }));
1251
+ },
1252
+
1253
+ /**
1254
+ * Create an ActionDefinition to enable the user to configure the card with the CardEditor.
1255
+ *
1256
+ * @since 1.114.0
1257
+ * @param {sap.ui.integration.widgets.Card} oCard The card to configure.
1258
+ * @param {string} sWidgetContextPath The card to configure.
1259
+ * @param {function} fnOnPress Handler function, called when the ActionDefinition button is pressed.
1260
+ *
1261
+ * @returns {sap.ui.integration.ActionDefinition} The ActionDefinition item.
1262
+ * @private
1263
+ */
1264
+ _createCardConfigurationActionDefinition: function (oCard, sWidgetContextPath, fnOnPress) {
1265
+ const sActionDefinitionText = this.getView().getModel("i18n").getResourceBundle().getText("WorkPage.Card.ActionDefinition.Configure");
1266
+ const oActionDefinition = new ActionDefinition({
1267
+ type: "Custom",
1268
+ visible: "{/editMode}",
1269
+ buttonType: "Transparent",
1270
+ text: sActionDefinitionText
1271
+ });
1272
+
1273
+ oActionDefinition.setModel(this.oModel);
1274
+ oActionDefinition.attachPress({
1275
+ card: oCard,
1276
+ widgetContextPath: sWidgetContextPath
1277
+ }, fnOnPress);
1278
+ return oActionDefinition;
1279
+ },
1280
+
1281
+ /**
1282
+ * Create an ActionDefinition to enable the user to reset the card when some configuration was made.
1283
+ *
1284
+ * @since 1.117.0
1285
+ * @param {Configuration[]} aWidgetConfigurations The widget configuration items.
1286
+ * @param {string} sWidgetContextPath The path of the card data in the model.
1287
+ * @param {function} fnOnPress Handler function, called when the ActionDefinition button is pressed.
1288
+ *
1289
+ * @returns {sap.ui.integration.ActionDefinition} The ActionDefinition item.
1290
+ * @private
1291
+ */
1292
+ _createCardResetActionDefinition: function (aWidgetConfigurations, sWidgetContextPath, fnOnPress) {
1293
+ const sActionDefinitionText = this.getView().getModel("i18n").getResourceBundle().getText("WorkPage.Card.ActionDefinition.Reset");
1294
+ const oActionDefinition = new ActionDefinition({
1295
+ type: "Custom",
1296
+ visible: "{/editMode}",
1297
+ buttonType: "Transparent",
1298
+ text: sActionDefinitionText
1299
+ });
1300
+
1301
+ oActionDefinition.setModel(this.oModel);
1302
+ oActionDefinition.attachPress({
1303
+ widgetContextPath: sWidgetContextPath,
1304
+ widgetConfigurations: aWidgetConfigurations
1305
+ }, fnOnPress);
1306
+ return oActionDefinition;
1307
+ },
1308
+
1309
+ /**
1310
+ * Adds the CardEditor into the Dialog and opens it.
1311
+ *
1312
+ * @since 1.113.0
1313
+ * @param {sap.base.Event} oEvent The event object.
1314
+ * @param {{card: sap.ui.integration.widgets.Card, widgetContextPath: string}} oContextData The context data.
1315
+ * @returns {Promise} Promise that will resolve the Dialog
1316
+ * @private
1317
+ */
1318
+ _openCardConfigurationEditor: function (oEvent, oContextData) {
1319
+ if (!this.oCardEditorDialogPromise) {
1320
+ this.oCardEditorDialogPromise = this._createCardEditorDialog(oContextData.card);
1321
+ }
1390
1322
 
1391
- this.getOwnerComponent().fireEvent("workPageEdited");
1323
+ var oCardEditorPromise = this._createCardEditor(oContextData.card);
1324
+
1325
+ return Promise.all([oCardEditorPromise, this.oCardEditorDialogPromise]).then(function (aInstances) {
1326
+ this.oCardEditorDialog = aInstances[1];
1327
+ this.oCardEditorDialog.removeAllContent();
1328
+ this.oCardEditorDialog.getBeginButton()
1329
+ .detachPress(this._fnSaveCardConfiguration)
1330
+ .attachPress(oContextData.widgetContextPath, this._fnSaveCardConfiguration);
1331
+ this._setCardDialogTitle(this.oCardEditorDialog, oContextData.card);
1332
+ this.oCardEditorDialog.addContent(aInstances[0]);
1333
+ this.oCardEditorDialog.open();
1334
+ }.bind(this));
1335
+ },
1336
+
1337
+
1338
+ /**
1339
+ * Opens the card reset dialog and attaches the reset button handler.
1340
+ *
1341
+ * @since 1.117.0
1342
+ * @param {sap.base.Event} oEvent The press event.
1343
+ * @param { {
1344
+ * card: sap.ui.integration.widgets.Card,
1345
+ * widgetContextPath: string,
1346
+ * widgetConfigurations: Configuration[],
1347
+ * vizConfigurations: Configuration[]
1348
+ * } } oContextData The required context data.
1349
+ * @returns {Promise} A promise resolving when the card dialog was opened.
1350
+ * @private
1351
+ */
1352
+ _openResetCardConfigurationDialog: function (oEvent, oContextData) {
1353
+ if (!this.oCardResetDialogPromise) {
1354
+ this.oCardResetDialogPromise = this._createResetCardConfigurationDialog();
1355
+ }
1392
1356
 
1393
- oDialog.close();
1394
- },
1395
-
1396
- /**
1397
- * Resets the configuration of the card after confirming a failsafe dialog.
1398
- * @returns {Promise<sap.m.Dialog>} A Promise resolving the the sap.m.Dialog control.
1399
- *
1400
- * @since 1.117.0
1401
- * @private
1402
- */
1403
- _createResetCardConfigurationDialog: function () {
1404
- var oI18nBundle = this.getView().getModel("i18n").getResourceBundle();
1405
- var sDialogTitle = oI18nBundle.getText("WorkPage.CardEditor.DeleteConfigurationDialog.Title");
1406
- var sDialogContent = oI18nBundle.getText("WorkPage.CardEditor.DeleteConfigurationDialog.Content");
1407
- var sBeginButtonText = oI18nBundle.getText("WorkPage.CardEditor.DeleteConfigurationDialog.Accept");
1408
- var sEndButtonText = oI18nBundle.getText("WorkPage.CardEditor.DeleteConfigurationDialog.Deny");
1409
-
1410
- return new Promise((resolve, reject) => {
1411
- sap.ui.require(["sap/m/Dialog", "sap/m/Button", "sap/m/Text"], (Dialog, Button, Text) => {
1412
- var oDialog = new Dialog({
1413
- id: this.createId("cardConfigurationResetDialog"),
1414
- type: mLibrary.DialogType.Message,
1415
- state: ValueState.Warning,
1416
- title: sDialogTitle,
1417
- content: new Text({
1418
- text: sDialogContent
1419
- }),
1420
- beginButton: new Button({
1421
- type: mLibrary.ButtonType.Emphasized,
1422
- text: sBeginButtonText
1423
- }),
1424
- endButton: new Button({
1425
- text: sEndButtonText,
1426
- press: function () {
1427
- oDialog.close();
1428
- }
1429
- })
1430
- });
1431
- resolve(oDialog);
1432
- }, reject);
1433
- });
1434
- },
1435
-
1436
- /**
1437
- *
1438
- * @param {sap.m.Dialog} oDialog The dialog control.
1439
- * @param {sap.ui.integration.widgets.Card} oCard The card control.
1440
- * @private
1441
- */
1442
- _setCardDialogTitle: function (oDialog, oCard) {
1443
- var oI18nBundle = this.getView().getModel("i18n").getResourceBundle();
1444
- var sCardEditorTitle = this._getCardTitle(oCard)
1445
- ? oI18nBundle.getText("WorkPage.CardEditor.Title", [this._getCardTitle(oCard)])
1446
- : oI18nBundle.getText("WorkPage.CardEditor.Title.NoCardTitle");
1447
- oDialog.setTitle(sCardEditorTitle);
1448
- },
1449
-
1450
- /**
1451
- * Creates and returns the CardEditor.
1452
- * @param {sap.ui.integration.widgets.Card} oCard The card control.
1453
- * @since 1.114.0
1454
- *
1455
- * @returns {sap.ui.integration.designtime.editor.CardEditor} The CardEditor instance.
1456
- * @private
1457
- */
1458
- _createCardEditor: function (oCard) {
1459
- return new Promise((fResolve, fReject) => {
1460
- sap.ui.require(["sap-ui-integration-card-editor"],
1461
- () => {
1462
- sap.ui.require(["sap/ui/integration/designtime/editor/CardEditor"], (CardEditor) => {
1463
- fResolve(
1464
- new CardEditor({
1465
- previewPosition: "right",
1466
- card: oCard,
1467
- mode: "content"
1468
- })
1469
- );
1470
- },
1471
- fReject
1357
+ return this.oCardResetDialogPromise.then(function (oCardResetDialog) {
1358
+ this.oCardResetDialog = oCardResetDialog;
1359
+ this.getView().addDependent(this.oCardResetDialog);
1360
+ this.oCardResetDialog.getBeginButton()
1361
+ .detachPress(this._fnResetCardConfiguration)
1362
+ .attachPress(oContextData, this._fnResetCardConfiguration);
1363
+ this.oCardResetDialog.open();
1364
+ }.bind(this));
1365
+ },
1366
+
1367
+ /**
1368
+ *
1369
+ * @param {sap.base.Event} oEvent The press event.
1370
+ * @param {{ widgetContextPath: string, widgetConfigurations: Configuration[] }} oContextData The context data object.
1371
+ * @since 1.117.0
1372
+ * @private
1373
+ */
1374
+ _onResetCardConfigurations: function (oEvent, oContextData) {
1375
+ var oDialog = oEvent.getSource().getParent();
1376
+ var aWidgetConfigurations = oContextData.widgetConfigurations;
1377
+ var sWidgetConfigurationsPath = oContextData.widgetContextPath + "/configurations";
1378
+ var aRemainingConfigurations = aWidgetConfigurations.filter(function (oConfig) {
1379
+ return oConfig.level !== "PG";
1380
+ });
1381
+
1382
+ this.oModel.setProperty(sWidgetConfigurationsPath, aRemainingConfigurations);
1383
+
1384
+ this.getOwnerComponent().fireEvent("workPageEdited");
1385
+
1386
+ oDialog.close();
1387
+ },
1388
+
1389
+ /**
1390
+ * Resets the configuration of the card after confirming a failsafe dialog.
1391
+ * @returns {Promise<sap.m.Dialog>} A Promise resolving the the sap.m.Dialog control.
1392
+ *
1393
+ * @since 1.117.0
1394
+ * @private
1395
+ */
1396
+ _createResetCardConfigurationDialog: function () {
1397
+ var oI18nBundle = this.getView().getModel("i18n").getResourceBundle();
1398
+ var sDialogTitle = oI18nBundle.getText("WorkPage.CardEditor.DeleteConfigurationDialog.Title");
1399
+ var sDialogContent = oI18nBundle.getText("WorkPage.CardEditor.DeleteConfigurationDialog.Content");
1400
+ var sBeginButtonText = oI18nBundle.getText("WorkPage.CardEditor.DeleteConfigurationDialog.Accept");
1401
+ var sEndButtonText = oI18nBundle.getText("WorkPage.CardEditor.DeleteConfigurationDialog.Deny");
1402
+
1403
+ return new Promise((resolve, reject) => {
1404
+ sap.ui.require(["sap/m/Dialog", "sap/m/Button", "sap/m/Text"], (Dialog, Button, Text) => {
1405
+ var oDialog = new Dialog({
1406
+ id: this.createId("cardConfigurationResetDialog"),
1407
+ type: mLibrary.DialogType.Message,
1408
+ state: ValueState.Warning,
1409
+ title: sDialogTitle,
1410
+ content: new Text({
1411
+ text: sDialogContent
1412
+ }),
1413
+ beginButton: new Button({
1414
+ type: mLibrary.ButtonType.Emphasized,
1415
+ text: sBeginButtonText
1416
+ }),
1417
+ endButton: new Button({
1418
+ text: sEndButtonText,
1419
+ press: function () {
1420
+ oDialog.close();
1421
+ }
1422
+ })
1423
+ });
1424
+ resolve(oDialog);
1425
+ }, reject);
1426
+ });
1427
+ },
1428
+
1429
+ /**
1430
+ *
1431
+ * @param {sap.m.Dialog} oDialog The dialog control.
1432
+ * @param {sap.ui.integration.widgets.Card} oCard The card control.
1433
+ * @private
1434
+ */
1435
+ _setCardDialogTitle: function (oDialog, oCard) {
1436
+ var oI18nBundle = this.getView().getModel("i18n").getResourceBundle();
1437
+ var sCardEditorTitle = this._getCardTitle(oCard)
1438
+ ? oI18nBundle.getText("WorkPage.CardEditor.Title", [this._getCardTitle(oCard)])
1439
+ : oI18nBundle.getText("WorkPage.CardEditor.Title.NoCardTitle");
1440
+ oDialog.setTitle(sCardEditorTitle);
1441
+ },
1442
+
1443
+ /**
1444
+ * Creates and returns the CardEditor.
1445
+ * @param {sap.ui.integration.widgets.Card} oCard The card control.
1446
+ * @since 1.114.0
1447
+ *
1448
+ * @returns {sap.ui.integration.designtime.editor.CardEditor} The CardEditor instance.
1449
+ * @private
1450
+ */
1451
+ _createCardEditor: function (oCard) {
1452
+ return new Promise((fResolve, fReject) => {
1453
+ sap.ui.require(["sap-ui-integration-card-editor"],
1454
+ () => {
1455
+ sap.ui.require(["sap/ui/integration/designtime/editor/CardEditor"], (CardEditor) => {
1456
+ fResolve(
1457
+ new CardEditor({
1458
+ previewPosition: "right",
1459
+ card: oCard,
1460
+ mode: "content"
1461
+ })
1472
1462
  );
1473
1463
  },
1474
- fReject
1475
- );
1476
- });
1477
- },
1478
-
1479
- /**
1480
- * Creates a dialog to be used with the CardEditor.
1481
- * @since 1.114.0
1482
- * @param {sap.ui.integration.widgets.Card} oCard The card control instance.
1483
- * @returns {Promise<sap.m.Dialog>} Promise that will resolve the Dialog
1484
- * @private
1485
- */
1486
- _createCardEditorDialog: function (oCard) {
1487
- var oI18nBundle = this.getView().getModel("i18n").getResourceBundle();
1488
- var sCardEditorSaveText = oI18nBundle.getText("WorkPage.CardEditor.Save");
1489
- var sCardEditorCancelText = oI18nBundle.getText("WorkPage.CardEditor.Cancel");
1490
-
1491
- return new Promise((resolve, reject) => {
1492
- sap.ui.require(["sap/m/Dialog", "sap/m/Button"], (Dialog, Button) => {
1493
- var oDialog = new Dialog({
1494
- id: this.createId("cardEditorDialog"),
1495
- contentWidth: "40rem",
1496
- beginButton: new Button({
1497
- text: sCardEditorSaveText,
1498
- type: mLibrary.ButtonType.Emphasized
1499
- }),
1500
- endButton: new Button({
1501
- text: sCardEditorCancelText,
1502
- press: function () {
1503
- oDialog.close();
1504
- }
1505
- })
1506
- });
1507
- resolve(oDialog);
1508
- }, reject);
1509
- });
1510
- },
1511
-
1512
- /**
1513
- * Returns the card title. First checks if the card has a header title, falls back to the manifest title.
1514
- *
1515
- * @param {sap.ui.integration.widgets.Card} oCard The card control instance.
1516
- * @returns {string} The card title.
1517
- * @since 1.114.0
1518
- */
1519
- _getCardTitle: function (oCard) {
1520
- if (oCard.getCardHeader() && oCard.getCardHeader().getTitle()) {
1521
- return oCard.getCardHeader().getTitle();
1522
- }
1523
- },
1524
-
1525
- /**
1526
- * Saves the card's new configuration
1527
- * @since 1.114.0
1528
- * @param {sap.base.Event} oEvent The event object.
1529
- * @param {string} sWidgetContextPath The path to the card.
1530
- * @private
1531
- */
1532
- _onSaveCardEditor: function (oEvent, sWidgetContextPath) {
1533
- var oDialog = oEvent.getSource().getParent();
1534
- var oCardEditor = oDialog.getContent()[0];
1535
- var oCard = oCardEditor.getCard();
1536
- var sWidgetConfigurationsPath = sWidgetContextPath + "/configurations";
1537
- var oCurrentSettings = oCardEditor.getCurrentSettings();
1538
- var aWidgetConfigurations = this.oModel.getProperty(sWidgetConfigurationsPath) || [];
1539
-
1540
- var oWidgetConfiguration = aWidgetConfigurations.find(function (oConfiguration) {
1541
- return oConfiguration.level === "PG";
1542
- });
1543
-
1544
- if (!oWidgetConfiguration) {
1545
- oWidgetConfiguration = {};
1546
- oWidgetConfiguration.id = this._generateUniqueId();
1547
- oWidgetConfiguration.level = "PG";
1548
- oWidgetConfiguration.settings = {
1549
- value: oCurrentSettings,
1550
- schemaVersion: "3.2.0"
1551
- };
1552
- aWidgetConfigurations.push(oWidgetConfiguration);
1553
- } else {
1554
- aWidgetConfigurations = aWidgetConfigurations.map(function (oConfiguration) {
1555
- if (oConfiguration.level === "PG") {
1556
- oConfiguration.settings.value = deepExtend({}, oConfiguration.settings.value, oCurrentSettings);
1557
- }
1558
- return oConfiguration;
1464
+ fReject
1465
+ );
1466
+ },
1467
+ fReject
1468
+ );
1469
+ });
1470
+ },
1471
+
1472
+ /**
1473
+ * Creates a dialog to be used with the CardEditor.
1474
+ * @since 1.114.0
1475
+ * @param {sap.ui.integration.widgets.Card} oCard The card control instance.
1476
+ * @returns {Promise<sap.m.Dialog>} Promise that will resolve the Dialog
1477
+ * @private
1478
+ */
1479
+ _createCardEditorDialog: function (oCard) {
1480
+ var oI18nBundle = this.getView().getModel("i18n").getResourceBundle();
1481
+ var sCardEditorSaveText = oI18nBundle.getText("WorkPage.CardEditor.Save");
1482
+ var sCardEditorCancelText = oI18nBundle.getText("WorkPage.CardEditor.Cancel");
1483
+
1484
+ return new Promise((resolve, reject) => {
1485
+ sap.ui.require(["sap/m/Dialog", "sap/m/Button"], (Dialog, Button) => {
1486
+ var oDialog = new Dialog({
1487
+ id: this.createId("cardEditorDialog"),
1488
+ contentWidth: "40rem",
1489
+ beginButton: new Button({
1490
+ text: sCardEditorSaveText,
1491
+ type: mLibrary.ButtonType.Emphasized
1492
+ }),
1493
+ endButton: new Button({
1494
+ text: sCardEditorCancelText,
1495
+ press: function () {
1496
+ oDialog.close();
1497
+ }
1498
+ })
1559
1499
  });
1560
- }
1561
-
1562
- this.oModel.setProperty(sWidgetConfigurationsPath, aWidgetConfigurations);
1500
+ resolve(oDialog);
1501
+ }, reject);
1502
+ });
1503
+ },
1504
+
1505
+ /**
1506
+ * Returns the card title. First checks if the card has a header title, falls back to the manifest title.
1507
+ *
1508
+ * @param {sap.ui.integration.widgets.Card} oCard The card control instance.
1509
+ * @returns {string} The card title.
1510
+ * @since 1.114.0
1511
+ */
1512
+ _getCardTitle: function (oCard) {
1513
+ if (oCard.getCardHeader() && oCard.getCardHeader().getTitle()) {
1514
+ return oCard.getCardHeader().getTitle();
1515
+ }
1516
+ },
1517
+
1518
+ /**
1519
+ * Saves the card's new configuration
1520
+ * @since 1.114.0
1521
+ * @param {sap.base.Event} oEvent The event object.
1522
+ * @param {string} sWidgetContextPath The path to the card.
1523
+ * @private
1524
+ */
1525
+ _onSaveCardEditor: function (oEvent, sWidgetContextPath) {
1526
+ var oDialog = oEvent.getSource().getParent();
1527
+ var oCardEditor = oDialog.getContent()[0];
1528
+ var oCard = oCardEditor.getCard();
1529
+ var sWidgetConfigurationsPath = sWidgetContextPath + "/configurations";
1530
+ var oCurrentSettings = oCardEditor.getCurrentSettings();
1531
+ var aWidgetConfigurations = this.oModel.getProperty(sWidgetConfigurationsPath) || [];
1532
+
1533
+ var oWidgetConfiguration = aWidgetConfigurations.find(function (oConfiguration) {
1534
+ return oConfiguration.level === "PG";
1535
+ });
1536
+
1537
+ if (!oWidgetConfiguration) {
1538
+ oWidgetConfiguration = {};
1539
+ oWidgetConfiguration.id = this._generateUniqueId();
1540
+ oWidgetConfiguration.level = "PG";
1541
+ oWidgetConfiguration.settings = {
1542
+ value: oCurrentSettings,
1543
+ schemaVersion: "3.2.0"
1544
+ };
1545
+ aWidgetConfigurations.push(oWidgetConfiguration);
1546
+ } else {
1547
+ aWidgetConfigurations = aWidgetConfigurations.map(function (oConfiguration) {
1548
+ if (oConfiguration.level === "PG") {
1549
+ oConfiguration.settings.value = deepExtend({}, oConfiguration.settings.value, oCurrentSettings);
1550
+ }
1551
+ return oConfiguration;
1552
+ });
1553
+ }
1563
1554
 
1564
- oCard.setManifestChanges([oCurrentSettings]);
1555
+ this.oModel.setProperty(sWidgetConfigurationsPath, aWidgetConfigurations);
1556
+
1557
+ oCard.setManifestChanges([oCurrentSettings]);
1558
+
1559
+ this.getOwnerComponent().fireEvent("workPageEdited");
1560
+
1561
+ oDialog.close();
1562
+ },
1563
+
1564
+ /**
1565
+ * Close the edit mode and request to save changes by firing the "closeEditMode" event. The edit mode needs to be managed
1566
+ * the outer component to also handle the UserAction Menu button for edit mode.´
1567
+ */
1568
+ saveEditChanges: function () {
1569
+ this.getOwnerComponent().fireEvent("closeEditMode", {
1570
+ saveChanges: true
1571
+ });
1572
+ },
1573
+
1574
+ /**
1575
+ * Close the edit mode and request to cancel changes by firing the "closeEditMode" event. The edit mode needs to be managed
1576
+ * the outer component to also handle the UserAction Menu button for edit mode.´
1577
+ */
1578
+ cancelEditChanges: function () {
1579
+ this.getOwnerComponent().fireEvent("closeEditMode", {
1580
+ saveChanges: false
1581
+ });
1582
+ },
1583
+
1584
+ /**
1585
+ * Called if a WorkPageCell is dropped before or after another WorkPageCell in a WorkPageColumn.
1586
+ *
1587
+ * @param {sap.base.Event} oEvent The drop event.
1588
+ *
1589
+ * @since 1.116.0
1590
+ * @private
1591
+ */
1592
+ onCellDrop: function (oEvent) {
1593
+ var oSourceCell = oEvent.getParameter("draggedControl");
1594
+ var oTargetCell = oEvent.getParameter("droppedControl");
1595
+ var sDropPosition = oEvent.getParameter("dropPosition");
1596
+ var oSourceColumn = oSourceCell.getParent();
1597
+ var oTargetColumn = oTargetCell.getParent();
1598
+
1599
+ var iSourceIndex = oSourceColumn.indexOfAggregation("cells", oSourceCell);
1600
+ var iTargetIndex = oTargetColumn.indexOfAggregation("cells", oTargetCell);
1601
+
1602
+ // Increase the drop position if the dragged element is moved below the target element.
1603
+ if (sDropPosition === "After") {
1604
+ iTargetIndex++;
1605
+ }
1565
1606
 
1566
- this.getOwnerComponent().fireEvent("workPageEdited");
1607
+ this._moveCell(oSourceColumn, oTargetColumn, iSourceIndex, iTargetIndex);
1608
+ },
1609
+
1610
+ /**
1611
+ * Called if a WorkPageCell is dropped on an empty WorkPageColumn.
1612
+ *
1613
+ * @param {sap.base.Event} oEvent The drop event.
1614
+ *
1615
+ * @since 1.116.0
1616
+ * @private
1617
+ */
1618
+ onCellDropOnEmptyColumn: function (oEvent) {
1619
+ var oSourceCell = oEvent.getParameter("draggedControl");
1620
+ var oTargetColumn = oEvent.getParameter("droppedControl");
1621
+ var oSourceColumn = oSourceCell.getParent();
1622
+
1623
+ var iSourceIndex = oSourceColumn.indexOfAggregation("cells", oSourceCell);
1624
+ var iTargetIndex = 0;
1625
+
1626
+ this._moveCell(oSourceColumn, oTargetColumn, iSourceIndex, iTargetIndex);
1627
+ },
1628
+
1629
+ /**
1630
+ * Called if a Visualization is dropped between Cells (e.g. a tile is dropped between two cards)
1631
+ *
1632
+ * @param {sap.base.Event} oEvent The drop event
1633
+ *
1634
+ * @since 1.118.0
1635
+ * @private
1636
+ */
1637
+ onVisualizationDropBetweenCells: function (oEvent) {
1638
+ const oSourceVisualization = oEvent.getParameter("draggedControl");
1639
+ const oTargetCell = oEvent.getParameter("droppedControl");
1640
+ const sDropPosition = oEvent.getParameter("dropPosition");
1641
+ const oSourceCell = oSourceVisualization.getParent().getParent();
1642
+ const oTargetColumn = oTargetCell.getParent();
1643
+ let iPositionInTargetColumn = oTargetColumn.indexOfAggregation("cells", oTargetCell);
1644
+
1645
+ if (sDropPosition === "After") {
1646
+ iPositionInTargetColumn++;
1647
+ }
1567
1648
 
1568
- oDialog.close();
1569
- },
1570
-
1571
- /**
1572
- * Close the edit mode and request to save changes by firing the "closeEditMode" event. The edit mode needs to be managed
1573
- * the outer component to also handle the UserAction Menu button for edit mode.´
1574
- */
1575
- saveEditChanges: function () {
1576
- this.getOwnerComponent().fireEvent("closeEditMode", {
1577
- saveChanges: true
1578
- });
1579
- },
1580
-
1581
- /**
1582
- * Close the edit mode and request to cancel changes by firing the "closeEditMode" event. The edit mode needs to be managed
1583
- * the outer component to also handle the UserAction Menu button for edit mode.´
1584
- */
1585
- cancelEditChanges: function () {
1586
- this.getOwnerComponent().fireEvent("closeEditMode", {
1587
- saveChanges: false
1588
- });
1589
- },
1590
-
1591
- /**
1592
- * Called if a WorkPageCell is dropped before or after another WorkPageCell in a WorkPageColumn.
1593
- *
1594
- * @param {sap.base.Event} oEvent The drop event.
1595
- *
1596
- * @since 1.116.0
1597
- * @private
1598
- */
1599
- onCellDrop: function (oEvent) {
1600
- var oSourceCell = oEvent.getParameter("draggedControl");
1601
- var oTargetCell = oEvent.getParameter("droppedControl");
1602
- var sDropPosition = oEvent.getParameter("dropPosition");
1603
- var oSourceColumn = oSourceCell.getParent();
1604
- var oTargetColumn = oTargetCell.getParent();
1605
-
1606
- var iSourceIndex = oSourceColumn.indexOfAggregation("cells", oSourceCell);
1607
- var iTargetIndex = oTargetColumn.indexOfAggregation("cells", oTargetCell);
1608
-
1609
- // Increase the drop position if the dragged element is moved below the target element.
1610
- if (sDropPosition === "After") {
1611
- iTargetIndex++;
1649
+ this._moveVisualizationToCellOrColumn(oSourceVisualization, oSourceCell, oTargetColumn, iPositionInTargetColumn);
1650
+ },
1651
+
1652
+ /**
1653
+ * Called when a Visualization is dropped on top of a Cell (e.g. a tile is dropped on top of an empty cells illustrated message)
1654
+ *
1655
+ * @param {sap.base.Event} oEvent The drop event.
1656
+ *
1657
+ * @since 1.118.0
1658
+ * @private
1659
+ */
1660
+ onVisualizationDropOnCell: function (oEvent) {
1661
+ const oSourceVisualization = oEvent.getParameter("draggedControl");
1662
+ const oTargetColumn = oEvent.getParameter("droppedControl");
1663
+ const oSourceCell = oSourceVisualization.getParent().getParent();
1664
+ const iPositionInTargetColumn = 0;
1665
+
1666
+ this._moveVisualizationToCellOrColumn(oSourceVisualization, oSourceCell, oTargetColumn, iPositionInTargetColumn);
1667
+ },
1668
+
1669
+ /**
1670
+ * Called when a Visualization is dropped on an empty Widget Container
1671
+ *
1672
+ * @param {sap.base.Event} oEvent The drop event.
1673
+ *
1674
+ * @since 1.118.0
1675
+ * @private
1676
+ */
1677
+ onVisualizationDropOnEmptyWidgetContainer: function (oEvent) {
1678
+ const oSourceVisualization = oEvent.getParameter("draggedControl");
1679
+ const oTargetCell = oEvent.getParameter("droppedControl");
1680
+ const oSourceCell = oSourceVisualization.getParent().getParent();
1681
+
1682
+ this._moveVisualizationToCellOrColumn(oSourceVisualization, oSourceCell, oTargetCell);
1683
+ },
1684
+
1685
+ /**
1686
+ * Moves a visualization to an empty spot in a Column or into an empty Cell
1687
+ *
1688
+ * @param {object} oVisualization The Visualization
1689
+ * @param {object} oSourceCell The Cell where the tile was initially
1690
+ * @param {object} oTargetControl The target control (Column or empty Cell)
1691
+ * @param {int} [iPositionInTargetColumn] The position in the target column. Only needed when target control is a WorkPageColumn
1692
+ *
1693
+ * @since 1.118.0
1694
+ * @private
1695
+ */
1696
+ _moveVisualizationToCellOrColumn: function (oVisualization, oSourceCell, oTargetControl, iPositionInTargetColumn) {
1697
+ const oModel = this.getView().getModel();
1698
+ const sCellWidgetsPath = oSourceCell.getBindingContext().getPath() + "/widgets";
1699
+ const aCellWidgets = oModel.getProperty(sCellWidgetsPath);
1700
+ const iIndexInSourceCell = oSourceCell.indexOfAggregation("widgets", oVisualization);
1701
+ const sSourceVisPath = oVisualization.getBindingContext().getPath();
1702
+ const oSourceVisWidgetData = oModel.getProperty(sSourceVisPath);
1703
+
1704
+ aCellWidgets.splice(iIndexInSourceCell, 1);
1705
+
1706
+ // Insert the dragged object into a new target array to avoid mutation.
1707
+ const aNewCellWidgets = [].concat(aCellWidgets);
1708
+
1709
+ oModel.setProperty(sCellWidgetsPath, aNewCellWidgets);
1710
+ if (oTargetControl.isA("sap.ushell.components.workPageBuilder.controls.WorkPageCell")) {
1711
+ this._setCellData(oTargetControl, [oSourceVisWidgetData]);
1712
+ } else if (oTargetControl.isA("sap.ushell.components.workPageBuilder.controls.WorkPageColumn")) {
1713
+ this._setColumnData(oTargetControl, [oSourceVisWidgetData], iPositionInTargetColumn);
1714
+ }
1715
+ InvisibleMessage.getInstance().announce(this.getView().getModel("i18n").getResourceBundle().getText("WorkPage.Message.WidgetMoved"), InvisibleMessageMode.Assertive);
1716
+ this.getOwnerComponent().fireEvent("workPageEdited");
1717
+ },
1718
+
1719
+ /**
1720
+ * Moves a cell between two columns and updates the model accordingly.
1721
+ *
1722
+ * @param {sap.ushell.components.workPageBuilder.controls.WorkPageColumn} oSourceColumn The column from where the cell originates from
1723
+ * @param {sap.ushell.components.workPageBuilder.controls.WorkPageColumn} oTargetColumn The column where the cell will be moved to
1724
+ * @param {int} iSourceIndex The position in the column where the cell originates from
1725
+ * @param {int} iTargetIndex The position in the column where the cell will be moved to
1726
+ *
1727
+ * @private
1728
+ * @since 1.116.0
1729
+ */
1730
+ _moveCell: function (oSourceColumn, oTargetColumn, iSourceIndex, iTargetIndex) {
1731
+ var oModel = this.getView().getModel();
1732
+
1733
+ var bSameContainer = oTargetColumn.getId() === oSourceColumn.getId();
1734
+
1735
+ var sSourceColumnCellsPath = oSourceColumn.getBindingContext().getPath() + "/cells";
1736
+ var sTargetColumnCellsPath = oTargetColumn.getBindingContext().getPath() + "/cells";
1737
+
1738
+ var aSourceColumnCells = oModel.getProperty(sSourceColumnCellsPath);
1739
+ var aTargetColumnCells = oModel.getProperty(sTargetColumnCellsPath);
1740
+
1741
+ if (bSameContainer) {
1742
+ // Decrease drop position if the dragged element is taken from before the drop position in the same container.
1743
+ if (iSourceIndex < iTargetIndex) {
1744
+ iTargetIndex--;
1612
1745
  }
1613
-
1614
- this._moveCell(oSourceColumn, oTargetColumn, iSourceIndex, iTargetIndex);
1615
- },
1616
-
1617
- /**
1618
- * Called if a WorkPageCell is dropped on an empty WorkPageColumn.
1619
- *
1620
- * @param {sap.base.Event} oEvent The drop event.
1621
- *
1622
- * @since 1.116.0
1623
- * @private
1624
- */
1625
- onCellDropOnEmptyColumn: function (oEvent) {
1626
- var oSourceCell = oEvent.getParameter("draggedControl");
1627
- var oTargetColumn = oEvent.getParameter("droppedControl");
1628
- var oSourceColumn = oSourceCell.getParent();
1629
-
1630
- var iSourceIndex = oSourceColumn.indexOfAggregation("cells", oSourceCell);
1631
- var iTargetIndex = 0;
1632
-
1633
- this._moveCell(oSourceColumn, oTargetColumn, iSourceIndex, iTargetIndex);
1634
- },
1635
-
1636
- /**
1637
- * Called if a Visualization is dropped between Cells (e.g. a tile is dropped between two cards)
1638
- *
1639
- * @param {sap.base.Event} oEvent The drop event
1640
- *
1641
- * @since 1.118.0
1642
- * @private
1643
- */
1644
- onVisualizationDropBetweenCells: function (oEvent) {
1645
- const oSourceVisualization = oEvent.getParameter("draggedControl");
1646
- const oTargetCell = oEvent.getParameter("droppedControl");
1647
- const sDropPosition = oEvent.getParameter("dropPosition");
1648
- const oSourceCell = oSourceVisualization.getParent().getParent();
1649
- const oTargetColumn = oTargetCell.getParent();
1650
- let iPositionInTargetColumn = oTargetColumn.indexOfAggregation("cells", oTargetCell);
1651
-
1652
- if (sDropPosition === "After") {
1653
- iPositionInTargetColumn++;
1746
+ // Return if the result is the same for drag position and drop position in the same container (and prevent the MessageToast).
1747
+ if (iSourceIndex === iTargetIndex) {
1748
+ return;
1654
1749
  }
1750
+ }
1655
1751
 
1656
- this._moveVisualizationToCellOrColumn(oSourceVisualization, oSourceCell, oTargetColumn, iPositionInTargetColumn);
1657
- },
1658
-
1659
- /**
1660
- * Called when a Visualization is dropped on top of a Cell (e.g. a tile is dropped on top of an empty cells illustrated message)
1661
- *
1662
- * @param {sap.base.Event} oEvent The drop event.
1663
- *
1664
- * @since 1.118.0
1665
- * @private
1666
- */
1667
- onVisualizationDropOnCell: function (oEvent) {
1668
- const oSourceVisualization = oEvent.getParameter("draggedControl");
1669
- const oTargetColumn = oEvent.getParameter("droppedControl");
1670
- const oSourceCell = oSourceVisualization.getParent().getParent();
1671
- const iPositionInTargetColumn = 0;
1672
-
1673
- this._moveVisualizationToCellOrColumn(oSourceVisualization, oSourceCell, oTargetColumn, iPositionInTargetColumn);
1674
- },
1675
-
1676
- /**
1677
- * Called when a Visualization is dropped on an empty Widget Container
1678
- *
1679
- * @param {sap.base.Event} oEvent The drop event.
1680
- *
1681
- * @since 1.118.0
1682
- * @private
1683
- */
1684
- onVisualizationDropOnEmptyWidgetContainer: function (oEvent) {
1685
- const oSourceVisualization = oEvent.getParameter("draggedControl");
1686
- const oTargetCell = oEvent.getParameter("droppedControl");
1687
- const oSourceCell = oSourceVisualization.getParent().getParent();
1688
-
1689
- this._moveVisualizationToCellOrColumn(oSourceVisualization, oSourceCell, oTargetCell);
1690
- },
1691
-
1692
- /**
1693
- * Moves a visualization to an empty spot in a Column or into an empty Cell
1694
- *
1695
- * @param {object} oVisualization The Visualization
1696
- * @param {object} oSourceCell The Cell where the tile was initially
1697
- * @param {object} oTargetControl The target control (Column or empty Cell)
1698
- * @param {int} [iPositionInTargetColumn] The position in the target column. Only needed when target control is a WorkPageColumn
1699
- *
1700
- * @since 1.118.0
1701
- * @private
1702
- */
1703
- _moveVisualizationToCellOrColumn: function (oVisualization, oSourceCell, oTargetControl, iPositionInTargetColumn) {
1704
- const oModel = this.getView().getModel();
1705
- const sCellWidgetsPath = oSourceCell.getBindingContext().getPath() + "/widgets";
1706
- const aCellWidgets = oModel.getProperty(sCellWidgetsPath);
1707
- const iIndexInSourceCell = oSourceCell.indexOfAggregation("widgets", oVisualization);
1708
- const sSourceVisPath = oVisualization.getBindingContext().getPath();
1709
- const oSourceVisWidgetData = oModel.getProperty(sSourceVisPath);
1710
-
1711
- aCellWidgets.splice(iIndexInSourceCell, 1);
1712
-
1713
- // Insert the dragged object into a new target array to avoid mutation.
1714
- const aNewCellWidgets = [].concat(aCellWidgets);
1715
-
1716
- oModel.setProperty(sCellWidgetsPath, aNewCellWidgets);
1717
- if (oTargetControl.isA("sap.ushell.components.workPageBuilder.controls.WorkPageCell")) {
1718
- this._setCellData(oTargetControl, [oSourceVisWidgetData]);
1719
- } else if (oTargetControl.isA("sap.ushell.components.workPageBuilder.controls.WorkPageColumn")) {
1720
- this._setColumnData(oTargetControl, [oSourceVisWidgetData], iPositionInTargetColumn);
1721
- }
1722
- InvisibleMessage.getInstance().announce(this.getView().getModel("i18n").getResourceBundle().getText("WorkPage.Message.WidgetMoved"), InvisibleMessageMode.Assertive);
1723
- this.getOwnerComponent().fireEvent("workPageEdited");
1724
- },
1725
-
1726
- /**
1727
- * Moves a cell between two columns and updates the model accordingly.
1728
- *
1729
- * @param {sap.ushell.components.workPageBuilder.controls.WorkPageColumn} oSourceColumn The column from where the cell originates from
1730
- * @param {sap.ushell.components.workPageBuilder.controls.WorkPageColumn} oTargetColumn The column where the cell will be moved to
1731
- * @param {int} iSourceIndex The position in the column where the cell originates from
1732
- * @param {int} iTargetIndex The position in the column where the cell will be moved to
1733
- *
1734
- * @private
1735
- * @since 1.116.0
1736
- */
1737
- _moveCell: function (oSourceColumn, oTargetColumn, iSourceIndex, iTargetIndex) {
1738
- var oModel = this.getView().getModel();
1739
-
1740
- var bSameContainer = oTargetColumn.getId() === oSourceColumn.getId();
1741
-
1742
- var sSourceColumnCellsPath = oSourceColumn.getBindingContext().getPath() + "/cells";
1743
- var sTargetColumnCellsPath = oTargetColumn.getBindingContext().getPath() + "/cells";
1744
-
1745
- var aSourceColumnCells = oModel.getProperty(sSourceColumnCellsPath);
1746
- var aTargetColumnCells = oModel.getProperty(sTargetColumnCellsPath);
1747
-
1748
- if (bSameContainer) {
1749
- // Decrease drop position if the dragged element is taken from before the drop position in the same container.
1750
- if (iSourceIndex < iTargetIndex) {
1751
- iTargetIndex--;
1752
- }
1753
- // Return if the result is the same for drag position and drop position in the same container (and prevent the MessageToast).
1754
- if (iSourceIndex === iTargetIndex) {
1755
- return;
1756
- }
1757
- }
1752
+ // Filter the dragged item from the source array instead of splicing to avoid mutation.
1753
+ var aNewDragColumnCells = aSourceColumnCells.filter(function (oWidget, iIndex) {
1754
+ return iIndex !== iSourceIndex;
1755
+ });
1758
1756
 
1759
- // Filter the dragged item from the source array instead of splicing to avoid mutation.
1760
- var aNewDragColumnCells = aSourceColumnCells.filter(function (oWidget, iIndex) {
1761
- return iIndex !== iSourceIndex;
1762
- });
1757
+ // If dnd happened in the same cell, the drop cells become the dragged cells without the dragged object.
1758
+ if (bSameContainer) {
1759
+ aTargetColumnCells = aNewDragColumnCells;
1760
+ }
1763
1761
 
1764
- // If dnd happened in the same cell, the drop cells become the dragged cells without the dragged object.
1765
- if (bSameContainer) {
1766
- aTargetColumnCells = aNewDragColumnCells;
1767
- }
1762
+ // Insert the dragged object into a new target array to avoid mutation.
1763
+ var aNewDropColumnCells = [aTargetColumnCells.slice(0, iTargetIndex), aSourceColumnCells[iSourceIndex], aTargetColumnCells.slice(iTargetIndex)].flat();
1764
+
1765
+ oModel.setProperty(sSourceColumnCellsPath, aNewDragColumnCells);
1766
+ oModel.setProperty(sTargetColumnCellsPath, aNewDropColumnCells);
1767
+
1768
+ InvisibleMessage.getInstance().announce(this.getView().getModel("i18n").getResourceBundle().getText("WorkPage.Message.WidgetMoved"), InvisibleMessageMode.Assertive);
1769
+ this.getOwnerComponent().fireEvent("workPageEdited");
1770
+ },
1771
+
1772
+ /**
1773
+ * Called if a widget is dropped on the WorkPageCell.
1774
+ * @since 1.116.0
1775
+ * @param {sap.base.Event} oEvent The drop event.
1776
+ */
1777
+ onWidgetOnCellDrop: function (oEvent) {
1778
+ var oDragged = oEvent.getParameter("draggedControl");
1779
+ var oSourceCell = oDragged.getParent().getParent();
1780
+ var oTargetCell = oEvent.getParameter("droppedControl");
1781
+ var iDragPosition = oSourceCell.indexOfAggregation("widgets", oDragged);
1782
+ var iDropPosition = oTargetCell.getBindingContext().getProperty("widgets").length;
1783
+
1784
+ this._moveVisualization(oSourceCell, oTargetCell, iDragPosition, iDropPosition);
1785
+ },
1786
+
1787
+ /**
1788
+ * Called when a Widget is dragged over a Cell. Prevents the drop for Cells with tiles or based on conditions defined by the parameters.
1789
+ * Note: The Tile drop event is prevented here because it is handled by a different drag/drop option via the GridContainer
1790
+ *
1791
+ * @param {sap.base.Event} oEvent The dragEnter event.
1792
+ * @param {object} bEmptyCellExpected Determines whether it is expected that Widgets are already present in the target Cell
1793
+ */
1794
+ onWidgetOnCellDragEnter: function (oEvent, bEmptyCellExpected) {
1795
+ const oCell = oEvent.getParameter("target");
1796
+ const bWidgetsPresent = !!oCell.getBindingContext().getProperty("widgets").length;
1797
+ if (oCell.getTileMode() && bWidgetsPresent || bEmptyCellExpected === bWidgetsPresent) {
1798
+ oEvent.preventDefault();
1799
+ }
1800
+ },
1801
+
1802
+ /**
1803
+ * Called if a widget is dropped to a certain position in the GridContainer.
1804
+ * @since 1.110.0
1805
+ * @param {sap.base.Event} oEvent The drop event.
1806
+ */
1807
+ onGridDrop: function (oEvent) {
1808
+ var oTargetCell = oEvent.getSource();
1809
+ var oDragged = oEvent.getParameter("draggedControl");
1810
+ var oDropped = oEvent.getParameter("droppedControl");
1811
+ var sInsertPosition = oEvent.getParameter("dropPosition");
1812
+ var oSourceCell = oDragged.getParent().getParent();
1813
+
1814
+ var iDragPosition = oSourceCell.indexOfAggregation("widgets", oDragged);
1815
+ var iDropPosition = oTargetCell.indexOfAggregation("widgets", oDropped);
1816
+
1817
+ var bSameContainer = oTargetCell.getId() === oSourceCell.getId();
1818
+
1819
+ // Increase the drop position if the dragged element is moved to the right.
1820
+ if (sInsertPosition === "After") {
1821
+ iDropPosition++;
1822
+ }
1768
1823
 
1769
- // Insert the dragged object into a new target array to avoid mutation.
1770
- var aNewDropColumnCells = [aTargetColumnCells.slice(0, iTargetIndex), aSourceColumnCells[iSourceIndex], aTargetColumnCells.slice(iTargetIndex)].flat();
1771
-
1772
- oModel.setProperty(sSourceColumnCellsPath, aNewDragColumnCells);
1773
- oModel.setProperty(sTargetColumnCellsPath, aNewDropColumnCells);
1774
-
1775
- InvisibleMessage.getInstance().announce(this.getView().getModel("i18n").getResourceBundle().getText("WorkPage.Message.WidgetMoved"), InvisibleMessageMode.Assertive);
1776
- this.getOwnerComponent().fireEvent("workPageEdited");
1777
- },
1778
-
1779
- /**
1780
- * Called if a widget is dropped on the WorkPageCell.
1781
- * @since 1.116.0
1782
- * @param {sap.base.Event} oEvent The drop event.
1783
- */
1784
- onWidgetOnCellDrop: function (oEvent) {
1785
- var oDragged = oEvent.getParameter("draggedControl");
1786
- var oSourceCell = oDragged.getParent().getParent();
1787
- var oTargetCell = oEvent.getParameter("droppedControl");
1788
- var iDragPosition = oSourceCell.indexOfAggregation("widgets", oDragged);
1789
- var iDropPosition = oTargetCell.getBindingContext().getProperty("widgets").length;
1790
-
1791
- this._moveVisualization(oSourceCell, oTargetCell, iDragPosition, iDropPosition);
1792
- },
1793
-
1794
- /**
1795
- * Called when a Widget is dragged over a Cell. Prevents the drop for Cells with tiles or based on conditions defined by the parameters.
1796
- * Note: The Tile drop event is prevented here because it is handled by a different drag/drop option via the GridContainer
1797
- *
1798
- * @param {sap.base.Event} oEvent The dragEnter event.
1799
- * @param {object} bEmptyCellExpected Determines whether it is expected that Widgets are already present in the target Cell
1800
- */
1801
- onWidgetOnCellDragEnter: function (oEvent, bEmptyCellExpected) {
1802
- let oCell = oEvent.getParameter("target");
1803
- let bWidgetsPresent = !!oCell.getBindingContext().getProperty("widgets").length;
1804
- if (oCell.getTileMode() && bWidgetsPresent || bEmptyCellExpected === bWidgetsPresent) {
1805
- oEvent.preventDefault();
1824
+ if (bSameContainer) {
1825
+ // Decrease drop position if the dragged element is taken from before the drop position in the same container.
1826
+ if (iDragPosition < iDropPosition) {
1827
+ iDropPosition--;
1806
1828
  }
1807
- },
1808
-
1809
- /**
1810
- * Called if a widget is dropped to a certain position in the GridContainer.
1811
- * @since 1.110.0
1812
- * @param {sap.base.Event} oEvent The drop event.
1813
- */
1814
- onGridDrop: function (oEvent) {
1815
- var oTargetCell = oEvent.getSource();
1816
- var oDragged = oEvent.getParameter("draggedControl");
1817
- var oDropped = oEvent.getParameter("droppedControl");
1818
- var sInsertPosition = oEvent.getParameter("dropPosition");
1819
- var oSourceCell = oDragged.getParent().getParent();
1820
-
1821
- var iDragPosition = oSourceCell.indexOfAggregation("widgets", oDragged);
1822
- var iDropPosition = oTargetCell.indexOfAggregation("widgets", oDropped);
1823
-
1824
- var bSameContainer = oTargetCell.getId() === oSourceCell.getId();
1825
-
1826
- // Increase the drop position if the dragged element is moved to the right.
1827
- if (sInsertPosition === "After") {
1828
- iDropPosition++;
1829
- }
1830
-
1831
- if (bSameContainer) {
1832
- // Decrease drop position if the dragged element is taken from before the drop position in the same container.
1833
- if (iDragPosition < iDropPosition) {
1834
- iDropPosition--;
1835
- }
1836
- // Return if the result is the same for drag position and drop position in the same container (and prevent the MessageToast).
1837
- if (iDragPosition === iDropPosition) {
1838
- return;
1839
- }
1829
+ // Return if the result is the same for drag position and drop position in the same container (and prevent the MessageToast).
1830
+ if (iDragPosition === iDropPosition) {
1831
+ return;
1840
1832
  }
1833
+ }
1841
1834
 
1842
- this._moveVisualization(oSourceCell, oTargetCell, iDragPosition, iDropPosition);
1843
- },
1844
-
1845
- /**
1846
- * Updates the model according to the new positions.
1847
- * Removes the widget data from the widgets in the source cell at the drag position.
1848
- * Inserts the object into the widgets array in the target cell at the drop position.
1849
- *
1850
- * @since 1.110.0
1851
- * @param {sap.ushell.components.workPageBuilder.controls.WorkPageCell} oSourceCell The cell from which the widget was dragged.
1852
- * @param {sap.ushell.components.workPageBuilder.controls.WorkPageCell} oTargetCell The cell into which the widget was dropped.
1853
- * @param {int} iDragPosition The position the widget was dragged from.
1854
- * @param {int} iDropPosition The position the widget was dropped to.
1855
- * @private
1856
- */
1857
- _moveVisualization: function (oSourceCell, oTargetCell, iDragPosition, iDropPosition) {
1858
- var oModel = this.getView().getModel();
1859
-
1860
- var sDragContainerWidgetsPath = oSourceCell.getBindingContext().getPath() + "/widgets";
1861
- var sDropContainerWidgetsPath = oTargetCell.getBindingContext().getPath() + "/widgets";
1862
- var bSameCell = sDragContainerWidgetsPath === sDropContainerWidgetsPath;
1863
-
1864
- var aDragContainerWidgets = oModel.getProperty(sDragContainerWidgetsPath);
1865
- var aDropContainerWidgets = oModel.getProperty(sDropContainerWidgetsPath);
1866
-
1867
- var oDraggedObject = aDragContainerWidgets[iDragPosition];
1868
-
1869
- // Filter the dragged item from the source array instead of splicing to avoid mutation.
1870
- var aNewDragContainerWidgets = aDragContainerWidgets.filter(function (oWidget, iIndex) {
1871
- return iIndex !== iDragPosition;
1872
- });
1873
-
1874
- // If dnd happened in the same cell, the drop widgets become the dragged widgets without the dragged object.
1875
- if (bSameCell) {
1876
- aDropContainerWidgets = aNewDragContainerWidgets;
1877
- }
1835
+ this._moveVisualization(oSourceCell, oTargetCell, iDragPosition, iDropPosition);
1836
+ },
1837
+
1838
+ /**
1839
+ * Updates the model according to the new positions.
1840
+ * Removes the widget data from the widgets in the source cell at the drag position.
1841
+ * Inserts the object into the widgets array in the target cell at the drop position.
1842
+ *
1843
+ * @since 1.110.0
1844
+ * @param {sap.ushell.components.workPageBuilder.controls.WorkPageCell} oSourceCell The cell from which the widget was dragged.
1845
+ * @param {sap.ushell.components.workPageBuilder.controls.WorkPageCell} oTargetCell The cell into which the widget was dropped.
1846
+ * @param {int} iDragPosition The position the widget was dragged from.
1847
+ * @param {int} iDropPosition The position the widget was dropped to.
1848
+ * @private
1849
+ */
1850
+ _moveVisualization: function (oSourceCell, oTargetCell, iDragPosition, iDropPosition) {
1851
+ var oModel = this.getView().getModel();
1852
+
1853
+ var sDragContainerWidgetsPath = oSourceCell.getBindingContext().getPath() + "/widgets";
1854
+ var sDropContainerWidgetsPath = oTargetCell.getBindingContext().getPath() + "/widgets";
1855
+ var bSameCell = sDragContainerWidgetsPath === sDropContainerWidgetsPath;
1856
+
1857
+ var aDragContainerWidgets = oModel.getProperty(sDragContainerWidgetsPath);
1858
+ var aDropContainerWidgets = oModel.getProperty(sDropContainerWidgetsPath);
1859
+
1860
+ var oDraggedObject = aDragContainerWidgets[iDragPosition];
1861
+
1862
+ // Filter the dragged item from the source array instead of splicing to avoid mutation.
1863
+ var aNewDragContainerWidgets = aDragContainerWidgets.filter(function (oWidget, iIndex) {
1864
+ return iIndex !== iDragPosition;
1865
+ });
1866
+
1867
+ // If dnd happened in the same cell, the drop widgets become the dragged widgets without the dragged object.
1868
+ if (bSameCell) {
1869
+ aDropContainerWidgets = aNewDragContainerWidgets;
1870
+ }
1878
1871
 
1879
- // Insert the dragged object into a new target array to avoid mutation.
1880
- var aNewDropContainerWidgets = [aDropContainerWidgets.slice(0, iDropPosition), oDraggedObject, aDropContainerWidgets.slice(iDropPosition)].flat();
1881
-
1882
- oModel.setProperty(sDragContainerWidgetsPath, aNewDragContainerWidgets);
1883
- oModel.setProperty(sDropContainerWidgetsPath, aNewDropContainerWidgets);
1884
-
1885
- InvisibleMessage.getInstance().announce(this.getView().getModel("i18n").getResourceBundle().getText("WorkPage.Message.WidgetMoved"), InvisibleMessageMode.Assertive);
1886
- this.getOwnerComponent().fireEvent("workPageEdited");
1887
- },
1888
-
1889
- /**
1890
- * Returns true if the aWidgets array does not contain cards.
1891
- *
1892
- * @param {sap.ui.core.Control[]} aWidgets The array of widget controls.
1893
- * @returns {boolean} The result indicating if tileMode is active.
1894
- */
1895
- tileMode: function (aWidgets) {
1896
- var oModel = this.getView().getModel();
1897
- var oUsedViz;
1898
-
1899
- return !!aWidgets && (aWidgets.length > 1 || !aWidgets.some(function (oWidget) {
1900
- oUsedViz = oModel.getProperty("/data/usedVisualizations/" + ObjectPath.get("visualization.id", oWidget));
1901
- return ObjectPath.get("type", oUsedViz) === "sap.card";
1902
- }));
1903
- },
1904
-
1905
- /**
1906
- * Formatter for the appsearch button. Returns true if the cell is in tileMode and editMode is active.
1907
- *
1908
- * @param {object[]} aWidgets The widgets array.
1909
- * @param {boolean} bEditMode The editMode flag
1910
- * @returns {boolean} The result.
1911
- */
1912
- showAppSearchButton: function (aWidgets, bEditMode) {
1913
- return this.tileMode(aWidgets) && bEditMode;
1914
- },
1915
-
1916
- /**
1917
- * Updates the model with the columnWidths.
1918
- *
1919
- * @param {sap.ushell.components.workPageBuilder.controls.WorkPageRow} oRow The surrounding row.
1920
- * @param {int} iLeftColumnIndex The index of the left column to update.
1921
- * @param {int} iRightColumnIndex The index of the right column to update.
1922
- * @param {int} iNewLeftColumnWidth The new columnWidth value for the left column.
1923
- * @param {int} iNewRightColumnWidth The new columnWidth value for the right column.
1924
- * @private
1925
- */
1926
- _updateModelWithColumnWidths: function (oRow, iLeftColumnIndex, iRightColumnIndex, iNewLeftColumnWidth, iNewRightColumnWidth) {
1927
- var oModel = this.getView().getModel();
1928
- var oRowBindingContext = oRow.getBindingContext();
1929
- var sRowBindingContextPath = oRowBindingContext.getPath();
1930
- var sLeftColumnPath = sRowBindingContextPath + "/columns/" + iLeftColumnIndex + "/descriptor/value/columnWidth";
1931
- var sRightColumnPath = sRowBindingContextPath + "/columns/" + iRightColumnIndex + "/descriptor/value/columnWidth";
1932
- oModel.setProperty(sLeftColumnPath, iNewLeftColumnWidth);
1933
- oModel.setProperty(sRightColumnPath, iNewRightColumnWidth);
1934
- },
1935
-
1936
- /**
1937
- * Gets the column width from the column descriptor entry, falls back to max column width if the columnWidth is empty.
1938
- *
1939
- * @param {object} oColumn The column data object.
1940
- * @returns {int} The column width as an integer.
1941
- * @private
1942
- */
1943
- _getColumnWidth: function (oColumn) {
1944
- return ObjectPath.get("descriptor.value.columnWidth", oColumn) || MAX_GRID_COLUMN_WIDTH;
1945
- },
1946
-
1947
- /**
1948
- * Sets the column width to the column descriptor.
1949
- *
1950
- * @param {object} oColumn The column data object.
1951
- * @param {int} iColumnWidth The column data object.
1952
- * @private
1953
- */
1954
- _setColumnWidth: function (oColumn, iColumnWidth) {
1955
- ObjectPath.set("descriptor.value.columnWidth", iColumnWidth, oColumn);
1956
- },
1957
-
1958
- /**
1959
- *
1960
- * @param {sap.ushell.components.workPageBuilder.controls.WorkPageColumn[]} aColumns An array of WorkPageColumn controls.
1961
- * @param {int} iColumnIndex The column index.
1962
- * @param {int} iTotalColumns The total number of columns.
1963
- * @returns {sap.ushell.components.workPageBuilder.controls.WorkPageColumn[]} The updated array of WorkPageColumn controls.
1964
- * @private
1965
- */
1966
- _calculateColWidths: function (aColumns, iColumnIndex, iTotalColumns) {
1967
- var oColumn = aColumns[iColumnIndex];
1968
-
1969
- if (this._getColumnWidth(oColumn) - STEP_SIZE >= MIN_GRID_COLUMN_WIDTH) {
1970
- this._setColumnWidth(oColumn, this._getColumnWidth(oColumn) - STEP_SIZE);
1971
- iTotalColumns = iTotalColumns - STEP_SIZE;
1972
- }
1872
+ // Insert the dragged object into a new target array to avoid mutation.
1873
+ var aNewDropContainerWidgets = [aDropContainerWidgets.slice(0, iDropPosition), oDraggedObject, aDropContainerWidgets.slice(iDropPosition)].flat();
1874
+
1875
+ oModel.setProperty(sDragContainerWidgetsPath, aNewDragContainerWidgets);
1876
+ oModel.setProperty(sDropContainerWidgetsPath, aNewDropContainerWidgets);
1877
+
1878
+ InvisibleMessage.getInstance().announce(this.getView().getModel("i18n").getResourceBundle().getText("WorkPage.Message.WidgetMoved"), InvisibleMessageMode.Assertive);
1879
+ this.getOwnerComponent().fireEvent("workPageEdited");
1880
+ },
1881
+
1882
+ /**
1883
+ * Returns true if the aWidgets array does not contain cards.
1884
+ *
1885
+ * @param {sap.ui.core.Control[]} aWidgets The array of widget controls.
1886
+ * @returns {boolean} The result indicating if tileMode is active.
1887
+ */
1888
+ tileMode: function (aWidgets) {
1889
+ var oModel = this.getView().getModel();
1890
+ var oUsedViz;
1891
+
1892
+ return !!aWidgets && (aWidgets.length > 1 || !aWidgets.some(function (oWidget) {
1893
+ oUsedViz = oModel.getProperty("/data/usedVisualizations/" + ObjectPath.get("visualization.id", oWidget));
1894
+ return ObjectPath.get("type", oUsedViz) === "sap.card";
1895
+ }));
1896
+ },
1897
+
1898
+ /**
1899
+ * Formatter for the appsearch button. Returns true if the cell is in tileMode and editMode is active.
1900
+ *
1901
+ * @param {object[]} aWidgets The widgets array.
1902
+ * @param {boolean} bEditMode The editMode flag
1903
+ * @returns {boolean} The result.
1904
+ */
1905
+ showAppSearchButton: function (aWidgets, bEditMode) {
1906
+ return this.tileMode(aWidgets) && bEditMode;
1907
+ },
1908
+
1909
+ /**
1910
+ * Updates the model with the columnWidths.
1911
+ *
1912
+ * @param {sap.ushell.components.workPageBuilder.controls.WorkPageRow} oRow The surrounding row.
1913
+ * @param {int} iLeftColumnIndex The index of the left column to update.
1914
+ * @param {int} iRightColumnIndex The index of the right column to update.
1915
+ * @param {int} iNewLeftColumnWidth The new columnWidth value for the left column.
1916
+ * @param {int} iNewRightColumnWidth The new columnWidth value for the right column.
1917
+ * @private
1918
+ */
1919
+ _updateModelWithColumnWidths: function (oRow, iLeftColumnIndex, iRightColumnIndex, iNewLeftColumnWidth, iNewRightColumnWidth) {
1920
+ var oModel = this.getView().getModel();
1921
+ var oRowBindingContext = oRow.getBindingContext();
1922
+ var sRowBindingContextPath = oRowBindingContext.getPath();
1923
+ var sLeftColumnPath = sRowBindingContextPath + "/columns/" + iLeftColumnIndex + "/descriptor/value/columnWidth";
1924
+ var sRightColumnPath = sRowBindingContextPath + "/columns/" + iRightColumnIndex + "/descriptor/value/columnWidth";
1925
+ oModel.setProperty(sLeftColumnPath, iNewLeftColumnWidth);
1926
+ oModel.setProperty(sRightColumnPath, iNewRightColumnWidth);
1927
+ },
1928
+
1929
+ /**
1930
+ * Gets the column width from the column descriptor entry, falls back to max column width if the columnWidth is empty.
1931
+ *
1932
+ * @param {object} oColumn The column data object.
1933
+ * @returns {int} The column width as an integer.
1934
+ * @private
1935
+ */
1936
+ _getColumnWidth: function (oColumn) {
1937
+ return ObjectPath.get("descriptor.value.columnWidth", oColumn) || MAX_GRID_COLUMN_WIDTH;
1938
+ },
1939
+
1940
+ /**
1941
+ * Sets the column width to the column descriptor.
1942
+ *
1943
+ * @param {object} oColumn The column data object.
1944
+ * @param {int} iColumnWidth The column data object.
1945
+ * @private
1946
+ */
1947
+ _setColumnWidth: function (oColumn, iColumnWidth) {
1948
+ ObjectPath.set("descriptor.value.columnWidth", iColumnWidth, oColumn);
1949
+ },
1950
+
1951
+ /**
1952
+ *
1953
+ * @param {sap.ushell.components.workPageBuilder.controls.WorkPageColumn[]} aColumns An array of WorkPageColumn controls.
1954
+ * @param {int} iColumnIndex The column index.
1955
+ * @param {int} iTotalColumns The total number of columns.
1956
+ * @returns {sap.ushell.components.workPageBuilder.controls.WorkPageColumn[]} The updated array of WorkPageColumn controls.
1957
+ * @private
1958
+ */
1959
+ _calculateColWidths: function (aColumns, iColumnIndex, iTotalColumns) {
1960
+ var oColumn = aColumns[iColumnIndex];
1961
+
1962
+ if (this._getColumnWidth(oColumn) - STEP_SIZE >= MIN_GRID_COLUMN_WIDTH) {
1963
+ this._setColumnWidth(oColumn, this._getColumnWidth(oColumn) - STEP_SIZE);
1964
+ iTotalColumns = iTotalColumns - STEP_SIZE;
1965
+ }
1973
1966
 
1974
- if (iTotalColumns > MAX_GRID_COLUMN_WIDTH) {
1975
- var nextIndex = iColumnIndex - 1 >= 0 ? iColumnIndex - 1 : aColumns.length - 1;
1976
- this._calculateColWidths(aColumns, nextIndex, iTotalColumns);
1977
- }
1967
+ if (iTotalColumns > MAX_GRID_COLUMN_WIDTH) {
1968
+ var nextIndex = iColumnIndex - 1 >= 0 ? iColumnIndex - 1 : aColumns.length - 1;
1969
+ this._calculateColWidths(aColumns, nextIndex, iTotalColumns);
1970
+ }
1978
1971
 
1979
- return aColumns;
1980
- },
1981
-
1982
- /**
1983
- * Returns the data representation of an empty WorkPageColumn.
1984
- *
1985
- * @param {int} iColumnWidth The columnWidth for the column.
1986
- * @returns {object} The WorkPageColumn data object.
1987
- * @private
1988
- */
1989
- _createEmptyColumn: function (iColumnWidth) {
1990
- return {
1991
- id: this._generateUniqueId(),
1992
- descriptor: {
1993
- value: {
1994
- columnWidth: iColumnWidth
1995
- },
1996
- schemaVersion: "3.2.0"
1972
+ return aColumns;
1973
+ },
1974
+
1975
+ /**
1976
+ * Returns the data representation of an empty WorkPageColumn.
1977
+ *
1978
+ * @param {int} iColumnWidth The columnWidth for the column.
1979
+ * @returns {object} The WorkPageColumn data object.
1980
+ * @private
1981
+ */
1982
+ _createEmptyColumn: function (iColumnWidth) {
1983
+ return {
1984
+ id: this._generateUniqueId(),
1985
+ descriptor: {
1986
+ value: {
1987
+ columnWidth: iColumnWidth
1997
1988
  },
1998
- configurations: [],
1999
- cells: []
2000
- };
2001
- },
2002
-
2003
- /**
2004
- * Returns the data representation of an empty WorkPageRow.
2005
- *
2006
- * @returns {object} The WorkPageRow data object.
2007
- * @private
2008
- */
2009
- _createEmptyRow: function () {
2010
- return {
2011
- id: this._generateUniqueId(),
2012
- descriptor: {
2013
- value: {
2014
- title: ""
2015
- },
2016
- schemaVersion: "3.2.0"
1989
+ schemaVersion: "3.2.0"
1990
+ },
1991
+ configurations: [],
1992
+ cells: []
1993
+ };
1994
+ },
1995
+
1996
+ /**
1997
+ * Returns the data representation of an empty WorkPageRow.
1998
+ *
1999
+ * @returns {object} The WorkPageRow data object.
2000
+ * @private
2001
+ */
2002
+ _createEmptyRow: function () {
2003
+ return {
2004
+ id: this._generateUniqueId(),
2005
+ descriptor: {
2006
+ value: {
2007
+ title: ""
2017
2008
  },
2018
- columns: [this._createEmptyColumn(MAX_GRID_COLUMN_WIDTH)]
2019
- };
2020
- },
2021
-
2022
- /**
2023
- * Saves the host in a variable to be attached to a card.
2024
- *
2025
- * @private
2026
- */
2027
- _saveHost: function () {
2028
- this.oHost = Element.getElementById("sap.shell.host.environment");
2029
- if (!this.oHost) {
2030
- this.oHost = new WorkPageHost("sap.shell.host.environment");
2031
- // set the ushell container on the host for navigation service access
2032
- this.oHost._setContainer(this.getOwnerComponent().getUshellContainer());
2033
- // create a property binding for navigationDisabled to forward to host if a model is present.
2034
- if (this.oModel) {
2035
- var oNavDisabledBinding = this.oModel.bindProperty("/navigationDisabled");
2036
- this.oHost._setNavigationDisabled(oNavDisabledBinding.getValue());
2037
- // listen to changes on navigationDisabled and propagate to host
2038
- oNavDisabledBinding.attachChange(function (oEvent) {
2039
- this.oHost._setNavigationDisabled(oEvent.getSource().getValue());
2040
- }.bind(this));
2041
- }
2009
+ schemaVersion: "3.2.0"
2010
+ },
2011
+ columns: [this._createEmptyColumn(MAX_GRID_COLUMN_WIDTH)]
2012
+ };
2013
+ },
2014
+
2015
+ /**
2016
+ * Saves the host in a variable to be attached to a card.
2017
+ *
2018
+ * @private
2019
+ */
2020
+ _saveHost: function () {
2021
+ this.oHost = Element.getElementById("sap.shell.host.environment");
2022
+ if (!this.oHost) {
2023
+ this.oHost = new WorkPageHost("sap.shell.host.environment");
2024
+ // set the ushell container on the host for navigation service access
2025
+ this.oHost._setContainer(this.getOwnerComponent().getUshellContainer());
2026
+ // create a property binding for navigationDisabled to forward to host if a model is present.
2027
+ if (this.oModel) {
2028
+ var oNavDisabledBinding = this.oModel.bindProperty("/navigationDisabled");
2029
+ this.oHost._setNavigationDisabled(oNavDisabledBinding.getValue());
2030
+ // listen to changes on navigationDisabled and propagate to host
2031
+ oNavDisabledBinding.attachChange(function (oEvent) {
2032
+ this.oHost._setNavigationDisabled(oEvent.getSource().getValue());
2033
+ }.bind(this));
2042
2034
  }
2043
- },
2044
-
2045
- /**
2046
- * Check if Navigation is disabled
2047
- *
2048
- * @private
2049
- * @since 1.109.0
2050
- */
2051
-
2052
- getNavigationDisabled: function () {
2053
- return this.oModel.getProperty("/navigationDisabled");
2054
- },
2055
-
2056
- /**
2057
- * Disable the navigation on tiles and widgets
2058
- * @param {boolean} bNavigation true or false
2059
- *
2060
- * @private
2061
- * @since 1.109.0
2062
- */
2063
-
2064
- setNavigationDisabled: function (bNavigation) {
2065
- this.oModel.setProperty("/navigationDisabled", bNavigation);
2066
- },
2067
-
2068
- /**
2069
- * Returns a unique id which does not yet exist on the WorkPage.
2070
- * Optionally an array of existing IDs can be given as an argument.
2071
- * This can be helpful if new entities are created in a loop but not yet entered into the model.
2072
- *
2073
- * @since 1.112.0
2074
- * @param {string[]} [aExistingIds] An array of existing IDs as strings.
2075
- * @returns {string} A unique ID.
2076
- * @private
2077
- */
2078
- _generateUniqueId: function (aExistingIds) {
2079
- // make a copy to not change the passed array.
2080
- var aIds = (aExistingIds || []).concat([]);
2081
- var oWorkPage = this.oModel.getProperty("/data/workPage");
2082
- var fnCollectIds = this._collectIds.bind(this);
2083
-
2084
- aIds = aIds.concat(fnCollectIds(oWorkPage));
2085
-
2086
- (oWorkPage.rows || []).forEach(function (oRow) {
2087
- aIds = aIds.concat(fnCollectIds(oRow));
2088
- (oRow.columns || []).forEach(function (oColumn) {
2089
- aIds = aIds.concat(fnCollectIds(oColumn));
2090
- (oColumn.cells || []).forEach(function (oCell) {
2091
- aIds = aIds.concat(fnCollectIds(oCell));
2092
- (oCell.widgets || []).forEach(function (oWidget) {
2093
- aIds = aIds.concat(fnCollectIds(oWidget));
2094
- });
2035
+ }
2036
+ },
2037
+
2038
+ /**
2039
+ * Check if Navigation is disabled
2040
+ *
2041
+ * @private
2042
+ * @since 1.109.0
2043
+ */
2044
+
2045
+ getNavigationDisabled: function () {
2046
+ return this.oModel.getProperty("/navigationDisabled");
2047
+ },
2048
+
2049
+ /**
2050
+ * Disable the navigation on tiles and widgets
2051
+ * @param {boolean} bNavigation true or false
2052
+ *
2053
+ * @private
2054
+ * @since 1.109.0
2055
+ */
2056
+
2057
+ setNavigationDisabled: function (bNavigation) {
2058
+ this.oModel.setProperty("/navigationDisabled", bNavigation);
2059
+ },
2060
+
2061
+ /**
2062
+ * Returns a unique id which does not yet exist on the WorkPage.
2063
+ * Optionally an array of existing IDs can be given as an argument.
2064
+ * This can be helpful if new entities are created in a loop but not yet entered into the model.
2065
+ *
2066
+ * @since 1.112.0
2067
+ * @param {string[]} [aExistingIds] An array of existing IDs as strings.
2068
+ * @returns {string} A unique ID.
2069
+ * @private
2070
+ */
2071
+ _generateUniqueId: function (aExistingIds) {
2072
+ // make a copy to not change the passed array.
2073
+ var aIds = (aExistingIds || []).concat([]);
2074
+ var oWorkPage = this.oModel.getProperty("/data/workPage");
2075
+ var fnCollectIds = this._collectIds.bind(this);
2076
+
2077
+ aIds = aIds.concat(fnCollectIds(oWorkPage));
2078
+
2079
+ (oWorkPage.rows || []).forEach(function (oRow) {
2080
+ aIds = aIds.concat(fnCollectIds(oRow));
2081
+ (oRow.columns || []).forEach(function (oColumn) {
2082
+ aIds = aIds.concat(fnCollectIds(oColumn));
2083
+ (oColumn.cells || []).forEach(function (oCell) {
2084
+ aIds = aIds.concat(fnCollectIds(oCell));
2085
+ (oCell.widgets || []).forEach(function (oWidget) {
2086
+ aIds = aIds.concat(fnCollectIds(oWidget));
2095
2087
  });
2096
2088
  });
2097
2089
  });
2098
-
2099
- aIds = aIds.filter(function (sId) {
2100
- return !!sId;
2101
- });
2102
-
2103
- return utils.generateUniqueId(aIds);
2104
- },
2105
-
2106
- /**
2107
- * Collects the id and all the configuration ids of an entity on the WorkPage.
2108
- *
2109
- * @param {object} oEntity An entity on the WorkPage
2110
- * @returns {string[]} An array of all ids related to this entity.
2111
- * @private
2112
- * @since 1.116.0
2113
- */
2114
- _collectIds: function (oEntity) {
2115
- var aIds = [oEntity.id];
2116
- var aSettings = oEntity.configurations || [];
2117
-
2118
- var aConfigIds = aSettings.map(function (oConfig) {
2119
- return oConfig.id;
2120
- });
2121
-
2122
- return aIds.concat(aConfigIds);
2123
- }
2124
- });
2090
+ });
2091
+
2092
+ aIds = aIds.filter(function (sId) {
2093
+ return !!sId;
2094
+ });
2095
+
2096
+ return utils.generateUniqueId(aIds);
2097
+ },
2098
+
2099
+ /**
2100
+ * Collects the id and all the configuration ids of an entity on the WorkPage.
2101
+ *
2102
+ * @param {object} oEntity An entity on the WorkPage
2103
+ * @returns {string[]} An array of all ids related to this entity.
2104
+ * @private
2105
+ * @since 1.116.0
2106
+ */
2107
+ _collectIds: function (oEntity) {
2108
+ var aIds = [oEntity.id];
2109
+ var aSettings = oEntity.configurations || [];
2110
+
2111
+ var aConfigIds = aSettings.map(function (oConfig) {
2112
+ return oConfig.id;
2113
+ });
2114
+
2115
+ return aIds.concat(aConfigIds);
2116
+ }
2117
+ });
2125
2118
  });