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