@openui5/sap.ui.mdc 1.97.1 → 1.99.1

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 (263) hide show
  1. package/.reuse/dep5 +25 -30
  2. package/THIRDPARTY.txt +14 -21
  3. package/package.json +4 -4
  4. package/src/sap/ui/mdc/.library +1 -1
  5. package/src/sap/ui/mdc/ActionToolbar.js +6 -3
  6. package/src/sap/ui/mdc/AggregationBaseDelegate.js +2 -2
  7. package/src/sap/ui/mdc/BaseDelegate.js +1 -1
  8. package/src/sap/ui/mdc/Chart.js +1100 -1796
  9. package/src/sap/ui/mdc/ChartDelegate.js +429 -270
  10. package/src/sap/ui/mdc/ChartRenderer.js +73 -77
  11. package/src/sap/ui/mdc/Control.js +1 -1
  12. package/src/sap/ui/mdc/Element.js +1 -1
  13. package/src/sap/ui/mdc/Field.js +2 -2
  14. package/src/sap/ui/mdc/FilterBar.js +3 -2
  15. package/src/sap/ui/mdc/FilterField.js +11 -8
  16. package/src/sap/ui/mdc/Link.js +23 -4
  17. package/src/sap/ui/mdc/LinkDelegate.js +3 -3
  18. package/src/sap/ui/mdc/MultiValueField.js +20 -6
  19. package/src/sap/ui/mdc/Table.js +79 -64
  20. package/src/sap/ui/mdc/TableDelegate.js +40 -12
  21. package/src/sap/ui/mdc/ValueHelp.js +19 -9
  22. package/src/sap/ui/mdc/actiontoolbar/ActionToolbarAction.js +2 -2
  23. package/src/sap/ui/mdc/{chartNew/ChartSelectionDetailsNew.js → chart/ChartSelectionDetails.js} +8 -8
  24. package/src/sap/ui/mdc/{chartNew/ChartToolbarNew.js → chart/ChartToolbar.js} +49 -13
  25. package/src/sap/ui/mdc/chart/ChartTypeButton.js +55 -54
  26. package/src/sap/ui/mdc/{chartNew/DrillBreadcrumbsNew.js → chart/DrillBreadcrumbs.js} +3 -3
  27. package/src/sap/ui/mdc/chart/DrillStackHandler.js +38 -249
  28. package/src/sap/ui/mdc/chart/Item.js +62 -92
  29. package/src/sap/ui/mdc/{chartNew/PropertyHelperNew.js → chart/PropertyHelper.js} +3 -3
  30. package/src/sap/ui/mdc/chart/SelectionDetailsActions.js +17 -21
  31. package/src/sap/ui/mdc/condition/Condition.js +1 -1
  32. package/src/sap/ui/mdc/condition/ConditionConverter.js +1 -1
  33. package/src/sap/ui/mdc/condition/ConditionModel.js +1 -1
  34. package/src/sap/ui/mdc/condition/FilterConverter.js +1 -1
  35. package/src/sap/ui/mdc/condition/FilterOperatorUtil.js +256 -43
  36. package/src/sap/ui/mdc/condition/Operator.js +1 -1
  37. package/src/sap/ui/mdc/condition/OperatorDynamicDateOption.js +1 -1
  38. package/src/sap/ui/mdc/condition/RangeOperator.js +1 -1
  39. package/src/sap/ui/mdc/designtime/chart/Chart.designtime.js +80 -5
  40. package/src/sap/ui/mdc/designtime/field/Field.designtime.js +81 -5
  41. package/src/sap/ui/mdc/designtime/filterbar/FilterBarBase.designtime.js +3 -0
  42. package/src/sap/ui/mdc/designtime/table/Table.designtime.js +60 -20
  43. package/src/sap/ui/mdc/field/BoolFieldHelp.js +1 -1
  44. package/src/sap/ui/mdc/field/ConditionFieldHelp.js +1 -1
  45. package/src/sap/ui/mdc/field/ConditionType.js +3 -3
  46. package/src/sap/ui/mdc/field/ConditionsType.js +1 -1
  47. package/src/sap/ui/mdc/field/CustomFieldHelp.js +1 -1
  48. package/src/sap/ui/mdc/field/CustomFieldInfo.js +1 -1
  49. package/src/sap/ui/mdc/field/DefineConditionPanel.js +75 -27
  50. package/src/sap/ui/mdc/field/DynamicDateRangeConditionsType.js +4 -4
  51. package/src/sap/ui/mdc/field/FieldBase.js +32 -6
  52. package/src/sap/ui/mdc/field/FieldBaseRenderer.js +0 -3
  53. package/src/sap/ui/mdc/field/FieldHelpBase.js +2 -2
  54. package/src/sap/ui/mdc/field/FieldInfoBase.js +23 -10
  55. package/src/sap/ui/mdc/field/FieldInput.js +1 -1
  56. package/src/sap/ui/mdc/field/FieldInputRenderUtil.js +1 -1
  57. package/src/sap/ui/mdc/field/FieldMultiInput.js +1 -1
  58. package/src/sap/ui/mdc/field/FieldValueHelp.js +2 -2
  59. package/src/sap/ui/mdc/field/FieldValueHelpContentWrapperBase.js +1 -1
  60. package/src/sap/ui/mdc/field/FieldValueHelpMTableWrapper.js +1 -1
  61. package/src/sap/ui/mdc/field/FieldValueHelpMdcTableWrapper.js +2 -2
  62. package/src/sap/ui/mdc/field/FieldValueHelpTableWrapperBase.js +6 -3
  63. package/src/sap/ui/mdc/field/FieldValueHelpUITableWrapper.js +1 -1
  64. package/src/sap/ui/mdc/field/InParameter.js +1 -1
  65. package/src/sap/ui/mdc/field/ListFieldHelp.js +10 -2
  66. package/src/sap/ui/mdc/field/ListFieldHelpItem.js +1 -1
  67. package/src/sap/ui/mdc/field/MultiValueFieldItem.js +1 -1
  68. package/src/sap/ui/mdc/field/OutParameter.js +1 -1
  69. package/src/sap/ui/mdc/field/TokenDisplay.js +70 -0
  70. package/src/sap/ui/mdc/field/TokenDisplayRenderer.js +24 -0
  71. package/src/sap/ui/mdc/field/TokenizerDisplay.js +80 -0
  72. package/src/sap/ui/mdc/field/TokenizerDisplayRenderer.js +69 -0
  73. package/src/sap/ui/mdc/field/ValueHelpPanel.js +1 -1
  74. package/src/sap/ui/mdc/field/content/ContentFactory.js +5 -5
  75. package/src/sap/ui/mdc/field/content/DateContent.js +2 -2
  76. package/src/sap/ui/mdc/field/content/DefaultContent.js +35 -13
  77. package/src/sap/ui/mdc/field/content/LinkContent.js +1 -1
  78. package/src/sap/ui/mdc/filterbar/FilterBarBase.js +335 -126
  79. package/src/sap/ui/mdc/filterbar/FilterBarBaseRenderer.js +1 -1
  80. package/src/sap/ui/mdc/filterbar/PropertyHelper.js +1 -1
  81. package/src/sap/ui/mdc/filterbar/p13n/AdaptationFilterBar.js +8 -2
  82. package/src/sap/ui/mdc/filterbar/vh/CollectiveSearchSelect.js +3 -1
  83. package/src/sap/ui/mdc/filterbar/vh/FilterBar.js +7 -1
  84. package/src/sap/ui/mdc/filterbar/vh/GenericFilterBarDelegate.js +6 -6
  85. package/src/sap/ui/mdc/flexibility/AggregateFlex.js +2 -2
  86. package/src/sap/ui/mdc/flexibility/Chart.flexibility.js +6 -4
  87. package/src/sap/ui/mdc/flexibility/ColumnFlex.js +1 -1
  88. package/src/sap/ui/mdc/flexibility/FilterBar.flexibility.js +4 -3
  89. package/src/sap/ui/mdc/flexibility/FilterItemFlex.js +1 -1
  90. package/src/sap/ui/mdc/flexibility/GroupFlex.js +1 -1
  91. package/src/sap/ui/mdc/flexibility/Panel.flexibility.js +9 -3
  92. package/src/sap/ui/mdc/flexibility/PropertyInfoFlex.js +110 -0
  93. package/src/sap/ui/mdc/flexibility/SortFlex.js +2 -2
  94. package/src/sap/ui/mdc/flp/FlpLinkDelegate.js +6 -6
  95. package/src/sap/ui/mdc/library.js +45 -42
  96. package/src/sap/ui/mdc/link/ContactDetails.js +1 -1
  97. package/src/sap/ui/mdc/link/ContactDetailsAddressItem.js +1 -1
  98. package/src/sap/ui/mdc/link/ContactDetailsEmailItem.js +1 -1
  99. package/src/sap/ui/mdc/link/ContactDetailsItem.js +1 -1
  100. package/src/sap/ui/mdc/link/ContactDetailsPhoneItem.js +1 -1
  101. package/src/sap/ui/mdc/link/Factory.js +2 -2
  102. package/src/sap/ui/mdc/link/FakeFlpConnector.js +1 -1
  103. package/src/sap/ui/mdc/link/LinkItem.js +1 -1
  104. package/src/sap/ui/mdc/link/Log.js +1 -1
  105. package/src/sap/ui/mdc/link/Panel.js +140 -177
  106. package/src/sap/ui/mdc/link/PanelItem.js +1 -1
  107. package/src/sap/ui/mdc/link/PanelListItem.js +1 -1
  108. package/src/sap/ui/mdc/link/SemanticObjectMapping.js +1 -1
  109. package/src/sap/ui/mdc/link/SemanticObjectMappingItem.js +1 -1
  110. package/src/sap/ui/mdc/link/SemanticObjectUnavailableAction.js +1 -1
  111. package/src/sap/ui/mdc/messagebundle.properties +55 -1
  112. package/src/sap/ui/mdc/messagebundle_ar.properties +39 -4
  113. package/src/sap/ui/mdc/messagebundle_bg.properties +54 -19
  114. package/src/sap/ui/mdc/messagebundle_ca.properties +37 -2
  115. package/src/sap/ui/mdc/messagebundle_cs.properties +52 -17
  116. package/src/sap/ui/mdc/messagebundle_cy.properties +37 -2
  117. package/src/sap/ui/mdc/messagebundle_da.properties +44 -9
  118. package/src/sap/ui/mdc/messagebundle_de.properties +37 -2
  119. package/src/sap/ui/mdc/messagebundle_el.properties +38 -3
  120. package/src/sap/ui/mdc/messagebundle_en.properties +37 -2
  121. package/src/sap/ui/mdc/messagebundle_en_GB.properties +37 -2
  122. package/src/sap/ui/mdc/messagebundle_en_US_sappsd.properties +37 -2
  123. package/src/sap/ui/mdc/messagebundle_en_US_saprigi.properties +61 -4
  124. package/src/sap/ui/mdc/messagebundle_en_US_saptrc.properties +37 -2
  125. package/src/sap/ui/mdc/messagebundle_es.properties +37 -2
  126. package/src/sap/ui/mdc/messagebundle_es_MX.properties +51 -16
  127. package/src/sap/ui/mdc/messagebundle_et.properties +37 -2
  128. package/src/sap/ui/mdc/messagebundle_fi.properties +43 -8
  129. package/src/sap/ui/mdc/messagebundle_fr.properties +38 -3
  130. package/src/sap/ui/mdc/messagebundle_fr_CA.properties +37 -2
  131. package/src/sap/ui/mdc/messagebundle_hi.properties +38 -3
  132. package/src/sap/ui/mdc/messagebundle_hr.properties +37 -2
  133. package/src/sap/ui/mdc/messagebundle_hu.properties +37 -2
  134. package/src/sap/ui/mdc/messagebundle_id.properties +37 -2
  135. package/src/sap/ui/mdc/messagebundle_it.properties +53 -18
  136. package/src/sap/ui/mdc/messagebundle_iw.properties +38 -3
  137. package/src/sap/ui/mdc/messagebundle_ja.properties +37 -2
  138. package/src/sap/ui/mdc/messagebundle_kk.properties +37 -2
  139. package/src/sap/ui/mdc/messagebundle_ko.properties +41 -6
  140. package/src/sap/ui/mdc/messagebundle_lt.properties +37 -2
  141. package/src/sap/ui/mdc/messagebundle_lv.properties +41 -6
  142. package/src/sap/ui/mdc/messagebundle_ms.properties +37 -2
  143. package/src/sap/ui/mdc/messagebundle_nl.properties +42 -7
  144. package/src/sap/ui/mdc/messagebundle_no.properties +45 -10
  145. package/src/sap/ui/mdc/messagebundle_pl.properties +38 -3
  146. package/src/sap/ui/mdc/messagebundle_pt.properties +44 -9
  147. package/src/sap/ui/mdc/messagebundle_pt_PT.properties +37 -2
  148. package/src/sap/ui/mdc/messagebundle_ro.properties +37 -2
  149. package/src/sap/ui/mdc/messagebundle_ru.properties +37 -2
  150. package/src/sap/ui/mdc/messagebundle_sh.properties +37 -2
  151. package/src/sap/ui/mdc/messagebundle_sk.properties +37 -2
  152. package/src/sap/ui/mdc/messagebundle_sl.properties +37 -2
  153. package/src/sap/ui/mdc/messagebundle_sv.properties +39 -4
  154. package/src/sap/ui/mdc/messagebundle_th.properties +40 -5
  155. package/src/sap/ui/mdc/messagebundle_tr.properties +37 -2
  156. package/src/sap/ui/mdc/messagebundle_uk.properties +41 -6
  157. package/src/sap/ui/mdc/messagebundle_vi.properties +37 -2
  158. package/src/sap/ui/mdc/messagebundle_zh_CN.properties +37 -2
  159. package/src/sap/ui/mdc/messagebundle_zh_TW.properties +37 -2
  160. package/src/sap/ui/mdc/mixin/AdaptationMixin.js +19 -5
  161. package/src/sap/ui/mdc/mixin/DelegateMixin.js +2 -2
  162. package/src/sap/ui/mdc/mixin/FilterIntegrationMixin.js +14 -9
  163. package/src/sap/ui/mdc/mixin/PromiseMixin.js +2 -3
  164. package/src/sap/ui/mdc/odata/TypeUtil.js +1 -1
  165. package/src/sap/ui/mdc/odata/v4/ChartDelegate.js +29 -483
  166. package/src/sap/ui/mdc/odata/v4/{ChartPropertyHelperNew.js → ChartPropertyHelper.js} +5 -5
  167. package/src/sap/ui/mdc/odata/v4/TableDelegate.js +112 -96
  168. package/src/sap/ui/mdc/odata/v4/TypeUtil.js +1 -1
  169. package/src/sap/ui/mdc/odata/v4/util/DelegateUtil.js +1 -1
  170. package/src/sap/ui/mdc/odata/v4/vizChart/{ChartDelegateNew.js → ChartDelegate.js} +206 -116
  171. package/src/sap/ui/mdc/p13n/Engine.js +31 -13
  172. package/src/sap/ui/mdc/p13n/FlexUtil.js +11 -118
  173. package/src/sap/ui/mdc/p13n/P13nBuilder.js +7 -7
  174. package/src/sap/ui/mdc/p13n/PropertyHelper.js +1 -1
  175. package/src/sap/ui/mdc/p13n/StateUtil.js +20 -6
  176. package/src/sap/ui/mdc/p13n/UIManager.js +5 -7
  177. package/src/sap/ui/mdc/p13n/modification/FlexModificationHandler.js +4 -1
  178. package/src/sap/ui/mdc/p13n/modification/ModificationHandler.js +9 -6
  179. package/src/sap/ui/mdc/p13n/modules/DefaultProviderRegistry.js +1 -1
  180. package/src/sap/ui/mdc/p13n/panels/ChartItemPanel.js +1092 -48
  181. package/src/sap/ui/mdc/p13n/panels/LinkSelectionPanel.js +72 -0
  182. package/src/sap/ui/mdc/p13n/panels/ListView.js +6 -2
  183. package/src/sap/ui/mdc/p13n/subcontroller/AdaptFiltersController.js +6 -5
  184. package/src/sap/ui/mdc/p13n/subcontroller/BaseController.js +156 -11
  185. package/src/sap/ui/mdc/p13n/subcontroller/ChartItemController.js +15 -26
  186. package/src/sap/ui/mdc/p13n/subcontroller/ColumnController.js +6 -5
  187. package/src/sap/ui/mdc/p13n/subcontroller/FilterController.js +14 -7
  188. package/src/sap/ui/mdc/p13n/subcontroller/LinkPanelController.js +173 -0
  189. package/src/sap/ui/mdc/p13n/subcontroller/SortController.js +10 -17
  190. package/src/sap/ui/mdc/table/Column.js +12 -12
  191. package/src/sap/ui/mdc/table/CreationRow.js +11 -11
  192. package/src/sap/ui/mdc/table/GridTableType.js +5 -6
  193. package/src/sap/ui/mdc/table/PropertyHelper.js +44 -7
  194. package/src/sap/ui/mdc/table/ResponsiveTableType.js +8 -10
  195. package/src/sap/ui/mdc/table/RowSettings.js +4 -4
  196. package/src/sap/ui/mdc/table/TableTypeBase.js +2 -2
  197. package/src/sap/ui/mdc/table/V4AnalyticsPropertyHelper.js +1 -1
  198. package/src/sap/ui/mdc/themes/base/FieldBase.less +0 -5
  199. package/src/sap/ui/mdc/themes/base/TokenDisplay.less +89 -0
  200. package/src/sap/ui/mdc/themes/base/TokenizerDisplay.less +90 -0
  201. package/src/sap/ui/mdc/themes/base/ValueHelpDialog.less +15 -4
  202. package/src/sap/ui/mdc/themes/base/library.source.less +2 -0
  203. package/src/sap/ui/mdc/ui/Container.js +2 -2
  204. package/src/sap/ui/mdc/ui/ContainerItem.js +2 -2
  205. package/src/sap/ui/mdc/util/Common.js +1 -1
  206. package/src/sap/ui/mdc/util/DateUtil.js +1 -1
  207. package/src/sap/ui/mdc/util/FilterUtil.js +1 -1
  208. package/src/sap/ui/mdc/util/FormatUtil.js +3 -3
  209. package/src/sap/ui/mdc/util/IdentifierUtil.js +6 -6
  210. package/src/sap/ui/mdc/util/PromiseCache.js +1 -1
  211. package/src/sap/ui/mdc/util/PropertyHelper.js +43 -12
  212. package/src/sap/ui/mdc/util/TypeUtil.js +5 -4
  213. package/src/sap/ui/mdc/valuehelp/Dialog.js +11 -8
  214. package/src/sap/ui/mdc/valuehelp/Popover.js +2 -1
  215. package/src/sap/ui/mdc/valuehelp/base/Container.js +2 -1
  216. package/src/sap/ui/mdc/valuehelp/base/Content.js +2 -1
  217. package/src/sap/ui/mdc/valuehelp/base/DialogTab.js +2 -1
  218. package/src/sap/ui/mdc/valuehelp/base/FilterableListContent.js +2 -1
  219. package/src/sap/ui/mdc/valuehelp/base/ListContent.js +2 -1
  220. package/src/sap/ui/mdc/valuehelp/content/Bool.js +2 -1
  221. package/src/sap/ui/mdc/valuehelp/content/Conditions.js +4 -2
  222. package/src/sap/ui/mdc/valuehelp/content/FixedList.js +11 -5
  223. package/src/sap/ui/mdc/valuehelp/content/MDCTable.js +43 -8
  224. package/src/sap/ui/mdc/valuehelp/content/MTable.js +43 -24
  225. package/test/sap/ui/mdc/testutils/opa/TestLibrary.js +3 -1
  226. package/test/sap/ui/mdc/testutils/opa/actions/OpenContextMenu.js +3 -3
  227. package/test/sap/ui/mdc/testutils/opa/{chartNew → chart}/ActionsBase.js +3 -3
  228. package/test/sap/ui/mdc/testutils/opa/{chartNew → chart}/ActionsViz.js +0 -0
  229. package/test/sap/ui/mdc/testutils/opa/{chartNew → chart}/AssertionsBase.js +1 -1
  230. package/test/sap/ui/mdc/testutils/opa/{chartNew → chart}/AssertionsViz.js +0 -0
  231. package/test/sap/ui/mdc/testutils/opa/{chartNew → chart}/ChartNew.js +0 -0
  232. package/test/sap/ui/mdc/testutils/opa/chart/TestObjects.js +289 -0
  233. package/test/sap/ui/mdc/testutils/opa/chartNew/TestObjects.js +7 -7
  234. package/test/sap/ui/mdc/testutils/opa/filterbar/TestObjects.js +9 -9
  235. package/test/sap/ui/mdc/testutils/opa/filterbar/Util.js +12 -11
  236. package/test/sap/ui/mdc/testutils/opa/link/Actions.js +85 -0
  237. package/test/sap/ui/mdc/testutils/opa/link/Assertions.js +79 -0
  238. package/test/sap/ui/mdc/testutils/opa/link/TestObjects.js +112 -0
  239. package/test/sap/ui/mdc/testutils/opa/link/waitForLink.js +50 -0
  240. package/test/sap/ui/mdc/testutils/opa/p13n/Actions.js +261 -138
  241. package/test/sap/ui/mdc/testutils/opa/p13n/Util.js +27 -26
  242. package/test/sap/ui/mdc/testutils/opa/valueHelp/Actions.js +54 -0
  243. package/test/sap/ui/mdc/testutils/opa/valueHelp/Assertions.js +5 -0
  244. package/test/sap/ui/mdc/testutils/opa/valueHelp/TestObjects.js +40 -0
  245. package/test/sap/ui/mdc/testutils/opa/valueHelp/Util.js +28 -0
  246. package/src/sap/ui/mdc/ChartDelegateNew.js +0 -395
  247. package/src/sap/ui/mdc/ChartNew.js +0 -1114
  248. package/src/sap/ui/mdc/ChartNewRenderer.js +0 -91
  249. package/src/sap/ui/mdc/chart/DimensionItem.js +0 -281
  250. package/src/sap/ui/mdc/chart/MeasureItem.js +0 -318
  251. package/src/sap/ui/mdc/chart/MetadataDelegate.js +0 -31
  252. package/src/sap/ui/mdc/chart/SelectionHandler.js +0 -127
  253. package/src/sap/ui/mdc/chart/ToolbarHandler.js +0 -328
  254. package/src/sap/ui/mdc/chartNew/ChartTypeButtonNew.js +0 -295
  255. package/src/sap/ui/mdc/chartNew/DrillStackHandlerNew.js +0 -212
  256. package/src/sap/ui/mdc/chartNew/ItemNew.js +0 -72
  257. package/src/sap/ui/mdc/chartNew/SelectionDetailsActionsNew.js +0 -34
  258. package/src/sap/ui/mdc/designtime/chart/ChartNew.designtime.js +0 -91
  259. package/src/sap/ui/mdc/link/SelectionDialog.control.xml +0 -66
  260. package/src/sap/ui/mdc/link/SelectionDialog.js +0 -213
  261. package/src/sap/ui/mdc/link/SelectionDialogItem.js +0 -86
  262. package/src/sap/ui/mdc/odata/v4/ChartDelegateNew.js +0 -35
  263. package/src/sap/ui/mdc/p13n/panels/ChartItemPanelNew.js +0 -1179
@@ -5,93 +5,80 @@
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.97.1
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/FilterController",
23
+ "sap/ui/mdc/p13n/subcontroller/SortController",
24
+ "sap/ui/base/ManagedObjectObserver",
25
+ "sap/ui/mdc/chart/DrillBreadcrumbs",
26
+ "sap/ui/mdc/actiontoolbar/ActionToolbarAction"
27
+ ],
28
+ function (
29
+ Core,
30
+ Control,
31
+ ChartSettings,
32
+ loadModules,
33
+ ChartRenderer,
34
+ MDCLib,
35
+ Text,
36
+ VBox,
37
+ Log,
38
+ ChartToolbar,
39
+ PropertyHelper,
40
+ FilterIntegrationMixin,
41
+ ManagedObjectModel,
42
+ ChartItemController,
43
+ FilterController,
44
+ SortController,
45
+ ManagedObjectObserver,
46
+ Breadcrumbs,
47
+ ActionToolbarAction
48
+ ) {
49
+ "use strict";
50
+
51
+ var DrillStackHandler;
52
+
53
+ /**
54
+ * Constructor for a new Chart.
55
+ *
56
+ * @param {string} [sId] id for the new control, generated automatically if no id is given
57
+ * @param {object} [mSettings] initial settings for the new control
58
+ * @class The Chart control creates a chart based on metadata and the configuration specified.
59
+ * @extends sap.ui.mdc.Control
60
+ * @author SAP SE
61
+ * @version 1.99.1
62
+ * @constructor
63
+ * @experimental As of version ...
64
+ * @private
65
+ * @ui5-restricted sap.fe
66
+ * @MDC_PUBLIC_CANDIDATE
67
+ * @since 1.88
68
+ * @alias sap.ui.mdc.Chart
69
+ * @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
70
+ */
71
+ var Chart = Control.extend("sap.ui.mdc.Chart", /** @lends sap.ui.mdc.Chart.prototype */ {
72
+ metadata: {
73
+ library: "sap.ui.mdc",
74
+ designtime: "sap/ui/mdc/designtime/chart/Chart.designtime",
75
+ interfaces: [
76
+ "sap.ui.mdc.IFilterSource",
77
+ "sap.ui.mdc.IxState"
78
+ ],
79
+ defaultAggregation: "items",
80
+ properties: {
81
+ /**
95
82
  * Defines the width of the chart.
96
83
  */
97
84
  width: {
@@ -109,1787 +96,1104 @@ sap.ui.define([
109
96
  defaultValue: "100%",
110
97
  invalidate: true
111
98
  },
99
+ /**
100
+ * Defines the module path of the metadata delegate.
101
+ */
102
+ delegate: {
103
+ type: "object",
104
+ group: "Data",
105
+ defaultValue: {
106
+ name: "sap/ui/mdc/ChartDelegate"
107
+ }
108
+ },
109
+ /**
110
+ * Specifies header text that is shown in chart
111
+ */
112
+ header: {
113
+ type: "string",
114
+ group: "Misc",
115
+ defaultValue: null
116
+ },
117
+ /**
118
+ * Defines the no data text shown in the chart.
119
+ * @since 1.88
120
+ */
121
+ noDataText: {
122
+ type: "string",
123
+ defaultValue: "No data"
124
+ },
125
+ /**
126
+ * Specifies the personalization options available for the chart.<br>
127
+ * <b>Note:</b> The order of the provided options does not influence the arrangement of the icons on the UI.
128
+ *
129
+ * @since 1.88
130
+ */
131
+ p13nMode: {
132
+ type: "sap.ui.mdc.ChartP13nMode[]",
133
+ defaultValue: []
134
+ },
135
+
136
+ /**
137
+ * Set chart's legend properties.
138
+ *
139
+ * @since 1.88
140
+ */
141
+ legendVisible: {
142
+ type: "boolean",
143
+ group: "Misc",
144
+ defaultValue: true
145
+ },
146
+ /**
147
+ * Specifies which actions should not be available in the chart's toolbar.
148
+ *
149
+ * @since 1.88
150
+ */
151
+ ignoreToolbarActions: {
152
+ type: "sap.ui.mdc.ChartToolbarActionType[]",
153
+ defaultValue: []
154
+ },
155
+ //TODO: Do we really need this? Should be avoided.
156
+ /**
157
+ * The minimal width
158
+ */
159
+ minWidth: {
160
+ type: "sap.ui.core.CSSSize",
161
+ group: "Dimension",
162
+ defaultValue: "240px",
163
+ invalidate: true
164
+ },
165
+ //TODO: Do we really need this? Should be avoided.
166
+ /**
167
+ * The minimal height
168
+ */
169
+ minHeight: {
170
+ type: "sap.ui.core.CSSSize",
171
+ group: "Dimension",
172
+ defaultValue: "400px",
173
+ invalidate: true
174
+ },
175
+ /**
176
+ * Defines the sort conditions.
177
+ *
178
+ * <b>Note:</b> This property is exclusively used for handling flexibility changes. Do not use it for anything else.
179
+ *
180
+ * @since 1.88
181
+ */
182
+ sortConditions: {
183
+ type: "object"
184
+ },
185
+ /**
186
+ * Defines the filter conditions.
187
+ *
188
+ * <b>Note:</b> This property is exclusively used for handling flexibility changes. Do not use it for anything else.
189
+ *
190
+ * @since 1.99
191
+ */
192
+ filterConditions: {
193
+ type: "object"
194
+ },
195
+ /**
196
+ * Controls the visibility of the chart tooltip. If set to <code>true </code>, an instance of sap.viz.ui5.controls.VizTooltip will
197
+ * be created and shown when hovering over a data point.
198
+ *
199
+ * @since 1.88
200
+ */
201
+ showChartTooltip: {
202
+ type: "boolean",
203
+ group: "Misc",
204
+ defaultValue: true
205
+ },
206
+ /**
207
+ * Binds the chart automatically after the initial creation of the chart
208
+ */
209
+ autoBindOnInit: {
210
+ type: "boolean",
211
+ group: "Misc",
212
+ defaultValue: true
213
+ },
214
+
215
+ /**
216
+ * Specifies the type of chart to be created by the SmartChart control.
217
+ */
218
+ chartType: {
219
+ type: "string",
220
+ group: "Misc",
221
+ defaultValue: "column"
222
+ },
223
+ showSelectionDetails: {
224
+ type: "boolean",
225
+ group: "Misc",
226
+ defaultValue: true
227
+ }
228
+ },
229
+ aggregations: {
230
+ items: {
231
+ type: "sap.ui.mdc.chart.Item",
232
+ multiple: true
233
+ },
234
+ actions: {
235
+ type: "sap.ui.core.Control",
236
+ multiple: true,
237
+ forwarding: {
238
+ getter: "_getToolbar",
239
+ aggregation: "actions"
240
+ }
241
+ },
242
+ _toolbar: {
243
+ type: "sap.ui.mdc.chart.ChartToolbar",
244
+ multiple: false,
245
+ visibility: "hidden"
246
+ },
247
+ _breadcrumbs: {
248
+ type: "sap.m.Breadcrumbs",
249
+ multiple: false,
250
+ visibility: "hidden"
251
+ },
252
+ _innerChart: {
253
+ type: "sap.ui.core.Control",
254
+ multiple: false,
255
+ visibility: "hidden"
256
+ },
257
+ selectionDetailsActions: {
258
+ type: "sap.ui.mdc.chart.SelectionDetailsActions",
259
+ multiple: false
260
+ },
261
+ /**
262
+ * <code>VariantManagement<code> control for the chart.
263
+ */
264
+ variant: {
265
+ type: "sap.ui.fl.variants.VariantManagement",
266
+ multiple: false
267
+ }
268
+ },
269
+ associations: {
270
+ /**
271
+ * Control or object which enables the chart to do filtering, such as {@link sap.ui.mdc.FilterBar}.
272
+ * Also see {@link sap.ui.mdc.IFilter}.
273
+ *
274
+ * @since 1.88
275
+ */
276
+ filter: {
277
+ type: "sap.ui.mdc.IFilter",
278
+ multiple: false
279
+ }
280
+ },
281
+ events: {
282
+ /**
283
+ * This event is fired when a SelectionDetailsAction is pressed.
284
+ */
285
+ selectionDetailsActionPressed: {
286
+ parameters: {
112
287
 
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
- },
288
+ /**
289
+ * The action that has to be processed once the action has been pressed
290
+ */
291
+ action: {
292
+ type: "sap.ui.core.Item"
293
+ },
210
294
 
211
- /**
212
- * The minimal width
213
- */
214
- minWidth: {
215
- type: "sap.ui.core.CSSSize",
216
- group: "Dimension",
217
- defaultValue: "240px",
218
- invalidate: true
219
- },
295
+ /**
296
+ * If the action is pressed on one of the {@link sap.m.SelectionDetailsItem items}, the parameter contains the
297
+ * {@link sap.ui.model.Context context} of the pressed {@link sap.m.SelectionDetailsItem item}. If a custom action or action
298
+ * group of the SelectionDetails popover is pressed, this parameter contains all {@link sap.ui.model.Context contexts} of the
299
+ * {@link sap.m.SelectionDetailsItem items}.
300
+ */
301
+ itemContexts: {
302
+ type: "sap.ui.model.Context"
303
+ },
220
304
 
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
305
  /**
351
- * The context of selected / deselected data points
306
+ * The action level of action buttons. The available levels are Item, List and Group
307
+ */
308
+ level: {
309
+ type: "sap.m.SelectionDetailsActionLevel"
310
+ }
311
+ }
312
+ },
313
+ /**
314
+ * This event is fired when a data load on the inner chart completes
315
+ */
316
+ innerChartLoadedData: {
317
+ parameters: {
318
+ /**
319
+ * Reference to the inner chart
352
320
  */
353
- dataContext: {
354
- type: "object"
321
+ innerChart: {
322
+ type: "sap.ui.core.Control"
355
323
  }
356
324
  }
357
325
  }
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
- }
374
-
375
- vValue = vValue || this.getSelectionMode();
376
- oChart.setSelectionMode(vValue);
377
-
378
- if (vValue !== "NONE") {
379
- this._prepareSelection();
380
- }
381
-
382
- }.bind(this));
383
- };
384
-
385
- FilterIntegrationMixin.call(Chart.prototype);
326
+ }
327
+ },
328
+
329
+ renderer: ChartRenderer
330
+ });
331
+
332
+ FilterIntegrationMixin.call(Chart.prototype);
333
+
334
+ /**
335
+ * Initialises the MDC Chart
336
+ *
337
+ * @experimental
338
+ * @private
339
+ * @ui5-restricted sap.ui.mdc
340
+ */
341
+ Chart.prototype.init = function () {
342
+ this._oManagedObjectModel = new ManagedObjectModel(this);
343
+ this.setModel(this._oManagedObjectModel, "$mdcChart");
344
+ this._bNewP13n = true;//TODO: remove with migration
345
+ Control.prototype.init.apply(this, arguments);
346
+ };
347
+
348
+ Chart.prototype.setP13nMode = function(aMode) {
349
+ var aSortedKeys = null;
350
+ if (aMode && aMode.length >= 1){
351
+ aSortedKeys = [];
352
+ var mKeys = aMode.reduce(function(mMap, sKey, iIndex){
353
+ mMap[sKey] = true;
354
+ return mMap;
355
+ }, {});
356
+
357
+ //as the p13nMode has no strict order we need to ensure the order of tabs here
358
+ if (mKeys.Item) {
359
+ aSortedKeys.push("Item");
360
+ }
361
+ if (mKeys.Sort) {
362
+ aSortedKeys.push("Sort");
363
+ }
364
+ if (mKeys.Filter) {
365
+ aSortedKeys.push("Filter");
366
+ }
367
+ if (mKeys.Type) {
368
+ this._typeBtnActive = true;
369
+ } else {
370
+ this._typeBtnActive = false;
371
+ }
372
+ } else {
373
+ aSortedKeys = aMode;
374
+ }
375
+
376
+ this.setProperty("p13nMode", aSortedKeys, true);
377
+
378
+ this._updateAdaptation(this.getP13nMode());
379
+
380
+ return this;
381
+ };
382
+
383
+ Chart.prototype._updateAdaptation = function(aMode) {
384
+ var oRegisterConfig = {
385
+ controller: {}
386
+ };
387
+
388
+ var mRegistryOptions = {
389
+ Item: ChartItemController,
390
+ Sort: SortController,
391
+ Filter: FilterController
392
+ };
393
+
394
+ if (aMode && aMode.length > 0) {
395
+ aMode.forEach(function(sMode){
396
+ var sKey = sMode;
397
+ var oController = mRegistryOptions[sMode];
398
+ if (oController) {
399
+ oRegisterConfig.controller[sKey] = oController;
400
+ }
401
+ });
402
+
403
+ this.getEngine().registerAdaptation(this, oRegisterConfig);
404
+ }
405
+
406
+ };
407
+
408
+
409
+ Chart.prototype.isFilteringEnabled = function() {
410
+ return this.getP13nMode().indexOf("Filter") > -1;
411
+ };
412
+
413
+ Chart.prototype.setFilterConditions = function(mConditions) {
414
+ this.setProperty("filterConditions", mConditions, true);
415
+
416
+ var oP13nFilter = this.getInbuiltFilter();
417
+ if (oP13nFilter) {
418
+ oP13nFilter.setFilterConditions(mConditions);
419
+ }
420
+
421
+ return this;
422
+ };
423
+
424
+ Chart.prototype.getConditions = function() {
425
+ //may only return conditions if the inner FilterBar has already been initialized
426
+ return this.getInbuiltFilter() ? this.getInbuiltFilter().getConditions() : [];
427
+ };
428
+
429
+ Chart.prototype._registerInnerFilter = function(oFilter) {
430
+ oFilter.attachSearch(function() {
431
+ this._rebind();
432
+ }, this);
433
+ };
434
+
435
+ /**
436
+ * Applies given settings onto the MDC Chart, loads the delegate and initializes the MDC Chart
437
+ *
438
+ * @param {*} mSettings settings to apply
439
+ *
440
+ * @experimental
441
+ * @private
442
+ * @ui5-restricted sap.ui.mdc
443
+ */
444
+ Chart.prototype.applySettings = function (mSettings, oScope) {
445
+ Control.prototype.applySettings.apply(this, arguments);
446
+
447
+ this.initializedPromise = new Promise(function (resolve, reject) {
448
+ this._fnResolveInitialized = resolve;
449
+ this._fnRejectInitialized = reject;
450
+ }.bind(this));
386
451
 
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);
452
+ this.innerChartBoundPromise = new Promise(function (resolve, reject) {
453
+ this._fnResolveInnerChartBound = resolve;
454
+ this._fnRejectInnerChartBound = reject;
455
+ }.bind(this));
409
456
 
410
- };
457
+ //load required modules before init of inner controls
458
+ var pLoadDelegate = this._loadDelegate().then(function(oDelegate){
459
+ return oDelegate;
460
+ }).then(function(oDelegate){
461
+ return this.initControlDelegate(oDelegate);
462
+ }.bind(this)).catch(function (error) {
463
+ this._fnRejectInitialized(error);
464
+ }.bind(this));
411
465
 
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
- };
466
+ var aInitPromises = [
467
+ pLoadDelegate
468
+ ];
427
469
 
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
- }
470
+ if (this.isFilteringEnabled()) {
471
+ aInitPromises.push(this.retrieveInbuiltFilter());
472
+ }
459
473
 
460
- if (!this._oToolbarHandler) {
461
- this._oToolbarHandler = new ToolbarHandler();
462
- }
474
+ Promise.all(aInitPromises).then(function(){
475
+ this._initInnerControls();
476
+ }.bind(this));
463
477
 
464
- var oManagedObj = Control.prototype.applySettings.apply(this, arguments);
465
- this._tempResolve;
466
- this._tempReject;
478
+ };
467
479
 
468
- this.oChartPromise = new SyncPromise(function(resolve, reject) {
469
- this._tempResolve = resolve;
470
- this._tempReject = reject;
471
- }.bind(this));
480
+ /**
481
+ * Initializes the inner controls of the MDC Chart (toolbar, inner chart)
482
+ * Inner chart is initialized via the delegate
483
+ */
484
+ Chart.prototype._initInnerControls = function () {
485
+ this.getControlDelegate().initializeInnerChart(this).then(function (oInnerChart) {
472
486
 
473
- var oRegisterConfig = {};
474
- oRegisterConfig.controller = {};
487
+ this.setBusyIndicatorDelay(0);
475
488
 
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
- });
489
+ this.getControlDelegate().createInitialChartContent(this);
490
+ this._renderOverlay(true);
485
491
 
486
- this.getEngine().registerAdaptation(this, oRegisterConfig);
492
+ if (this.getAutoBindOnInit()) {
493
+ this.setBusy(true);
494
+ this._createContentfromPropertyInfos();
495
+ }
487
496
 
497
+ this.setAggregation("_innerChart", oInnerChart);
488
498
 
489
- if (this.getAutoBindOnInit()){
490
- this._createChart(mSettings, aActions);
491
- } else {
492
- this._mStoredSettings = mSettings;
493
- this._mStoredActions = aActions;
499
+ this._bInnerChartReady = true;
494
500
 
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
- }
501
+ this._fnResolveInitialized();
502
+ // eslint-disable-next-line no-empty
503
+ this.invalidate();
504
+ }.bind(this)).catch(function (error) {
505
+ this._fnRejectInitialized(error);
506
+ }.bind(this));
499
507
 
500
- return oManagedObj;
508
+ //independent from fetchProperties
509
+ this._getToolbar().createToolbarContent(this);
510
+ };
511
+
512
+ /**
513
+ * Creates the content for the inner chart from properties.
514
+ * The properties are given via the PropertyHelper which is initialized here.
515
+ * The rest of the creation of the content for the inner chart is done in the delegate.
516
+ * Also creates the breadcrumbs.
517
+ *
518
+ * Is called during init when autoBindOnInit = "true", if "false" then this is called by _rebind()
519
+ */
520
+ Chart.prototype._createContentfromPropertyInfos = function () {
521
+ this.initPropertyHelper(PropertyHelper).then(function () {
522
+ //Create content on inner chart instance
523
+ this.getControlDelegate().createInnerChartContent(this, this._innerChartDataLoadComplete.bind(this));
524
+
525
+ this._createBreadcrumbs();
526
+ //From now on, listen to changes on Items Aggregation and sync them with inner chart
527
+ this._oObserver = new ManagedObjectObserver(this._propagateItemChangeToInnerChart.bind(this));
528
+ this._oObserver.observe(this, {
529
+ aggregations: [
530
+ "items"
531
+ ]
532
+ });
533
+
534
+ //Sync MDC Chart properties with inner chart
535
+ this._propagatePropertiesToInnerChart();
536
+
537
+ this._fnResolveInnerChartBound();
501
538
 
502
- };
539
+ }.bind(this));
503
540
 
504
- Chart.prototype._getToolbar = function(){
505
- if (!this.getAggregation("_toolbar")){
506
- this._oToolbarHandler.createToolbar(this);
507
- }
541
+ };
508
542
 
509
- return this.getAggregation("_toolbar");
510
- };
543
+ Chart.prototype.setHeight = function(iHeight) {
544
+ try {
545
+ this.getControlDelegate().adjustChartHeight(this);
546
+ } catch (oError) {
547
+ //No need to do anything as correct height will be calculated anyways once inner chart is ready
548
+ }
511
549
 
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
- };
550
+ this.setProperty("height", iHeight);
532
551
 
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
- }
552
+ return this;
553
+ };
562
554
 
563
- return this.getControlDelegate().fetchProperties(this);
564
- }.bind(this))
555
+ Chart.prototype._createBreadcrumbs = function () {
556
+ this._oBreadcrumbs = new Breadcrumbs(this.getId() + "--breadcrumbs");
557
+ this._oBreadcrumbs.updateDrillBreadcrumbs(this, this.getControlDelegate().getDrillableItems(this));
558
+ this.setAggregation("_breadcrumbs", this._oBreadcrumbs);
565
559
 
566
- .then(function createInnerChart(aProperties) {
560
+ this._oBreadcrumbs.addEventDelegate({
561
+ onAfterRendering: function() {
562
+ this.getControlDelegate().adjustChartHeight(this);
563
+ }.bind(this)
564
+ });
565
+ };
567
566
 
568
- if (this.bIsDestroyed) {
569
- return SyncPromise.reject();
570
- }
567
+ /**
568
+ * Loads the delegate for the MDC Chart
569
+ * @returns {Promise} resolved when delegate is loaded
570
+ */
571
+ Chart.prototype._loadDelegate = function () {
571
572
 
572
- var mItems = {};
573
- aProperties.forEach(function(oProperty) {
574
- mItems[oProperty.name] = oProperty;
575
- });
573
+ return new Promise(function (resolve) {
574
+ var aNotLoadedModulePaths = [this.getDelegate().name];
576
575
 
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
- }
576
+ function onModulesLoadedSuccess(oDelegate) {
577
+ resolve(oDelegate);
578
+ }
582
579
 
583
- return this._createInnerChart(mSettings, mItems);
584
- }.bind(this))
580
+ sap.ui.require(aNotLoadedModulePaths, onModulesLoadedSuccess);
581
+ }.bind(this));
585
582
 
586
- .then(function createDrillBreadcrumbs(oInnerChart) {
583
+ };
584
+ /**
585
+ * Gets whether filtering is enabled for p13n
586
+ *
587
+ * @experimental
588
+ * @private
589
+ * @ui5-restricted Fiori Elements
590
+ */
591
+ Chart.prototype.isFilteringEnabled = function () {
592
+ return this.getP13nMode().indexOf("Filter") > -1;
593
+ };
594
+
595
+ /**
596
+ * Gets the adaption UI for the p13n dialog
597
+ * @returns {Prmoise} promise that resolves with UI
598
+ */
599
+ Chart.prototype.getAdaptationUI = function () {
600
+ return this.getControlDelegate().getAdaptionUI(this);
601
+ };
602
+
603
+ /**
604
+ * Propagates a change on the "item" aggregation to the inner chart via the delegate
605
+ * The delegate must then update the inner chart accordingly
606
+ *
607
+ * @param {object} oChange the change object from the ManagedObjectModel observer
608
+ */
609
+ Chart.prototype._propagateItemChangeToInnerChart = function (oChange) {
610
+
611
+ if (this._bIsDestroyed){
612
+ return; //Don't propagate changes when CHart is destroyed
613
+ }
614
+
615
+ this.setBusy(true);
616
+ switch (oChange.mutation) {
617
+
618
+ case "insert":
619
+ var iIndex;
620
+
621
+ if (oChange.child && oChange.child.getType()) {
622
+ iIndex = this.getItems().filter(function(oItem){return oItem.getType() === oChange.child.getType();}).indexOf(oChange.child);
623
+ } else {
624
+ iIndex = this.getItems().indexOf(oChange.child);
625
+ }
587
626
 
588
- if (!this._oToolbarHandler) {
589
- this._oToolbarHandler = new ToolbarHandler();
590
- }
627
+ this.getControlDelegate().insertItemToInnerChart(this, oChange.child, iIndex);
628
+ break;
629
+ case "remove":
630
+ this.getControlDelegate().removeItemFromInnerChart(this, oChange.child);
631
+ break;
632
+ default:
633
+ Log.error("Unknown mutation on MDC Chart Item Aggregation. This will not sync to inner chart!");
634
+ break;
635
+ }
636
+
637
+ //Needed to apply current sorters when sorted measure/dimension was not selected yet
638
+ //However, since this gets called multiple times when the aggregation adds/removes multiple properties, the binding seems to break
639
+ this._rebind();
640
+
641
+ //Update the breadcrumbs after an MDC Item change
642
+ this._oBreadcrumbs.updateDrillBreadcrumbs(this, this.getControlDelegate().getDrillableItems(this));
643
+ };
644
+
645
+ /**
646
+ * Rebinds the inner chart instance by calling oDelegate.rebindChart
647
+ */
648
+ Chart.prototype._rebind = function () {
649
+
650
+ if (!this._bInnerChartReady) {
651
+ //TODO: This can lead to a race conditition when the "Go" button is pressed while the inner chart still intializes
652
+ //TODO: Check whether we really need this since we insantiate the inner chart right away
653
+ //this._initInnerControls();
654
+
655
+ //Wait with rebind until inner chart is ready
656
+ this.initialized().then(function () {
657
+ this._rebind();
658
+ }.bind(this));
659
+ return;
660
+ }
661
+
662
+ this.setBusy(true);
663
+
664
+ if (!this.getControlDelegate().getInnerChartBound(this)) {
665
+ this._createContentfromPropertyInfos();
666
+ return;
667
+ }
668
+
669
+ var oBindingInfo = this.getControlDelegate()._getBindingInfo(this);
670
+
671
+ if (oBindingInfo) {
672
+ oBindingInfo.sorter = this._getSorters();
673
+ }
674
+
675
+ this.getControlDelegate().updateBindingInfo(this, oBindingInfo); //Applies filters
676
+ this.getControlDelegate().rebind(this, oBindingInfo);
677
+ };
678
+
679
+ /**
680
+ * Creates a new instance of ChartToolbar
681
+ *
682
+ * @private
683
+ */
684
+ Chart.prototype._getToolbar = function () {
685
+ if (this.getAggregation("_toolbar")) {
686
+ return this.getAggregation("_toolbar");
687
+ } else {
688
+ var oToolbar = new ChartToolbar(this.getId() + "--toolbar", {
689
+ design: "Transparent"
690
+ });
691
+
692
+ this.setAggregation("_toolbar", oToolbar);
693
+ return oToolbar;
694
+ }
695
+ };
696
+
697
+ /**
698
+ * Calls the update function on the toolbar, if toolbar exists
699
+ *
700
+ * @private
701
+ */
702
+ Chart.prototype._updateToolbar = function () {
703
+ if (this.getAggregation("_toolbar")) {
704
+ this.getAggregation("_toolbar").updateToolbar(this);
705
+ } else {
706
+ Log.warning("Trying to uipdate Chart Toolbar, but toolbar is not yet initialized. This will not work!");
707
+ }
708
+ };
709
+
710
+ /**
711
+ * Returns the instance of the inner chart from the delegate
712
+ * @returns {sap.core.Control} the instance of the inner chart
713
+ *
714
+ * @private
715
+ */
716
+ Chart.prototype._getInnerChart = function () {
717
+ if (this._bInnerChartReady) {
718
+ return this.getControlDelegate().getInnerChart(this);
719
+ } else {
720
+ Log.error("Trying to acces inner chart while inner chart is not yet initialized!");
721
+ }
722
+ };
723
+
724
+ //TODO: Think of a good name
725
+ Chart.prototype._addItems = function () {
726
+
727
+ };
728
+
729
+ /**
730
+ * Gets the collection model from the binding information
731
+ * @returns {object} Object containing the binding information
732
+ *
733
+ * @experimental
734
+ * @private
735
+ * @ui5-restricted Fiori Elements
736
+ */
737
+ Chart.prototype.getCollectionModel = function () {
738
+ var oBindingInfo = this.getBindingInfo("data");
739
+ return oBindingInfo ? this.getModel(oBindingInfo.model) : null;
740
+ };
741
+
742
+
743
+ /**
744
+ * Can be used to check whether the chart is initialized
745
+ * After initialization the delegate should be loaded and (in case of autoBindOnInit=true) the inner chart has been created
746
+ * This does not include the inner chart to be bound. Use <code>innerChartBound</code> for it.
747
+ * @returns {Promise} Promise that resolves once MDC Chart is initialized. Contains reference to MDC Chart
748
+ *
749
+ * @experimental
750
+ * @private
751
+ * @ui5-restricted sap.ui.mdc, sap.fe
752
+ */
753
+ Chart.prototype.initialized = function () {
754
+ return this.initializedPromise;
755
+ };
756
+
757
+ /**
758
+ * Can be used to check whether the inner chart is initialized and bound
759
+ * @returns {Promise} Promise that resolves once MDC Chart is bound
760
+ *
761
+ * @experimental
762
+ * @private
763
+ * @ui5-restricted sap.ui.mdc, sap.fe
764
+ */
765
+ Chart.prototype.innerChartBound = function () {
766
+ return this.innerChartBoundPromise;
767
+ };
768
+
769
+ /**
770
+ * Zooms in the inner chart
771
+ * @param {int} iValue how much steps should be zoomed in
772
+ *
773
+ * @experimental
774
+ * @private
775
+ * @ui5-restricted sap.ui.mdc, sap.fe
776
+ */
777
+ Chart.prototype.zoomIn = function (iValue) {
778
+ if (!iValue) {
779
+ iValue = 10;
780
+ }
781
+
782
+ this.getControlDelegate().zoomIn(this, iValue);
783
+ };
784
+
785
+ /**
786
+ * Zooms out the inner chart
787
+ * @param {int} iValue how much steps should be zoomed out
788
+ *
789
+ * @experimental
790
+ * @private
791
+ * @ui5-restricted sap.ui.mdc, sap.fe
792
+ */
793
+ Chart.prototype.zoomOut = function (iValue) {
794
+ if (iValue) {
795
+ iValue = 10;
796
+ }
797
+
798
+ this.getControlDelegate().zoomOut(this, iValue);
799
+ };
800
+
801
+ /**
802
+ * Returns the current zoom information as an object
803
+ * {
804
+ * "enabled":true,
805
+ * "currentZoomLevel":0.16
806
+ * }
807
+ *
808
+ * @returns {Object} current Zoom Information
809
+ *
810
+ * @experimental
811
+ * @private
812
+ * @ui5-restricted sap.ui.mdc, sap.fe
813
+ */
814
+ Chart.prototype.getZoomState = function () {
815
+ return this.getControlDelegate().getZoomState(this);
816
+ };
817
+
818
+ Chart.prototype.getSelectionHandler = function () {
819
+ return this.getControlDelegate().getInnerChartSelectionHandler(this);
820
+ };
821
+
822
+ Chart.prototype.getChartTypeLayoutConfig = function() {
823
+ return this.getControlDelegate().getChartTypeLayoutConfig();
824
+ };
825
+
826
+ Chart.prototype.getAllowedRolesForKinds = function() {
827
+ return this.getControlDelegate().getAllowedRolesForKinds();
828
+ };
829
+
830
+ /**
831
+ * Sets the visibility of the legend
832
+ * Calls the Delegates <code>setLegendVisible</code>. Never call the delegates function directly as it would not update the Chart Toolbar!
833
+ * @param {boolean} bVisible true to show legend, false to hide
834
+ *
835
+ * @experimental
836
+ * @private
837
+ * @ui5-restricted Fiori Elements, sap.ui.mdc
838
+ */
839
+ Chart.prototype.setLegendVisible = function (bVisible) {
840
+ this.setProperty("legendVisible", bVisible);
841
+
842
+ //Skip if no control delegate; gets propagated by _propagatePropertiesToInnerChart after init
843
+ try {
844
+ this.getControlDelegate().setLegendVisible(this, bVisible);
845
+ } catch (e) {
846
+ Log.info("Trying to set legend visiblity for Chart before delegate was initialized");
847
+ }
848
+
849
+
850
+ return this;
851
+ };
852
+
853
+ /**
854
+ * Sets the ShowChartTooltip Property
855
+ * @param {boolean} bValue true for visible; false for invisible
856
+ * @returns {sap.ui.mdc.Chart} the MDC Chart
857
+ */
858
+ Chart.prototype.setShowChartTooltip = function (bValue) {
859
+ this.setProperty("showChartTooltip", bValue);
860
+
861
+ //Skip if no control delegate; gets propagated by _propagatePropertiesToInnerChart after init
862
+ try {
863
+ this.getControlDelegate().setChartTooltipVisibility(this, bValue);
864
+ } catch (e) {
865
+ Log.info("Trying to set tooltip visibility before delegate was initialized");
866
+ }
867
+
868
+ return this;
869
+ };
870
+
871
+ Chart.prototype.destroy = function() {
872
+ this._bIsDestroyed = true;
873
+
874
+ Control.prototype.destroy.apply(this, arguments);
875
+ };
876
+
877
+ /**
878
+ * shows the drill-down popover for selection a dimension to drill down to.
879
+ * @param {sap.m.Button} oDrillBtn reference to the drill down button for loacation of the popover
880
+ *
881
+ * @experimental
882
+ * @private
883
+ * @ui5-restricted sap.ui.mdc
884
+ */
885
+ Chart.prototype._showDrillDown = function (oDrillBtn) {
886
+ if (!this.oDrillPopover) {
887
+ if (DrillStackHandler) {
888
+ this.oDrillPopover = DrillStackHandler.createDrillDownPopover(this);
889
+ this.oDrillPopover.attachAfterClose(function(){
890
+ delete this.oDrillPopover;
891
+ }.bind(this));
892
+
893
+ return DrillStackHandler.showDrillDownPopover(this, oDrillBtn);
894
+ }
591
895
 
592
- if (this.getAutoBindOnInit()){
593
- this._oToolbarHandler.createToolbar(this, aActions);
594
- } else {
595
- this._oToolbarHandler.updateToolbar(this);
596
- }
896
+ return new Promise(function (resolve, reject) {
897
+ sap.ui.require([
898
+ "sap/ui/mdc/chart/DrillStackHandler"
899
+ ], function (DrillStackHandlerLoaded) {
900
+ DrillStackHandler = DrillStackHandlerLoaded;
901
+ this.oDrillPopover = DrillStackHandler.createDrillDownPopover(this);
902
+ this.oDrillPopover.attachAfterClose(function(){
903
+ delete this.oDrillPopover;
904
+ }.bind(this));
905
+
906
+ DrillStackHandler.showDrillDownPopover(this, oDrillBtn)
907
+ .then(function (oDrillDownPopover) {
908
+ resolve(oDrillDownPopover);
909
+ });
910
+ }.bind(this));
911
+ }.bind(this));
912
+ }
913
+ };
914
+
915
+ /**
916
+ * If some properties are set on the MDC Chart while the inner chart is not yet initialized, they need to eb set after initialaization.
917
+ * This methods gets called after inner chart is ready and takes care of that
918
+ *
919
+ * @private
920
+ */
921
+ Chart.prototype._propagatePropertiesToInnerChart = function () {
922
+ //TODO: Can this be set by constructor of inner chart?
923
+ this.setLegendVisible(this.getLegendVisible());
924
+ this.setShowChartTooltip(this.getShowChartTooltip());
925
+ this.setChartType(this.getChartType());
926
+ };
927
+
928
+ /**
929
+ * Gets information about the current chart type.
930
+ *
931
+ * @returns {sap.ui.mdc.Chart.ChartTypeInfo} Object containing information about the chart type
932
+ *
933
+ * @experimental
934
+ * @private
935
+ * @ui5-restricted Fiori Elements
936
+ *
937
+ */
938
+ Chart.prototype.getChartTypeInfo = function () {
939
+ var mInfo;
940
+
941
+ try {
942
+ mInfo = this.getControlDelegate().getChartTypeInfo(this);
943
+ } catch (error) {
944
+ //Inner chart is not yet ready
945
+ if (!mInfo) {
946
+ mInfo = {
947
+ icon: "sap-icon://vertical-bar-chart",
948
+ text: "Selected Chart Type: Bar Chart"
949
+ };
950
+ }
951
+ }
952
+
953
+ return mInfo;
954
+ };
955
+
956
+ /**
957
+ * Gets the available chart types for the current state of the inner chart
958
+ *
959
+ * @returns {array} Array containing the available chart types
960
+ *
961
+ * @experimental
962
+ * @private
963
+ * @ui5-restricted Fiori Elements
964
+ */
965
+ Chart.prototype.getAvailableChartTypes = function () {
966
+ return this.getControlDelegate().getAvailableChartTypes(this);
967
+ };
968
+
969
+
970
+ /**
971
+ * Sets the MDC Chart to a specific chart type
972
+ * @param {string} sChartType the name of the new chart type
973
+ * @returns {sap.ui.mdc.chart} reference to <code>this</code> for method chaining
974
+ */
975
+ Chart.prototype.setChartType = function (sChartType) {
976
+ this.setProperty("chartType", sChartType);
977
+
978
+ try {
979
+ this.getControlDelegate().setChartType(this, sChartType);
980
+ } catch (e) {
981
+ Log.info("Trying to set chart type for Chart before delegate was initialized");
982
+ }
983
+
984
+ return this;
985
+ };
986
+
987
+ /**
988
+ * Gets the managed object model.
989
+ * @returns {sap.ui.model.base.ManagedObjectModel} the managed object model
990
+ *
991
+ * @experimental
992
+ * @private
993
+ * @ui5-restricted Fiori Elements
994
+ */
995
+ Chart.prototype.getManagedObjectModel = function () {
996
+ return this._oManagedObjectModel;
997
+ };
998
+
999
+ /**
1000
+ * This is a callback function which is called from the delegate once the inner chart finished loading data
1001
+ * Updates the Toolbar
1002
+ * Fires the innerChartLoadedData event
1003
+ *
1004
+ * @private
1005
+ */
1006
+ Chart.prototype._innerChartDataLoadComplete = function (mArguments) {
1007
+ this.setBusy(false);
1008
+ this._renderOverlay(false);
1009
+
1010
+ this.getControlDelegate().requestToolbarUpdate(this);
1011
+
1012
+ this.fireEvent("innerChartLoadedData ", {
1013
+ innerChart: this.getControlDelegate().getInnerChart(this)
1014
+ });
1015
+ };
1016
+
1017
+ /**
1018
+ * Fetches the current state of the chart (as a JSON)
1019
+ * Needed for P13n to fetch current state
1020
+ *
1021
+ * @experimental
1022
+ * @private
1023
+ * @returns {Object} Current state of the chart
1024
+ * @ui5-restricted sap.ui.mdc
1025
+ */
1026
+ Chart.prototype.getCurrentState = function () {
1027
+ var oState = {};
1028
+ var aP13nMode = this.getP13nMode();
1029
+
1030
+ if (aP13nMode) {
1031
+ if (aP13nMode.indexOf("Item") > -1) {
1032
+ oState.items = this._getVisibleProperties();
1033
+ }
597
1034
 
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
- }
1035
+ if (aP13nMode.indexOf("Sort") > -1) {
1036
+ oState.sorters = this._getSortedProperties();
1037
+ }
611
1038
 
612
- }.bind(this));
1039
+ if (aP13nMode.indexOf("Filter") > -1) {
1040
+ oState.filter = this.getFilterConditions();
1041
+ }
1042
+ }
1043
+
1044
+ return oState;
1045
+ };
1046
+
1047
+ /**
1048
+ * Returns the currently visible Properties
1049
+ * Needed for P13n
1050
+ * @returns {array} Array containing the currently visible properties
1051
+ *
1052
+ * @private
1053
+ */
1054
+ Chart.prototype._getVisibleProperties = function () {
1055
+ var aProperties = [];
1056
+ this.getItems().forEach(function (oItem) {
1057
+ aProperties.push({
1058
+ name: oItem.getName(),
1059
+ role: oItem.getRole()
1060
+ });
1061
+
1062
+ });
1063
+ return aProperties;
1064
+ };
1065
+
1066
+ /**
1067
+ * Returns the currently sorted Properties
1068
+ * Needed for P13n
1069
+ * @returns {array} Array containing the currently sorted properties
1070
+ *
1071
+ * @private
1072
+ */
1073
+ Chart.prototype._getSortedProperties = function () {
1074
+ return this.getSortConditions() ? this.getSortConditions().sorters : [];
1075
+ };
1076
+
1077
+ /**
1078
+ * Returns sorters available for the data
1079
+ *
1080
+ * @returns {array} Array containing available sorters
1081
+ *
1082
+ * @experimental
1083
+ * @private
1084
+ * @ui5-restricted sap.ui.mdc
1085
+ */
1086
+ Chart.prototype._getSorters = function () {
1087
+ var aSorters;
1088
+ var aSorterProperties = this.getSortConditions() ? this.getSortConditions().sorters : [];
613
1089
 
614
- if (!mSettings || mSettings.selectionMode === undefined || this._bNeedSelectionModeSet) {
615
- _onSelectionMode.apply(this);
616
- }
1090
+ aSorterProperties.forEach(function (oSortProp) {
617
1091
 
618
- if (mSettings && mSettings.data) {
619
- this._addBindingListener(mSettings.data, "change", this._onDataLoadComplete.bind(this));
620
- }
1092
+ var oMDCItem = this.getItems().find(function (oProp) {
1093
+ return oProp.getName() === oSortProp.name;
1094
+ });
621
1095
 
622
- this._bInnerChartInitialized = true;
623
- this.bindAggregation("data", this.oDataInfo);
624
- };
1096
+ //Ignore not visible Items
1097
+ if (!oMDCItem) {
1098
+ return;
1099
+ }
625
1100
 
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) {
1101
+ //TODO: Check for inResultDimensions
1102
+ var oSorter = this.getControlDelegate().getSorterForItem(oMDCItem, oSortProp);
639
1103
 
640
- if (sName == "data") {
1104
+ if (aSorters) {
1105
+ aSorters.push(oSorter);
1106
+ } else {
1107
+ aSorters = [
1108
+ oSorter
1109
+ ];//[] has special meaning in sorting
1110
+ }
1111
+ }.bind(this));
641
1112
 
642
- this.oDataInfo = oBindingInfo;
643
- var oChart = this.getAggregation("_chart");
1113
+ return aSorters;
644
1114
 
645
- if (oChart && this.bDelegateInitialized) {
646
- this.getControlDelegate().rebindChart(this, oBindingInfo, sSearchText);
1115
+ };
647
1116
 
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
- };
1117
+ /**
1118
+ * Returns the fetched properties from the delegate
1119
+ *
1120
+ * @private
1121
+ */
1122
+ Chart.prototype._getPropertyData = function () {
657
1123
 
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
- };
1124
+ if (!this.aFetchedProperties) {
1125
+ //retrieve the data
1126
+ this.aFetchedProperties = this.getControlDelegate().fetchProperties(this);
1127
+ } else {
1128
+ //take the already instantiated data
1129
+ return this.aFetchedProperties;
1130
+ }
663
1131
 
664
- Chart.prototype._addBindingListener = function(oBindingInfo, sEventName, fHandler) {
665
- if (!oBindingInfo.events) {
666
- oBindingInfo.events = {};
667
- }
1132
+ };
668
1133
 
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
- };
1134
+ Chart.prototype._getTypeBtnActive = function(){
1135
+ return !!this._typeBtnActive;
1136
+ };
680
1137
 
681
- /**
682
- * Gets information about the current data binding
1138
+ /**
1139
+ * Callback for when fuilters changed
1140
+ * Activates the overlay on the MDC Chart
683
1141
  *
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
1142
+ * @param oEvent filter changed event
700
1143
  *
701
1144
  * @experimental
702
1145
  * @private
703
1146
  * @ui5-restricted Fiori Elements, sap.ui.mdc
704
1147
  */
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)));
1148
+ Chart.prototype._onFiltersChanged = function(oEvent) {
1149
+ if (this._bInnerChartReady && this.getControlDelegate() && this.getControlDelegate().getInnerChartBound(this) && oEvent.getParameter("conditionsBased")) {
1150
+ this._renderOverlay(true);
800
1151
  }
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
1152
  };
842
1153
 
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
- };
1154
+ Chart.prototype.setVariant = function(oControl) {
1155
+ this.setAggregation("variant", oControl);
857
1156
 
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));
880
- }
1157
+ //Only add VM directly when Toolbar already exists; otherwise VM will be added during init of toolbar
1158
+ if (this.getAggregation("_toolbar")){
1159
+ this.getAggregation("_toolbar").addVariantManagement(oControl);
1160
+ }
881
1161
 
882
- this._oObserver.observe(oItem, {
883
- properties: [
884
- "visible", "inResult", "role"
885
- ]
886
- });
887
1162
 
888
- return this.addAggregation("items", oItem, bSuppressInvalidate);
889
- };
1163
+ return this;
1164
+ };
890
1165
 
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
1166
+ /**
1167
+ * Adds/Removes the overlay shown above the inner chart
1168
+ * @param {boolean} bShow true to show overlay, false to hide
896
1169
  *
897
1170
  * @experimental
898
1171
  * @private
899
1172
  * @ui5-restricted Fiori Elements, sap.ui.mdc
900
1173
  */
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");
1174
+ Chart.prototype._renderOverlay = function(bShow) {
908
1175
 
909
- if (oChart) {
910
- oItem.toChart(oChart);
911
- } else if (this.oChartPromise) {
912
- this.oChartPromise.then(function (oChart) {
1176
+ if (this.getControlDelegate().getInnerChart(this)) {
913
1177
 
914
- if (oChart) {
915
- this.toChart(oChart);
916
- }
917
- }.bind(oItem));
1178
+ var $this = this.getControlDelegate().getInnerChart(this).$(), $overlay = $this.find(".sapUiMdcChartOverlay");
1179
+ if (bShow && $overlay.length === 0) {
1180
+ $overlay = jQuery("<div>").addClass("sapUiOverlay sapUiMdcChartOverlay").css("z-index", "1");
1181
+ $this.append($overlay);
1182
+ } else if (!bShow) {
1183
+ $overlay.remove();
1184
+ }
918
1185
  }
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
1186
  };
944
1187
 
945
- Chart.prototype.exit = function() {
946
- Control.prototype.exit.apply(this, arguments);
1188
+ Chart.prototype.addAction = function(oControl) {
1189
+ if (oControl.getMetadata().getName() !== "sap.ui.mdc.actiontoolbar.ActionToolbarAction") {
1190
+ oControl = new ActionToolbarAction(oControl.getId() + "-action", {
1191
+ action: oControl
1192
+ });
1193
+ }
947
1194
 
948
- this.oChartPromise = null;
949
- this._oSelectionHandlerPromise = null;
950
-
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
- };
1195
+ return Control.prototype.addAggregation.apply(this, ["actions", oControl]);
1196
+ };
1893
1197
 
1894
- return Chart;
1895
- }, true);
1198
+ return Chart;
1199
+ });