@openui5/sap.ui.mdc 1.96.2 → 1.98.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 (329) hide show
  1. package/.reuse/dep5 +26 -31
  2. package/THIRDPARTY.txt +15 -21
  3. package/package.json +4 -4
  4. package/src/sap/ui/mdc/.library +2 -2
  5. package/src/sap/ui/mdc/ActionToolbar.js +3 -8
  6. package/src/sap/ui/mdc/AggregationBaseDelegate.js +2 -2
  7. package/src/sap/ui/mdc/BaseDelegate.js +2 -2
  8. package/src/sap/ui/mdc/Chart.js +1017 -1797
  9. package/src/sap/ui/mdc/ChartDelegate.js +430 -271
  10. package/src/sap/ui/mdc/ChartRenderer.js +74 -78
  11. package/src/sap/ui/mdc/Control.js +2 -2
  12. package/src/sap/ui/mdc/Delegate.js +1 -1
  13. package/src/sap/ui/mdc/Element.js +2 -2
  14. package/src/sap/ui/mdc/Field.js +4 -3
  15. package/src/sap/ui/mdc/FilterBar.js +4 -3
  16. package/src/sap/ui/mdc/FilterBarDelegate.js +1 -1
  17. package/src/sap/ui/mdc/FilterField.js +26 -9
  18. package/src/sap/ui/mdc/Link.js +5 -4
  19. package/src/sap/ui/mdc/LinkDelegate.js +2 -2
  20. package/src/sap/ui/mdc/MultiValueField.js +3 -2
  21. package/src/sap/ui/mdc/Table.js +174 -142
  22. package/src/sap/ui/mdc/TableDelegate.js +31 -16
  23. package/src/sap/ui/mdc/ValueHelp.js +52 -16
  24. package/src/sap/ui/mdc/ValueHelpDelegate.js +21 -1
  25. package/src/sap/ui/mdc/actiontoolbar/ActionToolbarAction.js +2 -2
  26. package/src/sap/ui/mdc/actiontoolbar/ActionToolbarActionRenderer.js +1 -1
  27. package/src/sap/ui/mdc/{chartNew/ChartSelectionDetailsNew.js → chart/ChartSelectionDetails.js} +9 -9
  28. package/src/sap/ui/mdc/chart/ChartSettings.js +1 -1
  29. package/src/sap/ui/mdc/{chartNew/ChartToolbarNew.js → chart/ChartToolbar.js} +11 -11
  30. package/src/sap/ui/mdc/chart/ChartTypeButton.js +49 -53
  31. package/src/sap/ui/mdc/{chartNew/DrillBreadcrumbsNew.js → chart/DrillBreadcrumbs.js} +4 -4
  32. package/src/sap/ui/mdc/chart/DrillStackHandler.js +39 -250
  33. package/src/sap/ui/mdc/chart/Item.js +63 -93
  34. package/src/sap/ui/mdc/{chartNew/PropertyHelperNew.js → chart/PropertyHelper.js} +4 -4
  35. package/src/sap/ui/mdc/chart/SelectionDetailsActions.js +18 -22
  36. package/src/sap/ui/mdc/condition/Condition.js +2 -2
  37. package/src/sap/ui/mdc/condition/ConditionConverter.js +2 -2
  38. package/src/sap/ui/mdc/condition/ConditionModel.js +2 -2
  39. package/src/sap/ui/mdc/condition/ConditionModelPropertyBinding.js +1 -1
  40. package/src/sap/ui/mdc/condition/FilterConverter.js +2 -2
  41. package/src/sap/ui/mdc/condition/FilterOperatorUtil.js +7 -3
  42. package/src/sap/ui/mdc/condition/Operator.js +10 -10
  43. package/src/sap/ui/mdc/condition/OperatorDynamicDateOption.js +437 -0
  44. package/src/sap/ui/mdc/condition/RangeOperator.js +2 -2
  45. package/src/sap/ui/mdc/designtime/actiontoolbar/ActionToolbar.designtime.js +1 -1
  46. package/src/sap/ui/mdc/designtime/chart/Chart.designtime.js +78 -6
  47. package/src/sap/ui/mdc/designtime/field/Field.designtime.js +97 -0
  48. package/src/sap/ui/mdc/designtime/field/FieldBase.designtime.js +104 -0
  49. package/src/sap/ui/mdc/designtime/field/FilterField.designtime.js +22 -0
  50. package/src/sap/ui/mdc/designtime/field/MultiValueField.designtime.js +23 -0
  51. package/src/sap/ui/mdc/designtime/filterbar/FilterBar.designtime.js +1 -1
  52. package/src/sap/ui/mdc/designtime/filterbar/FilterBarBase.designtime.js +4 -1
  53. package/src/sap/ui/mdc/designtime/library.designtime.js +1 -1
  54. package/src/sap/ui/mdc/designtime/link/Panel.designtime.js +1 -1
  55. package/src/sap/ui/mdc/designtime/link/PanelItem.designtime.js +1 -1
  56. package/src/sap/ui/mdc/designtime/p13n/PersistenceProvider.designtime.js +1 -1
  57. package/src/sap/ui/mdc/designtime/table/Table.designtime.js +1 -1
  58. package/src/sap/ui/mdc/enum/ActionToolbarActionAlignment.js +1 -1
  59. package/src/sap/ui/mdc/enum/BaseType.js +1 -1
  60. package/src/sap/ui/mdc/enum/ConditionValidated.js +1 -1
  61. package/src/sap/ui/mdc/enum/ContentMode.js +1 -1
  62. package/src/sap/ui/mdc/enum/EditMode.js +1 -1
  63. package/src/sap/ui/mdc/enum/FieldDisplay.js +1 -1
  64. package/src/sap/ui/mdc/enum/OutParameterMode.js +1 -1
  65. package/src/sap/ui/mdc/enum/PersistenceMode.js +1 -1
  66. package/src/sap/ui/mdc/enum/SelectType.js +1 -1
  67. package/src/sap/ui/mdc/field/BoolFieldHelp.js +2 -2
  68. package/src/sap/ui/mdc/field/ConditionFieldHelp.js +2 -2
  69. package/src/sap/ui/mdc/field/ConditionType.js +8 -8
  70. package/src/sap/ui/mdc/field/ConditionsType.js +8 -8
  71. package/src/sap/ui/mdc/field/CustomFieldHelp.js +2 -2
  72. package/src/sap/ui/mdc/field/CustomFieldInfo.js +2 -2
  73. package/src/sap/ui/mdc/field/DefineConditionPanel.js +59 -22
  74. package/src/sap/ui/mdc/field/DynamicDateRangeConditionsType.js +311 -0
  75. package/src/sap/ui/mdc/field/FieldBase.js +84 -53
  76. package/src/sap/ui/mdc/field/FieldBaseDelegate.js +1 -1
  77. package/src/sap/ui/mdc/field/FieldBaseRenderer.js +1 -4
  78. package/src/sap/ui/mdc/field/FieldHelpBase.js +2 -2
  79. package/src/sap/ui/mdc/field/FieldHelpBaseDelegate.js +1 -1
  80. package/src/sap/ui/mdc/field/FieldInfoBase.js +2 -2
  81. package/src/sap/ui/mdc/field/FieldInput.js +2 -2
  82. package/src/sap/ui/mdc/field/FieldInputRenderUtil.js +2 -2
  83. package/src/sap/ui/mdc/field/FieldInputRenderer.js +1 -1
  84. package/src/sap/ui/mdc/field/FieldMultiInput.js +2 -2
  85. package/src/sap/ui/mdc/field/FieldMultiInputRenderer.js +1 -1
  86. package/src/sap/ui/mdc/field/FieldValueHelp.js +8 -8
  87. package/src/sap/ui/mdc/field/FieldValueHelpContentWrapperBase.js +2 -2
  88. package/src/sap/ui/mdc/field/FieldValueHelpDelegate.js +21 -1
  89. package/src/sap/ui/mdc/field/FieldValueHelpMTableWrapper.js +2 -2
  90. package/src/sap/ui/mdc/field/FieldValueHelpMdcTableWrapper.js +2 -2
  91. package/src/sap/ui/mdc/field/FieldValueHelpTableWrapperBase.js +3 -2
  92. package/src/sap/ui/mdc/field/FieldValueHelpUITableWrapper.js +2 -2
  93. package/src/sap/ui/mdc/field/InParameter.js +2 -2
  94. package/src/sap/ui/mdc/field/ListFieldHelp.js +11 -3
  95. package/src/sap/ui/mdc/field/ListFieldHelpItem.js +2 -2
  96. package/src/sap/ui/mdc/field/MultiValueFieldDelegate.js +1 -1
  97. package/src/sap/ui/mdc/field/MultiValueFieldItem.js +2 -2
  98. package/src/sap/ui/mdc/field/OutParameter.js +2 -2
  99. package/src/sap/ui/mdc/field/ValueHelpPanel.js +3 -2
  100. package/src/sap/ui/mdc/field/content/BooleanContent.js +2 -2
  101. package/src/sap/ui/mdc/field/content/ContentFactory.js +24 -22
  102. package/src/sap/ui/mdc/field/content/DateContent.js +129 -3
  103. package/src/sap/ui/mdc/field/content/DateTimeContent.js +10 -2
  104. package/src/sap/ui/mdc/field/content/DefaultContent.js +2 -2
  105. package/src/sap/ui/mdc/field/content/LinkContent.js +1 -1
  106. package/src/sap/ui/mdc/field/content/SearchContent.js +1 -1
  107. package/src/sap/ui/mdc/field/content/TimeContent.js +9 -2
  108. package/src/sap/ui/mdc/field/content/UnitContent.js +24 -5
  109. package/src/sap/ui/mdc/filterbar/FilterBarBase.js +326 -141
  110. package/src/sap/ui/mdc/filterbar/FilterBarBaseRenderer.js +1 -1
  111. package/src/sap/ui/mdc/filterbar/IFilterContainer.js +1 -1
  112. package/src/sap/ui/mdc/filterbar/PropertyHelper.js +2 -2
  113. package/src/sap/ui/mdc/filterbar/aligned/FilterContainer.js +1 -1
  114. package/src/sap/ui/mdc/filterbar/aligned/FilterItemLayout.js +1 -1
  115. package/src/sap/ui/mdc/filterbar/p13n/AdaptationFilterBar.js +9 -3
  116. package/src/sap/ui/mdc/filterbar/p13n/FilterColumnLayout.js +1 -1
  117. package/src/sap/ui/mdc/filterbar/p13n/FilterGroupLayout.js +1 -1
  118. package/src/sap/ui/mdc/filterbar/p13n/GroupContainer.js +1 -1
  119. package/src/sap/ui/mdc/filterbar/p13n/TableContainer.js +1 -1
  120. package/src/sap/ui/mdc/filterbar/vh/CollectiveSearchSelect.js +4 -2
  121. package/src/sap/ui/mdc/filterbar/vh/FilterBar.js +8 -2
  122. package/src/sap/ui/mdc/filterbar/vh/FilterContainer.js +1 -1
  123. package/src/sap/ui/mdc/filterbar/vh/GenericFilterBarDelegate.js +7 -7
  124. package/src/sap/ui/mdc/flexibility/ActionToolbar.flexibility.js +1 -1
  125. package/src/sap/ui/mdc/flexibility/ActionToolbarAction.flexibility.js +1 -1
  126. package/src/sap/ui/mdc/flexibility/AggregateFlex.js +3 -3
  127. package/src/sap/ui/mdc/flexibility/AggregationConfigFlex.js +1 -1
  128. package/src/sap/ui/mdc/flexibility/Chart.flexibility.js +2 -2
  129. package/src/sap/ui/mdc/flexibility/ChartItemFlex.js +1 -1
  130. package/src/sap/ui/mdc/flexibility/ColumnFlex.js +2 -2
  131. package/src/sap/ui/mdc/flexibility/ConditionFlex.js +1 -1
  132. package/src/sap/ui/mdc/flexibility/FilterBar.flexibility.js +5 -4
  133. package/src/sap/ui/mdc/flexibility/FilterItemFlex.js +2 -2
  134. package/src/sap/ui/mdc/flexibility/GroupFlex.js +2 -2
  135. package/src/sap/ui/mdc/flexibility/ItemBaseFlex.js +1 -1
  136. package/src/sap/ui/mdc/flexibility/Panel.flexibility.js +10 -4
  137. package/src/sap/ui/mdc/flexibility/PanelItem.flexibility.js +1 -1
  138. package/src/sap/ui/mdc/flexibility/PropertyInfoFlex.js +110 -0
  139. package/src/sap/ui/mdc/flexibility/SortFlex.js +3 -3
  140. package/src/sap/ui/mdc/flexibility/Table.flexibility.js +1 -1
  141. package/src/sap/ui/mdc/flp/FlpLinkDelegate.js +2 -2
  142. package/src/sap/ui/mdc/library.js +50 -39
  143. package/src/sap/ui/mdc/link/ContactDetails.js +2 -2
  144. package/src/sap/ui/mdc/link/ContactDetailsAddressItem.js +2 -2
  145. package/src/sap/ui/mdc/link/ContactDetailsEmailItem.js +2 -2
  146. package/src/sap/ui/mdc/link/ContactDetailsItem.js +2 -2
  147. package/src/sap/ui/mdc/link/ContactDetailsPhoneItem.js +2 -2
  148. package/src/sap/ui/mdc/link/Factory.js +3 -3
  149. package/src/sap/ui/mdc/link/FakeFlpConnector.js +2 -2
  150. package/src/sap/ui/mdc/link/LinkItem.js +2 -2
  151. package/src/sap/ui/mdc/link/Log.js +1 -1
  152. package/src/sap/ui/mdc/link/Panel.js +141 -179
  153. package/src/sap/ui/mdc/link/PanelItem.js +2 -2
  154. package/src/sap/ui/mdc/link/PanelListItem.js +2 -2
  155. package/src/sap/ui/mdc/link/SemanticObjectMapping.js +2 -2
  156. package/src/sap/ui/mdc/link/SemanticObjectMappingItem.js +2 -2
  157. package/src/sap/ui/mdc/link/SemanticObjectUnavailableAction.js +2 -2
  158. package/src/sap/ui/mdc/messagebundle.properties +19 -4
  159. package/src/sap/ui/mdc/messagebundle_ar.properties +13 -4
  160. package/src/sap/ui/mdc/messagebundle_bg.properties +11 -2
  161. package/src/sap/ui/mdc/messagebundle_ca.properties +11 -2
  162. package/src/sap/ui/mdc/messagebundle_cs.properties +26 -17
  163. package/src/sap/ui/mdc/messagebundle_cy.properties +11 -2
  164. package/src/sap/ui/mdc/messagebundle_da.properties +18 -9
  165. package/src/sap/ui/mdc/messagebundle_de.properties +11 -2
  166. package/src/sap/ui/mdc/messagebundle_el.properties +12 -3
  167. package/src/sap/ui/mdc/messagebundle_en.properties +11 -2
  168. package/src/sap/ui/mdc/messagebundle_en_GB.properties +11 -2
  169. package/src/sap/ui/mdc/messagebundle_en_US_sappsd.properties +17 -0
  170. package/src/sap/ui/mdc/messagebundle_en_US_saprigi.properties +3 -19
  171. package/src/sap/ui/mdc/messagebundle_en_US_saptrc.properties +17 -0
  172. package/src/sap/ui/mdc/messagebundle_es.properties +12 -3
  173. package/src/sap/ui/mdc/messagebundle_es_MX.properties +24 -15
  174. package/src/sap/ui/mdc/messagebundle_et.properties +11 -2
  175. package/src/sap/ui/mdc/messagebundle_fi.properties +17 -8
  176. package/src/sap/ui/mdc/messagebundle_fr.properties +15 -6
  177. package/src/sap/ui/mdc/messagebundle_fr_CA.properties +11 -2
  178. package/src/sap/ui/mdc/messagebundle_hi.properties +12 -3
  179. package/src/sap/ui/mdc/messagebundle_hr.properties +11 -2
  180. package/src/sap/ui/mdc/messagebundle_hu.properties +11 -2
  181. package/src/sap/ui/mdc/messagebundle_id.properties +11 -2
  182. package/src/sap/ui/mdc/messagebundle_it.properties +26 -17
  183. package/src/sap/ui/mdc/messagebundle_iw.properties +12 -3
  184. package/src/sap/ui/mdc/messagebundle_ja.properties +11 -2
  185. package/src/sap/ui/mdc/messagebundle_kk.properties +11 -2
  186. package/src/sap/ui/mdc/messagebundle_ko.properties +15 -6
  187. package/src/sap/ui/mdc/messagebundle_lt.properties +11 -2
  188. package/src/sap/ui/mdc/messagebundle_lv.properties +11 -2
  189. package/src/sap/ui/mdc/messagebundle_ms.properties +11 -2
  190. package/src/sap/ui/mdc/messagebundle_nl.properties +16 -7
  191. package/src/sap/ui/mdc/messagebundle_no.properties +19 -10
  192. package/src/sap/ui/mdc/messagebundle_pl.properties +12 -3
  193. package/src/sap/ui/mdc/messagebundle_pt.properties +18 -9
  194. package/src/sap/ui/mdc/messagebundle_pt_PT.properties +11 -2
  195. package/src/sap/ui/mdc/messagebundle_ro.properties +11 -2
  196. package/src/sap/ui/mdc/messagebundle_ru.properties +11 -2
  197. package/src/sap/ui/mdc/messagebundle_sh.properties +11 -2
  198. package/src/sap/ui/mdc/messagebundle_sk.properties +11 -2
  199. package/src/sap/ui/mdc/messagebundle_sl.properties +11 -2
  200. package/src/sap/ui/mdc/messagebundle_sv.properties +13 -4
  201. package/src/sap/ui/mdc/messagebundle_th.properties +11 -2
  202. package/src/sap/ui/mdc/messagebundle_tr.properties +11 -2
  203. package/src/sap/ui/mdc/messagebundle_uk.properties +12 -3
  204. package/src/sap/ui/mdc/messagebundle_vi.properties +11 -2
  205. package/src/sap/ui/mdc/messagebundle_zh_CN.properties +11 -2
  206. package/src/sap/ui/mdc/messagebundle_zh_TW.properties +11 -2
  207. package/src/sap/ui/mdc/mixin/AdaptationMixin.js +3 -4
  208. package/src/sap/ui/mdc/mixin/DelegateMixin.js +3 -3
  209. package/src/sap/ui/mdc/mixin/FilterIntegrationMixin.js +17 -12
  210. package/src/sap/ui/mdc/mixin/PromiseMixin.js +3 -4
  211. package/src/sap/ui/mdc/odata/TypeUtil.js +2 -2
  212. package/src/sap/ui/mdc/odata/json/FilterBarDelegate.js +1 -1
  213. package/src/sap/ui/mdc/odata/v4/ChartDelegate.js +30 -484
  214. package/src/sap/ui/mdc/odata/v4/{ChartPropertyHelperNew.js → ChartPropertyHelper.js} +6 -6
  215. package/src/sap/ui/mdc/odata/v4/FieldBaseDelegate.js +1 -1
  216. package/src/sap/ui/mdc/odata/v4/FieldValueHelpDelegate.js +1 -1
  217. package/src/sap/ui/mdc/odata/v4/FilterBarDelegate.js +1 -1
  218. package/src/sap/ui/mdc/odata/v4/ODataMetaModelUtil.js +1 -1
  219. package/src/sap/ui/mdc/odata/v4/TableDelegate.js +158 -114
  220. package/src/sap/ui/mdc/odata/v4/TypeUtil.js +2 -2
  221. package/src/sap/ui/mdc/odata/v4/ValueHelpDelegate.js +2 -2
  222. package/src/sap/ui/mdc/odata/v4/util/DelegateUtil.js +2 -2
  223. package/src/sap/ui/mdc/odata/v4/vizChart/{ChartDelegateNew.js → ChartDelegate.js} +137 -49
  224. package/src/sap/ui/mdc/p13n/AdaptationProvider.js +1 -1
  225. package/src/sap/ui/mdc/p13n/Engine.js +56 -19
  226. package/src/sap/ui/mdc/p13n/FlexUtil.js +12 -119
  227. package/src/sap/ui/mdc/p13n/P13nBuilder.js +3 -3
  228. package/src/sap/ui/mdc/p13n/PersistenceProvider.js +22 -11
  229. package/src/sap/ui/mdc/p13n/PropertyHelper.js +2 -2
  230. package/src/sap/ui/mdc/p13n/StateUtil.js +41 -7
  231. package/src/sap/ui/mdc/p13n/UIManager.js +16 -13
  232. package/src/sap/ui/mdc/p13n/modification/FlexModificationHandler.js +5 -2
  233. package/src/sap/ui/mdc/p13n/modification/ModificationHandler.js +10 -7
  234. package/src/sap/ui/mdc/p13n/{DefaultProviderRegistry.js → modules/DefaultProviderRegistry.js} +3 -3
  235. package/src/sap/ui/mdc/p13n/modules/StateHandlerRegistry.js +86 -0
  236. package/src/sap/ui/mdc/p13n/panels/ActionToolbarPanel.js +1 -1
  237. package/src/sap/ui/mdc/p13n/panels/AdaptFiltersPanel.js +20 -4
  238. package/src/sap/ui/mdc/p13n/panels/BasePanel.js +1 -1
  239. package/src/sap/ui/mdc/p13n/panels/ChartItemPanel.js +1093 -49
  240. package/src/sap/ui/mdc/p13n/panels/GroupView.js +1 -1
  241. package/src/sap/ui/mdc/p13n/panels/LinkSelectionPanel.js +72 -0
  242. package/src/sap/ui/mdc/p13n/panels/ListView.js +7 -3
  243. package/src/sap/ui/mdc/p13n/panels/SelectionPanel.js +1 -1
  244. package/src/sap/ui/mdc/p13n/panels/SortPanel.js +1 -1
  245. package/src/sap/ui/mdc/p13n/subcontroller/ActionToolbarController.js +1 -1
  246. package/src/sap/ui/mdc/p13n/subcontroller/AdaptFiltersController.js +7 -6
  247. package/src/sap/ui/mdc/p13n/subcontroller/AggregateController.js +2 -2
  248. package/src/sap/ui/mdc/p13n/subcontroller/BaseController.js +157 -12
  249. package/src/sap/ui/mdc/p13n/subcontroller/ChartItemController.js +16 -27
  250. package/src/sap/ui/mdc/p13n/subcontroller/ColumnController.js +7 -6
  251. package/src/sap/ui/mdc/p13n/subcontroller/ColumnWidthController.js +1 -1
  252. package/src/sap/ui/mdc/p13n/subcontroller/FilterController.js +7 -6
  253. package/src/sap/ui/mdc/p13n/subcontroller/GroupController.js +1 -1
  254. package/src/sap/ui/mdc/p13n/subcontroller/LinkPanelController.js +173 -0
  255. package/src/sap/ui/mdc/p13n/subcontroller/SortController.js +11 -18
  256. package/src/sap/ui/mdc/table/Column.js +36 -11
  257. package/src/sap/ui/mdc/table/CreationRow.js +15 -14
  258. package/src/sap/ui/mdc/table/GridTableType.js +14 -14
  259. package/src/sap/ui/mdc/table/PropertyHelper.js +65 -28
  260. package/src/sap/ui/mdc/table/ResponsiveTableType.js +27 -30
  261. package/src/sap/ui/mdc/table/RowSettings.js +8 -6
  262. package/src/sap/ui/mdc/table/TableSettings.js +1 -1
  263. package/src/sap/ui/mdc/table/TableTypeBase.js +7 -7
  264. package/src/sap/ui/mdc/table/V4AnalyticsPropertyHelper.js +16 -72
  265. package/src/sap/ui/mdc/themes/base/Chart.less +3 -0
  266. package/src/sap/ui/mdc/themes/base/FieldBase.less +0 -5
  267. package/src/sap/ui/mdc/themes/base/ValueHelpDialog.less +12 -1
  268. package/src/sap/ui/mdc/themes/base/library.source.less +2 -1
  269. package/src/sap/ui/mdc/ui/Container.js +3 -3
  270. package/src/sap/ui/mdc/ui/ContainerItem.js +3 -3
  271. package/src/sap/ui/mdc/util/Common.js +2 -2
  272. package/src/sap/ui/mdc/util/DateUtil.js +2 -2
  273. package/src/sap/ui/mdc/util/FilterUtil.js +2 -2
  274. package/src/sap/ui/mdc/util/FormatUtil.js +2 -2
  275. package/src/sap/ui/mdc/util/IdentifierUtil.js +2 -2
  276. package/src/sap/ui/mdc/util/PromiseCache.js +2 -2
  277. package/src/sap/ui/mdc/util/PropertyHelper.js +149 -326
  278. package/src/sap/ui/mdc/util/TypeUtil.js +6 -5
  279. package/src/sap/ui/mdc/util/loadModules.js +1 -1
  280. package/src/sap/ui/mdc/valuehelp/Dialog.js +13 -9
  281. package/src/sap/ui/mdc/valuehelp/Popover.js +15 -3
  282. package/src/sap/ui/mdc/valuehelp/base/Container.js +34 -2
  283. package/src/sap/ui/mdc/valuehelp/base/Content.js +37 -6
  284. package/src/sap/ui/mdc/valuehelp/base/DialogTab.js +3 -2
  285. package/src/sap/ui/mdc/valuehelp/base/FilterableListContent.js +44 -16
  286. package/src/sap/ui/mdc/valuehelp/base/ListContent.js +3 -2
  287. package/src/sap/ui/mdc/valuehelp/content/Bool.js +3 -2
  288. package/src/sap/ui/mdc/valuehelp/content/Conditions.js +29 -33
  289. package/src/sap/ui/mdc/valuehelp/content/FixedList.js +12 -6
  290. package/src/sap/ui/mdc/valuehelp/content/MDCTable.js +44 -9
  291. package/src/sap/ui/mdc/valuehelp/content/MTable.js +58 -27
  292. package/test/sap/ui/mdc/testutils/opa/TestLibrary.js +2 -1
  293. package/test/sap/ui/mdc/testutils/opa/actions/OpenContextMenu.js +3 -3
  294. package/test/sap/ui/mdc/testutils/opa/{chartNew → chart}/ActionsBase.js +3 -3
  295. package/test/sap/ui/mdc/testutils/opa/{chartNew → chart}/ActionsViz.js +0 -0
  296. package/test/sap/ui/mdc/testutils/opa/{chartNew → chart}/AssertionsBase.js +1 -1
  297. package/test/sap/ui/mdc/testutils/opa/{chartNew → chart}/AssertionsViz.js +0 -0
  298. package/test/sap/ui/mdc/testutils/opa/{chartNew → chart}/ChartNew.js +0 -0
  299. package/test/sap/ui/mdc/testutils/opa/chart/TestObjects.js +289 -0
  300. package/test/sap/ui/mdc/testutils/opa/chartNew/TestObjects.js +5 -5
  301. package/test/sap/ui/mdc/testutils/opa/filterbar/Util.js +12 -11
  302. package/test/sap/ui/mdc/testutils/opa/link/Actions.js +85 -0
  303. package/test/sap/ui/mdc/testutils/opa/link/Assertions.js +79 -0
  304. package/test/sap/ui/mdc/testutils/opa/link/TestObjects.js +112 -0
  305. package/test/sap/ui/mdc/testutils/opa/link/waitForLink.js +50 -0
  306. package/test/sap/ui/mdc/testutils/opa/p13n/Actions.js +365 -236
  307. package/test/sap/ui/mdc/testutils/opa/p13n/Util.js +27 -26
  308. package/src/sap/ui/mdc/ChartDelegateNew.js +0 -395
  309. package/src/sap/ui/mdc/ChartNew.js +0 -1114
  310. package/src/sap/ui/mdc/ChartNewRenderer.js +0 -91
  311. package/src/sap/ui/mdc/chart/DimensionItem.js +0 -281
  312. package/src/sap/ui/mdc/chart/MeasureItem.js +0 -318
  313. package/src/sap/ui/mdc/chart/MetadataDelegate.js +0 -31
  314. package/src/sap/ui/mdc/chart/SelectionHandler.js +0 -127
  315. package/src/sap/ui/mdc/chart/ToolbarHandler.js +0 -328
  316. package/src/sap/ui/mdc/chartNew/ChartTypeButtonNew.js +0 -295
  317. package/src/sap/ui/mdc/chartNew/DrillStackHandlerNew.js +0 -212
  318. package/src/sap/ui/mdc/chartNew/ItemNew.js +0 -72
  319. package/src/sap/ui/mdc/chartNew/SelectionDetailsActionsNew.js +0 -34
  320. package/src/sap/ui/mdc/designtime/chart/ChartNew.designtime.js +0 -91
  321. package/src/sap/ui/mdc/link/SelectionDialog.control.xml +0 -66
  322. package/src/sap/ui/mdc/link/SelectionDialog.js +0 -213
  323. package/src/sap/ui/mdc/link/SelectionDialogItem.js +0 -86
  324. package/src/sap/ui/mdc/odata/v4/ChartDelegateNew.js +0 -35
  325. package/src/sap/ui/mdc/p13n/panels/ChartItemPanelNew.js +0 -1171
  326. package/src/sap/ui/mdc/p13n/panels/GroupPanel.js +0 -111
  327. package/src/sap/ui/mdc/p13n/panels/QueryPanel.js +0 -322
  328. package/src/sap/ui/mdc/p13n/panels/SortQueryPanel.js +0 -133
  329. package/src/sap/ui/mdc/p13n/panels/Wrapper.js +0 -203
@@ -1,97 +1,81 @@
1
1
  /*!
2
2
  * OpenUI5
3
- * (c) Copyright 2009-2021 SAP SE or an SAP affiliate company.
3
+ * (c) Copyright 2009-2022 SAP SE or an SAP affiliate company.
4
4
  * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
5
  */
6
6
 
7
7
  sap.ui.define([
8
- "sap/ui/core/Core",
9
- "sap/ui/mdc/Control",
10
- "./chart/ChartSettings",
11
- "sap/ui/base/SyncPromise",
12
- "sap/ui/mdc/util/loadModules",
13
- "./ChartRenderer",
14
- "sap/ui/base/ManagedObjectObserver",
15
- "sap/ui/model/json/JSONModel",
16
- "sap/ui/mdc/library",
17
- "sap/ui/model/base/ManagedObjectModel",
18
- "sap/ui/model/Sorter",
19
- "sap/base/Log",
20
- "sap/base/util/deepEqual",
21
- "sap/ui/Device",
22
- "sap/ui/mdc/chart/ToolbarHandler",
23
- "sap/ui/mdc/mixin/FilterIntegrationMixin",
24
- "sap/m/VBox",
25
- "sap/m/Text",
26
- "sap/ui/mdc/p13n/subcontroller/ChartItemController",
27
- "sap/ui/mdc/p13n/subcontroller/SortController",
28
- "sap/ui/events/KeyCodes",
29
- "sap/ui/mdc/actiontoolbar/ActionToolbarAction",
30
- 'sap/ui/mdc/p13n/panels/ChartItemPanelNew'
31
- ],
32
- function (
33
- Core,
34
- Control,
35
- ChartSettings,
36
- SyncPromise,
37
- loadModules,
38
- ChartRenderer,
39
- ManagedObjectObserver,
40
- JSONModel,
41
- MDCLib,
42
- ManagedObjectModel,
43
- Sorter,
44
- Log,
45
- deepEqual,
46
- Device,
47
- ToolbarHandler,
48
- FilterIntegrationMixin,
49
- VBox,
50
- Text,
51
- ChartItemController,
52
- SortController,
53
- KeyCodes,
54
- ActionToolbarAction,
55
- ChartItemPanel
56
- ) {
57
- "use strict";
58
-
59
- var ChartClass,
60
- SelectionHandler,
61
- DrillStackHandler,
62
- ChartTypeButton,
63
- MeasureItemClass,
64
- VizTooltip;
65
-
66
- /**
67
- * Constructor for a new Chart.
68
- *
69
- * @param {string} [sId] id for the new control, generated automatically if no id is given
70
- * @param {object} [mSettings] initial settings for the new control
71
- * @class The Chart control creates a chart based on metadata and the configuration specified.
72
- * @extends sap.ui.mdc.Control
73
- * @author SAP SE
74
- * @version 1.96.2
75
- * @constructor
76
- * @experimental As of version 1.61
77
- * @private
78
- * @ui5-restricted sap.fe
79
- * @MDC_PUBLIC_CANDIDATE
80
- * @since 1.61
81
- * @alias sap.ui.mdc.Chart
82
- * @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
83
- */
84
- var Chart = Control.extend("sap.ui.mdc.Chart", /** @lends sap.ui.mdc.Chart.prototype */ {
85
- metadata: {
86
- library: "sap.ui.mdc",
87
- designtime: "sap/ui/mdc/designtime/chart/Chart.designtime",
88
- interfaces: [
89
- "sap.ui.mdc.IxState"
90
- ],
91
- defaultAggregation: "items",
92
- properties: {
93
-
94
- /**
8
+ "sap/ui/core/Core",
9
+ "sap/ui/mdc/Control",
10
+ "./chart/ChartSettings",
11
+ "sap/ui/mdc/util/loadModules",
12
+ "./ChartRenderer",
13
+ "sap/ui/mdc/library",
14
+ "sap/m/Text",
15
+ "sap/m/VBox",
16
+ "sap/base/Log",
17
+ "./chart/ChartToolbar",
18
+ "./chart/PropertyHelper",
19
+ "sap/ui/mdc/mixin/FilterIntegrationMixin",
20
+ "sap/ui/model/base/ManagedObjectModel",
21
+ "sap/ui/mdc/p13n/subcontroller/ChartItemController",
22
+ "sap/ui/mdc/p13n/subcontroller/SortController",
23
+ "sap/ui/base/ManagedObjectObserver",
24
+ "sap/ui/mdc/chart/DrillBreadcrumbs",
25
+ "sap/ui/mdc/actiontoolbar/ActionToolbarAction"
26
+ ],
27
+ function (
28
+ Core,
29
+ Control,
30
+ ChartSettings,
31
+ loadModules,
32
+ ChartRenderer,
33
+ MDCLib,
34
+ Text,
35
+ VBox,
36
+ Log,
37
+ ChartToolbar,
38
+ PropertyHelper,
39
+ FilterIntegrationMixin,
40
+ ManagedObjectModel,
41
+ ChartItemController,
42
+ SortController,
43
+ ManagedObjectObserver,
44
+ Breadcrumbs,
45
+ ActionToolbarAction
46
+ ) {
47
+ "use strict";
48
+
49
+ var DrillStackHandler;
50
+
51
+ /**
52
+ * Constructor for a new Chart.
53
+ *
54
+ * @param {string} [sId] id for the new control, generated automatically if no id is given
55
+ * @param {object} [mSettings] initial settings for the new control
56
+ * @class The Chart control creates a chart based on metadata and the configuration specified.
57
+ * @extends sap.ui.mdc.Control
58
+ * @author SAP SE
59
+ * @version 1.98.0
60
+ * @constructor
61
+ * @experimental As of version ...
62
+ * @private
63
+ * @ui5-restricted sap.fe
64
+ * @MDC_PUBLIC_CANDIDATE
65
+ * @since 1.88
66
+ * @alias sap.ui.mdc.Chart
67
+ * @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
68
+ */
69
+ var Chart = Control.extend("sap.ui.mdc.Chart", /** @lends sap.ui.mdc.Chart.prototype */ {
70
+ metadata: {
71
+ library: "sap.ui.mdc",
72
+ designtime: "sap/ui/mdc/designtime/chart/Chart.designtime",
73
+ interfaces: [
74
+ "sap.ui.mdc.IxState"
75
+ ],
76
+ defaultAggregation: "items",
77
+ properties: {
78
+ /**
95
79
  * Defines the width of the chart.
96
80
  */
97
81
  width: {
@@ -109,1787 +93,1023 @@ sap.ui.define([
109
93
  defaultValue: "100%",
110
94
  invalidate: true
111
95
  },
96
+ /**
97
+ * Defines the module path of the metadata delegate.
98
+ */
99
+ delegate: {
100
+ type: "object",
101
+ group: "Data",
102
+ defaultValue: {
103
+ name: "sap/ui/mdc/ChartDelegate"
104
+ }
105
+ },
106
+ /**
107
+ * Specifies header text that is shown in chart
108
+ */
109
+ header: {
110
+ type: "string",
111
+ group: "Misc",
112
+ defaultValue: null
113
+ },
114
+ /**
115
+ * Defines the no data text shown in the chart.
116
+ * @since 1.88
117
+ */
118
+ noDataText: {
119
+ type: "string",
120
+ defaultValue: "No data"
121
+ },
122
+ /**
123
+ * Specifies the personalization options available for the chart.<br>
124
+ * <b>Note:</b> The order of the provided options does not influence the arrangement of the icons on the UI.
125
+ *
126
+ * @since 1.88
127
+ */
128
+ p13nMode: {
129
+ type: "sap.ui.mdc.ChartP13nMode[]"
130
+ },
131
+
132
+ /**
133
+ * Set chart's legend properties.
134
+ *
135
+ * @since 1.88
136
+ */
137
+ legendVisible: {
138
+ type: "boolean",
139
+ group: "Misc",
140
+ defaultValue: true
141
+ },
142
+ /**
143
+ * Specifies which actions should not be available in the chart's toolbar.
144
+ *
145
+ * @since 1.88
146
+ */
147
+ ignoreToolbarActions: {
148
+ type: "sap.ui.mdc.ChartToolbarActionType[]",
149
+ defaultValue: []
150
+ },
151
+ //TODO: Do we really need this? Should be avoided.
152
+ /**
153
+ * The minimal width
154
+ */
155
+ minWidth: {
156
+ type: "sap.ui.core.CSSSize",
157
+ group: "Dimension",
158
+ defaultValue: "240px",
159
+ invalidate: true
160
+ },
161
+ //TODO: Do we really need this? Should be avoided.
162
+ /**
163
+ * The minimal height
164
+ */
165
+ minHeight: {
166
+ type: "sap.ui.core.CSSSize",
167
+ group: "Dimension",
168
+ defaultValue: "400px",
169
+ invalidate: true
170
+ },
171
+ /**
172
+ * Defines the sort conditions.
173
+ *
174
+ * <b>Note:</b> This property is exclusively used for handling flexibility changes. Do not use it for anything else.
175
+ *
176
+ * @since 1.88
177
+ */
178
+ sortConditions: {
179
+ type: "object"
180
+ },
181
+ /**
182
+ * Controls the visibility of the chart tooltip. If set to <code>true </code>, an instance of sap.viz.ui5.controls.VizTooltip will
183
+ * be created and shown when hovering over a data point.
184
+ *
185
+ * @since 1.88
186
+ */
187
+ showChartTooltip: {
188
+ type: "boolean",
189
+ group: "Misc",
190
+ defaultValue: true
191
+ },
192
+ /**
193
+ * Binds the chart automatically after the initial creation of the chart
194
+ */
195
+ autoBindOnInit: {
196
+ type: "boolean",
197
+ group: "Misc",
198
+ defaultValue: true
199
+ },
200
+
201
+ /**
202
+ * Specifies the type of chart to be created by the SmartChart control.
203
+ */
204
+ chartType: {
205
+ type: "string",
206
+ group: "Misc",
207
+ defaultValue: "column"
208
+ },
209
+ showSelectionDetails: {
210
+ type: "boolean",
211
+ group: "Misc",
212
+ defaultValue: true
213
+ }
214
+ },
215
+ aggregations: {
216
+ items: {
217
+ type: "sap.ui.mdc.chart.Item",
218
+ multiple: true
219
+ },
220
+ actions: {
221
+ type: "sap.ui.core.Control",
222
+ multiple: true,
223
+ forwarding: {
224
+ getter: "_getToolbar",
225
+ aggregation: "actions"
226
+ }
227
+ },
228
+ _toolbar: {
229
+ type: "sap.ui.mdc.chart.ChartToolbar",
230
+ multiple: false,
231
+ visibility: "hidden"
232
+ },
233
+ _breadcrumbs: {
234
+ type: "sap.m.Breadcrumbs",
235
+ multiple: false,
236
+ visibility: "hidden"
237
+ },
238
+ _innerChart: {
239
+ type: "sap.ui.core.Control",
240
+ multiple: false,
241
+ visibility: "hidden"
242
+ },
243
+ selectionDetailsActions: {
244
+ type: "sap.ui.mdc.chart.SelectionDetailsActions",
245
+ multiple: false
246
+ }
247
+ },
248
+ associations: {
249
+ /**
250
+ * Control or object which enables the chart to do filtering, such as {@link sap.ui.mdc.FilterBar}.
251
+ * Also see {@link sap.ui.mdc.IFilter}.
252
+ *
253
+ * @since 1.88
254
+ */
255
+ filter: {
256
+ type: "sap.ui.mdc.IFilter",
257
+ multiple: false
258
+ }
259
+ },
260
+ events: {
261
+ /**
262
+ * This event is fired when a SelectionDetailsAction is pressed.
263
+ */
264
+ selectionDetailsActionPressed: {
265
+ parameters: {
112
266
 
113
- /**
114
- * Defines the module path of the metadata delegate.
115
- */
116
- delegate: {
117
- type: "object",
118
- group: "Data",
119
- defaultValue: {
120
- name: "sap/ui/mdc/ChartDelegate"
121
- }
122
- },
123
-
124
- /**
125
- * Specifies header text that is shown in chart
126
- */
127
- header: {
128
- type: "string",
129
- group: "Misc",
130
- defaultValue: null
131
- },
132
-
133
- /**
134
- * Defines the no data text shown in the chart.
135
- * @since 1.78
136
- */
137
- noDataText: {
138
- type: "string"
139
- },
140
-
141
- /**
142
- * Specifies the type of chart to be created by the SmartChart control.
143
- */
144
- chartType: {
145
- type: "string",
146
- group: "Misc",
147
- defaultValue: "column"
148
- },
149
-
150
- /**
151
- * the selection mode of the chart
152
- */
153
- selectionMode: {
154
- type: "string",
155
- group: "Misc",
156
- defaultValue: "MULTIPLE"
157
- },
158
-
159
- /**
160
- * Specifies the personalization options available for the chart.<br>
161
- * <b>Note:</b> The order of the provided options does not influence the arrangement of the icons on the UI.
162
- *
163
- * @since 1.75
164
- */
165
- p13nMode: {
166
- type: "sap.ui.mdc.ChartP13nMode[]"
167
- },
168
-
169
- /**
170
- * Set chart's legend properties.
171
- *
172
- * @since 1.62
173
- */
174
- legendVisible: {
175
- type: "boolean",
176
- group: "Misc",
177
- defaultValue: true
178
- },
179
-
180
- /**
181
- * The vizProperties
182
- *
183
- * @since 1.62
184
- */
185
- vizProperties: {
186
- type: "object",
187
- group: "Misc"
188
- },
189
-
190
- /**
191
- * The coloring
192
- *
193
- * @since 1.64
194
- */
195
- _colorings: {
196
- type: "object",
197
- visibility: "hidden",
198
- byValue: true
199
- },
200
-
201
- /**
202
- * Specifies which actions should not be available in the chart's toolbar.
203
- *
204
- * @since 1.64
205
- */
206
- ignoreToolbarActions: {
207
- type: "sap.ui.mdc.ChartToolbarActionType[]",
208
- defaultValue: []
209
- },
267
+ /**
268
+ * The action that has to be processed once the action has been pressed
269
+ */
270
+ action: {
271
+ type: "sap.ui.core.Item"
272
+ },
210
273
 
211
- /**
212
- * The minimal width
213
- */
214
- minWidth: {
215
- type: "sap.ui.core.CSSSize",
216
- group: "Dimension",
217
- defaultValue: "240px",
218
- invalidate: true
219
- },
274
+ /**
275
+ * If the action is pressed on one of the {@link sap.m.SelectionDetailsItem items}, the parameter contains the
276
+ * {@link sap.ui.model.Context context} of the pressed {@link sap.m.SelectionDetailsItem item}. If a custom action or action
277
+ * group of the SelectionDetails popover is pressed, this parameter contains all {@link sap.ui.model.Context contexts} of the
278
+ * {@link sap.m.SelectionDetailsItem items}.
279
+ */
280
+ itemContexts: {
281
+ type: "sap.ui.model.Context"
282
+ },
220
283
 
221
- /**
222
- * The minimal height
223
- */
224
- minHeight: {
225
- type: "sap.ui.core.CSSSize",
226
- group: "Dimension",
227
- defaultValue: "400px",
228
- invalidate: true
229
- },
230
- /**
231
- * Defines the sort conditions.
232
- *
233
- * <b>Note:</b> This property is exclusively used for handling flexibility changes. Do not use it for anything else.
234
- *
235
- * @since 1.74
236
- */
237
- sortConditions: {
238
- type: "object"
239
- },
240
- /**
241
- * Controls the visibility of the chart tooltip. If set to <code>true </code>, an instance of sap.viz.ui5.controls.VizTooltip will
242
- * be created and shown when hovering over a data point.
243
- *
244
- * @since 1.86
245
- */
246
- showChartTooltip: {
247
- type: "boolean",
248
- group: "Misc",
249
- defaultValue: true
250
- },
251
- /*
252
- * Binds the chart automatically after the initial creation of the chart
253
- */
254
- autoBindOnInit: {
255
- type: "boolean",
256
- group: "Misc",
257
- defaultValue: true
258
- }
259
- },
260
- aggregations: {
261
- data: {
262
- multiple: true
263
- },
264
- items: {
265
- type: "sap.ui.mdc.chart.Item",
266
- multiple: true
267
- },
268
- actions: {
269
- type: "sap.ui.core.Control",
270
- multiple: true,
271
- forwarding: {
272
- getter: "_getToolbar",
273
- aggregation: "actions"
274
- }
275
- },
276
- _chart: {
277
- type: "sap.chart.Chart",
278
- multiple: false,
279
- visibility: "hidden"
280
- },
281
- _toolbar: {
282
- type: "sap.ui.mdc.ActionToolbar",
283
- multiple: false,
284
- visibility: "hidden"
285
- },
286
- _breadcrumbs: {
287
- type: "sap.m.Breadcrumbs",
288
- multiple: false,
289
- visibility: "hidden"
290
- },
291
- _noDataStruct: {
292
- type: "sap.m.VBox",
293
- multiple: false,
294
- visibility: "hidden"
295
- },
296
- selectionDetailsActions: {
297
- type: "sap.ui.mdc.chart.SelectionDetailsActions",
298
- multiple: false
299
- }
300
- },
301
- associations: {
302
- /**
303
- * Control or object which enables the chart to do filtering, such as {@link sap.ui.mdc.FilterBar}.
304
- * Also see {@link sap.ui.mdc.IFilter}.
305
- *
306
- * @since 1.78
307
- */
308
- filter: {
309
- type: "sap.ui.mdc.IFilter",
310
- multiple: false
311
- }
312
- },
313
- events: {
314
- /**
315
- * This event is fired when a SelectionDetailsAction is pressed.
316
- */
317
- selectionDetailsActionPressed: {
318
- parameters: {
319
-
320
- /**
321
- * The action that has to be processed once the action has been pressed
322
- */
323
- action: {
324
- type: "sap.ui.core.Item"
325
- },
326
-
327
- /**
328
- * If the action is pressed on one of the {@link sap.m.SelectionDetailsItem items}, the parameter contains the
329
- * {@link sap.ui.model.Context context} of the pressed {@link sap.m.SelectionDetailsItem item}. If a custom action or action
330
- * group of the SelectionDetails popover is pressed, this parameter contains all {@link sap.ui.model.Context contexts} of the
331
- * {@link sap.m.SelectionDetailsItem items}.
332
- */
333
- itemContexts: {
334
- type: "sap.ui.model.Context"
335
- },
336
-
337
- /**
338
- * The action level of action buttons. The available levels are Item, List and Group
339
- */
340
- level: {
341
- type: "sap.m.SelectionDetailsActionLevel"
342
- }
343
- }
344
- },
345
- /**
346
- * This event is fired when the selection in the inner chart changes.
347
- */
348
- dataPointsSelected:{
349
- parameters: {
350
284
  /**
351
- * The context of selected / deselected data points
285
+ * The action level of action buttons. The available levels are Item, List and Group
286
+ */
287
+ level: {
288
+ type: "sap.m.SelectionDetailsActionLevel"
289
+ }
290
+ }
291
+ },
292
+ /**
293
+ * This event is fired when a data load on the inner chart completes
294
+ */
295
+ innerChartLoadedData: {
296
+ parameters: {
297
+ /**
298
+ * Reference to the inner chart
352
299
  */
353
- dataContext: {
354
- type: "object"
300
+ innerChart: {
301
+ type: "sap.ui.core.Control"
355
302
  }
356
303
  }
357
304
  }
358
- }
359
- }
360
- });
361
-
362
- var _onSelectionMode = function(vValue) {
363
-
364
- if (!this.oChartPromise) {
365
- this._bNeedSelectionModeSet = true;
366
- return;
367
- }
368
-
369
- this.oChartPromise.then(function(oChart) {
370
-
371
- if (this.bIsDestroyed) {
372
- return;
373
- }
305
+ }
306
+ },
307
+
308
+ renderer: ChartRenderer
309
+ });
310
+
311
+ FilterIntegrationMixin.call(Chart.prototype);
312
+
313
+ /**
314
+ * Initialises the MDC Chart
315
+ *
316
+ * @experimental
317
+ * @private
318
+ * @ui5-restricted sap.ui.mdc
319
+ */
320
+ Chart.prototype.init = function () {
321
+ this._oManagedObjectModel = new ManagedObjectModel(this);
322
+ this.setModel(this._oManagedObjectModel, "$mdcChart");
323
+ this._bNewP13n = true;//TODO: remove with migration
324
+ Control.prototype.init.apply(this, arguments);
325
+ };
326
+
327
+ Chart.prototype.setP13nMode = function(aMode) {
328
+ var aSortedKeys = null;
329
+ if (aMode && aMode.length >= 1){
330
+ aSortedKeys = [];
331
+ var mKeys = aMode.reduce(function(mMap, sKey, iIndex){
332
+ mMap[sKey] = true;
333
+ return mMap;
334
+ }, {});
335
+
336
+ //as the p13nMode has no strict order we need to ensure the order of tabs here
337
+ if (mKeys.Item) {
338
+ aSortedKeys.push("Item");
339
+ }
340
+ if (mKeys.Sort) {
341
+ aSortedKeys.push("Sort");
342
+ }
343
+ if (mKeys.Type) {
344
+ this._typeBtnActive = true;
345
+ } else {
346
+ this._typeBtnActive = false;
347
+ }
348
+ } else {
349
+ aSortedKeys = aMode;
350
+ }
374
351
 
375
- vValue = vValue || this.getSelectionMode();
376
- oChart.setSelectionMode(vValue);
352
+ this.setProperty("p13nMode", aSortedKeys, true);
377
353
 
378
- if (vValue !== "NONE") {
379
- this._prepareSelection();
380
- }
354
+ this._updateAdaptation(this.getP13nMode());
381
355
 
382
- }.bind(this));
383
- };
356
+ return this;
357
+ };
384
358
 
385
- FilterIntegrationMixin.call(Chart.prototype);
359
+ Chart.prototype._updateAdaptation = function(aMode) {
360
+ var oRegisterConfig = {
361
+ controller: {}
362
+ };
386
363
 
387
- /**
388
- * Initialises the MDC Chart
389
- *
390
- * @experimental
391
- * @private
392
- * @ui5-restricted sap.ui.mdc
393
- */
394
- Chart.prototype.init = function() {
395
- this._oObserver = new ManagedObjectObserver(this.update.bind(this));
396
-
397
- this._oObserver.observe(this, {
398
- aggregations: [
399
- "items", "_chart"
400
- ],
401
- properties: [
402
- "ignoreToolbarActions", "p13nMode"
403
- ]
404
- });
405
-
406
- this._oManagedObjectModel = new ManagedObjectModel(this);
407
- this.setModel(this._oManagedObjectModel, "$mdcChart");
408
- Control.prototype.init.apply(this, arguments);
364
+ var mRegistryOptions = {
365
+ Item: ChartItemController,
366
+ Sort: SortController
367
+ };
409
368
 
410
- };
369
+ if (aMode && aMode.length > 0) {
370
+ aMode.forEach(function(sMode){
371
+ var sKey = sMode;
372
+ var oController = mRegistryOptions[sMode];
373
+ if (oController) {
374
+ oRegisterConfig.controller[sKey] = oController;
375
+ }
376
+ });
377
+
378
+ this.getEngine().registerAdaptation(this, oRegisterConfig);
379
+ }
380
+
381
+ };
382
+
383
+ /**
384
+ * Applies given settings onto the MDC Chart, loads the delegate and initializes the MDC Chart
385
+ *
386
+ * @param {*} mSettings settings to apply
387
+ *
388
+ * @experimental
389
+ * @private
390
+ * @ui5-restricted sap.ui.mdc
391
+ */
392
+ Chart.prototype.applySettings = function (mSettings, oScope) {
393
+ Control.prototype.applySettings.apply(this, arguments);
394
+
395
+ this.initializedPromise = new Promise(function (resolve, reject) {
396
+ this._fnResolveInitialized = resolve;
397
+ this._fnRejectInitialized = reject;
398
+ }.bind(this));
411
399
 
412
- /**
413
- * Initializes modules needed for MDC Chart
414
- *
415
- * @param {array} aModules Modules to initialize
416
- *
417
- * @private
418
- * @ui5-restricted sap.ui.mdc
419
- */
420
- Chart.prototype.initModules = function(aModules) {
421
- this.initControlDelegate(aModules[0]);
422
- ChartClass = aModules[1];
423
- ChartTypeButton = aModules[2];
424
- MeasureItemClass = aModules[3];
425
- VizTooltip = aModules[4];
426
- };
400
+ this.innerChartBoundPromise = new Promise(function (resolve, reject) {
401
+ this._fnResolveInnerChartBound = resolve;
402
+ this._fnRejectInnerChartBound = reject;
403
+ }.bind(this));
427
404
 
428
- function getModulesPaths() {
429
- return [
430
- "sap/chart/Chart",
431
- "sap/ui/mdc/chart/ChartTypeButton",
432
- "sap/ui/mdc/chart/MeasureItem",
433
- "sap/viz/ui5/controls/VizTooltip"
434
- ];
435
- }
436
-
437
- /**
438
- * Applies given settings onto the MDC Chart and initialized it
439
- *
440
- * @param {*} mSettings settings to apply
441
- *
442
- * @experimental
443
- * @private
444
- * @ui5-restricted sap.ui.mdc
445
- */
446
- Chart.prototype.applySettings = function(mSettings, oScope) {
447
- var aActions;
448
-
449
- // Note: In the mdc.Chart control metadata, the "action" aggregation
450
- // is defined as a forwarded aggregation.
451
- // However, the automatic forwarding of aggregations only works when
452
- // the target aggregation exists.
453
- // So, the actions are removed from the settings argument to prevent
454
- // an exception to happen when an aggregation is forwarded to a
455
- // target control that has not been created.
456
- if (mSettings) {
457
- aActions = mSettings.actions;
458
- }
405
+ //load required modules before init of inner controls
406
+ this._loadDelegate().then(function (oDelegate) {
407
+ this.initControlDelegate(oDelegate).then(function () {
408
+ this._initInnerControls();
459
409
 
460
- if (!this._oToolbarHandler) {
461
- this._oToolbarHandler = new ToolbarHandler();
462
- }
463
410
 
464
- var oManagedObj = Control.prototype.applySettings.apply(this, arguments);
465
- this._tempResolve;
466
- this._tempReject;
411
+ }.bind(this)).catch(function (error) {
412
+ this._fnRejectInitialized(error);
413
+ }.bind(this));
414
+ }.bind(this)).catch(function (error) {
415
+ this._fnRejectInitialized(error);
416
+ }.bind(this));
467
417
 
468
- this.oChartPromise = new SyncPromise(function(resolve, reject) {
469
- this._tempResolve = resolve;
470
- this._tempReject = reject;
471
- }.bind(this));
472
418
 
473
- var oRegisterConfig = {};
474
- oRegisterConfig.controller = {};
419
+ };
475
420
 
476
- var aMode = this.getP13nMode() || [];
477
- aMode.forEach(function(sMode){
478
- if (sMode == "Item") {
479
- oRegisterConfig.controller["Item"] = ChartItemController;
480
- }
481
- if (sMode == "Sort") {
482
- oRegisterConfig.controller["Sort"] = SortController;
483
- }
484
- });
421
+ /**
422
+ * Initializes the inner controls of the MDC Chart (toolbar, inner chart)
423
+ * Inner chart is initialized via the delegate
424
+ */
425
+ Chart.prototype._initInnerControls = function () {
426
+ this.getControlDelegate().initializeInnerChart(this).then(function (oInnerChart) {
485
427
 
486
- this.getEngine().registerAdaptation(this, oRegisterConfig);
428
+ this.setBusyIndicatorDelay(0);
487
429
 
430
+ this.getControlDelegate().createInitialChartContent(this);
431
+ this._renderOverlay(true);
488
432
 
489
- if (this.getAutoBindOnInit()){
490
- this._createChart(mSettings, aActions);
491
- } else {
492
- this._mStoredSettings = mSettings;
493
- this._mStoredActions = aActions;
433
+ if (this.getAutoBindOnInit()) {
434
+ this.setBusy(true);
435
+ this._createContentfromPropertyInfos();
436
+ }
494
437
 
495
- //Toolbar needs settings to be applied before creation to read properties like header/title
496
- this._oToolbarHandler.createToolbar(this, aActions, true);
497
- this._createTempNoData();
498
- }
438
+ this.setAggregation("_innerChart", oInnerChart);
499
439
 
500
- return oManagedObj;
440
+ this._bInnerChartReady = true;
501
441
 
502
- };
442
+ this._fnResolveInitialized();
443
+ // eslint-disable-next-line no-empty
444
+ this.invalidate();
445
+ }.bind(this)).catch(function (error) {
446
+ this._fnRejectInitialized(error);
447
+ }.bind(this));
503
448
 
504
- Chart.prototype._getToolbar = function(){
505
- if (!this.getAggregation("_toolbar")){
506
- this._oToolbarHandler.createToolbar(this);
507
- }
449
+ //independent from fetchProperties
450
+ this._getToolbar().createToolbarContent(this);
451
+ };
452
+
453
+ /**
454
+ * Creates the content for the inner chart from properties.
455
+ * The properties are given via the PropertyHelper which is initialized here.
456
+ * The rest of the creation of the content for the inner chart is done in the delegate.
457
+ * Also creates the breadcrumbs.
458
+ *
459
+ * Is called during init when autoBindOnInit = "true", if "false" then this is called by _rebind()
460
+ */
461
+ Chart.prototype._createContentfromPropertyInfos = function () {
462
+ this.initPropertyHelper(PropertyHelper).then(function () {
463
+ //Create content on inner chart instance
464
+ this.getControlDelegate().createInnerChartContent(this, this._innerChartDataLoadComplete.bind(this));
465
+
466
+ this._createBreadcrumbs();
467
+ //From now on, listen to changes on Items Aggregation and sync them with inner chart
468
+ this._oObserver = new ManagedObjectObserver(this._propagateItemChangeToInnerChart.bind(this));
469
+ this._oObserver.observe(this, {
470
+ aggregations: [
471
+ "items"
472
+ ]
473
+ });
474
+
475
+ //Sync MDC Chart properties with inner chart
476
+ this._propagatePropertiesToInnerChart();
477
+
478
+ this._fnResolveInnerChartBound();
508
479
 
509
- return this.getAggregation("_toolbar");
510
- };
480
+ }.bind(this));
511
481
 
512
- /**
513
- * Create a temporary NoData structure in case inner chart is not created yet.
514
- * @private
515
- */
516
- Chart.prototype._createTempNoData = function() {
517
- var oNoDataText = new Text({
518
- text: this.getProperty("noDataText")
519
- });
520
-
521
- var oNoDataStruct = new VBox({
522
- items: [
523
- oNoDataText
524
- ],
525
- justifyContent: "Center",
526
- alignItems: "Center",
527
- height: "100%"
528
- });
529
-
530
- this.setAggregation("_noDataStruct", oNoDataStruct);
531
- };
482
+ };
532
483
 
533
- /**
534
- * Handles the creation of all chart components (inner chart, toolbar, delegate, ...)
535
- * @param {*} mSettings the settings to apply to this managed object
536
- * @param {*} aActions actions for toolbar
537
- *
538
- * @experimental
539
- * @private
540
- */
541
- Chart.prototype._createChart = function(mSettings, aActions){
542
- var oDelegateSettings = (mSettings && mSettings.delegate) || this.getDelegate();
543
- var sDelegatePath = oDelegateSettings && oDelegateSettings.name;
544
- var aModulesPaths = [ sDelegatePath ].concat(getModulesPaths());
545
-
546
- // Needs to be set in order to visualize busy indicator when binding happens very fast
547
- this.setBusyIndicatorDelay(0);
548
- this.setBusy(true);
549
-
550
- loadModules(aModulesPaths)
551
-
552
- .then(function onModulesLoaded(aModules) {
553
- this.initModules(aModules);
554
-
555
- // If the Chart control is destroyed before this async callback is
556
- // invoked, return a rejected promise object to suppress unnecessary
557
- // work (e.g. creation of the inner Chart) and further invocation
558
- // of .then() handlers.
559
- if (this.bIsDestroyed) {
560
- return SyncPromise.reject();
561
- }
484
+ Chart.prototype.setHeight = function(iHeight) {
485
+ try {
486
+ this.getControlDelegate().adjustChartHeight(this);
487
+ } catch (oError) {
488
+ //No need to do anything as correct height will be calculated anyways once inner chart is ready
489
+ }
562
490
 
563
- return this.getControlDelegate().fetchProperties(this);
564
- }.bind(this))
491
+ this.setProperty("height", iHeight);
565
492
 
566
- .then(function createInnerChart(aProperties) {
493
+ return this;
494
+ };
567
495
 
568
- if (this.bIsDestroyed) {
569
- return SyncPromise.reject();
570
- }
496
+ Chart.prototype._createBreadcrumbs = function () {
497
+ this._oBreadcrumbs = new Breadcrumbs(this.getId() + "--breadcrumbs");
498
+ this._oBreadcrumbs.updateDrillBreadcrumbs(this, this.getControlDelegate().getDrillableItems(this));
499
+ this.setAggregation("_breadcrumbs", this._oBreadcrumbs);
571
500
 
572
- var mItems = {};
573
- aProperties.forEach(function(oProperty) {
574
- mItems[oProperty.name] = oProperty;
575
- });
501
+ this._oBreadcrumbs.addEventDelegate({
502
+ onAfterRendering: function() {
503
+ this.getControlDelegate().adjustChartHeight(this);
504
+ }.bind(this)
505
+ });
506
+ };
576
507
 
577
- // make sure to destroy the temporary NoData structure before inserting the inner chart
578
- if (this.getAggregation("_noDataStruct")) {
579
- this.getAggregation("_noDataStruct").destroy();
580
- this.setAggregation("_noDataStruct", null);
581
- }
508
+ /**
509
+ * Loads the delegate for the MDC Chart
510
+ * @returns {Promise} resolved when delegate is loaded
511
+ */
512
+ Chart.prototype._loadDelegate = function () {
582
513
 
583
- return this._createInnerChart(mSettings, mItems);
584
- }.bind(this))
514
+ return new Promise(function (resolve) {
515
+ var aNotLoadedModulePaths = [this.getDelegate().name];
585
516
 
586
- .then(function createDrillBreadcrumbs(oInnerChart) {
517
+ function onModulesLoadedSuccess(oDelegate) {
518
+ resolve(oDelegate);
519
+ }
587
520
 
588
- if (!this._oToolbarHandler) {
589
- this._oToolbarHandler = new ToolbarHandler();
590
- }
521
+ sap.ui.require(aNotLoadedModulePaths, onModulesLoadedSuccess);
522
+ }.bind(this));
591
523
 
592
- if (this.getAutoBindOnInit()){
593
- this._oToolbarHandler.createToolbar(this, aActions);
594
- } else {
595
- this._oToolbarHandler.updateToolbar(this);
596
- }
524
+ };
525
+ /**
526
+ * Gets whether filtering is enabled for p13n
527
+ *
528
+ * @experimental
529
+ * @private
530
+ * @ui5-restricted Fiori Elements
531
+ */
532
+ Chart.prototype.isFilteringEnabled = function () {
533
+
534
+ };
535
+
536
+ /**
537
+ * Gets the adaption UI for the p13n dialog
538
+ * @returns {Prmoise} promise that resolves with UI
539
+ */
540
+ Chart.prototype.getAdaptationUI = function () {
541
+ return this.getControlDelegate().getAdaptionUI(this);
542
+ };
543
+
544
+ /**
545
+ * Propagates a change on the "item" aggregation to the inner chart via the delegate
546
+ * The delegate must then update the inner chart accordingly
547
+ *
548
+ * @param {object} oChange the change object from the ManagedObjectModel observer
549
+ */
550
+ Chart.prototype._propagateItemChangeToInnerChart = function (oChange) {
551
+
552
+ if (this._bIsDestroyed){
553
+ return; //Don't propagate changes when CHart is destroyed
554
+ }
555
+
556
+ this.setBusy(true);
557
+ switch (oChange.mutation) {
558
+
559
+ case "insert":
560
+ var iIndex;
561
+
562
+ if (oChange.child && oChange.child.getType()) {
563
+ iIndex = this.getItems().filter(function(oItem){return oItem.getType() === oChange.child.getType();}).indexOf(oChange.child);
564
+ } else {
565
+ iIndex = this.getItems().indexOf(oChange.child);
566
+ }
597
567
 
598
- this._createDrillBreadcrumbs();
599
- this._toggleChartTooltipVisibility(this.getShowChartTooltip());
600
- this._tempResolve(oInnerChart);
601
- return oInnerChart;
602
- }.bind(this))
603
-
604
- .catch(function applySettingsHandleException(oError) {
605
- this._tempReject();
606
- // only log an error in the console if the promise was not intentionally rejected
607
- // by calling Promise.reject()
608
- if (oError) {
609
- Log.error("The control could not be initialized.", oError, this.getMetadata().getName());
610
- }
568
+ this.getControlDelegate().insertItemToInnerChart(this, oChange.child, iIndex);
569
+ break;
570
+ case "remove":
571
+ this.getControlDelegate().removeItemFromInnerChart(this, oChange.child);
572
+ break;
573
+ default:
574
+ Log.error("Unknown mutation on MDC Chart Item Aggregation. This will not sync to inner chart!");
575
+ break;
576
+ }
577
+
578
+ //Needed to apply current sorters when sorted measure/dimension was not selected yet
579
+ //However, since this gets called multiple times when the aggregation adds/removes multiple properties, the binding seems to break
580
+ this._rebind();
581
+
582
+ //Update the breadcrumbs after an MDC Item change
583
+ this._oBreadcrumbs.updateDrillBreadcrumbs(this, this.getControlDelegate().getDrillableItems(this));
584
+ };
585
+
586
+ /**
587
+ * Rebinds the inner chart instance by calling oDelegate.rebindChart
588
+ */
589
+ Chart.prototype._rebind = function () {
590
+
591
+ if (!this._bInnerChartReady) {
592
+ //TODO: This can lead to a race conditition when the "Go" button is pressed while the inner chart still intializes
593
+ //TODO: Check whether we really need this since we insantiate the inner chart right away
594
+ //this._initInnerControls();
595
+
596
+ //Wait with rebind until inner chart is ready
597
+ this.initialized().then(function () {
598
+ this._rebind();
599
+ }.bind(this));
600
+ return;
601
+ }
602
+
603
+ this.setBusy(true);
604
+
605
+ if (!this.getControlDelegate().getInnerChartBound(this)) {
606
+ this._createContentfromPropertyInfos();
607
+ return;
608
+ }
609
+
610
+ var oBindingInfo = this.getControlDelegate()._getBindingInfo(this);
611
+
612
+ if (oBindingInfo) {
613
+ oBindingInfo.sorter = this._getSorters();
614
+ }
615
+
616
+ this.getControlDelegate().updateBindingInfo(this, oBindingInfo); //Applies filters
617
+ this.getControlDelegate().rebind(this, oBindingInfo);
618
+ };
619
+
620
+ /**
621
+ * Creates a new instance of ChartToolbar
622
+ *
623
+ * @private
624
+ */
625
+ Chart.prototype._getToolbar = function () {
626
+ if (this.getAggregation("_toolbar")) {
627
+ return this.getAggregation("_toolbar");
628
+ } else {
629
+ var oToolbar = new ChartToolbar(this.getId() + "--toolbar", {
630
+ design: "Transparent"
631
+ });
632
+
633
+ this.setAggregation("_toolbar", oToolbar);
634
+ return oToolbar;
635
+ }
636
+ };
637
+
638
+ /**
639
+ * Calls the update function on the toolbar, if toolbar exists
640
+ *
641
+ * @private
642
+ */
643
+ Chart.prototype._updateToolbar = function () {
644
+ if (this.getAggregation("_toolbar")) {
645
+ this.getAggregation("_toolbar").updateToolbar(this);
646
+ } else {
647
+ Log.warning("Trying to uipdate Chart Toolbar, but toolbar is not yet initialized. This will not work!");
648
+ }
649
+ };
650
+
651
+ /**
652
+ * Returns the instance of the inner chart from the delegate
653
+ * @returns {sap.core.Control} the instance of the inner chart
654
+ *
655
+ * @private
656
+ */
657
+ Chart.prototype._getInnerChart = function () {
658
+ if (this._bInnerChartReady) {
659
+ return this.getControlDelegate().getInnerChart(this);
660
+ } else {
661
+ Log.error("Trying to acces inner chart while inner chart is not yet initialized!");
662
+ }
663
+ };
664
+
665
+ //TODO: Think of a good name
666
+ Chart.prototype._addItems = function () {
667
+
668
+ };
669
+
670
+ /**
671
+ * Gets the collection model from the binding information
672
+ * @returns {object} Object containing the binding information
673
+ *
674
+ * @experimental
675
+ * @private
676
+ * @ui5-restricted Fiori Elements
677
+ */
678
+ Chart.prototype.getCollectionModel = function () {
679
+ var oBindingInfo = this.getBindingInfo("data");
680
+ return oBindingInfo ? this.getModel(oBindingInfo.model) : null;
681
+ };
682
+
683
+
684
+ /**
685
+ * Can be used to check whether the chart is initialized
686
+ * After initialization the delegate should be loaded and (in case of autoBindOnInit=true) the inner chart has been created
687
+ * This does not include the inner chart to be bound. Use <code>innerChartBound</code> for it.
688
+ * @returns {Promise} Promise that resolves once MDC Chart is initialized. Contains reference to MDC Chart
689
+ *
690
+ * @experimental
691
+ * @private
692
+ * @ui5-restricted sap.ui.mdc, sap.fe
693
+ */
694
+ Chart.prototype.initialized = function () {
695
+ return this.initializedPromise;
696
+ };
697
+
698
+ /**
699
+ * Can be used to check whether the inner chart is initialized and bound
700
+ * @returns {Promise} Promise that resolves once MDC Chart is bound
701
+ *
702
+ * @experimental
703
+ * @private
704
+ * @ui5-restricted sap.ui.mdc, sap.fe
705
+ */
706
+ Chart.prototype.innerChartBound = function () {
707
+ return this.innerChartBoundPromise;
708
+ };
709
+
710
+ /**
711
+ * Zooms in the inner chart
712
+ * @param {int} iValue how much steps should be zoomed in
713
+ *
714
+ * @experimental
715
+ * @private
716
+ * @ui5-restricted sap.ui.mdc, sap.fe
717
+ */
718
+ Chart.prototype.zoomIn = function (iValue) {
719
+ if (!iValue) {
720
+ iValue = 10;
721
+ }
722
+
723
+ this.getControlDelegate().zoomIn(this, iValue);
724
+ };
725
+
726
+ /**
727
+ * Zooms out the inner chart
728
+ * @param {int} iValue how much steps should be zoomed out
729
+ *
730
+ * @experimental
731
+ * @private
732
+ * @ui5-restricted sap.ui.mdc, sap.fe
733
+ */
734
+ Chart.prototype.zoomOut = function (iValue) {
735
+ if (iValue) {
736
+ iValue = 10;
737
+ }
738
+
739
+ this.getControlDelegate().zoomOut(this, iValue);
740
+ };
741
+
742
+ /**
743
+ * Returns the current zoom information as an object
744
+ * {
745
+ * "enabled":true,
746
+ * "currentZoomLevel":0.16
747
+ * }
748
+ *
749
+ * @returns {Object} current Zoom Information
750
+ *
751
+ * @experimental
752
+ * @private
753
+ * @ui5-restricted sap.ui.mdc, sap.fe
754
+ */
755
+ Chart.prototype.getZoomState = function () {
756
+ return this.getControlDelegate().getZoomState(this);
757
+ };
758
+
759
+ Chart.prototype.getSelectionHandler = function () {
760
+ return this.getControlDelegate().getInnerChartSelectionHandler(this);
761
+ };
762
+
763
+ Chart.prototype.getChartTypeLayoutConfig = function() {
764
+ return this.getControlDelegate().getChartTypeLayoutConfig();
765
+ };
766
+
767
+ Chart.prototype.getAllowedRolesForKinds = function() {
768
+ return this.getControlDelegate().getAllowedRolesForKinds();
769
+ };
770
+
771
+ /**
772
+ * Sets the visibility of the legend
773
+ * Calls the Delegates <code>setLegendVisible</code>. Never call the delegates function directly as it would not update the Chart Toolbar!
774
+ * @param {boolean} bVisible true to show legend, false to hide
775
+ *
776
+ * @experimental
777
+ * @private
778
+ * @ui5-restricted Fiori Elements, sap.ui.mdc
779
+ */
780
+ Chart.prototype.setLegendVisible = function (bVisible) {
781
+ this.setProperty("legendVisible", bVisible);
782
+
783
+ //Skip if no control delegate; gets propagated by _propagatePropertiesToInnerChart after init
784
+ try {
785
+ this.getControlDelegate().setLegendVisible(this, bVisible);
786
+ } catch (e) {
787
+ Log.info("Trying to set legend visiblity for Chart before delegate was initialized");
788
+ }
789
+
790
+
791
+ return this;
792
+ };
793
+
794
+ /**
795
+ * Sets the ShowChartTooltip Property
796
+ * @param {boolean} bValue true for visible; false for invisible
797
+ * @returns {sap.ui.mdc.Chart} the MDC Chart
798
+ */
799
+ Chart.prototype.setShowChartTooltip = function (bValue) {
800
+ this.setProperty("showChartTooltip", bValue);
801
+
802
+ //Skip if no control delegate; gets propagated by _propagatePropertiesToInnerChart after init
803
+ try {
804
+ this.getControlDelegate().setChartTooltipVisibility(this, bValue);
805
+ } catch (e) {
806
+ Log.info("Trying to set tooltip visibility before delegate was initialized");
807
+ }
808
+
809
+ return this;
810
+ };
811
+
812
+ Chart.prototype.destroy = function() {
813
+ this._bIsDestroyed = true;
814
+
815
+ Control.prototype.destroy.apply(this, arguments);
816
+ };
817
+
818
+ /**
819
+ * shows the drill-down popover for selection a dimension to drill down to.
820
+ * @param {sap.m.Button} oDrillBtn reference to the drill down button for loacation of the popover
821
+ *
822
+ * @experimental
823
+ * @private
824
+ * @ui5-restricted sap.ui.mdc
825
+ */
826
+ Chart.prototype._showDrillDown = function (oDrillBtn) {
827
+ if (DrillStackHandler) {
828
+
829
+ DrillStackHandler.createDrillDownPopover(this);
830
+ return DrillStackHandler.showDrillDownPopover(this, oDrillBtn);
831
+ }
832
+
833
+ return new Promise(function (resolve, reject) {
834
+ sap.ui.require([
835
+ "sap/ui/mdc/chart/DrillStackHandler"
836
+ ], function (DrillStackHandlerLoaded) {
837
+ DrillStackHandler = DrillStackHandlerLoaded;
838
+ DrillStackHandler.createDrillDownPopover(this);
839
+ DrillStackHandler.showDrillDownPopover(this, oDrillBtn)
840
+ .then(function (oDrillDownPopover) {
841
+ resolve(oDrillDownPopover);
842
+ });
843
+ }.bind(this));
844
+ }.bind(this));
845
+ };
846
+
847
+ /**
848
+ * If some properties are set on the MDC Chart while the inner chart is not yet initialized, they need to eb set after initialaization.
849
+ * This methods gets called after inner chart is ready and takes care of that
850
+ *
851
+ * @private
852
+ */
853
+ Chart.prototype._propagatePropertiesToInnerChart = function () {
854
+ //TODO: Can this be set by constructor of inner chart?
855
+ this.setLegendVisible(this.getLegendVisible());
856
+ this.setShowChartTooltip(this.getShowChartTooltip());
857
+ this.setChartType(this.getChartType());
858
+ };
859
+
860
+ /**
861
+ * Gets information about the current chart type.
862
+ *
863
+ * @returns {sap.ui.mdc.Chart.ChartTypeInfo} Object containing information about the chart type
864
+ *
865
+ * @experimental
866
+ * @private
867
+ * @ui5-restricted Fiori Elements
868
+ *
869
+ */
870
+ Chart.prototype.getChartTypeInfo = function () {
871
+ var mInfo;
872
+
873
+ try {
874
+ mInfo = this.getControlDelegate().getChartTypeInfo(this);
875
+ } catch (error) {
876
+ //Inner chart is not yet ready
877
+ if (!mInfo) {
878
+ mInfo = {
879
+ icon: "sap-icon://vertical-bar-chart",
880
+ text: "Selected Chart Type: Bar Chart"
881
+ };
882
+ }
883
+ }
884
+
885
+ return mInfo;
886
+ };
887
+
888
+ /**
889
+ * Gets the available chart types for the current state of the inner chart
890
+ *
891
+ * @returns {array} Array containing the available chart types
892
+ *
893
+ * @experimental
894
+ * @private
895
+ * @ui5-restricted Fiori Elements
896
+ */
897
+ Chart.prototype.getAvailableChartTypes = function () {
898
+ return this.getControlDelegate().getAvailableChartTypes(this);
899
+ };
900
+
901
+
902
+ /**
903
+ * Sets the MDC Chart to a specific chart type
904
+ * @param {string} sChartType the name of the new chart type
905
+ * @returns {sap.ui.mdc.chart} reference to <code>this</code> for method chaining
906
+ */
907
+ Chart.prototype.setChartType = function (sChartType) {
908
+ this.setProperty("chartType", sChartType);
909
+
910
+ try {
911
+ this.getControlDelegate().setChartType(this, sChartType);
912
+ } catch (e) {
913
+ Log.info("Trying to set chart type for Chart before delegate was initialized");
914
+ }
915
+
916
+ return this;
917
+ };
918
+
919
+ /**
920
+ * Gets the managed object model.
921
+ * @returns {sap.ui.model.base.ManagedObjectModel} the managed object model
922
+ *
923
+ * @experimental
924
+ * @private
925
+ * @ui5-restricted Fiori Elements
926
+ */
927
+ Chart.prototype.getManagedObjectModel = function () {
928
+ return this._oManagedObjectModel;
929
+ };
930
+
931
+ /**
932
+ * This is a callback function which is called from the delegate once the inner chart finished loading data
933
+ * Updates the Toolbar
934
+ * Fires the innerChartLoadedData event
935
+ *
936
+ * @private
937
+ */
938
+ Chart.prototype._innerChartDataLoadComplete = function (mArguments) {
939
+ this.setBusy(false);
940
+ this._renderOverlay(false);
941
+
942
+ this.getControlDelegate().requestToolbarUpdate(this);
943
+
944
+ this.fireEvent("innerChartLoadedData ", {
945
+ innerChart: this.getControlDelegate().getInnerChart(this)
946
+ });
947
+ };
948
+
949
+ /**
950
+ * Fetches the current state of the chart (as a JSON)
951
+ * Needed for P13n to fetch current state
952
+ *
953
+ * @experimental
954
+ * @private
955
+ * @returns {Object} Current state of the chart
956
+ * @ui5-restricted sap.ui.mdc
957
+ */
958
+ Chart.prototype.getCurrentState = function () {
959
+ var oState = {};
960
+ var aP13nMode = this.getP13nMode();
961
+
962
+ if (aP13nMode) {
963
+ if (aP13nMode.indexOf("Item") > -1) {
964
+ oState.items = this._getVisibleProperties();
965
+ }
611
966
 
612
- }.bind(this));
967
+ if (aP13nMode.indexOf("Sort") > -1) {
968
+ oState.sorters = this._getSortedProperties();
969
+ }
970
+ }
971
+
972
+ return oState;
973
+ };
974
+
975
+ /**
976
+ * Returns the currently visible Properties
977
+ * Needed for P13n
978
+ * @returns {array} Array containing the currently visible properties
979
+ *
980
+ * @private
981
+ */
982
+ Chart.prototype._getVisibleProperties = function () {
983
+ var aProperties = [];
984
+ this.getItems().forEach(function (oItem) {
985
+ aProperties.push({
986
+ name: oItem.getName(),
987
+ role: oItem.getRole()
988
+ });
989
+
990
+ });
991
+ return aProperties;
992
+ };
993
+
994
+ /**
995
+ * Returns the currently sorted Properties
996
+ * Needed for P13n
997
+ * @returns {array} Array containing the currently sorted properties
998
+ *
999
+ * @private
1000
+ */
1001
+ Chart.prototype._getSortedProperties = function () {
1002
+ return this.getSortConditions() ? this.getSortConditions().sorters : [];
1003
+ };
1004
+
1005
+ /**
1006
+ * Returns sorters available for the data
1007
+ *
1008
+ * @returns {array} Array containing available sorters
1009
+ *
1010
+ * @experimental
1011
+ * @private
1012
+ * @ui5-restricted sap.ui.mdc
1013
+ */
1014
+ Chart.prototype._getSorters = function () {
1015
+ var aSorters;
1016
+ var aSorterProperties = this.getSortConditions() ? this.getSortConditions().sorters : [];
613
1017
 
614
- if (!mSettings || mSettings.selectionMode === undefined || this._bNeedSelectionModeSet) {
615
- _onSelectionMode.apply(this);
616
- }
1018
+ aSorterProperties.forEach(function (oSortProp) {
617
1019
 
618
- if (mSettings && mSettings.data) {
619
- this._addBindingListener(mSettings.data, "change", this._onDataLoadComplete.bind(this));
620
- }
1020
+ var oMDCItem = this.getItems().find(function (oProp) {
1021
+ return oProp.getName() === oSortProp.name;
1022
+ });
621
1023
 
622
- this._bInnerChartInitialized = true;
623
- this.bindAggregation("data", this.oDataInfo);
624
- };
1024
+ //Ignore not visible Items
1025
+ if (!oMDCItem) {
1026
+ return;
1027
+ }
625
1028
 
626
- /**
627
- * Calls the Delegates to bind the aggregation onto the inner chart
628
- *
629
- * @param {string} sName Name of a public aggregation to bind
630
- * @param {sap.ui.base.ManagedObject.AggregationBindingInfo} oBindingInfo binding info for the aggregation
631
- * @param {string} [sSearchText] search text (optional)
632
- * @returns {this} Returns <code>this</code> to allow method chaining
633
- *
634
- * @experimental
635
- * @private
636
- * @ui5-restricted Fiori Elements
637
- */
638
- Chart.prototype.bindAggregation = function (sName, oBindingInfo, sSearchText) {
1029
+ //TODO: Check for inResultDimensions
1030
+ var oSorter = this.getControlDelegate().getSorterForItem(oMDCItem, oSortProp);
639
1031
 
640
- if (sName == "data") {
1032
+ if (aSorters) {
1033
+ aSorters.push(oSorter);
1034
+ } else {
1035
+ aSorters = [
1036
+ oSorter
1037
+ ];//[] has special meaning in sorting
1038
+ }
1039
+ }.bind(this));
641
1040
 
642
- this.oDataInfo = oBindingInfo;
643
- var oChart = this.getAggregation("_chart");
1041
+ return aSorters;
644
1042
 
645
- if (oChart && this.bDelegateInitialized) {
646
- this.getControlDelegate().rebindChart(this, oBindingInfo, sSearchText);
1043
+ };
647
1044
 
648
- } else if (this.oChartPromise) {
649
- this.oChartPromise.then(function (oChart) {
650
- this.getControlDelegate().rebindChart(this, oBindingInfo, sSearchText);
651
- }.bind(this));
652
- }
653
- return this;
654
- }
655
- return Control.prototype.bindAggregation.apply(this, arguments);
656
- };
1045
+ /**
1046
+ * Returns the fetched properties from the delegate
1047
+ *
1048
+ * @private
1049
+ */
1050
+ Chart.prototype._getPropertyData = function () {
657
1051
 
658
- Chart.prototype._onDataLoadComplete = function(mEventParams) {
659
- if ((mEventParams.mParameters.reason === "change" || mEventParams.mParameters.reason === "filter" ) && !mEventParams.mParameters.detailedReason) {
660
- this.setBusy(false);
661
- }
662
- };
1052
+ if (!this.aFetchedProperties) {
1053
+ //retrieve the data
1054
+ this.aFetchedProperties = this.getControlDelegate().fetchProperties(this);
1055
+ } else {
1056
+ //take the already instantiated data
1057
+ return this.aFetchedProperties;
1058
+ }
663
1059
 
664
- Chart.prototype._addBindingListener = function(oBindingInfo, sEventName, fHandler) {
665
- if (!oBindingInfo.events) {
666
- oBindingInfo.events = {};
667
- }
1060
+ };
668
1061
 
669
- if (!oBindingInfo.events[sEventName]) {
670
- oBindingInfo.events[sEventName] = fHandler;
671
- } else {
672
- // Wrap the event handler of the other party to add our handler.
673
- var fOriginalHandler = oBindingInfo.events[sEventName];
674
- oBindingInfo.events[sEventName] = function() {
675
- fHandler.apply(this, arguments);
676
- fOriginalHandler.apply(this, arguments);
677
- };
678
- }
679
- };
1062
+ Chart.prototype._getTypeBtnActive = function(){
1063
+ return !!this._typeBtnActive;
1064
+ };
680
1065
 
681
- /**
682
- * Gets information about the current data binding
1066
+ /**
1067
+ * Callback for when fuilters changed
1068
+ * Activates the overlay on the MDC Chart
683
1069
  *
684
- * @experimental
685
- * @private
686
- * @ui5-restricted Fiori Elements, sap.ui.mdc
687
- */
688
- Chart.prototype.getBindingInfo = function (sName) {
689
-
690
- if (sName == "data") {
691
- return this.oDataInfo;
692
- }
693
-
694
- return Control.prototype.getBindingInfo.apply(this, arguments);
695
- };
696
-
697
- /**
698
- * Sets the visibility of the legend
699
- * @param {boolean} bVisible true to show legend, false to hide
1070
+ * @param oEvent filter changed event
700
1071
  *
701
1072
  * @experimental
702
1073
  * @private
703
1074
  * @ui5-restricted Fiori Elements, sap.ui.mdc
704
1075
  */
705
- Chart.prototype.setLegendVisible = function (bVisible) {
706
-
707
- // inherited from vizFrame
708
- this.setVizProperties({
709
- 'legend': {
710
- 'visible': bVisible
711
- },
712
- 'sizeLegend': {
713
- 'visible': bVisible
714
- }
715
- });
716
-
717
- return this.setProperty("legendVisible", bVisible);
718
- };
719
-
720
- /**
721
- * Creates inner chart
722
- *
723
- * @experimental
724
- * @private
725
- * @ui5-restricted sap.ui.mdc
726
- */
727
- Chart.prototype._createInnerChart = function (mSettings, mItems) {
728
- mSettings = mSettings || {};
729
-
730
- var mInitialChartSettings = {},
731
- oItem,
732
- aVizItems = [],
733
- aColMeasures = [],
734
- aInSettings = [],
735
- mVizItemSettings = {};
736
-
737
- mInitialChartSettings.chartType = '{$mdcChart>/chartType}';
738
- mInitialChartSettings.dimensions = [];
739
- mInitialChartSettings.measures = [];
740
- mInitialChartSettings.id = this.getId() + "--innerChart";
741
- mInitialChartSettings.height = '100%';
742
- mInitialChartSettings.width = '100%';
743
- mInitialChartSettings.vizProperties = '{$mdcChart>/vizProperties}';
744
-
745
- mSettings.items = mSettings.items || [];
746
-
747
- function moveToSettings(oVizItem) {
748
- if (this && this.getVizItemType() == "Dimension") {
749
- mInitialChartSettings.dimensions.push(oVizItem);
750
- } else {
751
- mInitialChartSettings.measures.push(oVizItem);
752
- }
753
- }
754
-
755
- function prepareColoring(oItem, oChart) {
756
- //COLORING
757
- if (oItem.getCriticality()) {
758
- oChart._addCriticality(oItem);
759
- }
760
-
761
- aInSettings.push(oItem.getKey());
762
-
763
- if (oItem.getAdditionalColoringMeasures) {
764
-
765
- for (var j = 0; j < oItem.getAdditionalColoringMeasures().length; j++) {
766
-
767
- if (aColMeasures.indexOf(oItem.getAdditionalColoringMeasures()[j]) == -1) {
768
- aColMeasures.push(oItem.getAdditionalColoringMeasures()[j]);
769
- }
770
- }
771
- }
772
- }
773
-
774
- function addAdditionalColoringMeasures() {
775
- var sKey, mColorItem;
776
-
777
- for (var i = 0; i < aColMeasures.length; i++) {
778
- sKey = aColMeasures[i];
779
-
780
- if (aInSettings.indexOf(sKey) == -1) {
781
- mColorItem = this.getControlDelegate().retrieveAggregationItem("items", mItems[sKey]);
782
- mColorItem = MeasureItemClass.getVizItemSettings(mColorItem.settings);
783
- //only add the measure to the vizFrame not to the mdc chart
784
- aVizItems.push(MeasureItemClass.createVizChartItem(mColorItem).then(moveToSettings));
785
- }
786
- }
787
- }
788
-
789
- for (var i = 0; i < mSettings.items.length; i++) {
790
- oItem = mSettings.items[i];
791
- prepareColoring(oItem, this);
792
-
793
- if (mItems[oItem.getKey()]) {
794
- mVizItemSettings = this.getControlDelegate().retrieveAggregationItem("items", mItems[oItem.getKey()]).settings;
795
- } else {
796
- mVizItemSettings = undefined;
797
- }
798
-
799
- aVizItems.push(oItem.toVizChartItem(mVizItemSettings).then(moveToSettings.bind(oItem)));
800
- }
801
-
802
- //After collecting all additional measure names for coloring we need to add them
803
- addAdditionalColoringMeasures();
804
-
805
-
806
- //attach dataPointsSelected event to inner charts selection/deselection events
807
- var fireDataPointsSelectedEvent = function(oEvent){
808
- this.fireDataPointsSelected({
809
- dataContext: oEvent.getParameters()
810
- });
811
- };
812
-
813
- return Promise.all(aVizItems).then(function() {
814
- var oChart = new ChartClass(mInitialChartSettings);
815
-
816
- //initial setup
817
- oChart.setVisibleDimensions([]);
818
- oChart.setVisibleMeasures([]);
819
- oChart.setInResultDimensions([]);
820
-
821
- oChart.attachSelectData(function(oEvent){
822
- fireDataPointsSelectedEvent.call(this, oEvent);
823
- }.bind(this));
824
-
825
- oChart.attachDeselectData(function(oEvent){
826
- fireDataPointsSelectedEvent.call(this, oEvent);
827
- }.bind(this));
828
-
829
- this._oObserver.observe(oChart, {
830
- bindings: [
831
- "data"
832
- ],
833
- aggregations: [
834
- "dimensions", "measures"
835
- ]
836
- });
837
-
838
- this.setAggregation("_chart", oChart);
839
- return oChart;
840
- }.bind(this));
841
- };
842
-
843
- /**
844
- * Sets the <code>selectionMode</code> property
845
- * @param {string} vValue the selection mode to set the chart to
846
- * @returns {this} reference to <code>this</code> for method chaining
847
- *
848
- * @private
849
- * @ui5-restricted Fiori Elements
850
- */
851
- Chart.prototype.setSelectionMode = function (vValue) {
852
- this.setProperty("selectionMode", vValue, true);
853
- vValue = this.getSelectionMode();
854
- _onSelectionMode.call(this, vValue);
855
- return this;
856
- };
857
-
858
- /**
859
- * Adds a Item to the chart
860
- *
861
- * @param {sap.ui.mdc.chart.Item} oItem a chart Item
862
- * @param {boolean} bSuppressInvalidate Suppress invalidation of the control
863
- *
864
- * @private
865
- * @experimental
866
- * @ui5-restricted Fiori Elements
867
- */
868
- Chart.prototype.addItem = function (oItem, bSuppressInvalidate) {
869
- var oChart = this.getAggregation("_chart");
870
-
871
- if (oChart) {
872
- oItem.toChart(oChart);
873
- } else if (this.oChartPromise) {
874
- this.oChartPromise.then(function(oChart) {
875
-
876
- if (oChart) {
877
- this.toChart(oChart);
878
- }
879
- }.bind(oItem));
1076
+ Chart.prototype._onFiltersChanged = function(oEvent) {
1077
+ if (this._bInnerChartReady && this.getControlDelegate() && this.getControlDelegate().getInnerChartBound(this) && oEvent.getParameter("conditionsBased")) {
1078
+ this._renderOverlay(true);
880
1079
  }
881
-
882
- this._oObserver.observe(oItem, {
883
- properties: [
884
- "visible", "inResult", "role"
885
- ]
886
- });
887
-
888
- return this.addAggregation("items", oItem, bSuppressInvalidate);
889
1080
  };
890
1081
 
891
- /**
892
- * Inserts an Item into the chart
893
- * @param {sap.ui.mdc.chart.Item} oItem a chart Item
894
- * @param {int} iIndex the index
895
- * @param {boolean} bSuppressInvalidate Suppress invalidation of the control
1082
+ /**
1083
+ * Adds/Removes the overlay shown above the inner chart
1084
+ * @param {boolean} bShow true to show overlay, false to hide
896
1085
  *
897
1086
  * @experimental
898
1087
  * @private
899
1088
  * @ui5-restricted Fiori Elements, sap.ui.mdc
900
1089
  */
901
- Chart.prototype.insertItem = function (oItem, iIndex, bSuppressInvalidate) {
902
-
903
- if (oItem.getCriticality()) {
904
- this._addCriticality(oItem);
905
- }
906
-
907
- var oChart = this.getAggregation("_chart");
1090
+ Chart.prototype._renderOverlay = function(bShow) {
908
1091
 
909
- if (oChart) {
910
- oItem.toChart(oChart);
911
- } else if (this.oChartPromise) {
912
- this.oChartPromise.then(function (oChart) {
1092
+ if (this.getControlDelegate().getInnerChart(this)) {
913
1093
 
914
- if (oChart) {
915
- this.toChart(oChart);
916
- }
917
- }.bind(oItem));
1094
+ var $this = this.getControlDelegate().getInnerChart(this).$(), $overlay = $this.find(".sapUiMdcChartOverlay");
1095
+ if (bShow && $overlay.length === 0) {
1096
+ $overlay = jQuery("<div>").addClass("sapUiOverlay sapUiMdcChartOverlay").css("z-index", "1");
1097
+ $this.append($overlay);
1098
+ } else if (!bShow) {
1099
+ $overlay.remove();
1100
+ }
918
1101
  }
919
-
920
- this._oObserver.observe(oItem, {
921
- properties: [
922
- "visible", "inResult", "role"
923
- ]
924
- });
925
-
926
- return this.insertAggregation("items", oItem, iIndex, bSuppressInvalidate);
927
- };
928
-
929
- /**
930
- * Removes the chart item
931
- *
932
- * @param {sap.ui.mdc.chart.Item} oItem oItem a chart Item
933
- * @param bSuppressInvalidate Suppress invalidation of the control
934
- * @returns {*}
935
- *
936
- * @experimental
937
- * @private
938
- * @ui5-restricted Fiori Elements, sap.ui.mdc
939
- */
940
- Chart.prototype.removeItem = function (oItem, bSuppressInvalidate) {
941
- this._oObserver.unobserve(oItem);
942
- return this.removeAggregation("items", oItem, bSuppressInvalidate);
943
1102
  };
944
1103
 
945
- Chart.prototype.exit = function() {
946
- Control.prototype.exit.apply(this, arguments);
947
-
948
- this.oChartPromise = null;
949
- this._oSelectionHandlerPromise = null;
1104
+ Chart.prototype.addAction = function(oControl) {
1105
+ if (oControl.getMetadata().getName() !== "sap.ui.mdc.actiontoolbar.ActionToolbarAction") {
1106
+ oControl = new ActionToolbarAction(oControl.getId() + "-action", {
1107
+ action: oControl
1108
+ });
1109
+ }
950
1110
 
951
- if (this._oToolbarHandler) {
952
- this._oToolbarHandler.destroy();
953
- this._oToolbarHandler = null;
954
- }
955
-
956
- var oChart = this.getAggregation("_chart");
957
-
958
- if (oChart) {
959
- oChart.destroy();
960
- }
961
- };
962
-
963
- /**
964
- * Gets the item from the aggregation named <code>items</code> that
965
- * matches the given <code>aItemKeys</code>.
966
- *
967
- * @param {array} aItemKeys The item keys that specify the item to be retrieved
968
- * @returns {array} Array containing the matching items
969
- *
970
- * @experimental
971
- * @private
972
- * @ui5-restricted Fiori Elements
973
- */
974
- Chart.prototype.getItemsByKeys = function(aItemKeys) {
975
- var aFilteredItems = [],
976
- aItems = this.getItems();
977
-
978
- aItemKeys.forEach(function(sItemName) {
979
- for (var i = aItems.length - 1; i >= 0; i--) {
980
- if (aItems[i].getKey() == sItemName /*&& is of type DimensionItem*/) {
981
- aFilteredItems.push(aItems[i]);
982
- break;
983
- }
984
- }
985
- });
986
-
987
- return aFilteredItems;
988
- };
989
-
990
- /**
991
- * shows the drill-down popover for selection a dimension to drill down to.
992
- *
993
- * @experimental
994
- * @private
995
- * @ui5-restricted Fiori Elements
996
- */
997
- Chart.prototype._showDrillDown = function() {
998
-
999
- if (DrillStackHandler) {
1000
-
1001
- if (!this._oDrillDownPopover) {
1002
- DrillStackHandler.createDrillDownPopover(this);
1003
- }
1004
-
1005
- return DrillStackHandler.showDrillDownPopover(this);
1006
- }
1007
-
1008
- return new Promise(function(resolve, reject) {
1009
- sap.ui.require([
1010
- "sap/ui/mdc/chart/DrillStackHandler"
1011
- ], function(DrillStackHandlerLoaded) {
1012
- DrillStackHandler = DrillStackHandlerLoaded;
1013
- DrillStackHandler.createDrillDownPopover(this);
1014
- DrillStackHandler.showDrillDownPopover(this)
1015
- .then(function(oDrillDownPopover) {
1016
- resolve(oDrillDownPopover);
1017
- });
1018
- }.bind(this));
1019
- }.bind(this));
1020
- };
1021
-
1022
- /**
1023
- * shows the Breadcrumbs for current drill-path and drilling up.
1024
- *
1025
- * @experimental
1026
- * @private
1027
- * @ui5-restricted Fiori Elements
1028
- */
1029
- Chart.prototype._createDrillBreadcrumbs = function() {
1030
-
1031
- if (DrillStackHandler) {
1032
-
1033
- if (!this._oDrillBreadcrumbs) {
1034
- return DrillStackHandler.createDrillBreadcrumbs(this);
1035
- }
1036
-
1037
- return Promise.resolve(this._oDrillBreadcrumbs);
1038
- }
1039
-
1040
- return new Promise(function(resolve, reject) {
1041
- sap.ui.require([
1042
- "sap/ui/mdc/chart/DrillStackHandler"
1043
- ], function(DrillStackHandlerLoaded) {
1044
- DrillStackHandler = DrillStackHandlerLoaded;
1045
- DrillStackHandler.createDrillBreadcrumbs(this).then(function(oDrillBreadcrumbs) {
1046
- resolve(oDrillBreadcrumbs);
1047
- });
1048
- }.bind(this));
1049
- }.bind(this));
1050
- };
1051
-
1052
- Chart.prototype._getPropertyData = function () {
1053
- return new Promise(function (resolve, reject) {
1054
-
1055
- // check if the data already has been retrieved
1056
- if (!this.aFetchedProperties) {
1057
- //retrieve the data
1058
- return this.oChartPromise.then(function() {
1059
- return this.getControlDelegate().fetchProperties(this);
1060
- }.bind(this))
1061
- .then(function(aFetchedProperties) {
1062
- this.aFetchedProperties = aFetchedProperties;
1063
- resolve(aFetchedProperties);
1064
- }.bind(this));
1065
-
1066
- } else {
1067
- //take the already instantiated data
1068
- resolve(this.aFetchedProperties);
1069
- }
1070
- }.bind(this));
1071
- };
1072
-
1073
- /**
1074
- * Gets the available chart types for the current state of the inner chart
1075
- *
1076
- * @returns {array} Array containing the available chart types
1077
- *
1078
- * @experimental
1079
- * @private
1080
- * @ui5-restricted Fiori Elements
1081
- */
1082
- Chart.prototype.getAvailableChartTypes = function () {
1083
- var aChartTypes = [];
1084
- var oChart = this.getAggregation("_chart");
1085
-
1086
- if (oChart) {
1087
- var aAvailableChartTypes = oChart.getAvailableChartTypes().available;
1088
-
1089
- if (aChartTypes) {
1090
-
1091
- var oChartResourceBundle = Core.getLibraryResourceBundle("sap.chart.messages");
1092
-
1093
- for (var i = 0; i < aAvailableChartTypes.length; i++) {
1094
- var sType = aAvailableChartTypes[i].chart;
1095
- aChartTypes.push({
1096
- key: sType,
1097
- icon: ChartTypeButton.mMatchingIcon[sType],
1098
- text: oChartResourceBundle.getText("info/" + sType),
1099
- selected: (sType == this.getChartType())
1100
- });
1101
- }
1102
- }
1103
- }
1104
-
1105
- return aChartTypes;
1106
- };
1107
-
1108
- /**
1109
- * @typedef {Object} sap.ui.mdc.Chart.ChartTypeInfo
1110
- * @property {string} icon - The icon of the selected chart type
1111
- * @property {string} text - Tooltip containing the current chart type
1112
- * @experimental
1113
- * @private
1114
- * @ui5-restricted Fiori Elements
1115
- */
1116
-
1117
- /**
1118
- * Gets information about the current chart type.
1119
- *
1120
- * @returns {sap.ui.mdc.Chart.ChartTypeInfo} Object containing information about the chart type
1121
- *
1122
- * @experimental
1123
- * @private
1124
- * @ui5-restricted Fiori Elements
1125
- *
1126
- */
1127
- Chart.prototype.getTypeInfo = function() {
1128
- var sType = this.getChartType(),
1129
- oMDCResourceBundle = Core.getLibraryResourceBundle("sap.ui.mdc");
1130
-
1131
- var mInfo = {
1132
- icon: ChartTypeButton && ChartTypeButton.mMatchingIcon[sType] ? ChartTypeButton.mMatchingIcon[sType] : "sap-icon://horizontal-bar-chart",
1133
- text: oMDCResourceBundle.getText("chart.CHART_TYPE_TOOLTIP", [
1134
- sType
1135
- ])
1136
- };
1137
-
1138
- return mInfo;
1139
- };
1140
-
1141
- /**
1142
- * Gets the managed object model.
1143
- * @returns {sap.ui.model.base.ManagedObjectModel} the managed object model
1144
- *
1145
- * @experimental
1146
- * @private
1147
- * @ui5-restricted Fiori Elements
1148
- */
1149
- Chart.prototype.getManagedObjectModel = function () {
1150
- return this._oManagedObjectModel;
1151
- };
1152
-
1153
- /**
1154
- * Updates the inner chart
1155
- * @param {object} oChanges Object containing the changes to update with
1156
- *
1157
- * @experimental
1158
- * @private
1159
- * @ui5-restricted Fiori Elements
1160
- */
1161
- Chart.prototype.update = function (oChanges) {
1162
- var oChart = this.getAggregation("_chart");
1163
-
1164
- if (oChart) {
1165
- this._update(oChart, oChanges);
1166
- } else if (this.oChartPromise) {
1167
- this.oChartPromise.then(function (oChart) {
1168
-
1169
- if (oChart) {
1170
- this._update(oChart, oChanges);
1171
- }
1172
- }.bind(this));
1173
- }
1174
- };
1175
-
1176
- /**
1177
- * Updates the inner chart
1178
- * @param {sap.chart.Chart} oChart the inner chart to update
1179
- * @param {object} oChanges Object containing the changes to update with
1180
- *
1181
- * @experimental
1182
- * @private
1183
- * @ui5-restricted Fiori Elements, sap.ui.mdc
1184
- */
1185
- Chart.prototype._update = function (oChart, oChanges) {
1186
-
1187
- var aItems = this.getItems(),
1188
- oVizItem,
1189
- oChartItem,
1190
- aVisibleMeasures = [],
1191
- aVisibleDimensions = [],
1192
- aInResultDimensions = [],
1193
- mDataPoints = {};
1194
-
1195
- if (oChanges.name === "ignoreToolbarActions" || oChanges.name === "p13nMode") {
1196
- //ToolbarHandler.updateToolbar(this);
1197
- return;
1198
- }
1199
-
1200
- if (oChanges.name === "data" && oChanges.type === "binding" && oChanges.mutation === "prepare" && oChanges.object.isA("sap.chart.Chart")) {
1201
- oChanges.bindingInfo.sorter = this._getSorters();
1202
- }
1203
-
1204
- this._aInResultProperties = [];
1205
-
1206
- for (var i = 0; i < aItems.length; i++) {
1207
- oChartItem = aItems[i];
1208
- oVizItem = oChartItem.getVizItemType() == "Measure" ? oChart.getMeasureByName(oChartItem.getKey()) : oChart.getDimensionByName(oChartItem.getKey());
1209
-
1210
- if (!oVizItem) {
1211
- continue;
1212
- }
1213
-
1214
- if (oChartItem.getVisible()) {
1215
-
1216
- if (oChartItem.getVizItemType() == "Measure") {
1217
- aVisibleMeasures.push(oVizItem.getName());
1218
-
1219
- if (oChartItem.getDataPoint()) {
1220
- mDataPoints[oVizItem.getName()] = oChartItem.getDataPoint();
1221
- }
1222
- } else {
1223
- aVisibleDimensions.push(oVizItem.getName());
1224
- }
1225
-
1226
- this._aInResultProperties.push(oVizItem.getName());
1227
- }
1228
-
1229
- //inResult only possible for dimensions
1230
- if (oChartItem.getVizItemType() == "Dimension") {
1231
-
1232
- if (oChartItem.getInResult()) {
1233
- aInResultDimensions.push(oVizItem.getName());
1234
- this._aInResultProperties.push(oVizItem.getName());
1235
- }
1236
- }
1237
- }
1238
-
1239
- var bRebind = false;
1240
-
1241
- if (!deepEqual(aVisibleDimensions, oChart.getVisibleDimensions())) {
1242
- oChart.setVisibleDimensions(aVisibleDimensions);
1243
- bRebind = true;
1244
- }
1245
-
1246
- if (!deepEqual(aVisibleMeasures, oChart.getVisibleMeasures())) {
1247
- oChart.setVisibleMeasures(aVisibleMeasures);
1248
- bRebind = true;
1249
- }
1250
-
1251
- if (!deepEqual(aInResultDimensions, oChart.getInResultDimensions())) {
1252
- oChart.setInResultDimensions(aInResultDimensions);
1253
- bRebind = true;
1254
- }
1255
-
1256
- // Update binding with sorters
1257
- if (bRebind) {
1258
- this.rebind();
1259
- this._updateSemanticalPattern(oChart, aVisibleMeasures, mDataPoints);
1260
- this._updateColoring(oChart, aVisibleDimensions, aVisibleMeasures);
1261
- }
1262
-
1263
- //TODO: Temporary Workaround
1264
- //TODO: Investigate for a onUpdate event. Could save us effort in attaching to inner chart events
1265
- if (DrillStackHandler && this.getAggregation("_breadcrumbs")) {
1266
- DrillStackHandler._updateDrillBreadcrumbs(this, this.getAggregation("_breadcrumbs"));
1267
- }
1268
-
1269
- };
1270
-
1271
- /**
1272
- * Updates the semantical pattern for given measures
1273
- *
1274
- * @param {sap.chart.Chart} oChart the inner chart
1275
- * @param {array} aVisibleMeasures array containing the visible measures on the inner chart
1276
- * @param {*} mDataPoints data points of the inner chart
1277
- *
1278
- * @experimental
1279
- * @private
1280
- * @ui5-restricted Fiori Elements, sap.ui.mdc
1281
- */
1282
- Chart.prototype._updateSemanticalPattern = function (oChart, aVisibleMeasures, mDataPoints) {
1283
-
1284
- for (var k = 0; k < aVisibleMeasures.length; k++) {
1285
- //first draft only with semantic pattern
1286
- var oDataPoint = mDataPoints[aVisibleMeasures[k]];
1287
-
1288
- if (oDataPoint) {
1289
-
1290
- if (oDataPoint.targetValue || oDataPoint.foreCastValue) {
1291
- var oActualMeasure = oChart.getMeasureByName(aVisibleMeasures[k]);
1292
-
1293
- oActualMeasure.setSemantics("actual");
1294
-
1295
- if (oDataPoint.targetValue != null) {
1296
- var oReferenceMeasure = oChart.getMeasureByName(oDataPoint.targetValue);
1297
-
1298
- if (oReferenceMeasure) {
1299
- oReferenceMeasure.setSemantics("reference");
1300
- } else {
1301
- Log.error("sap.ui.mdc.Chart: " + oDataPoint.targetValue + " is not a valid measure");
1302
- }
1303
- }
1304
-
1305
- if (oDataPoint.foreCastValue) {
1306
- var oProjectionMeasure = oChart.getMeasureByName(oDataPoint.foreCastValue);
1307
-
1308
- if (oProjectionMeasure) {
1309
- oProjectionMeasure.setSemantics("projected");
1310
- } else {
1311
- Log.error("sap.ui.comp.SmartChart: " + oDataPoint.ForecastValue.Path + " is not a valid measure");
1312
- }
1313
- }
1314
-
1315
- oActualMeasure.setSemanticallyRelatedMeasures({
1316
- referenceValueMeasure: oDataPoint.targetValue,
1317
- projectedValueMeasure: oDataPoint.foreCastValue
1318
- });
1319
- }
1320
- }
1321
- }
1322
- };
1323
-
1324
- /**
1325
- * Updates the coloring on the inner chart
1326
- * @param {sap.chart.Chart} oChart inner chart
1327
- * @param {array} aVisibleDimensions visible dimensions for inner chart
1328
- * @param {array} aVisibleMeasures visible measures for inner chart
1329
- *
1330
- * @experimental
1331
- * @private
1332
- * @ui5-restricted Fiori Elements
1333
- */
1334
- Chart.prototype._updateColoring = function (oChart, aVisibleDimensions, aVisibleMeasures, mDataPoints) {
1335
- var oColoring = this.getProperty("_colorings"), k;
1336
-
1337
- if (oColoring && oColoring.Criticality) {
1338
- var oActiveColoring;
1339
-
1340
- //dimensions overrule
1341
- for (k = 0; k < aVisibleDimensions.length; k++) {
1342
-
1343
- if (oColoring.Criticality.DimensionValues[aVisibleDimensions[k]]) {
1344
- oActiveColoring = {
1345
- coloring: "Criticality",
1346
- parameters: {
1347
- dimension: aVisibleDimensions[k]
1348
- }
1349
- };
1350
-
1351
- delete oColoring.Criticality.MeasureValues;
1352
- break;
1353
- }
1354
- }
1355
-
1356
- if (!oActiveColoring) {
1357
- delete oColoring.Criticality.DimensionValues;
1358
-
1359
- for (var sMeasure in oColoring.Criticality.MeasureValues) {
1360
-
1361
- if (aVisibleMeasures.indexOf(sMeasure) == -1) {
1362
- delete oColoring.Criticality.MeasureValues[sMeasure];
1363
- }
1364
- }
1365
-
1366
- oActiveColoring = {
1367
- coloring: "Criticality",
1368
- parameters: {
1369
- measure: aVisibleMeasures
1370
- }
1371
- };
1372
- }
1373
-
1374
- if (oActiveColoring) {
1375
- oChart.setColorings(oColoring);
1376
- oChart.setActiveColoring(oActiveColoring);
1377
- }
1378
- }
1379
- };
1380
-
1381
- Chart.prototype._prepareSelection = function () {
1382
- if (SelectionHandler) {
1383
- SelectionHandler.prepareChart(this);
1384
- } else {
1385
- this._oSelectionHandlerPromise = loadModules(["sap/ui/mdc/chart/SelectionHandler"]).then(function (aModules) {
1386
- SelectionHandler = aModules[0];
1387
-
1388
- if (this.bIsDestroyed) {
1389
- return;
1390
- }
1391
-
1392
- SelectionHandler.prepareChart(this);
1393
- }.bind(this));
1394
- }
1395
- };
1396
-
1397
- /**
1398
- * Returns sorters available for the data
1399
- *
1400
- * @returns {array} Array containing available sorters
1401
- *
1402
- * @experimental
1403
- * @private
1404
- * @ui5-restricted sap.ui.mdc
1405
- */
1406
- Chart.prototype._getSorters = function () {
1407
- var aSorters;
1408
- var aSorterProperties = this.getSortConditions() ? this.getSortConditions().sorters : [];
1409
-
1410
- aSorterProperties.forEach(function(oSortProp){
1411
- if (this._aInResultProperties.indexOf(oSortProp.name) != -1) {
1412
- var oSorter = new Sorter(oSortProp.name, oSortProp.descending);
1413
-
1414
- if (aSorters) {
1415
- aSorters.push(oSorter);
1416
- } else {
1417
- aSorters = [
1418
- oSorter
1419
- ];//[] has special meaning in sorting
1420
- }
1421
- }
1422
- }.bind(this));
1423
-
1424
- return aSorters;
1425
-
1426
- };
1427
-
1428
- /**
1429
- * Updates the delegate binding info and updates inner chart if necessary
1430
- *
1431
- * @experimental
1432
- * @private
1433
- * @ui5-restricted Fiori Elements, sap.ui.mdc
1434
- */
1435
- Chart.prototype.rebind = function() {
1436
- this.setBusy(true);
1437
-
1438
- //When autoBindOnInit = false, trigger everything on rebind
1439
- if (!this._bInnerChartInitialized) {
1440
- this._createChart(this._mStoredSettings, this._mStoredActions);
1441
- return;
1442
- }
1443
-
1444
- if (!this.bDelegateInitialized) {
1445
- return;
1446
- }
1447
-
1448
- var oBindingInfo = this.oDataInfo,
1449
- oDelegate = this.getControlDelegate();
1450
-
1451
- if (oDelegate) {
1452
- oDelegate.updateBindingInfo(this, oBindingInfo);
1453
- }
1454
-
1455
- if (!this.isInnerChartBound()) {
1456
- return;
1457
- }
1458
-
1459
- if (oBindingInfo) {
1460
-
1461
- //BindingInfo.filters = this._getFilterInfo().filters;
1462
- oBindingInfo.sorter = this._getSorters();
1463
- //TODO: Clarify why sap.ui.model.odata.v4.ODataListBinding.destroy this.bHasAnalyticalInfo is false
1464
- //TODO: on second call, as it leads to issues when changing layout options within the settings dialog.
1465
- //TODO: bHasAnalyticalInfo of inner chart binding should be true and in fact is true initially.
1466
- oBindingInfo.binding.bHasAnalyticalInfo = true;
1467
- }
1468
-
1469
- this.bindAggregation("data", oBindingInfo);
1470
- this._updateInnerChartNoDataText();
1471
- this._renderOverlay(false);
1472
- };
1473
-
1474
- /**
1475
- * Checks whether inner chart is bound
1476
- *
1477
- * @returns {boolean} true if bound, false if not
1478
- * @private
1479
- * @ui5-restricted Fiori Elements
1480
- */
1481
- Chart.prototype.isInnerChartBound = function() {
1482
- return this.getAggregation("_chart") ? this.getAggregation("_chart").isBound("data") : false;
1483
- };
1484
-
1485
- /**
1486
- * Callback for when fuilters changed
1487
- * Activates the overlay on the MDC Chart
1488
- *
1489
- * @param oEvent filter changed event
1490
- *
1491
- * @experimental
1492
- * @private
1493
- * @ui5-restricted Fiori Elements, sap.ui.mdc
1494
- */
1495
- Chart.prototype._onFiltersChanged = function(oEvent) {
1496
- if (this.isInnerChartBound() && oEvent.getParameter("conditionsBased")) {
1497
- this._renderOverlay(true);
1498
- }
1499
- };
1500
-
1501
- /**
1502
- * Adds/Removes the overlay shown above the inner chart
1503
- * @param {boolean} bShow true to show overlay, false to hide
1504
- *
1505
- * @experimental
1506
- * @private
1507
- * @ui5-restricted Fiori Elements, sap.ui.mdc
1508
- */
1509
- Chart.prototype._renderOverlay = function(bShow) {
1510
-
1511
- if (this.getAggregation("_chart")) {
1512
-
1513
- var $this = this.getAggregation("_chart").$(), $overlay = $this.find(".sapUiMdcChartOverlay");
1514
- if (bShow && $overlay.length === 0) {
1515
- $overlay = jQuery("<div>").addClass("sapUiOverlay sapUiMdcChartOverlay").css("z-index", "1");
1516
- $this.append($overlay);
1517
- } else if (!bShow) {
1518
- $overlay.remove();
1519
- }
1520
- }
1521
- };
1522
-
1523
- /**
1524
- * Sets the text shown for when there is no data for the chart
1525
- *
1526
- * @param {string} sNoData text to show when no data is shown
1527
- * @returns {*} reference to <code>this</code> for method chaining
1528
- *
1529
- * @experimental
1530
- * @private
1531
- * @ui5-restricted Fiori Elements
1532
- */
1533
- Chart.prototype.setNoDataText = function(sNoData) {
1534
- this.setProperty("noDataText", sNoData, true);
1535
- this._updateInnerChartNoDataText();
1536
- return this;
1537
- };
1538
-
1539
- //methods provided via FilterIntegrationMixin
1540
- Chart.prototype._onFilterProvided = function() {
1541
- this._updateInnerChartNoDataText();
1542
- };
1543
-
1544
- Chart.prototype._onFilterRemoved = function() {
1545
- this._updateInnerChartNoDataText();
1546
- };
1547
-
1548
- /**
1549
- * Updates the text shown when there is no data for the inner chart
1550
- *
1551
- * @experimental
1552
- * @private
1553
- * @ui5-restricted sap.ui.mdc
1554
- */
1555
- Chart.prototype._updateInnerChartNoDataText = function() {
1556
-
1557
- var oInnerChart = this.getAggregation("_chart");
1558
-
1559
- if (!oInnerChart) {
1560
- return;
1561
- }
1562
-
1563
- oInnerChart.setCustomMessages({
1564
- 'NO_DATA': this._getNoDataText()
1565
- });
1566
- };
1567
-
1568
- /**
1569
- * Gets the text shown for when there is no data on the inner chart
1570
- *
1571
- * @experimental
1572
- * @returns {string} text shown when data is missing
1573
- * @ui5-restricted sap.ui.mdc
1574
- */
1575
- Chart.prototype._getNoDataText = function() {
1576
- var sNoDataText = this.getNoDataText();
1577
- if (sNoDataText) {
1578
- return sNoDataText;
1579
- }
1580
-
1581
- var oRb = Core.getLibraryResourceBundle("sap.ui.mdc");
1582
-
1583
- if (!this.isInnerChartBound()) {
1584
- if (this.getFilter()) {
1585
- return oRb.getText("chart.NO_DATA_WITH_FILTERBAR");
1586
- }
1587
- return oRb.getText("chart.NO_DATA");
1588
- }
1589
-
1590
- return oRb.getText("chart.NO_RESULTS");
1591
- };
1592
-
1593
- /**
1594
- * Adds criticality to an item
1595
- *
1596
- * @param oItem item to add criticality to
1597
- *
1598
- * @experimental
1599
- * @private
1600
- * @ui5-restricted sap.ui.mdc
1601
- */
1602
- Chart.prototype._addCriticality = function (oItem) {
1603
- var oColoring = this.getProperty("_colorings");
1604
-
1605
- oColoring = oColoring || {
1606
- Criticality: {
1607
- DimensionValues: {},
1608
- MeasureValues: {}
1609
- }
1610
- };
1611
-
1612
- var mCrit = oItem.getCriticality(), mChartCrit = {};
1613
-
1614
- if (oItem.getVizItemType() == "Dimension") {
1615
-
1616
- for (var sKey in mCrit) {
1617
-
1618
- mChartCrit[sKey] = {
1619
- Values: mCrit[sKey]
1620
- };
1621
- }
1622
-
1623
- oColoring.Criticality.DimensionValues[oItem.getKey()] = mChartCrit;
1624
- } else {
1625
-
1626
- for (var sKey in mCrit) {
1627
- mChartCrit[sKey] = mCrit[sKey];
1628
- }
1629
-
1630
- oColoring.Criticality.MeasureValues[oItem.getKey()] = mChartCrit;
1631
- }
1632
-
1633
- this.setProperty("_colorings", oColoring);
1634
- };
1635
-
1636
- /**
1637
- * Gets the collection model from the binding information
1638
- * @returns {object} Object containing the binding information
1639
- *
1640
- * @experimental
1641
- * @private
1642
- * @ui5-restricted Fiori Elements
1643
- */
1644
- Chart.prototype.getCollectionModel = function () {
1645
- var oBindingInfo = this.getBindingInfo("data");
1646
- return oBindingInfo ? this.getModel(oBindingInfo.model) : null;
1647
- };
1648
-
1649
- /**
1650
- * Gets the collection path from the binding information
1651
- * @returns {string} path to collection
1652
- *
1653
- * @experimental
1654
- * @private
1655
- * @ui5-restricted Fiori Elements
1656
- */
1657
- Chart.prototype.getCollectionPath = function () {
1658
- var oBindingInfo = this.getBindingInfo("data");
1659
- return oBindingInfo ? oBindingInfo.path : null;
1660
- };
1661
-
1662
- /**
1663
- * Returns a Promise that resolves after the chart has been initialized after being created and after changing the type.
1664
- *
1665
- * @returns {Promise} A Promise that resolves after the chart has been initialized
1666
- *
1667
- * @experimental
1668
- * @private
1669
- * @ui5-restricted Fiori Elements
1670
- */
1671
- Chart.prototype.done = function () {
1672
- return this.oChartPromise;
1673
- };
1674
-
1675
- /**
1676
- * Returns a Promise that resolves after the chart has been initialized after being created and after changing the type.
1677
- *
1678
- * @returns {Promise} A Promise that resolves after the chart has been initialized
1679
- *
1680
- * @experimental
1681
- * @private
1682
- * @ui5-restricted Fiori Elements
1683
- */
1684
- Chart.prototype.initialized = function() {
1685
- return this.oChartPromise;
1686
- };
1687
-
1688
- var _getVisibleProperties = function (oChart) {
1689
- var aProperties = [];
1690
- if (oChart) {
1691
- oChart.getItems().forEach(function (oChartItem, iIndex) {
1692
- aProperties.push({
1693
- name: oChartItem.getKey(),
1694
- role: oChartItem.getRole()
1695
- });
1696
-
1697
- });
1698
- }
1699
- return aProperties;
1700
- };
1701
-
1702
- var _getSortedProperties = function(oChart) {
1703
- return oChart.getSortConditions() ? oChart.getSortConditions().sorters : [];
1704
- };
1705
-
1706
- /**
1707
- * Gets whether filtering is enabled for p13n
1708
- *
1709
- * @experimental
1710
- * @private
1711
- * @ui5-restricted Fiori Elements
1712
- */
1713
- Chart.prototype.isFilteringEnabled = function() {
1714
- var aP13nMode = this.getP13nMode() || [];
1715
- return aP13nMode.indexOf("Filter");
1716
- };
1717
-
1718
- /**
1719
- * Fetches the current state of the chart (as a JSON)
1720
- *
1721
- * @experimental
1722
- * @private
1723
- * @returns {Object} Current state of the chart
1724
- * @ui5-restricted Fiori Elements
1725
- */
1726
- Chart.prototype.getCurrentState = function() {
1727
- var oState = {};
1728
- var aP13nMode = this.getP13nMode();
1729
-
1730
- if (aP13nMode) {
1731
-
1732
- if (aP13nMode.indexOf("Item") > -1) {
1733
- oState.items = _getVisibleProperties(this);
1734
- }
1735
-
1736
- if (aP13nMode.indexOf("Sort") > -1) {
1737
- oState.sorters = _getSortedProperties(this);
1738
- }
1739
- }
1740
-
1741
- return oState;
1742
- };
1743
-
1744
- /**
1745
- * Sets the ShowChartTooltip Property
1746
- * @param {boolean} bValue new value
1747
- */
1748
- Chart.prototype.setShowChartTooltip = function (bValue) {
1749
- this.setProperty("showChartTooltip", bValue);
1750
- this._toggleChartTooltipVisibility(bValue);
1751
- return this;
1752
- };
1753
-
1754
- Chart.prototype._toggleChartTooltipVisibility = function(bFlag) {
1755
-
1756
- var oChart = this.getAggregation("_chart");
1757
-
1758
- if (oChart) {
1759
- this._setChartTooltipVisiblity(oChart, bFlag);
1760
- } else if (this.oChartPromise){
1761
- this.oChartPromise.then(function (oChart) {
1762
- this._setChartTooltipVisiblity(oChart, bFlag);
1763
- }.bind(this));
1764
- }
1765
- };
1766
-
1767
- Chart.prototype._setChartTooltipVisiblity = function(oChart, bFlag) {
1768
- if (bFlag) {
1769
- if (!this._vizTooltip) {
1770
- this._vizTooltip = new VizTooltip();
1771
- }
1772
- // Make this dynamic for setter calls
1773
- this._vizTooltip.connect(oChart.getVizUid());
1774
- } else {
1775
- if (this._vizTooltip) {
1776
- this._vizTooltip.destroy();
1777
- }
1778
- }
1779
- };
1780
-
1781
- /**
1782
- * This function is used by P13n to determine which chart type supports which layout options.
1783
- * There might be chart tyoes which do not support certain layout options (i.e. "Axis3").
1784
- * Layout config is defined as followed:
1785
- * {
1786
- * key: string //identifier for the chart type
1787
- * allowedLayoutOptions : [] //array containing allowed layout options as string
1788
- * }
1789
- *
1790
- * @returns {array}
1791
- */
1792
- Chart.prototype.getChartTypeLayoutConfig = function() {
1793
-
1794
- if (this._aChartTypeLayout) {
1795
- return this._aChartTypeLayout;
1796
- }
1797
-
1798
- var MDCRb = sap.ui.getCore().getLibraryResourceBundle("sap.ui.mdc");
1799
-
1800
- var aStandardSetup = [
1801
- {kind: "Dimension", availableRoles:[{key: MDCLib.ChartItemRoleType.category, text: MDCRb.getText('chart.PERSONALIZATION_DIALOG_CHARTROLE_CATEGORY')}, {key: MDCLib.ChartItemRoleType.series, text: MDCRb.getText('chart.PERSONALIZATION_DIALOG_CHARTROLE_SERIES')}]},
1802
- {kind: "Measure", availableRoles: [{key: MDCLib.ChartItemRoleType.axis1, text: MDCRb.getText('chart.PERSONALIZATION_DIALOG_CHARTROLE_AXIS1')}]}
1803
- ];
1804
-
1805
-
1806
- this._aChartTypeLayout = [
1807
- {key: "column", allowedLayoutOptions: [MDCLib.ChartItemRoleType.axis1, MDCLib.ChartItemRoleType.category, MDCLib.ChartItemRoleType.series], templateConfig: aStandardSetup},
1808
- {key: "bar", allowedLayoutOptions: [MDCLib.ChartItemRoleType.axis1, MDCLib.ChartItemRoleType.category, MDCLib.ChartItemRoleType.series], templateConfig: aStandardSetup},
1809
- {key: "dual_column", allowedLayoutOptions: [MDCLib.ChartItemRoleType.axis1, MDCLib.ChartItemRoleType.axis2, MDCLib.ChartItemRoleType.category, MDCLib.ChartItemRoleType.series], templateConfig: aStandardSetup}
1810
- ];
1811
- return this._aChartTypeLayout;
1812
- };
1813
-
1814
- Chart.prototype.getAdaptationUI = function() {
1815
-
1816
- var oLayoutConfig = this.getChartTypeLayoutConfig().find(function(it){return it.key === this.getChartType();}.bind(this));
1817
-
1818
- var oArguments = {panelConfig: oLayoutConfig};
1819
-
1820
- return Promise.resolve(new ChartItemPanel(oArguments));
1821
- };
1822
-
1823
- Chart.prototype.getAllowedRolesForKinds = function() {
1824
- return [
1825
- {kind: "Measure", allowedRoles: this._getLayoutOptionsForType("aggregatable")},
1826
- {kind: "Dimension", allowedRoles: this._getLayoutOptionsForType("groupable")}
1827
- ];
1828
- };
1829
-
1830
- Chart.prototype.onkeydown = function(oEvent) {
1831
- if (oEvent.isMarked()) {
1832
- return;
1833
- }
1834
-
1835
- if ((oEvent.metaKey || oEvent.ctrlKey) && oEvent.which === KeyCodes.COMMA) {
1836
- // CTRL (or Cmd) + COMMA key combination to open the table personalisation dialog
1837
- var oSettingsBtn = Core.byId(this.getId() + "-chart_settings");
1838
- if (oSettingsBtn && oSettingsBtn.getEnabled() && oSettingsBtn.getVisible()) {
1839
- oSettingsBtn.firePress();
1840
-
1841
- // Mark the event to ensure that parent handlers (e.g. FLP) can skip their processing if needed. Also prevent potential browser defaults
1842
- // (e.g. Cmd+, opens browser settings on Mac).
1843
- oEvent.setMarked();
1844
- oEvent.preventDefault();
1845
- }
1846
- }
1847
- };
1848
-
1849
- Chart.prototype.addAction = function(oControl) {
1850
- if (oControl.getMetadata().getName() !== "sap.ui.mdc.actiontoolbar.ActionToolbarAction") {
1851
- oControl = new ActionToolbarAction(oControl.getId() + "-action", {
1852
- action: oControl
1853
- });
1854
- }
1855
-
1856
- return Control.prototype.addAggregation.apply(this, ["actions", oControl]);
1857
- };
1858
- /**
1859
- * This returns the layout options for a specific type of Item (measure/dimension,groupable/aggregatable)
1860
- * It is used by p13n to determine which layout options to show in the p13n panel
1861
- * @param {string} sType the type for which the layout options are requested
1862
- */
1863
- Chart.prototype._getLayoutOptionsForType = function(sType){
1864
- var MDCRb = sap.ui.getCore().getLibraryResourceBundle("sap.ui.mdc");
1865
- var oAvailableRoles = {
1866
- groupable: [
1867
- {
1868
- key: MDCLib.ChartItemRoleType.category,
1869
- text: MDCRb.getText('chart.PERSONALIZATION_DIALOG_CHARTROLE_CATEGORY')
1870
- }, {
1871
- key: MDCLib.ChartItemRoleType.category2,
1872
- text: MDCRb.getText('chart.PERSONALIZATION_DIALOG_CHARTROLE_CATEGORY2')
1873
- }, {
1874
- key: MDCLib.ChartItemRoleType.series,
1875
- text: MDCRb.getText('chart.PERSONALIZATION_DIALOG_CHARTROLE_SERIES')
1876
- }
1877
- ],
1878
- aggregatable: [
1879
- {
1880
- key: MDCLib.ChartItemRoleType.axis1,
1881
- text: MDCRb.getText('chart.PERSONALIZATION_DIALOG_CHARTROLE_AXIS1')
1882
- }, {
1883
- key: MDCLib.ChartItemRoleType.axis2,
1884
- text: MDCRb.getText('chart.PERSONALIZATION_DIALOG_CHARTROLE_AXIS2')
1885
- }, {
1886
- key: MDCLib.ChartItemRoleType.axis3,
1887
- text: MDCRb.getText('chart.PERSONALIZATION_DIALOG_CHARTROLE_AXIS3')
1888
- }
1889
- ]
1890
- };
1891
- return oAvailableRoles[sType];
1892
- };
1111
+ return Control.prototype.addAggregation.apply(this, ["actions", oControl]);
1112
+ };
1893
1113
 
1894
- return Chart;
1895
- }, true);
1114
+ return Chart;
1115
+ });