@openui5/sap.m 1.103.1 → 1.104.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 (431) hide show
  1. package/.eslintrc.json +2 -3
  2. package/.reuse/dep5 +17 -0
  3. package/LICENSES/LicenseRef-tzdata-PublicDomain.txt +5 -0
  4. package/THIRDPARTY.txt +35 -2
  5. package/package.json +4 -4
  6. package/src/sap/m/.library +1 -1
  7. package/src/sap/m/AccButton.js +1 -1
  8. package/src/sap/m/ActionListItem.js +1 -1
  9. package/src/sap/m/ActionSelect.js +1 -1
  10. package/src/sap/m/ActionSheet.js +1 -1
  11. package/src/sap/m/App.js +1 -1
  12. package/src/sap/m/AssociativeOverflowToolbar.js +1 -1
  13. package/src/sap/m/Avatar.js +1 -1
  14. package/src/sap/m/Bar.js +11 -10
  15. package/src/sap/m/Breadcrumbs.js +2 -2
  16. package/src/sap/m/BusyDialog.js +1 -1
  17. package/src/sap/m/BusyIndicator.js +1 -1
  18. package/src/sap/m/Button.js +3 -2
  19. package/src/sap/m/Carousel.js +1 -1
  20. package/src/sap/m/CarouselLayout.js +1 -1
  21. package/src/sap/m/CheckBox.js +1 -1
  22. package/src/sap/m/ColorPalette.js +1 -1
  23. package/src/sap/m/ColorPalettePopover.js +1 -1
  24. package/src/sap/m/Column.js +1 -1
  25. package/src/sap/m/ColumnHeaderPopover.js +1 -1
  26. package/src/sap/m/ColumnListItem.js +1 -1
  27. package/src/sap/m/ColumnPopoverActionItem.js +1 -1
  28. package/src/sap/m/ColumnPopoverCustomItem.js +1 -1
  29. package/src/sap/m/ColumnPopoverItem.js +1 -1
  30. package/src/sap/m/ColumnPopoverSelectListItem.js +1 -1
  31. package/src/sap/m/ColumnPopoverSortItem.js +1 -1
  32. package/src/sap/m/ComboBox.js +1 -1
  33. package/src/sap/m/ComboBoxBase.js +1 -1
  34. package/src/sap/m/ComboBoxTextField.js +1 -1
  35. package/src/sap/m/CustomDynamicDateOption.js +1 -1
  36. package/src/sap/m/CustomListItem.js +1 -1
  37. package/src/sap/m/CustomTile.js +1 -1
  38. package/src/sap/m/CustomTreeItem.js +1 -1
  39. package/src/sap/m/DatePicker.js +14 -22
  40. package/src/sap/m/DateRangeSelection.js +45 -38
  41. package/src/sap/m/DateTimeField.js +87 -20
  42. package/src/sap/m/DateTimeInput.js +1 -1
  43. package/src/sap/m/DateTimePicker.js +40 -21
  44. package/src/sap/m/Dialog.js +1 -1
  45. package/src/sap/m/DisplayListItem.js +1 -1
  46. package/src/sap/m/DraftIndicator.js +1 -1
  47. package/src/sap/m/DynamicDate.js +1 -1
  48. package/src/sap/m/DynamicDateOption.js +6 -4
  49. package/src/sap/m/DynamicDateRange.js +3 -2
  50. package/src/sap/m/DynamicDateValueHelpUIType.js +1 -1
  51. package/src/sap/m/ExpandableText.js +1 -1
  52. package/src/sap/m/FacetFilter.js +1 -1
  53. package/src/sap/m/FacetFilterItem.js +1 -1
  54. package/src/sap/m/FacetFilterList.js +1 -1
  55. package/src/sap/m/FeedContent.js +1 -1
  56. package/src/sap/m/FeedInput.js +1 -1
  57. package/src/sap/m/FeedListItem.js +1 -1
  58. package/src/sap/m/FeedListItemAction.js +1 -1
  59. package/src/sap/m/Fiori20Adapter.js +2 -2
  60. package/src/sap/m/FlexBox.js +1 -1
  61. package/src/sap/m/FlexItemData.js +1 -1
  62. package/src/sap/m/FormattedText.js +1 -1
  63. package/src/sap/m/GenericTag.js +1 -1
  64. package/src/sap/m/GenericTile.js +12 -9
  65. package/src/sap/m/GenericTileLineModeRenderer.js +4 -4
  66. package/src/sap/m/GenericTileRenderer.js +16 -4
  67. package/src/sap/m/GroupHeaderListItem.js +1 -1
  68. package/src/sap/m/GrowingEnablement.js +11 -4
  69. package/src/sap/m/GrowingList.js +1 -1
  70. package/src/sap/m/HBox.js +1 -1
  71. package/src/sap/m/HeaderContainer.js +3 -3
  72. package/src/sap/m/HeaderContainerItemNavigator.js +1 -1
  73. package/src/sap/m/IconTabBar.js +1 -1
  74. package/src/sap/m/IconTabBarSelectList.js +1 -1
  75. package/src/sap/m/IconTabFilter.js +1 -1
  76. package/src/sap/m/IconTabFilterExpandButtonBadge.js +1 -1
  77. package/src/sap/m/IconTabHeader.js +7 -2
  78. package/src/sap/m/IconTabSeparator.js +1 -1
  79. package/src/sap/m/IllustratedMessage.js +63 -24
  80. package/src/sap/m/IllustratedMessageRenderer.js +10 -6
  81. package/src/sap/m/Illustration.js +1 -1
  82. package/src/sap/m/IllustrationPool.js +1 -0
  83. package/src/sap/m/Image.js +1 -1
  84. package/src/sap/m/ImageContent.js +1 -1
  85. package/src/sap/m/Input.js +1 -4
  86. package/src/sap/m/InputBase.js +1 -1
  87. package/src/sap/m/InputListItem.js +1 -1
  88. package/src/sap/m/Label.js +1 -1
  89. package/src/sap/m/LightBox.js +1 -1
  90. package/src/sap/m/LightBoxItem.js +1 -1
  91. package/src/sap/m/Link.js +41 -5
  92. package/src/sap/m/LinkRenderer.js +18 -10
  93. package/src/sap/m/List.js +1 -1
  94. package/src/sap/m/ListBase.js +4 -1
  95. package/src/sap/m/ListItemBase.js +10 -2
  96. package/src/sap/m/MaskEnabler.js +52 -2
  97. package/src/sap/m/MaskInput.js +23 -1
  98. package/src/sap/m/MaskInputRule.js +1 -1
  99. package/src/sap/m/Menu.js +1 -1
  100. package/src/sap/m/MenuButton.js +1 -1
  101. package/src/sap/m/MenuItem.js +1 -1
  102. package/src/sap/m/MenuListItem.js +1 -1
  103. package/src/sap/m/MessageItem.js +1 -1
  104. package/src/sap/m/MessageListItem.js +1 -1
  105. package/src/sap/m/MessagePage.js +1 -1
  106. package/src/sap/m/MessagePopover.js +4 -1
  107. package/src/sap/m/MessagePopoverItem.js +1 -1
  108. package/src/sap/m/MessageStrip.js +1 -1
  109. package/src/sap/m/MessageToast.js +1 -1
  110. package/src/sap/m/MessageView.js +1 -1
  111. package/src/sap/m/MultiComboBox.js +1 -1
  112. package/src/sap/m/MultiEditField.js +1 -1
  113. package/src/sap/m/MultiInput.js +1 -1
  114. package/src/sap/m/NavContainer.js +20 -16
  115. package/src/sap/m/NewsContent.js +1 -1
  116. package/src/sap/m/NotificationList.js +1 -1
  117. package/src/sap/m/NotificationListBase.js +1 -1
  118. package/src/sap/m/NotificationListGroup.js +1 -1
  119. package/src/sap/m/NotificationListItem.js +1 -1
  120. package/src/sap/m/NumericContent.js +1 -1
  121. package/src/sap/m/NumericInput.js +1 -1
  122. package/src/sap/m/ObjectAttribute.js +1 -1
  123. package/src/sap/m/ObjectHeader.js +1 -1
  124. package/src/sap/m/ObjectIdentifier.js +1 -1
  125. package/src/sap/m/ObjectListItem.js +1 -1
  126. package/src/sap/m/ObjectMarker.js +1 -1
  127. package/src/sap/m/ObjectNumber.js +1 -1
  128. package/src/sap/m/ObjectNumberRenderer.js +10 -3
  129. package/src/sap/m/ObjectStatus.js +1 -1
  130. package/src/sap/m/OverflowToolbar.js +1 -1
  131. package/src/sap/m/OverflowToolbarAssociativePopover.js +1 -1
  132. package/src/sap/m/OverflowToolbarButton.js +1 -1
  133. package/src/sap/m/OverflowToolbarLayoutData.js +1 -1
  134. package/src/sap/m/OverflowToolbarToggleButton.js +1 -1
  135. package/src/sap/m/P13nAnyFilterItem.js +1 -1
  136. package/src/sap/m/P13nColumnsItem.js +1 -1
  137. package/src/sap/m/P13nColumnsPanel.js +1 -1
  138. package/src/sap/m/P13nConditionPanel.js +1 -1
  139. package/src/sap/m/P13nDialog.js +1 -1
  140. package/src/sap/m/P13nDimMeasureItem.js +1 -1
  141. package/src/sap/m/P13nDimMeasurePanel.js +1 -1
  142. package/src/sap/m/P13nFilterItem.js +1 -1
  143. package/src/sap/m/P13nFilterPanel.js +1 -1
  144. package/src/sap/m/P13nGroupItem.js +1 -1
  145. package/src/sap/m/P13nGroupPanel.js +1 -1
  146. package/src/sap/m/P13nItem.js +1 -1
  147. package/src/sap/m/P13nPanel.js +1 -1
  148. package/src/sap/m/P13nSelectionItem.js +1 -1
  149. package/src/sap/m/P13nSelectionPanel.js +1 -1
  150. package/src/sap/m/P13nSortItem.js +1 -1
  151. package/src/sap/m/P13nSortPanel.js +1 -1
  152. package/src/sap/m/PDFViewer.js +2 -2
  153. package/src/sap/m/PDFViewerRenderer.js +1 -0
  154. package/src/sap/m/Page.js +1 -1
  155. package/src/sap/m/PageAccessibleLandmarkInfo.js +1 -1
  156. package/src/sap/m/PagingButton.js +1 -1
  157. package/src/sap/m/Panel.js +1 -1
  158. package/src/sap/m/PlanningCalendar.js +1 -1
  159. package/src/sap/m/PlanningCalendarHeader.js +1 -1
  160. package/src/sap/m/PlanningCalendarLegend.js +1 -1
  161. package/src/sap/m/PlanningCalendarRow.js +1 -1
  162. package/src/sap/m/PlanningCalendarView.js +1 -1
  163. package/src/sap/m/Popover.js +4 -4
  164. package/src/sap/m/ProgressIndicator.js +1 -1
  165. package/src/sap/m/ProgressIndicatorRenderer.js +6 -3
  166. package/src/sap/m/PullToRefresh.js +1 -1
  167. package/src/sap/m/QuickView.js +1 -1
  168. package/src/sap/m/QuickViewBase.js +1 -1
  169. package/src/sap/m/QuickViewCard.js +1 -1
  170. package/src/sap/m/QuickViewGroup.js +1 -1
  171. package/src/sap/m/QuickViewGroupElement.js +1 -1
  172. package/src/sap/m/QuickViewPage.js +1 -1
  173. package/src/sap/m/RadioButton.js +1 -1
  174. package/src/sap/m/RadioButtonGroup.js +1 -1
  175. package/src/sap/m/RangeSlider.js +1 -1
  176. package/src/sap/m/RatingIndicator.js +8 -1
  177. package/src/sap/m/RatingIndicatorRenderer.js +13 -4
  178. package/src/sap/m/ResponsivePopover.js +1 -1
  179. package/src/sap/m/ResponsiveScale.js +1 -1
  180. package/src/sap/m/ScrollBar.js +1 -1
  181. package/src/sap/m/ScrollContainer.js +1 -1
  182. package/src/sap/m/SearchField.js +1 -1
  183. package/src/sap/m/SegmentedButton.js +1 -1
  184. package/src/sap/m/SegmentedButtonItem.js +1 -1
  185. package/src/sap/m/Select.js +5 -12
  186. package/src/sap/m/SelectDialog.js +1 -1
  187. package/src/sap/m/SelectDialogBase.js +1 -1
  188. package/src/sap/m/SelectList.js +1 -1
  189. package/src/sap/m/SelectionDetails.js +1 -1
  190. package/src/sap/m/SelectionDetailsFacade.js +2 -2
  191. package/src/sap/m/SelectionDetailsItem.js +1 -1
  192. package/src/sap/m/SelectionDetailsItemLine.js +1 -1
  193. package/src/sap/m/Shell.js +1 -1
  194. package/src/sap/m/SimpleFixFlex.js +1 -1
  195. package/src/sap/m/SinglePlanningCalendar.js +1 -1
  196. package/src/sap/m/SinglePlanningCalendarDayView.js +1 -1
  197. package/src/sap/m/SinglePlanningCalendarGrid.js +1 -1
  198. package/src/sap/m/SinglePlanningCalendarMonthGrid.js +1 -1
  199. package/src/sap/m/SinglePlanningCalendarMonthView.js +1 -1
  200. package/src/sap/m/SinglePlanningCalendarView.js +1 -1
  201. package/src/sap/m/SinglePlanningCalendarWeekView.js +1 -1
  202. package/src/sap/m/SinglePlanningCalendarWorkWeekView.js +1 -1
  203. package/src/sap/m/SlideTile.js +1 -1
  204. package/src/sap/m/Slider.js +1 -1
  205. package/src/sap/m/SliderTooltip.js +1 -1
  206. package/src/sap/m/SliderTooltipBase.js +1 -1
  207. package/src/sap/m/SliderTooltipContainer.js +1 -1
  208. package/src/sap/m/SplitApp.js +1 -1
  209. package/src/sap/m/SplitButton.js +1 -1
  210. package/src/sap/m/SplitContainer.js +1 -1
  211. package/src/sap/m/StandardDynamicDateOption.js +1 -1
  212. package/src/sap/m/StandardListItem.js +1 -1
  213. package/src/sap/m/StandardTile.js +1 -1
  214. package/src/sap/m/StandardTreeItem.js +1 -1
  215. package/src/sap/m/StepInput.js +1 -1
  216. package/src/sap/m/SuggestionItem.js +1 -1
  217. package/src/sap/m/SuggestionsPopover.js +1 -1
  218. package/src/sap/m/Switch.js +1 -1
  219. package/src/sap/m/TabContainer.js +1 -1
  220. package/src/sap/m/TabContainerItem.js +1 -1
  221. package/src/sap/m/TabStrip.js +1 -1
  222. package/src/sap/m/TabStripItem.js +1 -1
  223. package/src/sap/m/Table.js +1 -1
  224. package/src/sap/m/TablePersoController.js +1 -1
  225. package/src/sap/m/TablePersoDialog.js +1 -1
  226. package/src/sap/m/TablePersoProvider.js +1 -1
  227. package/src/sap/m/TableSelectDialog.js +1 -1
  228. package/src/sap/m/Text.js +1 -1
  229. package/src/sap/m/TextArea.js +1 -1
  230. package/src/sap/m/Tile.js +1 -1
  231. package/src/sap/m/TileContainer.js +1 -1
  232. package/src/sap/m/TileContent.js +8 -9
  233. package/src/sap/m/TileContentRenderer.js +1 -1
  234. package/src/sap/m/TimePicker.js +43 -6
  235. package/src/sap/m/TimePickerClock.js +1 -1
  236. package/src/sap/m/TimePickerClocks.js +5 -3
  237. package/src/sap/m/TimePickerInputs.js +1 -1
  238. package/src/sap/m/TimePickerInternals.js +1 -1
  239. package/src/sap/m/TimePickerSlider.js +1 -1
  240. package/src/sap/m/TimePickerSliders.js +1 -1
  241. package/src/sap/m/Title.js +1 -1
  242. package/src/sap/m/TitlePropagationSupport.js +1 -1
  243. package/src/sap/m/ToggleButton.js +2 -2
  244. package/src/sap/m/Token.js +1 -1
  245. package/src/sap/m/Tokenizer.js +1 -1
  246. package/src/sap/m/Toolbar.js +1 -1
  247. package/src/sap/m/ToolbarLayoutData.js +1 -1
  248. package/src/sap/m/ToolbarSeparator.js +1 -1
  249. package/src/sap/m/ToolbarSpacer.js +1 -1
  250. package/src/sap/m/Tree.js +1 -1
  251. package/src/sap/m/TreeItemBase.js +1 -1
  252. package/src/sap/m/UploadCollection.js +2 -2
  253. package/src/sap/m/UploadCollectionItem.js +1 -1
  254. package/src/sap/m/UploadCollectionParameter.js +1 -1
  255. package/src/sap/m/UploadCollectionToolbarPlaceholder.js +1 -1
  256. package/src/sap/m/VBox.js +1 -1
  257. package/src/sap/m/ValueStateHeader.js +1 -1
  258. package/src/sap/m/VariantItem.js +160 -0
  259. package/src/sap/m/VariantManagement.js +610 -547
  260. package/src/sap/m/ViewSettingsCustomItem.js +1 -1
  261. package/src/sap/m/ViewSettingsCustomTab.js +1 -1
  262. package/src/sap/m/ViewSettingsDialog.js +1 -1
  263. package/src/sap/m/ViewSettingsFilterItem.js +1 -1
  264. package/src/sap/m/ViewSettingsItem.js +1 -1
  265. package/src/sap/m/VisibleItem.js +1 -1
  266. package/src/sap/m/WheelSlider.js +1 -1
  267. package/src/sap/m/WheelSliderContainer.js +1 -1
  268. package/src/sap/m/Wizard.js +1 -1
  269. package/src/sap/m/WizardProgressNavigator.js +1 -1
  270. package/src/sap/m/WizardStep.js +1 -1
  271. package/src/sap/m/changeHandler/AddTableColumn.js +1 -1
  272. package/src/sap/m/changeHandler/ChangeLinkTarget.js +1 -1
  273. package/src/sap/m/changeHandler/CombineButtons.js +1 -1
  274. package/src/sap/m/changeHandler/MoveTableColumns.js +2 -2
  275. package/src/sap/m/changeHandler/SelectIconTabBarFilter.js +1 -1
  276. package/src/sap/m/changeHandler/SplitMenuButton.js +1 -1
  277. package/src/sap/m/designtime/VariantManagement.designtime.js +34 -24
  278. package/src/sap/m/flexibility/EngineFlex.js +48 -0
  279. package/src/sap/m/library.js +29 -6
  280. package/src/sap/m/messagebundle.properties +23 -1
  281. package/src/sap/m/messagebundle_ar.properties +16 -5
  282. package/src/sap/m/messagebundle_bg.properties +11 -0
  283. package/src/sap/m/messagebundle_ca.properties +11 -0
  284. package/src/sap/m/messagebundle_cs.properties +11 -0
  285. package/src/sap/m/messagebundle_cy.properties +11 -0
  286. package/src/sap/m/messagebundle_da.properties +11 -0
  287. package/src/sap/m/messagebundle_de.properties +11 -0
  288. package/src/sap/m/messagebundle_el.properties +12 -1
  289. package/src/sap/m/messagebundle_en.properties +11 -0
  290. package/src/sap/m/messagebundle_en_GB.properties +11 -0
  291. package/src/sap/m/messagebundle_en_US_sappsd.properties +11 -0
  292. package/src/sap/m/messagebundle_en_US_saprigi.properties +9 -0
  293. package/src/sap/m/messagebundle_en_US_saptrc.properties +11 -0
  294. package/src/sap/m/messagebundle_es.properties +11 -0
  295. package/src/sap/m/messagebundle_es_MX.properties +11 -0
  296. package/src/sap/m/messagebundle_et.properties +11 -0
  297. package/src/sap/m/messagebundle_fi.properties +14 -3
  298. package/src/sap/m/messagebundle_fr.properties +11 -0
  299. package/src/sap/m/messagebundle_fr_CA.properties +11 -0
  300. package/src/sap/m/messagebundle_hi.properties +11 -0
  301. package/src/sap/m/messagebundle_hr.properties +15 -4
  302. package/src/sap/m/messagebundle_hu.properties +13 -2
  303. package/src/sap/m/messagebundle_id.properties +11 -0
  304. package/src/sap/m/messagebundle_it.properties +12 -1
  305. package/src/sap/m/messagebundle_iw.properties +12 -1
  306. package/src/sap/m/messagebundle_ja.properties +11 -0
  307. package/src/sap/m/messagebundle_kk.properties +11 -0
  308. package/src/sap/m/messagebundle_ko.properties +17 -6
  309. package/src/sap/m/messagebundle_lt.properties +11 -0
  310. package/src/sap/m/messagebundle_lv.properties +11 -0
  311. package/src/sap/m/messagebundle_ms.properties +11 -0
  312. package/src/sap/m/messagebundle_nl.properties +25 -14
  313. package/src/sap/m/messagebundle_no.properties +12 -1
  314. package/src/sap/m/messagebundle_pl.properties +12 -1
  315. package/src/sap/m/messagebundle_pt.properties +15 -4
  316. package/src/sap/m/messagebundle_pt_PT.properties +11 -0
  317. package/src/sap/m/messagebundle_ro.properties +11 -0
  318. package/src/sap/m/messagebundle_ru.properties +11 -0
  319. package/src/sap/m/messagebundle_sh.properties +11 -0
  320. package/src/sap/m/messagebundle_sk.properties +11 -0
  321. package/src/sap/m/messagebundle_sl.properties +11 -0
  322. package/src/sap/m/messagebundle_sv.properties +11 -0
  323. package/src/sap/m/messagebundle_th.properties +34 -23
  324. package/src/sap/m/messagebundle_tr.properties +11 -0
  325. package/src/sap/m/messagebundle_uk.properties +11 -0
  326. package/src/sap/m/messagebundle_vi.properties +11 -0
  327. package/src/sap/m/messagebundle_zh_CN.properties +11 -0
  328. package/src/sap/m/messagebundle_zh_TW.properties +11 -0
  329. package/src/sap/m/p13n/AbstractContainer.js +5 -5
  330. package/src/sap/m/p13n/AbstractContainerItem.js +2 -2
  331. package/src/sap/m/p13n/BasePanel.js +4 -3
  332. package/src/sap/m/p13n/Container.js +1 -1
  333. package/src/sap/m/p13n/Engine.js +1253 -0
  334. package/src/sap/m/p13n/FlexUtil.js +162 -0
  335. package/src/sap/m/p13n/GroupController.js +145 -0
  336. package/src/sap/m/p13n/GroupPanel.js +10 -3
  337. package/src/sap/m/p13n/MetadataHelper.js +35 -0
  338. package/src/sap/m/p13n/PersistenceProvider.js +135 -0
  339. package/src/sap/m/p13n/Popup.js +46 -9
  340. package/src/sap/m/p13n/QueryPanel.js +1 -1
  341. package/src/sap/m/p13n/SelectionController.js +563 -0
  342. package/src/sap/m/p13n/SelectionPanel.js +13 -1
  343. package/src/sap/m/p13n/SortController.js +153 -0
  344. package/src/sap/m/p13n/SortPanel.js +11 -1
  345. package/src/sap/m/p13n/enum/PersistenceMode.js +43 -0
  346. package/src/sap/m/p13n/handler/xConfigHandler.js +166 -0
  347. package/src/sap/m/p13n/modification/FlexModificationHandler.js +90 -0
  348. package/src/sap/m/p13n/modification/LocalStorageModificationHandler.js +75 -0
  349. package/src/sap/m/p13n/modification/ModificationHandler.js +133 -0
  350. package/src/sap/m/p13n/modules/AdaptationProvider.js +67 -0
  351. package/src/sap/m/p13n/modules/DefaultProviderRegistry.js +124 -0
  352. package/src/sap/m/p13n/modules/StateHandlerRegistry.js +101 -0
  353. package/src/sap/m/p13n/modules/UIManager.js +230 -0
  354. package/src/sap/m/p13n/modules/xConfigAPI.js +286 -0
  355. package/src/sap/m/plugins/ColumnResizer.js +15 -1
  356. package/src/sap/m/plugins/DataStateIndicator.js +2 -2
  357. package/src/sap/m/plugins/PasteProvider.js +1 -1
  358. package/src/sap/m/plugins/PluginBase.js +1 -1
  359. package/src/sap/m/semantic/AddAction.js +1 -1
  360. package/src/sap/m/semantic/CancelAction.js +1 -1
  361. package/src/sap/m/semantic/DeleteAction.js +1 -1
  362. package/src/sap/m/semantic/DetailPage.js +1 -1
  363. package/src/sap/m/semantic/DiscussInJamAction.js +1 -1
  364. package/src/sap/m/semantic/EditAction.js +1 -1
  365. package/src/sap/m/semantic/FavoriteAction.js +1 -1
  366. package/src/sap/m/semantic/FilterAction.js +1 -1
  367. package/src/sap/m/semantic/FilterSelect.js +1 -1
  368. package/src/sap/m/semantic/FlagAction.js +1 -1
  369. package/src/sap/m/semantic/ForwardAction.js +1 -1
  370. package/src/sap/m/semantic/FullscreenPage.js +1 -1
  371. package/src/sap/m/semantic/GroupAction.js +1 -1
  372. package/src/sap/m/semantic/GroupSelect.js +1 -1
  373. package/src/sap/m/semantic/MainAction.js +1 -1
  374. package/src/sap/m/semantic/MasterPage.js +1 -1
  375. package/src/sap/m/semantic/MessagesIndicator.js +1 -1
  376. package/src/sap/m/semantic/MultiSelectAction.js +1 -1
  377. package/src/sap/m/semantic/NegativeAction.js +1 -1
  378. package/src/sap/m/semantic/OpenInAction.js +1 -1
  379. package/src/sap/m/semantic/PositiveAction.js +1 -1
  380. package/src/sap/m/semantic/PrintAction.js +1 -1
  381. package/src/sap/m/semantic/SaveAction.js +1 -1
  382. package/src/sap/m/semantic/Segment.js +1 -1
  383. package/src/sap/m/semantic/SegmentedContainer.js +1 -1
  384. package/src/sap/m/semantic/SemanticButton.js +1 -1
  385. package/src/sap/m/semantic/SemanticConfiguration.js +1 -1
  386. package/src/sap/m/semantic/SemanticControl.js +1 -1
  387. package/src/sap/m/semantic/SemanticOverflowToolbarButton.js +1 -1
  388. package/src/sap/m/semantic/SemanticOverflowToolbarToggleButton.js +1 -1
  389. package/src/sap/m/semantic/SemanticPage.js +1 -1
  390. package/src/sap/m/semantic/SemanticSelect.js +1 -1
  391. package/src/sap/m/semantic/SemanticToggleButton.js +1 -1
  392. package/src/sap/m/semantic/SendEmailAction.js +1 -1
  393. package/src/sap/m/semantic/SendMessageAction.js +1 -1
  394. package/src/sap/m/semantic/ShareInJamAction.js +1 -1
  395. package/src/sap/m/semantic/ShareMenu.js +1 -1
  396. package/src/sap/m/semantic/ShareMenuPage.js +1 -1
  397. package/src/sap/m/semantic/SortAction.js +1 -1
  398. package/src/sap/m/semantic/SortSelect.js +1 -1
  399. package/src/sap/m/table/Util.js +8 -3
  400. package/src/sap/m/table/columnmenu/ActionItem.js +1 -1
  401. package/src/sap/m/table/columnmenu/Entry.js +1 -1
  402. package/src/sap/m/table/columnmenu/Item.js +1 -1
  403. package/src/sap/m/table/columnmenu/ItemBase.js +1 -1
  404. package/src/sap/m/table/columnmenu/Menu.js +8 -2
  405. package/src/sap/m/table/columnmenu/QuickAction.js +1 -1
  406. package/src/sap/m/table/columnmenu/QuickActionBase.js +1 -1
  407. package/src/sap/m/table/columnmenu/QuickActionItem.js +1 -1
  408. package/src/sap/m/table/columnmenu/QuickGroup.js +21 -1
  409. package/src/sap/m/table/columnmenu/QuickGroupItem.js +13 -1
  410. package/src/sap/m/table/columnmenu/QuickSort.js +1 -1
  411. package/src/sap/m/table/columnmenu/QuickSortItem.js +1 -1
  412. package/src/sap/m/table/columnmenu/QuickTotal.js +21 -1
  413. package/src/sap/m/table/columnmenu/QuickTotalItem.js +13 -1
  414. package/src/sap/m/themes/base/Breadcrumbs.less +6 -0
  415. package/src/sap/m/themes/base/CheckBox.less +1 -0
  416. package/src/sap/m/themes/base/Dialog.less +1 -0
  417. package/src/sap/m/themes/base/FeedContent.less +13 -5
  418. package/src/sap/m/themes/base/GenericTile.less +39 -9
  419. package/src/sap/m/themes/base/IllustratedMessage.less +7 -0
  420. package/src/sap/m/themes/base/NumericContent.less +1 -1
  421. package/src/sap/m/themes/base/ObjectStatus.less +2 -1
  422. package/src/sap/m/themes/base/OverflowToolbarAssociativePopover.less +5 -1
  423. package/src/sap/m/themes/base/SelectList.less +0 -5
  424. package/src/sap/m/themes/base/SinglePlanningCalendarGrid.less +7 -0
  425. package/src/sap/m/themes/base/SlideTile.less +20 -4
  426. package/src/sap/m/themes/base/Table.less +11 -1
  427. package/src/sap/m/themes/base/TileContent.less +17 -0
  428. package/src/sap/m/upload/UploadSet.js +98 -15
  429. package/src/sap/m/upload/UploadSetItem.js +13 -1
  430. package/src/sap/m/upload/UploadSetRenderer.js +8 -16
  431. package/src/sap/m/upload/UploadSetToolbarPlaceholder.js +1 -1
@@ -0,0 +1,1253 @@
1
+ /*
2
+ * ! OpenUI5
3
+ * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
4
+ * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
+ */
6
+
7
+ sap.ui.define([
8
+ "sap/m/p13n/modules/AdaptationProvider",
9
+ "sap/base/util/merge",
10
+ "sap/base/Log",
11
+ "sap/m/p13n/modification/FlexModificationHandler",
12
+ "sap/m/MessageStrip",
13
+ "sap/ui/core/library",
14
+ "sap/ui/core/Element",
15
+ "sap/m/p13n/modules/DefaultProviderRegistry",
16
+ "sap/m/p13n/modules/UIManager",
17
+ "sap/m/p13n/modules/StateHandlerRegistry",
18
+ "sap/m/p13n/modules/xConfigAPI"
19
+ ], function (AdaptationProvider, merge, Log, FlexModificationHandler, MessageStrip, coreLibrary, Element, DefaultProviderRegistry, UIManager, StateHandlerRegistry, xConfigAPI) {
20
+ "use strict";
21
+
22
+ var ERROR_INSTANCING = "Engine: This class is a singleton. Please use the getInstance() method instead.";
23
+
24
+ //Shortcut to 'MessageType'
25
+ var MessageType = coreLibrary.MessageType;
26
+
27
+ /*global WeakMap */
28
+ var _mRegistry = new WeakMap();
29
+
30
+ //Singleton storage
31
+ var oEngine;
32
+
33
+ /**
34
+ *
35
+ * The <code>Engine</code> offers personalization capabilites by registering a control instance for modification such as:
36
+ *
37
+ * <ul>
38
+ * <li><code>sap.m.p13n.Popup</code> initialization</li>
39
+ * <li>Storing personalization states by chosing the desired persistence layer</li>
40
+ * <li>State appliance considering the persistence layer</li>
41
+ * </ul>
42
+ *
43
+ * The Engine should be used whenever personalization should be enabled by considering a certain persistence layer.
44
+ * Available controller implementations for the registration process are:
45
+ *
46
+ * <ul>
47
+ * <li>{@link sap.m.p13n.SelectionController SelectionController}: can be used to define a list of selectable entries</li>
48
+ * <li>{@link sap.m.p13n.SortController SortController}: can be used to define a list of sortable properties</li>
49
+ * <li>{@link sap.m.p13n.GroupController GroupController}: can be used to define a list of groupable properties</li>
50
+ * </ul>
51
+ *
52
+ * The following persistence layers can be chosen for personalization services:
53
+ *
54
+ * <ul>
55
+ * <li>{@link sap.m.p13n.modification.FlexModificationHandler FlexModificationHandler}: Can be used in combination with <code>sap.ui.fl.variants.VariantManagement</code> to persist state in variant using <code>sap.ui.fl</code> capabilites.</li>
56
+ * <li>{@link sap.m.p13n.modification.LocalStorageModificationHandler LocalStorageModificationHandler}: can be used to store personalization state in the local storage</li>
57
+ * <li>{@link sap.m.p13n.modification.ModificationHandler ModificationHandler}: will be used by default - this handler will not persist state.</li>
58
+ * </ul>
59
+ *
60
+ * @namespace
61
+ * @alias sap.m.p13n.Engine
62
+ * @extends sap.m.p13n.AdaptationProvider
63
+ * @author SAP SE
64
+ * @version 1.104.0
65
+ * @public
66
+ * @experimental Since 1.104. Please note that the API of this control is not yet finalized!
67
+ * @since 1.104
68
+ */
69
+ var Engine = AdaptationProvider.extend("sap.m.p13n.Engine", {
70
+ constructor: function() {
71
+ AdaptationProvider.call(this);
72
+
73
+ if (oEngine) {
74
+ throw Error(ERROR_INSTANCING);
75
+ }
76
+
77
+ this._aRegistry = [];
78
+ this._aStateHandlers = [];
79
+
80
+ //Default Provider Registry to be used for internal PersistenceProvider functionality access
81
+ this.defaultProviderRegistry = DefaultProviderRegistry.getInstance();
82
+
83
+ //UIManager to be used for p13n UI creation
84
+ this.uimanager = UIManager.getInstance(this);
85
+
86
+ //Default state Handler Registry to be used for state event handling
87
+ this.stateHandlerRegistry = StateHandlerRegistry.getInstance();
88
+ }
89
+ });
90
+
91
+ /**
92
+ *
93
+ *
94
+ * This method should only be called once per instance to register provided
95
+ * classes of <code>sap.m.p13n.Controller</code> for the control instance.
96
+ *
97
+ * @public
98
+ * @experimental Since 1.104. Please note that the API of this control is not yet finalized!
99
+ *
100
+ * @param {sap.m.Control} oControl The control insance to be registered for adaptation
101
+ * @param {Object} oConfig The config object providing key value pairs of keys and
102
+ * <code>sap.m.p13n.*Controller</code> classes.
103
+ *
104
+ * @example
105
+ * {
106
+ * modification: new FlexModificationHandler(),
107
+ * helper: new Helper([
108
+ * {key: "idA", label: "Field A", path: "path/propA"},
109
+ * {key: "idB", label: "Field B", path: "path/propB"}
110
+ * ]),
111
+ * controller: {
112
+ * Item: new SelectionController({
113
+ * control: oMyControl,
114
+ * targetAggregation: "items"
115
+ * }),
116
+ * Sort: new SortController({
117
+ * control: oMyControl
118
+ * }),
119
+ * Filter: new GroupController({
120
+ * control: oMyControl
121
+ * })
122
+ * }
123
+ * }
124
+ */
125
+ Engine.prototype.register = function(oControl, oConfig) {
126
+
127
+ if (!oConfig.hasOwnProperty("controller") || Object.keys(oConfig.controller).length < 1) {
128
+ throw new Error("Please provide atleast a configuration 'controller' containing a map of key-value pairs (key + Controller class) in order to register adaptation.");
129
+ }
130
+
131
+ if (!oConfig.hasOwnProperty("helper") || !(oConfig.helper.getProperties instanceof Function)) {
132
+ throw new Error("Please provide atleast a configuration 'helper' containing a metadata helper instance implementing a #getProperties function.");
133
+ }
134
+
135
+ var oRegistryEntry = this._getRegistryEntry(oControl);
136
+
137
+ if (oRegistryEntry){
138
+ this.deregister(oControl);
139
+ }
140
+
141
+ oRegistryEntry = this._createRegistryEntry(oControl, oConfig);
142
+
143
+ var aControllerKeys = Object.keys(oConfig.controller);
144
+
145
+ aControllerKeys.forEach(function(sKey){
146
+
147
+ var oSubController = oConfig.controller[sKey];
148
+
149
+ if (!this.getController(oControl, sKey)) {
150
+ if (this._aRegistry.indexOf(oControl.getId()) < 0){
151
+ this._aRegistry.push(oControl.getId());
152
+ }
153
+
154
+ this.addController(oSubController, sKey);
155
+ }
156
+
157
+ }.bind(this));
158
+
159
+ this.getModificationHandler(oControl).initialize(oControl);
160
+
161
+ };
162
+
163
+
164
+ /**
165
+ * Deregister a registered control. By deregistering a control the control will
166
+ * be removed from the <code>Engine</code> registry and all instance specific sub
167
+ * modules such as the registered controllers are going to be destroyed.
168
+ *
169
+ * @public
170
+ * @experimental Since 1.104. Please note that the API of this control is not yet finalized!
171
+ *
172
+ * @param {sap.m.Control} oControl The registered control instance
173
+ */
174
+ Engine.prototype.deregister = function(oControl) {
175
+ var oRegistryEntry = this._getRegistryEntry(oControl);
176
+
177
+ //destroy subcontroller
178
+ Object.keys(oRegistryEntry.controller).forEach(function(sKey){
179
+ var oController = oRegistryEntry.controller[sKey];
180
+ oController.destroy();
181
+
182
+ delete oRegistryEntry.controller[sKey];
183
+ });
184
+
185
+ //Remove the control from the weakmap housekeeping
186
+ _mRegistry.delete(oControl);
187
+
188
+ //Remove the control from the array to maintain debugging
189
+ var iControlIndex = this._aRegistry.indexOf(oControl.getId());
190
+ this._aRegistry.splice(iControlIndex, 1);
191
+ };
192
+
193
+ /**
194
+ * Opens the personalization dialog.
195
+ *
196
+ * @public
197
+ * @experimental Since 1.104. Please note that the API of this control is not yet finalized!
198
+ *
199
+ *
200
+ * @param {sap.ui.core.Control} oControl The control instance to be personalized
201
+ * @param {string|string[]} vPanelKeys The affected panels that should be added to the <code>sap.m.p13n.Popup</code>
202
+ * @param {object} mSettings The settings object for the personalization
203
+ * @param {string} [mSettings.title] The title for the <code>sap.m.p13n.Popup</code> control
204
+ * @param {object} [mSettings.source] The source control to be used by the <code>sap.m.p13n.Popup</code> control (only necessary in case the mode is set to <code>ResponsivePopover</code>)
205
+ * @param {object} [mSettings.mode] The mode to be used by the <code>sap.m.p13n.Popup</code> control
206
+ * @param {object} [mSettings.contentHeight] Height configuration for the related popup container
207
+ * @param {object} [mSettings.contentWidth] Width configuration for the related popup container
208
+ *
209
+ * @returns {Promise} Promise resolving in the <code>sap.m.p13n.Popup</code> instance.
210
+ */
211
+ Engine.prototype.show = function(oControl, vPanelKeys, mSettings) {
212
+ return this.uimanager.show(oControl, vPanelKeys, mSettings);
213
+ };
214
+
215
+ /**
216
+ * Attaches an event handler to the <code>StateHandlerRegistry</code> class.
217
+ * The event handler may be fired every time a user triggers a personalization change for a control instance during runtime.
218
+ *
219
+ * @public
220
+ * @experimental Since 1.104. Please note that the API of this control is not yet finalized!
221
+ *
222
+ * @param {function} fnStateEventHandler The handler function to call when the event occurs
223
+ * @returns {this} Returns <code>this</code> to allow method chaining
224
+ */
225
+ Engine.prototype.attachStateChange = function(fnStateEventHandler) {
226
+ return this.stateHandlerRegistry.attachChange(fnStateEventHandler);
227
+ };
228
+
229
+ /**
230
+ * Removes a previously attached state change event handler from the <code>StateHandlerRegistry</code> class.
231
+ * The passed parameters must match those used for registration with {@link Engine#attachStateChange} beforehand.
232
+ *
233
+ * @public
234
+ * @experimental Since 1.104. Please note that the API of this control is not yet finalized!
235
+ *
236
+ * @param {function} fnStateEventHandler The handler function to detach from the event
237
+ * @returns {this} Returns <code>this</code> to allow method chaining
238
+ */
239
+ Engine.prototype.detachStateChange = function(fnStateEventHandler) {
240
+ return this.stateHandlerRegistry.detachChange(fnStateEventHandler);
241
+ };
242
+
243
+ /**
244
+ * This method can be used to trigger a reset on the provided control instance.
245
+ *
246
+ * @public
247
+ * @experimental Since 1.104. Please note that the API of this control is not yet finalized!
248
+ *
249
+ * @param {sap.m.Control} oControl The according control instance.
250
+ * @param {string} aKeys The key for the affected config.
251
+ *
252
+ * @returns {Promise} A Promise resolving once the reset is completed.
253
+ */
254
+ Engine.prototype.reset = function(oControl, aKeys) {
255
+
256
+ aKeys = aKeys instanceof Array ? aKeys : [aKeys];
257
+
258
+ var aSelectors = [];
259
+
260
+ aKeys.forEach(function(sKey) {
261
+ aSelectors = aSelectors.concat(this.getController(oControl, sKey).getSelectorForReset());
262
+ }.bind(this));
263
+
264
+ var oResetConfig = {
265
+ selectors: aSelectors,
266
+ selector: oControl
267
+ };
268
+
269
+ var oModificationSetting = this._determineModification(oControl);
270
+ return oModificationSetting.handler.reset(oResetConfig, oModificationSetting.payload).then(function(){
271
+ //Re-Init housekeeping after update
272
+ return this.initAdaptation(oControl, aKeys).then(function(oPropertyHelper){
273
+ aKeys.forEach(function(sKey){
274
+ var oController = this.getController(oControl, sKey);
275
+ oController.update(oPropertyHelper);
276
+ }.bind(this));
277
+ }.bind(this));
278
+ }.bind(this));
279
+ };
280
+
281
+
282
+ /**
283
+ * Apply a State on a control by passing an object that contains the
284
+ * registered controller key and an object matching the innter subcontroller housekeeping.
285
+ *
286
+ * @public
287
+ * @experimental Since 1.104. Please note that the API of this control is not yet finalized!
288
+ *
289
+ * @example {
290
+ * ControllerKey: [{<someState>}, {...}]
291
+ * }
292
+ *
293
+ * @param {sap.m.Control} oControl The registered control instance
294
+ * @param {object} oState The state object
295
+ * @param {boolean} bApplyAbsolute Defines whether the state should be an additional delta on the current control state
296
+ *
297
+ * @returns {Promise} A Promise resolving after the state has been applied
298
+ */
299
+ Engine.prototype.applyState = function(oControl, oState, bApplyAbsolute) {
300
+
301
+ //Call retrieve only to ensure that the control is initialized and enabled for modification
302
+ return this.retrieveState(oControl).then(function(oCurrentState){
303
+
304
+ var aStatePromise = [], aChanges = [], mInfoState = {};
305
+
306
+ if (oControl.validateState instanceof Function) {
307
+ mInfoState = oControl.validateState(this.externalizeKeys(oControl, oState));
308
+ }
309
+
310
+ if (mInfoState.validation === MessageType.Error){
311
+ Log.error(mInfoState.message);
312
+ }
313
+
314
+ var aKeys = Object.keys(oState);
315
+ aKeys.forEach(function(sControllerKey){
316
+
317
+ var oController = this.getController(oControl, sControllerKey);
318
+
319
+ if (!oController){
320
+ //TODO: p13nMode <> register <> StateUtil key alignment
321
+ return;
322
+ }
323
+
324
+ var oStatePromise = this.createChanges({
325
+ control: oControl,
326
+ key: sControllerKey,
327
+ state: oController.sanityCheck(oState[sControllerKey]),
328
+ suppressAppliance: true,
329
+ applyAbsolute: bApplyAbsolute
330
+ });
331
+
332
+ aStatePromise.push(oStatePromise);
333
+ }.bind(this));
334
+
335
+ return Promise.all(aStatePromise).then(function(aRawChanges){
336
+ var mChangeMap = {};
337
+
338
+ aRawChanges.forEach(function(aSpecificChanges, iIndex){
339
+
340
+ if (aSpecificChanges && aSpecificChanges.length > 0){
341
+ aChanges = aChanges.concat(aSpecificChanges);
342
+ var sKey = aKeys[iIndex];
343
+ mChangeMap[sKey] = aSpecificChanges;
344
+ }
345
+ });
346
+
347
+ return this._processChanges(oControl, mChangeMap);
348
+ }.bind(this));
349
+
350
+ }.bind(this));
351
+ };
352
+
353
+ /**
354
+ *
355
+ * Retrieves the externalized state for a given control instance,
356
+ * after all necessary changes have been applied (e.g. modification handler appliance).
357
+ * After the returned Promise has been resolved, the returned State is in sync with the according
358
+ * state object of the control.
359
+ *
360
+ * @public
361
+ * @param {object} oControl The control instance implementing IxState to retrieve the externalized state
362
+ *
363
+ * @returns {Promise} a Promise resolving in the current control state.
364
+ */
365
+ Engine.prototype.retrieveState = function(oControl) {
366
+
367
+ //ensure that the control has been initialized
368
+ return this.checkControlInitialized(oControl).then(function() {
369
+
370
+ //ensure that all changes have been applied
371
+ return Engine.getInstance().waitForChanges(oControl).then(function() {
372
+
373
+ var oRetrievedState = {};
374
+ Engine.getInstance().getRegisteredControllers(oControl).forEach(function(sKey){
375
+ oRetrievedState[sKey] = Engine.getInstance().getController(oControl, sKey).getCurrentState(true);
376
+ });
377
+
378
+ return merge({}, oRetrievedState);
379
+
380
+ });
381
+
382
+ });
383
+
384
+ };
385
+
386
+ /**
387
+ * This method can be used to set the modification handling for a control instance.
388
+ * @private
389
+ *
390
+ * @param {sap.m.Control} vControl The registered control instance
391
+ * @param {sap.m.p13n.modification.ModificationHandler} oModificationHandler The modification handler object
392
+ */
393
+ Engine.prototype._setModificationHandler = function(vControl, oModificationHandler) {
394
+ if (!oModificationHandler.isA("sap.m.p13n.modification.ModificationHandler")) {
395
+ throw new Error("Only sap.m.p13n.modification.ModificationHandler derivations are allowed for modification");
396
+ }
397
+ var oModificationSetting = this._determineModification(vControl); //check and calculate modification basics
398
+ oModificationSetting.handler = oModificationHandler;
399
+ this._getRegistryEntry(vControl).modification = oModificationSetting;
400
+ };
401
+
402
+ var fnQueue = function(oControl, fTask) {
403
+ var fCleanupPromiseQueue = function(pOriginalPromise) {
404
+ if (oControl._pModificationQueue === pOriginalPromise){
405
+ delete oControl._pModificationQueue;
406
+ }
407
+ };
408
+
409
+ oControl._pModificationQueue = oControl._pModificationQueue instanceof Promise ? oControl._pModificationQueue.then(fTask) : fTask();
410
+ oControl._pModificationQueue.then(fCleanupPromiseQueue.bind(null, oControl._pModificationQueue));
411
+
412
+ return oControl._pModificationQueue;
413
+ };
414
+
415
+ /**
416
+ * <code>Engine#createChanges</code> can be used to programmatically trigger the creation
417
+ * of a set of changes based on the current control state and the provided state.
418
+ *
419
+ * @ui5-restricted
420
+ *
421
+ * @param {object} mDiffParameters A map defining the configuration to create the changes.
422
+ * @param {sap.m.Control} mDiffParameters.control The control instance tht should be adapted.
423
+ * @param {string} mDiffParameters.key The key used to retrieve the corresponding Controller.
424
+ * @param {object} mDiffParameters.state The state which should be applied on the provided control instance
425
+ * @param {boolean} [mDiffParameters.applyAbsolute] Decides whether unmentioned entries should be affected,
426
+ * @param {boolean} [mDiffParameters.stateBefore] In case the state should be diffed manually
427
+ * for example if "A" is existing in the control state, but not mentioned in the new state provided in the
428
+ * mDiffParameters.state then the absolute appliance decides whether to remove "A" or to keep it.
429
+ * @param {boolean} [mDiffParameters.suppressAppliance] Decides whether the change should be applied directly.
430
+ * @param {boolean} [mDiffParameters.applySequentially] Decides whether the appliance should be queued or processed in parallel.
431
+ * Controller
432
+ *
433
+ * @returns {Promise} A Promise resolving in the according delta changes.
434
+ */
435
+ Engine.prototype.createChanges = function(mDiffParameters) {
436
+
437
+ var sKey = mDiffParameters.key;
438
+ var aNewState = mDiffParameters.state;
439
+ var bApplyAbsolute = !!mDiffParameters.applyAbsolute;
440
+ var bSuppressCallback = !!mDiffParameters.suppressAppliance;
441
+ var bApplySequentially = !!mDiffParameters.applySequentially;
442
+
443
+ if (!sKey || !mDiffParameters.control || !aNewState) {
444
+ throw new Error("To create changes via Engine, atleast a 1)Control 2)Key and 3)State needs to be provided.");
445
+ }
446
+
447
+ var oControl = Engine.getControlInstance(mDiffParameters.control);
448
+
449
+ var fDeltaHandling = function() {
450
+ return this.initAdaptation(oControl, sKey).then(function(){
451
+
452
+ var oController = this.getController(oControl, sKey);
453
+ var mChangeOperations = oController.getChangeOperations();
454
+
455
+ var oRegistryEntry = this._getRegistryEntry(oControl);
456
+ var oCurrentState = oController.getCurrentState();
457
+ var oPriorState = merge(oCurrentState instanceof Array ? [] : {}, oCurrentState);
458
+
459
+ var mDeltaConfig = {
460
+ existingState: mDiffParameters.stateBefore || oPriorState,
461
+ applyAbsolute: bApplyAbsolute,
462
+ changedState: aNewState,
463
+ control: oController.getAdaptationControl(),
464
+ changeOperations: mChangeOperations,
465
+ deltaAttributes: ["key"],
466
+ propertyInfo: oRegistryEntry.helper.getProperties().map(function(a){return {key: a.key};})
467
+ };
468
+
469
+ //Only execute change calculation in case there is a difference (--> example: press 'Ok' without a difference)
470
+ var aChanges = oController.getDelta(mDeltaConfig);
471
+
472
+ if (!bSuppressCallback) {
473
+ var mChangeMap = {};
474
+ mChangeMap[sKey] = aChanges;
475
+ return this._processChanges(oControl, mChangeMap);
476
+ }
477
+
478
+ return aChanges || [];
479
+
480
+ }.bind(this));
481
+
482
+ }.bind(this);
483
+
484
+ if (bApplySequentially) {
485
+ return fnQueue(oControl, fDeltaHandling);
486
+ } else {
487
+ return fDeltaHandling.apply(this);
488
+ }
489
+ };
490
+
491
+ /**
492
+ * Returns a promise resolving after all currently pending modifications have been applied.
493
+ *
494
+ * @ui5-restricted
495
+ *
496
+ * @param {sap.m.Control} oControl The according control instance.
497
+ * @returns {Promise} A Promise resolving after all pending modifications have been applied.
498
+ */
499
+ Engine.prototype.waitForChanges = function(oControl) {
500
+ var oModificationSetting = this._determineModification(oControl);
501
+ return oModificationSetting.handler.waitForChanges({
502
+ element: oControl
503
+ }, oModificationSetting.payload);
504
+ };
505
+
506
+ /**
507
+ * Determines whether the environment is suitable for the desired modification of the provided control instance.
508
+ *
509
+ * @ui5-restricted
510
+ * @param {sap.m.Control} oControl The according control instance.
511
+ *
512
+ * @returns {Promise} A Promise resolving in a boolean whether the requirements for the persistence layer are met.
513
+ */
514
+ Engine.prototype.isModificationSupported = function(oControl) {
515
+ var oModificationSetting = this._determineModification(oControl);
516
+ return oModificationSetting.handler.isModificationSupported({
517
+ element: oControl
518
+ }, oModificationSetting.payload);
519
+ };
520
+
521
+ Engine.prototype.fireStateChange = function(oControl) {
522
+ return this.retrieveState(oControl).then(function(oState){
523
+ this.stateHandlerRegistry.fireChange(oControl, oState);
524
+ }.bind(this));
525
+ };
526
+
527
+ /**
528
+ * This method can be used to process an array of changes.
529
+ * @ui5-restricted
530
+ *
531
+ * @param {sap.m.Control} vControl The registered control instance
532
+ * @param {object} mChanges A map of keys and arrays, every controller will provide an array of changes
533
+ * @returns {Promise} The change appliance promise.
534
+ */
535
+ Engine.prototype._processChanges = function(vControl, mChanges) {
536
+ var aChanges = [];
537
+ var aKeys = Object.keys(mChanges);
538
+
539
+ aKeys.forEach(function(sKey){
540
+ aChanges = aChanges.concat(mChanges[sKey]);
541
+ });
542
+
543
+ if (aChanges instanceof Array && aChanges.length > 0) {
544
+ var oModificationSetting = this._determineModification(vControl);
545
+ return oModificationSetting.handler.processChanges(aChanges, oModificationSetting.payload)
546
+ .then(function(aChanges){
547
+ return aChanges;
548
+ });
549
+ } else {
550
+ return Promise.resolve([]);
551
+ }
552
+ };
553
+
554
+ /**
555
+ * This method can be used in the control's according designtime metadata
556
+ * for keyuser personalization.
557
+ *
558
+ * @ui5-restricted
559
+ *
560
+ * @param {sap.m.Control} oControl The registered control instance.
561
+ * @param {object} mPropertyBag The propertybag provided in the settings action.
562
+ * @param {string} aKeys The keys to be used to display in the corresponding Controller
563
+ *
564
+ * @returns {Promise} A Promise resolving in the set of changes to be created during RTA.
565
+ */
566
+ Engine.prototype.getRTASettingsActionHandler = function (oControl, mPropertyBag, aKeys) {
567
+
568
+ var fResolveRTA;
569
+
570
+ //var aVMs = this.hasForReference(oControl, "sap.ui.fl.variants.VariantManagement");
571
+ // TODO: clarify if we need this error handling / what to do with the Link if we want to keep it
572
+ var aPVs = this.hasForReference(oControl, "sap.m.p13n.PersistenceProvider");
573
+
574
+ if (aPVs.length > 0 && !oControl.isA("sap.m.link.Panel")) {
575
+ return Promise.reject("Please do not use a PeristenceProvider in RTA.");
576
+ }
577
+
578
+ var oOriginalModifHandler = this.getModificationHandler(oControl);
579
+ var oTemporaryRTAHandler = new FlexModificationHandler();
580
+
581
+ var oRTAPromise = new Promise(function(resolve, reject){
582
+ fResolveRTA = resolve;
583
+ });
584
+
585
+ oTemporaryRTAHandler.processChanges = function(aChanges) {
586
+ fResolveRTA(aChanges);
587
+ return Promise.resolve(aChanges);
588
+ };
589
+
590
+ this._setModificationHandler(oControl, oTemporaryRTAHandler);
591
+
592
+ this.uimanager.show(oControl, aKeys).then(function(oContainer){
593
+ var oCustomHeader = oContainer._oPopup.getCustomHeader();
594
+ if (oCustomHeader) {
595
+ oCustomHeader.getContentRight()[0].setVisible(false);
596
+ }
597
+ oContainer._oPopup.addStyleClass(mPropertyBag.styleClass);
598
+ if (mPropertyBag.fnAfterClose instanceof Function) {
599
+ oContainer.attachAfterClose(mPropertyBag.fnAfterClose);
600
+ }
601
+ });
602
+
603
+ oRTAPromise.then(function(){
604
+ this._setModificationHandler(oControl, oOriginalModifHandler);
605
+ oTemporaryRTAHandler.destroy();
606
+ }.bind(this));
607
+
608
+ return oRTAPromise;
609
+
610
+ };
611
+
612
+ /**
613
+ * Enhances the xConfig object by using the <code>ModificationHandler</code>
614
+ *
615
+ * @ui5-restricted
616
+ *
617
+ * @param {sap.m.Control} vControl The registered control instance.
618
+ * @param {object} mEnhanceConfig An object providing the information about the xConfig enhancement
619
+ * @param {object} mEnhanceConfig.key The affected property name
620
+ * @param {object} mEnhanceConfig.controlMeta Object describing which config is affected
621
+ * @param {object} mEnhanceConfig.controlMeta.aggregation The affected aggregation name (such as <code>columns</code> or <code>filterItems</code>)
622
+ * @param {object} mEnhanceConfig.controlMeta.property The affected property name (such as <code>width</code> or <code>lable</code>)
623
+ * @param {object} mEnhanceConfig.value The value that should be written in the xConfig
624
+ * @param {object} [mEnhanceConfig.propertyBag] Optional propertybag for the <code>ModificationHandler</code>
625
+ * @returns {Promise} Promise resolving when the XConfig is successfully enhanced
626
+ */
627
+ Engine.prototype.enhanceXConfig = function(vControl, mEnhanceConfig) {
628
+
629
+ var oControl = Engine.getControlInstance(vControl);
630
+ var oRegistryEntry = this._getRegistryEntry(vControl);
631
+
632
+ return xConfigAPI.enhanceConfig(oControl, mEnhanceConfig)
633
+ .then(function(oConfig){
634
+ if (oRegistryEntry) {
635
+ //to simplify debugging
636
+ oRegistryEntry.xConfig = oConfig;
637
+ }
638
+ });
639
+ };
640
+
641
+ /**
642
+ * Returns a copy of the xConfig object
643
+ *
644
+ * @ui5-restricted sap.m
645
+ * @param {sap.ui.core.Element} vControl The according element which should be checked
646
+ * @param {object} [mEnhanceConfig] An object providing a modification handler specific payload
647
+ * @param {object} [mEnhanceConfig.propertyBag] Optional propertybag for different modification handler derivations
648
+ *
649
+ * @returns {Promise<object>|object}
650
+ * A promise that resolves with the xConfig, the xConfig directly if it is already available, or <code>null</code> if there is no xConfig
651
+ */
652
+ Engine.prototype.readXConfig = function(vControl, mEnhanceConfig) {
653
+
654
+ var oControl = Engine.getControlInstance(vControl);
655
+ return xConfigAPI.readConfig(oControl, mEnhanceConfig) || {};
656
+ };
657
+
658
+ /**
659
+ * The Engine is processing state via the internal key registry.
660
+ * The external state representation might differ from the internal registration.
661
+ * <b>Note:</b> This will only replace the keys to the external StateUtil representation, but not transform the state content itself.
662
+ *
663
+ * @private
664
+ * @param {string|sap.m.Control} vControl The registered control instance
665
+ * @param {object} oInternalState The internal state
666
+ * @returns {object} The externalized state
667
+ */
668
+ Engine.prototype.externalizeKeys = function(vControl, oInternalState) {
669
+ var oExternalState = {};
670
+ Object.keys(oInternalState).forEach(function(sInternalKey){
671
+ var oController = this.getController(Engine.getControlInstance(vControl), sInternalKey);
672
+ if (oController) {
673
+ oExternalState[oController.getStateKey()] = oInternalState[sInternalKey];
674
+ }
675
+ }.bind(this));
676
+ return oExternalState;
677
+ };
678
+
679
+ /**
680
+ * The Engine is processing state via the internal key registry.
681
+ * The external state representation might differ from the internal registration.
682
+ * <b>Note:</b> This will only replace the keys to the internal Engine registry, but not transform the state content itself.
683
+ *
684
+ * @private
685
+ * @param {string|sap.m.Control} vControl The registered control instance
686
+ * @param {object} oExternalState The external state
687
+ * @returns {object} The internalized state
688
+ */
689
+ Engine.prototype.internalizeKeys = function (vControl, oExternalState) {
690
+ var aControllerKeys = this.getRegisteredControllers(vControl), oInternalState = {};
691
+ aControllerKeys.forEach(function(sInternalRegistryKey){
692
+ var sExternalStateKey = this.getController(vControl, sInternalRegistryKey).getStateKey();
693
+ if (oExternalState.hasOwnProperty(sExternalStateKey)) {
694
+ oInternalState[sInternalRegistryKey] = oExternalState[sExternalStateKey];
695
+ }
696
+ }.bind(this));
697
+ return oInternalState;
698
+ };
699
+
700
+ Engine.prototype.diffState = function(oControl, oOld, oNew) {
701
+
702
+ var aDiffCreation = [], oDiffState = {};
703
+ oOld = merge({}, oOld);
704
+ oNew = merge({}, oNew);
705
+
706
+ this.getRegisteredControllers(oControl).forEach(function(sKey){
707
+
708
+ aDiffCreation.push(this.createChanges({
709
+ control: oControl,
710
+ stateBefore: oOld[sKey],
711
+ state: oNew[sKey],
712
+ applyAbsolute: true,
713
+ key: sKey,
714
+ suppressAppliance: true
715
+ }));
716
+
717
+ }.bind(this));
718
+
719
+ return Promise.all(aDiffCreation)
720
+ .then(function(aChanges){
721
+ this.getRegisteredControllers(oControl).forEach(function(sKey, i){
722
+
723
+ var aState = this.getController(oControl, sKey).changesToState(aChanges[i], oOld[sKey], oNew[sKey]);
724
+ oDiffState[sKey] = aState;
725
+
726
+ }.bind(this));
727
+
728
+ return oDiffState;
729
+
730
+ }.bind(this));
731
+ };
732
+
733
+ Engine.prototype.checkControlInitialized = function(vControl) {
734
+ var oControl = Engine.getControlInstance(vControl);
735
+ return oControl.initialized instanceof Function ? oControl.initialized() : Promise.resolve();
736
+ };
737
+
738
+ Engine.prototype.checkPropertyHelperInitialized = function(vControl) {
739
+ var oControl = Engine.getControlInstance(vControl);
740
+ return oControl.initPropertyHelper instanceof Function ? oControl.initPropertyHelper() : Promise.resolve();
741
+ };
742
+
743
+ /**
744
+ * This method can be used to initialize the Controller housekeeping.
745
+ *
746
+ * @private
747
+ *
748
+ * @param {sap.m.Control} vControl The registered control instance
749
+ * @param {string|string[]} aKeys The key for the according Controller
750
+ * @param {Object[]} aCustomInfo A custom set of propertyinfos as base to create the UI
751
+ *
752
+ * @returns {Promise} A Promise resolving after the adaptation housekeeping has been initialized.
753
+ */
754
+ Engine.prototype.initAdaptation = function(vControl, aKeys) {
755
+ this.verifyController(vControl, aKeys);
756
+
757
+ //1) Cache property helper
758
+ var oRegistryEntry = this._getRegistryEntry(vControl);
759
+ var oControl = Engine.getControlInstance(vControl);
760
+
761
+ if (oRegistryEntry.helper) {
762
+ return Promise.resolve(oRegistryEntry.helper);
763
+ }
764
+
765
+ return this.checkPropertyHelperInitialized(oControl).then(function (oPropertyHelper) {
766
+ oRegistryEntry.helper = oPropertyHelper;
767
+ return oPropertyHelper;
768
+ }, function (sHelperError) {
769
+ throw new Error(sHelperError);
770
+ });
771
+
772
+ };
773
+
774
+ /**
775
+ * This method should only be used to register a new Controller.
776
+ *
777
+ * @private
778
+ *
779
+ * @param {sap.m.p13n.subcontroller.Controller} oController The controller instance.
780
+ * @param {string} sKey The key that defines the later access to the controller instance.
781
+ * @param {object} oPreConfig A predefined configuration
782
+ */
783
+ Engine.prototype.addController = function(oController, sKey, oPreConfig) {
784
+ var oRegistryEntry = this._getRegistryEntry(oController.getAdaptationControl(), oPreConfig);
785
+ oRegistryEntry.controller[sKey] = oController;
786
+ };
787
+
788
+ /**
789
+ * This method can be used to get a controller instance.
790
+ * @private
791
+ *
792
+ * @param {sap.m.Control} vControl The registered Control instance.
793
+ * @param {string} sKey The key for which the controller has been registered.
794
+ *
795
+ * @returns {sap.m.p13n.SelectionController} The controller instance
796
+ */
797
+ Engine.prototype.getController = function(vControl, sKey) {
798
+ var oRegistryEntry = this._getRegistryEntry(vControl);
799
+
800
+ if (oRegistryEntry && oRegistryEntry.controller.hasOwnProperty(sKey)) {
801
+ return oRegistryEntry.controller[sKey];
802
+ }
803
+ };
804
+
805
+ /**
806
+ * Verifies the existence of a set of subcontrollers registered for a provided control instance.
807
+ *
808
+ * @param {sap.m.Control} vControl The registered Control instance.
809
+ * @param {string|array} vKey A key as string or an array of keys
810
+ */
811
+ Engine.prototype.verifyController = function(vControl, vKey) {
812
+ var aKeys = vKey instanceof Array ? vKey : [vKey];
813
+
814
+ aKeys.forEach(function(sKey){
815
+ if (!this.getController(vControl, sKey)) {
816
+ var oControl = Engine.getControlInstance(vControl);
817
+ throw new Error("No controller registered yet for " + oControl.getId() + " and key: " + sKey);
818
+ }
819
+ }.bind(this));
820
+
821
+ };
822
+
823
+ /**
824
+ * Retrieves the subcontroller UI settings for a provided control instance
825
+ * and the set of provided registered keys.
826
+ *
827
+ * @param {sap.m.Control} vControl The registered Control instance.
828
+ * @param {string|array} vKeys A key as string or an array of keys
829
+ *
830
+ * @returns {object} The requested UI settings of the control instance and provided keys
831
+ */
832
+ Engine.prototype.getUISettings = function(vControl, vKeys) {
833
+ var aKeys = Array.isArray(vKeys) ? vKeys : [vKeys];
834
+ this.verifyController(vControl, aKeys);
835
+ var oPropertyHelper = this._getRegistryEntry(vControl).helper;
836
+ var mUiSettings = {}, aPanelCreation = [];
837
+
838
+ aKeys.forEach(function(sKey){
839
+ var oController = this.getController(vControl, sKey);
840
+ var pAdaptationUI = oController.initAdaptationUI(oPropertyHelper);
841
+
842
+ //Check faceless controller implementations and skip them
843
+ if (pAdaptationUI instanceof Promise){
844
+ aPanelCreation.push(pAdaptationUI);
845
+ }
846
+ }.bind(this));
847
+
848
+ return Promise.all(aPanelCreation)
849
+ .then(function(aPanels){
850
+ aPanels.forEach(function(oPanel, iIndex){
851
+ var sKey = aKeys[iIndex];
852
+ mUiSettings[sKey] = {
853
+ panel: oPanel
854
+ };
855
+ });
856
+ return mUiSettings;
857
+ });
858
+ };
859
+
860
+ /**
861
+ * This method can be used to determine if modification settings for a control have already been created.
862
+ *
863
+ * @private
864
+ *
865
+ * @param {sap.m.Control} vControl The registered Control instance
866
+ * @returns {boolean} true if modification settings were already determined
867
+ */
868
+ Engine.prototype.isRegisteredForModification = function(vControl) {
869
+ var oRegistryEntry = this._getRegistryEntry(vControl);
870
+ return oRegistryEntry && !!oRegistryEntry.modification;
871
+ };
872
+
873
+ /**
874
+ * Retruns an array of all registered controllers
875
+ *
876
+ * @param {string|sap.m.Control} vControl The control id or instance
877
+ * @returns {array} An array of all registered controller instances
878
+ */
879
+ Engine.prototype.getRegisteredControllers = function(vControl){
880
+ var oRegistryEntry = this._getRegistryEntry(vControl);
881
+ return Object.keys(oRegistryEntry.controller);
882
+ };
883
+
884
+ /**
885
+ * This method can be used to get the registry entry for a control instance
886
+ *
887
+ * @private
888
+ * @param {string|sap.m.Control} vControl The control id or instance
889
+ *
890
+ * @returns {object} The according registry entry
891
+ */
892
+ Engine.prototype._getRegistryEntry = function(vControl) {
893
+
894
+ var oControl = Engine.getControlInstance(vControl);
895
+ return _mRegistry.get(oControl);
896
+
897
+ };
898
+
899
+ /**
900
+ * This method can be used to get the modification handling for a control instance
901
+ *
902
+ * @private
903
+ * @ui5-restricted sap.m
904
+ *
905
+ * @param {string|sap.m.Control} vControl The control id or instance
906
+ * @returns {object} The according ModificationHandler.
907
+ */
908
+ Engine.prototype.getModificationHandler = function(vControl) {
909
+ var oModificationSetting = this._determineModification(vControl);
910
+
911
+ //This method might also be retrieved by non-registered Controls (such as FilterBarBase) - the default should always be Flex.
912
+ return oModificationSetting.handler;
913
+
914
+ };
915
+
916
+ /**
917
+ * This method can be used to create the registry entry for a control instance
918
+ *
919
+ * @private
920
+ * @param {string|sap.m.Control} vControl The control id or instance
921
+ * @param {object} oPreConfig A predefined configuration
922
+ * @returns {object} The according registry entry
923
+ */
924
+ Engine.prototype._createRegistryEntry = function(vControl, oPreConfig) {
925
+
926
+ var oControl = Engine.getControlInstance(vControl);
927
+
928
+ if (!_mRegistry.has(oControl)) {
929
+
930
+ _mRegistry.set(oControl, {
931
+ modification: oPreConfig && oPreConfig.modification ? {
932
+ handler: oPreConfig.modification,//TBD
933
+ payload: {
934
+ mode: "Auto",//TBD,
935
+ hasVM: true,
936
+ hasPP: false
937
+ }
938
+ } : null,
939
+ controller: {},
940
+ activeP13n: null,
941
+ helper: oPreConfig && oPreConfig.helper ? oPreConfig.helper : null,
942
+ xConfig: null
943
+ });
944
+
945
+ }
946
+
947
+ return _mRegistry.get(oControl);
948
+ };
949
+
950
+ /**
951
+ * Determines and registeres the ModificationHandler per control instance
952
+ *
953
+ * @private
954
+ * @param {string|sap.m.Control} vControl The control id or instance
955
+ * @returns {object} The according modification registry entry
956
+ */
957
+ Engine.prototype._determineModification = function (vControl) {
958
+
959
+ var oRegistryEntry = this._getRegistryEntry(vControl);
960
+
961
+ //Modification setting is only calculated once per control instance
962
+ if (oRegistryEntry && oRegistryEntry.modification) {
963
+ return oRegistryEntry.modification;
964
+ }
965
+
966
+ var aPPResults = this.hasForReference(vControl, "sap.m.p13n.PersistenceProvider");
967
+ var aVMResults = this.hasForReference(vControl, "sap.ui.fl.variants.VariantManagement");
968
+
969
+ var aPersistenceProvider = aPPResults.length ? aPPResults : undefined;
970
+ var sHandlerMode = aPersistenceProvider ? aPersistenceProvider[0].getMode() : "Standard";
971
+
972
+ var mHandlerMode = {
973
+ //During preprocessing, it might be necessary to calculate the modification handler instance
974
+ //without an initialized control instance --> use flex as default
975
+ undefined: FlexModificationHandler,
976
+ Global: FlexModificationHandler,
977
+ Transient: FlexModificationHandler,
978
+ Standard: FlexModificationHandler,
979
+ Auto: FlexModificationHandler
980
+ };
981
+
982
+ var ModificiationHandler = mHandlerMode[sHandlerMode];
983
+
984
+ if (!ModificiationHandler) {
985
+ throw new Error("Please provide a valid ModificationHandler! - valid Modification handlers are:" + Object.keys(mHandlerMode));
986
+ }
987
+
988
+ var oModificationSetting = {
989
+ handler: ModificiationHandler.getInstance(),
990
+ payload: {
991
+ hasVM: aVMResults && aVMResults.length > 0,
992
+ hasPP: aPPResults && aPPResults.length > 0,
993
+ mode: sHandlerMode
994
+ }
995
+ };
996
+
997
+ if (oRegistryEntry && !oRegistryEntry.modification) {
998
+ oRegistryEntry.modification = oModificationSetting;
999
+ }
1000
+
1001
+ return oModificationSetting;
1002
+ };
1003
+
1004
+ Engine.prototype.hasForReference = function(vControl, sControlType) {
1005
+ var sControlId = vControl && vControl.getId ? vControl.getId() : vControl;
1006
+ var aResults = Element.registry.filter(function (oElement) {
1007
+ if (!oElement.isA(sControlType)) {
1008
+ return false;
1009
+ }
1010
+ var aFor = oElement.getFor instanceof Function ? oElement.getFor() : [];
1011
+ for (var n = 0; n < aFor.length; n++) {
1012
+ if (aFor[n] === sControlId || this.hasControlAncestorWithId(sControlId, aFor[n])) {
1013
+ return true;
1014
+ }
1015
+ }
1016
+ return false;
1017
+ });
1018
+ return aResults;
1019
+ };
1020
+
1021
+ /**
1022
+ * Determines and registeres the ModificationHandler per control instance
1023
+ *
1024
+ * @private
1025
+ * @param {string} sControlId The control id
1026
+ * @param {string} sAncestorControlId The control ancestor id
1027
+ *
1028
+ * @returns {boolean} Returns whether an according ancestor could be found.
1029
+ */
1030
+ Engine.prototype.hasControlAncestorWithId = function(sControlId, sAncestorControlId) {
1031
+ var oControl;
1032
+
1033
+ if (sControlId === sAncestorControlId) {
1034
+ return true;
1035
+ }
1036
+
1037
+ oControl = sap.ui.getCore().byId(sControlId);
1038
+ while (oControl) {
1039
+ if (oControl.getId() === sAncestorControlId) {
1040
+ return true;
1041
+ }
1042
+
1043
+ if (typeof oControl.getParent === "function") {
1044
+ oControl = oControl.getParent();
1045
+ } else {
1046
+ return false;
1047
+ }
1048
+ }
1049
+
1050
+ return false;
1051
+ };
1052
+
1053
+
1054
+ /**
1055
+ * This method can be used to get a control instance by passing either the control
1056
+ * or the Control's Id.
1057
+ *
1058
+ * @private
1059
+ *
1060
+ * @param {string|sap.m.Control} vControl The control id or instance
1061
+ * @returns {sap.ui.core.Control} The control instance
1062
+ */
1063
+ Engine.getControlInstance = function(vControl) {
1064
+ return typeof vControl == "string" ? sap.ui.getCore().byId(vControl) : vControl;
1065
+ };
1066
+
1067
+ /**
1068
+ * This method can be used to get the active p13n state of a registered Control.
1069
+ * E.g. the method will return the key of the Controller that is currently being
1070
+ * used to display a p13n UI.
1071
+ *
1072
+ * @private
1073
+ * @param {string|sap.m.Control} vControl The control id or instance
1074
+ *
1075
+ * @returns {boolean} The according flag is the Control has an open P13n container
1076
+ */
1077
+ Engine.prototype.hasActiveP13n = function(vControl) {
1078
+ return !!this._getRegistryEntry(vControl).activeP13n;
1079
+ };
1080
+
1081
+ /**
1082
+ * This method can be used to set the active p13n state of a registered Control.
1083
+ * E.g. the method will return the key of the Controller that is currently being
1084
+ * used to display a p13n UI.
1085
+ *
1086
+ * @private
1087
+ *
1088
+ * @param {sap.m.Control} vControl The registered control instance.
1089
+ * @param {string} sKey The registerd key to get the corresponding Controller.
1090
+ */
1091
+ Engine.prototype.setActiveP13n = function(vControl, sKey) {
1092
+ this._getRegistryEntry(vControl).activeP13n = sKey;
1093
+ };
1094
+
1095
+ /**
1096
+ * Triggers a validation for a certain controller - The method will create a
1097
+ * MessageStrip and place it on the according oP13nUI. The BaseController needs
1098
+ * to implement <code>BaseController#validateP13n</code>.
1099
+ *
1100
+ * @private
1101
+ *
1102
+ * @param {sap.m.Control} vControl The registered control instance.
1103
+ * @param {string} sKey The registerd key to get the corresponding Controller.
1104
+ * @param {sap.ui.core.Control} oP13nUI The adaptation UI displayed in the container (e.g. BasePanel derivation).
1105
+ */
1106
+ Engine.prototype.validateP13n = function(vControl, sKey, oP13nUI) {
1107
+ var oController = this.getController(vControl, sKey);
1108
+ var oControl = Engine.getControlInstance(vControl);
1109
+
1110
+
1111
+ var mControllers = this._getRegistryEntry(vControl).controller;
1112
+ var oTheoreticalState = {};
1113
+
1114
+ Object.keys(mControllers).forEach(function(sControllerKey){
1115
+ oTheoreticalState[sControllerKey] = mControllers[sControllerKey].getCurrentState();
1116
+ });
1117
+
1118
+ //Only execeute validation for controllers that support 'model2State'
1119
+ if (oController && oController.model2State instanceof Function) {
1120
+ oTheoreticalState[sKey] = oController.model2State();
1121
+
1122
+ var mInfoState = {
1123
+ validation: MessageType.None
1124
+ };
1125
+ if (oControl.validateState instanceof Function) {
1126
+ mInfoState = oControl.validateState(this.externalizeKeys(oControl, oTheoreticalState), sKey);
1127
+ }
1128
+
1129
+ var oMessageStrip;
1130
+
1131
+ if (mInfoState.validation !== MessageType.None) {
1132
+ oMessageStrip = new MessageStrip({
1133
+ type: mInfoState.validation,
1134
+ text: mInfoState.message
1135
+ });
1136
+ }
1137
+
1138
+ if (oP13nUI.setMessageStrip instanceof Function) {
1139
+ oP13nUI.setMessageStrip(oMessageStrip);
1140
+ } else {
1141
+ Log.warning("message strip could not be provided - the adaptation UI needs to implement 'setMessageStrip'");
1142
+ }
1143
+
1144
+ }
1145
+
1146
+ };
1147
+
1148
+ /**
1149
+ * Reads the current state of the subcontrollers and triggers a state appliance
1150
+ *
1151
+ * @param {sap.m.Control} oControl The registered Control instance.
1152
+ * @param {array} aKeys An array of keys
1153
+ * @returns {Promise} A Promise resolving after all p13n changes have been calculated and processed
1154
+ */
1155
+ Engine.prototype.handleP13n = function(oControl, aKeys) {
1156
+
1157
+ var pChanges = [];
1158
+
1159
+ aKeys.forEach(function(sControllerKey){
1160
+
1161
+ var oController = this.getController(oControl, sControllerKey);
1162
+
1163
+ var p = this.createChanges({
1164
+ control: oControl,
1165
+ key: sControllerKey,
1166
+ state: oController.getP13nData(),
1167
+ suppressAppliance: true,
1168
+ applyAbsolute: true
1169
+ })
1170
+ .then(function(aItemChanges){
1171
+
1172
+ return oController.getBeforeApply().then(function(aChanges){
1173
+
1174
+ var aComulatedChanges = aChanges ? aChanges.concat(aItemChanges) : aItemChanges;
1175
+ return aComulatedChanges;
1176
+
1177
+ });
1178
+ });
1179
+
1180
+ pChanges.push(p);
1181
+ }.bind(this));
1182
+
1183
+ return Promise.all(pChanges).then(function(aChangeMatrix){
1184
+
1185
+ var aApplyChanges = [];
1186
+ var mChangeMap = {};
1187
+ aChangeMatrix.forEach(function(aTypeChanges, iIndex){
1188
+ aApplyChanges = aApplyChanges.concat(aTypeChanges);
1189
+ var sKey = aKeys[iIndex];
1190
+ mChangeMap[sKey] = aTypeChanges;
1191
+ });
1192
+
1193
+ if (aApplyChanges.length > 0) {
1194
+ Engine.getInstance()._processChanges(oControl, mChangeMap);
1195
+ }
1196
+ });
1197
+
1198
+ };
1199
+
1200
+ /**
1201
+ * @private
1202
+ * @ui5-restricted sap.m
1203
+ *
1204
+ * This method is the central point of access to the Engine Singleton.
1205
+ * @returns {sap.m.p13n.Engine} The Engine instance
1206
+ */
1207
+ Engine.getInstance = function() {
1208
+ if (!oEngine) {
1209
+ oEngine = new Engine();
1210
+ }
1211
+ return oEngine;
1212
+ };
1213
+
1214
+ /**
1215
+ * This method can be used for debugging to retrieve the complete registry.
1216
+ *
1217
+ * @private
1218
+ * @returns {object} The Engine registry object
1219
+ */
1220
+ Engine.prototype._getRegistry = function() {
1221
+ var oRegistry = {
1222
+ stateHandlerRegistry: this.stateHandlerRegistry,
1223
+ defaultProviderRegistry: this.defaultProviderRegistry,
1224
+ controlRegistry: {}
1225
+ };
1226
+
1227
+ this._aRegistry.forEach(function(sKey){
1228
+ var oControl = sap.ui.getCore().byId(sKey);
1229
+ oRegistry.controlRegistry[sKey] = _mRegistry.get(oControl);
1230
+ });
1231
+
1232
+ return oRegistry;
1233
+ };
1234
+
1235
+ /**
1236
+ * @override
1237
+ * @inheritDoc
1238
+ */
1239
+ Engine.prototype.destroy = function() {
1240
+ AdaptationProvider.prototype.destroy.apply(this, arguments);
1241
+ oEngine = null;
1242
+ this._aRegistry = null;
1243
+ _mRegistry.delete(this);
1244
+ this.defaultProviderRegistry.destroy();
1245
+ this.defaultProviderRegistry = null;
1246
+ this.stateHandlerRegistry.destroy();
1247
+ this.stateHandlerRegistry = null;
1248
+ this.uimanager.destroy();
1249
+ this.uimanager = null;
1250
+ };
1251
+
1252
+ return Engine.getInstance();
1253
+ });