@openui5/sap.ui.mdc 1.93.3 → 1.96.2

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 (237) hide show
  1. package/.reuse/dep5 +6 -11
  2. package/THIRDPARTY.txt +10 -16
  3. package/package.json +4 -4
  4. package/src/sap/ui/mdc/.library +1 -1
  5. package/src/sap/ui/mdc/ActionToolbar.js +236 -334
  6. package/src/sap/ui/mdc/AggregationBaseDelegate.js +2 -1
  7. package/src/sap/ui/mdc/Chart.js +150 -22
  8. package/src/sap/ui/mdc/ChartDelegateNew.js +15 -0
  9. package/src/sap/ui/mdc/ChartNew.js +107 -66
  10. package/src/sap/ui/mdc/Control.js +4 -3
  11. package/src/sap/ui/mdc/Element.js +5 -4
  12. package/src/sap/ui/mdc/Field.js +2 -2
  13. package/src/sap/ui/mdc/FilterBar.js +1 -10
  14. package/src/sap/ui/mdc/FilterField.js +28 -4
  15. package/src/sap/ui/mdc/Link.js +2 -2
  16. package/src/sap/ui/mdc/MultiValueField.js +1 -1
  17. package/src/sap/ui/mdc/Table.js +172 -79
  18. package/src/sap/ui/mdc/TableDelegate.js +20 -3
  19. package/src/sap/ui/mdc/ValueHelp.js +1474 -0
  20. package/src/sap/ui/mdc/ValueHelpDelegate.js +147 -0
  21. package/src/sap/ui/mdc/actiontoolbar/ActionToolbarAction.js +49 -104
  22. package/src/sap/ui/mdc/chart/DimensionItem.js +3 -3
  23. package/src/sap/ui/mdc/chart/Item.js +2 -3
  24. package/src/sap/ui/mdc/chart/MeasureItem.js +2 -2
  25. package/src/sap/ui/mdc/chart/SelectionDetailsActions.js +21 -2
  26. package/src/sap/ui/mdc/chart/ToolbarHandler.js +237 -225
  27. package/src/sap/ui/mdc/chartNew/ChartSelectionDetailsNew.js +1 -1
  28. package/src/sap/ui/mdc/chartNew/ChartToolbarNew.js +14 -10
  29. package/src/sap/ui/mdc/chartNew/ChartTypeButtonNew.js +1 -1
  30. package/src/sap/ui/mdc/chartNew/DrillStackHandlerNew.js +12 -10
  31. package/src/sap/ui/mdc/chartNew/ItemNew.js +0 -1
  32. package/src/sap/ui/mdc/chartNew/PropertyHelperNew.js +1 -1
  33. package/src/sap/ui/mdc/condition/Condition.js +2 -2
  34. package/src/sap/ui/mdc/condition/ConditionConverter.js +1 -1
  35. package/src/sap/ui/mdc/condition/ConditionModel.js +1 -1
  36. package/src/sap/ui/mdc/condition/FilterConverter.js +1 -1
  37. package/src/sap/ui/mdc/condition/FilterOperatorUtil.js +13 -7
  38. package/src/sap/ui/mdc/condition/Operator.js +4 -4
  39. package/src/sap/ui/mdc/condition/RangeOperator.js +1 -1
  40. package/src/sap/ui/mdc/designtime/actiontoolbar/ActionToolbar.designtime.js +43 -0
  41. package/src/sap/ui/mdc/designtime/chart/ChartNew.designtime.js +91 -0
  42. package/src/sap/ui/mdc/designtime/filterbar/FilterBar.designtime.js +20 -0
  43. package/src/sap/ui/mdc/designtime/filterbar/FilterBarBase.designtime.js +31 -0
  44. package/src/sap/ui/mdc/designtime/table/Table.designtime.js +5 -0
  45. package/src/sap/ui/mdc/enum/ContentMode.js +25 -4
  46. package/src/sap/ui/mdc/enum/SelectType.js +43 -0
  47. package/src/sap/ui/mdc/field/BoolFieldHelp.js +1 -1
  48. package/src/sap/ui/mdc/field/ConditionFieldHelp.js +1 -1
  49. package/src/sap/ui/mdc/field/ConditionType.js +19 -4
  50. package/src/sap/ui/mdc/field/ConditionsType.js +5 -4
  51. package/src/sap/ui/mdc/field/CustomFieldHelp.js +1 -1
  52. package/src/sap/ui/mdc/field/CustomFieldInfo.js +1 -1
  53. package/src/sap/ui/mdc/field/DefineConditionPanel.js +38 -14
  54. package/src/sap/ui/mdc/field/FieldBase.js +92 -41
  55. package/src/sap/ui/mdc/field/FieldBaseDelegate.js +9 -2
  56. package/src/sap/ui/mdc/field/FieldHelpBase.js +64 -4
  57. package/src/sap/ui/mdc/field/FieldInfoBase.js +9 -1
  58. package/src/sap/ui/mdc/field/FieldInput.js +1 -1
  59. package/src/sap/ui/mdc/field/FieldInputRenderUtil.js +1 -1
  60. package/src/sap/ui/mdc/field/FieldMultiInput.js +1 -1
  61. package/src/sap/ui/mdc/field/FieldValueHelp.js +7 -1
  62. package/src/sap/ui/mdc/field/FieldValueHelpContentWrapperBase.js +1 -1
  63. package/src/sap/ui/mdc/field/FieldValueHelpMTableWrapper.js +1 -1
  64. package/src/sap/ui/mdc/field/FieldValueHelpMdcTableWrapper.js +1 -1
  65. package/src/sap/ui/mdc/field/FieldValueHelpTableWrapperBase.js +2 -2
  66. package/src/sap/ui/mdc/field/FieldValueHelpUITableWrapper.js +1 -1
  67. package/src/sap/ui/mdc/field/InParameter.js +1 -1
  68. package/src/sap/ui/mdc/field/ListFieldHelp.js +3 -3
  69. package/src/sap/ui/mdc/field/ListFieldHelpItem.js +1 -1
  70. package/src/sap/ui/mdc/field/MultiValueFieldItem.js +1 -1
  71. package/src/sap/ui/mdc/field/OutParameter.js +1 -1
  72. package/src/sap/ui/mdc/field/ValueHelpPanel.js +1 -1
  73. package/src/sap/ui/mdc/field/content/BooleanContent.js +15 -3
  74. package/src/sap/ui/mdc/field/content/ContentFactory.js +16 -8
  75. package/src/sap/ui/mdc/field/content/DefaultContent.js +64 -23
  76. package/src/sap/ui/mdc/field/content/LinkContent.js +6 -0
  77. package/src/sap/ui/mdc/field/content/SearchContent.js +21 -3
  78. package/src/sap/ui/mdc/field/content/UnitContent.js +2 -2
  79. package/src/sap/ui/mdc/filterbar/FilterBarBase.js +105 -44
  80. package/src/sap/ui/mdc/filterbar/PropertyHelper.js +52 -0
  81. package/src/sap/ui/mdc/filterbar/p13n/AdaptationFilterBar.js +10 -51
  82. package/src/sap/ui/mdc/filterbar/vh/FilterBar.js +1 -1
  83. package/src/sap/ui/mdc/flexibility/ActionToolbar.flexibility.js +22 -0
  84. package/src/sap/ui/mdc/flexibility/ActionToolbarAction.flexibility.js +19 -0
  85. package/src/sap/ui/mdc/flexibility/Chart.flexibility.js +1 -1
  86. package/src/sap/ui/mdc/flexibility/ConditionFlex.js +57 -46
  87. package/src/sap/ui/mdc/flexibility/FilterBar.flexibility.js +1 -1
  88. package/src/sap/ui/mdc/flexibility/FilterItemFlex.js +1 -1
  89. package/src/sap/ui/mdc/flexibility/ItemBaseFlex.js +203 -197
  90. package/src/sap/ui/mdc/library.js +588 -8
  91. package/src/sap/ui/mdc/link/ContactDetails.js +1 -1
  92. package/src/sap/ui/mdc/link/ContactDetailsAddressItem.js +1 -1
  93. package/src/sap/ui/mdc/link/ContactDetailsEmailItem.js +1 -1
  94. package/src/sap/ui/mdc/link/ContactDetailsItem.js +1 -1
  95. package/src/sap/ui/mdc/link/ContactDetailsPhoneItem.js +1 -1
  96. package/src/sap/ui/mdc/link/Factory.js +1 -1
  97. package/src/sap/ui/mdc/link/FakeFlpConnector.js +1 -1
  98. package/src/sap/ui/mdc/link/LinkItem.js +1 -1
  99. package/src/sap/ui/mdc/link/Panel.js +1 -1
  100. package/src/sap/ui/mdc/link/PanelItem.js +1 -1
  101. package/src/sap/ui/mdc/link/PanelListItem.js +1 -1
  102. package/src/sap/ui/mdc/link/SelectionDialog.js +2 -2
  103. package/src/sap/ui/mdc/link/SelectionDialogItem.js +1 -1
  104. package/src/sap/ui/mdc/link/SemanticObjectMapping.js +1 -1
  105. package/src/sap/ui/mdc/link/SemanticObjectMappingItem.js +1 -1
  106. package/src/sap/ui/mdc/link/SemanticObjectUnavailableAction.js +1 -1
  107. package/src/sap/ui/mdc/messagebundle.properties +31 -5
  108. package/src/sap/ui/mdc/messagebundle_ar.properties +19 -4
  109. package/src/sap/ui/mdc/messagebundle_bg.properties +18 -3
  110. package/src/sap/ui/mdc/messagebundle_ca.properties +18 -3
  111. package/src/sap/ui/mdc/messagebundle_cs.properties +31 -16
  112. package/src/sap/ui/mdc/messagebundle_cy.properties +18 -3
  113. package/src/sap/ui/mdc/messagebundle_da.properties +18 -3
  114. package/src/sap/ui/mdc/messagebundle_de.properties +20 -5
  115. package/src/sap/ui/mdc/messagebundle_el.properties +19 -4
  116. package/src/sap/ui/mdc/messagebundle_en.properties +17 -2
  117. package/src/sap/ui/mdc/messagebundle_en_GB.properties +18 -3
  118. package/src/sap/ui/mdc/messagebundle_en_US_sappsd.properties +11 -3
  119. package/src/sap/ui/mdc/messagebundle_en_US_saprigi.properties +19 -3
  120. package/src/sap/ui/mdc/messagebundle_en_US_saptrc.properties +11 -2
  121. package/src/sap/ui/mdc/messagebundle_es.properties +43 -28
  122. package/src/sap/ui/mdc/messagebundle_es_MX.properties +18 -3
  123. package/src/sap/ui/mdc/messagebundle_et.properties +18 -3
  124. package/src/sap/ui/mdc/messagebundle_fi.properties +19 -4
  125. package/src/sap/ui/mdc/messagebundle_fr.properties +32 -17
  126. package/src/sap/ui/mdc/messagebundle_fr_CA.properties +18 -3
  127. package/src/sap/ui/mdc/messagebundle_hi.properties +18 -3
  128. package/src/sap/ui/mdc/messagebundle_hr.properties +18 -3
  129. package/src/sap/ui/mdc/messagebundle_hu.properties +19 -4
  130. package/src/sap/ui/mdc/messagebundle_id.properties +19 -4
  131. package/src/sap/ui/mdc/messagebundle_it.properties +41 -26
  132. package/src/sap/ui/mdc/messagebundle_iw.properties +18 -3
  133. package/src/sap/ui/mdc/messagebundle_ja.properties +28 -13
  134. package/src/sap/ui/mdc/messagebundle_kk.properties +18 -3
  135. package/src/sap/ui/mdc/messagebundle_ko.properties +18 -3
  136. package/src/sap/ui/mdc/messagebundle_lt.properties +18 -3
  137. package/src/sap/ui/mdc/messagebundle_lv.properties +18 -3
  138. package/src/sap/ui/mdc/messagebundle_ms.properties +18 -3
  139. package/src/sap/ui/mdc/messagebundle_nl.properties +19 -4
  140. package/src/sap/ui/mdc/messagebundle_no.properties +25 -10
  141. package/src/sap/ui/mdc/messagebundle_pl.properties +22 -7
  142. package/src/sap/ui/mdc/messagebundle_pt.properties +19 -4
  143. package/src/sap/ui/mdc/messagebundle_pt_PT.properties +18 -3
  144. package/src/sap/ui/mdc/messagebundle_ro.properties +21 -6
  145. package/src/sap/ui/mdc/messagebundle_ru.properties +18 -3
  146. package/src/sap/ui/mdc/messagebundle_sh.properties +18 -3
  147. package/src/sap/ui/mdc/messagebundle_sk.properties +19 -4
  148. package/src/sap/ui/mdc/messagebundle_sl.properties +18 -3
  149. package/src/sap/ui/mdc/messagebundle_sv.properties +19 -4
  150. package/src/sap/ui/mdc/messagebundle_th.properties +24 -9
  151. package/src/sap/ui/mdc/messagebundle_tr.properties +18 -3
  152. package/src/sap/ui/mdc/messagebundle_uk.properties +18 -3
  153. package/src/sap/ui/mdc/messagebundle_vi.properties +18 -3
  154. package/src/sap/ui/mdc/messagebundle_zh_CN.properties +18 -3
  155. package/src/sap/ui/mdc/messagebundle_zh_TW.properties +18 -3
  156. package/src/sap/ui/mdc/mixin/AdaptationMixin.js +1 -1
  157. package/src/sap/ui/mdc/mixin/DelegateMixin.js +2 -2
  158. package/src/sap/ui/mdc/mixin/FilterIntegrationMixin.js +3 -3
  159. package/src/sap/ui/mdc/mixin/PromiseMixin.js +94 -0
  160. package/src/sap/ui/mdc/odata/v4/ChartPropertyHelperNew.js +1 -1
  161. package/src/sap/ui/mdc/odata/v4/FilterBarDelegate.js +6 -6
  162. package/src/sap/ui/mdc/odata/v4/TableDelegate.js +37 -10
  163. package/src/sap/ui/mdc/odata/v4/ValueHelpDelegate.js +94 -0
  164. package/src/sap/ui/mdc/odata/v4/vizChart/ChartDelegateNew.js +492 -203
  165. package/src/sap/ui/mdc/p13n/DefaultProviderRegistry.js +1 -1
  166. package/src/sap/ui/mdc/p13n/Engine.js +3 -2
  167. package/src/sap/ui/mdc/p13n/P13nBuilder.js +6 -60
  168. package/src/sap/ui/mdc/p13n/PropertyHelper.js +1 -1
  169. package/src/sap/ui/mdc/p13n/UIManager.js +1 -1
  170. package/src/sap/ui/mdc/p13n/modification/ModificationHandler.js +22 -24
  171. package/src/sap/ui/mdc/p13n/panels/ActionToolbarPanel.js +59 -0
  172. package/src/sap/ui/mdc/p13n/panels/AdaptFiltersPanel.js +1 -2
  173. package/src/sap/ui/mdc/p13n/panels/BasePanel.js +17 -8
  174. package/src/sap/ui/mdc/p13n/panels/ChartItemPanel.js +1 -2
  175. package/src/sap/ui/mdc/p13n/panels/ChartItemPanelNew.js +1171 -0
  176. package/src/sap/ui/mdc/p13n/panels/GroupPanel.js +1 -1
  177. package/src/sap/ui/mdc/p13n/panels/GroupView.js +7 -11
  178. package/src/sap/ui/mdc/p13n/panels/ListView.js +5 -3
  179. package/src/sap/ui/mdc/p13n/panels/QueryPanel.js +16 -9
  180. package/src/sap/ui/mdc/p13n/panels/SelectionPanel.js +0 -1
  181. package/src/sap/ui/mdc/p13n/panels/SortPanel.js +0 -1
  182. package/src/sap/ui/mdc/p13n/panels/SortQueryPanel.js +1 -1
  183. package/src/sap/ui/mdc/p13n/panels/Wrapper.js +1 -1
  184. package/src/sap/ui/mdc/p13n/subcontroller/ActionToolbarController.js +89 -0
  185. package/src/sap/ui/mdc/p13n/subcontroller/BaseController.js +9 -6
  186. package/src/sap/ui/mdc/p13n/subcontroller/ChartItemController.js +33 -4
  187. package/src/sap/ui/mdc/p13n/subcontroller/ColumnController.js +9 -15
  188. package/src/sap/ui/mdc/p13n/subcontroller/FilterController.js +12 -0
  189. package/src/sap/ui/mdc/p13n/subcontroller/GroupController.js +5 -12
  190. package/src/sap/ui/mdc/p13n/subcontroller/SortController.js +19 -21
  191. package/src/sap/ui/mdc/table/Column.js +35 -9
  192. package/src/sap/ui/mdc/table/CreationRow.js +1 -1
  193. package/src/sap/ui/mdc/table/GridTableType.js +0 -1
  194. package/src/sap/ui/mdc/table/PropertyHelper.js +108 -5
  195. package/src/sap/ui/mdc/table/ResponsiveTableType.js +19 -3
  196. package/src/sap/ui/mdc/table/RowSettings.js +1 -1
  197. package/src/sap/ui/mdc/table/TableTypeBase.js +0 -1
  198. package/src/sap/ui/mdc/table/V4AnalyticsPropertyHelper.js +1 -1
  199. package/src/sap/ui/mdc/themes/base/FilterBar.less +2 -2
  200. package/src/sap/ui/mdc/themes/base/GroupView.less +2 -2
  201. package/src/sap/ui/mdc/themes/base/ListView.less +2 -2
  202. package/src/sap/ui/mdc/themes/base/ValueHelpDialog.less +56 -21
  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 +26 -0
  206. package/src/sap/ui/mdc/util/FilterUtil.js +12 -1
  207. package/src/sap/ui/mdc/util/IdentifierUtil.js +4 -0
  208. package/src/sap/ui/mdc/util/PromiseCache.js +266 -0
  209. package/src/sap/ui/mdc/util/PropertyHelper.js +22 -1
  210. package/src/sap/ui/mdc/valuehelp/Dialog.js +498 -0
  211. package/src/sap/ui/mdc/valuehelp/Popover.js +362 -0
  212. package/src/sap/ui/mdc/valuehelp/base/Container.js +642 -0
  213. package/src/sap/ui/mdc/valuehelp/base/Content.js +628 -0
  214. package/src/sap/ui/mdc/valuehelp/base/DialogTab.js +139 -0
  215. package/src/sap/ui/mdc/valuehelp/base/FilterableListContent.js +557 -0
  216. package/src/sap/ui/mdc/valuehelp/base/ListContent.js +133 -0
  217. package/src/sap/ui/mdc/valuehelp/content/Bool.js +318 -0
  218. package/src/sap/ui/mdc/valuehelp/content/Conditions.js +276 -0
  219. package/src/sap/ui/mdc/valuehelp/content/FixedList.js +532 -0
  220. package/src/sap/ui/mdc/valuehelp/content/MDCTable.js +638 -0
  221. package/src/sap/ui/mdc/valuehelp/content/MTable.js +916 -0
  222. package/test/sap/ui/mdc/testutils/opa/TestLibrary.js +3 -2
  223. package/test/sap/ui/mdc/testutils/opa/actions/OpenContextMenu.js +48 -0
  224. package/test/sap/ui/mdc/testutils/opa/chartNew/ActionsBase.js +310 -0
  225. package/test/sap/ui/mdc/testutils/opa/chartNew/ActionsViz.js +39 -0
  226. package/test/sap/ui/mdc/testutils/opa/chartNew/AssertionsBase.js +118 -0
  227. package/test/sap/ui/mdc/testutils/opa/chartNew/AssertionsViz.js +137 -0
  228. package/test/sap/ui/mdc/testutils/opa/chartNew/ChartNew.js +24 -0
  229. package/test/sap/ui/mdc/testutils/opa/chartNew/TestObjects.js +289 -0
  230. package/test/sap/ui/mdc/testutils/opa/filterbar/Actions.js +250 -0
  231. package/test/sap/ui/mdc/testutils/opa/filterbar/Assertions.js +91 -0
  232. package/test/sap/ui/mdc/testutils/opa/filterbar/TestObjects.js +137 -0
  233. package/test/sap/ui/mdc/testutils/opa/filterbar/Util.js +25 -0
  234. package/test/sap/ui/mdc/testutils/opa/p13n/Actions.js +401 -93
  235. package/test/sap/ui/mdc/testutils/opa/p13n/Util.js +4 -1
  236. package/test/sap/ui/mdc/testutils/opa/p13n/{waitForP13nButtonWithParentAndIcon.js → waitForP13nButtonWithMatchers.js} +5 -18
  237. package/test/sap/ui/mdc/testutils/opa/table/TestObjects.js +0 -1
@@ -0,0 +1,1474 @@
1
+ /*
2
+ * ! OpenUI5
3
+ * (c) Copyright 2009-2021 SAP SE or an SAP affiliate company.
4
+ * Licensed under the Apache License, Version 2.0 - see LICENSE.txt.
5
+ */
6
+
7
+
8
+ /*
9
+ TODO: Remove!
10
+
11
+ <ValueHelp>
12
+ <typeahead>
13
+ <valuehelp.Popover useFirstMatch="true">
14
+ <popover.MTableContent><mTable/></popover.MTableContent>
15
+ </valuehelp.Popover>
16
+ </typeahead>
17
+ <dialog>
18
+ <valueHelp.Dialog title="My cool Dialog">
19
+ <dialog.MdcTableContent title="List View" keyPath="ID" descriptionPath="descr">
20
+ <filterbar><FilterBar/></filterbar>
21
+ <mdc.Table/>
22
+ </dialog.MdcTableContent>
23
+ <dialog.Conditions title="Condition View"/>
24
+ </valueHelp.Dialog>
25
+ </dialog>
26
+ </ValueHelp>
27
+ */
28
+
29
+ sap.ui.define([
30
+ 'sap/ui/mdc/Element',
31
+ 'sap/ui/mdc/mixin/PromiseMixin',
32
+ 'sap/ui/mdc/condition/Condition',
33
+ 'sap/ui/mdc/condition/FilterOperatorUtil',
34
+ 'sap/ui/mdc/condition/FilterConverter',
35
+ 'sap/ui/mdc/enum/SelectType',
36
+ 'sap/ui/mdc/enum/OutParameterMode',
37
+ 'sap/ui/mdc/enum/ConditionValidated',
38
+ 'sap/ui/model/Context',
39
+ 'sap/ui/model/FormatException',
40
+ 'sap/ui/model/ParseException',
41
+ 'sap/ui/model/base/ManagedObjectModel',
42
+ 'sap/ui/base/ManagedObjectObserver',
43
+ 'sap/base/util/merge',
44
+ 'sap/base/util/deepEqual'
45
+ ], function(
46
+ Element,
47
+ PromiseMixin,
48
+ Condition,
49
+ FilterOperatorUtil,
50
+ FilterConverter,
51
+ SelectType,
52
+ OutParameterMode,
53
+ ConditionValidated,
54
+ Context,
55
+ FormatException,
56
+ ParseException,
57
+ ManagedObjectModel,
58
+ ManagedObjectObserver,
59
+ merge,
60
+ deepEqual
61
+ ) {
62
+ "use strict";
63
+
64
+ /**
65
+ * Constructor for a new <code>ValueHelp</code>.
66
+ *
67
+ * @param {string} [sId] ID for the new control, generated automatically if no ID is given
68
+ * @param {object} [mSettings] Initial settings for the new control
69
+ * @class Element for the <code>FieldHelp</code> association in the <code>FieldBase</code> controls.
70
+ * @extends sap.ui.mdc.Element
71
+ * @implements sap.ui.core.PopupInterface
72
+ * @version 1.96.2
73
+ * @constructor
74
+ * @abstract
75
+ * @private
76
+ * @ui5-restricted sap.fe
77
+ * @MDC_PUBLIC_CANDIDATE
78
+ * @since 1.91.0
79
+ * @alias sap.ui.mdc.ValueHelp
80
+ * @ui5-metamodel This control/element also will be described in the UI5 (legacy) designtime metamodel
81
+ */
82
+ var ValueHelp = Element.extend("sap.ui.mdc.ValueHelp", /** @lends sap.ui.mdc.ValueHelp.prototype */
83
+ {
84
+ metadata: {
85
+ library: "sap.ui.mdc",
86
+ properties: {
87
+ /**
88
+ * The conditions of the selected items.
89
+ *
90
+ * <b>Note:</b> This property must only be set by the control the <code>ValueHelp</code> element
91
+ * belongs to, not by the application.
92
+ *
93
+ * <b>Note:</b> A condition must have the structure of {@link sap.ui.mdc.condition.ConditionObject ConditionObject}.
94
+ */
95
+ conditions: {
96
+ type: "object[]",
97
+ defaultValue: [],
98
+ byValue: true
99
+ },
100
+
101
+ delegate: {
102
+ type: "object",
103
+ group: "Data",
104
+ defaultValue: {
105
+ name: "sap/ui/mdc/ValueHelpDelegate"
106
+ }
107
+ },
108
+
109
+ /**
110
+ * The value by which the help is filtered.
111
+ *
112
+ * <b>Note:</b> This only takes effect if the <code>ValueHelp</code> elements content supports filtering.
113
+ *
114
+ * <b>Note:</b> This property must only be set by the control the <code>ValueHelp</code> element
115
+ * belongs to, not by the application.
116
+ */
117
+ filterValue: {
118
+ type: "string",
119
+ defaultValue: ""
120
+ },
121
+
122
+ /**
123
+ * If this property is set, the user input is validated against the value help.
124
+ * If no entry is found for the user input, an error occurs.
125
+ *
126
+ * If this property is not set, the user input is still checked against the value help.
127
+ * But if no entry is found, the user input is set to the field if the used data type allows this.
128
+ * (A type parsing error is shown if the user input adheres to the requirements of the used data type.)
129
+ */
130
+ validateInput: {
131
+ type: "boolean",
132
+ defaultValue: true
133
+ },
134
+ /**
135
+ * internal configuration
136
+ */
137
+ _config: {
138
+ type: "object",
139
+ defaultValue: {},
140
+ visibility: "hidden"
141
+ },
142
+ /**
143
+ * Internal property to allow to bind the valid state to OK Button or make it available for all content controls
144
+ */
145
+ _valid: {
146
+ type: "boolean",
147
+ group: "Appearance",
148
+ defaultValue: true,
149
+ visibility: "hidden"
150
+ },
151
+ /**
152
+ * Internal property to allow to bind the conditions created by InParameters to content
153
+ */
154
+ _inConditions: {
155
+ type: "object",
156
+ defaultValue: {},
157
+ byValue: true,
158
+ visibility: "hidden"
159
+ },
160
+ /**
161
+ * Internal property to allow to bind the paths used by OutParameters to content
162
+ */
163
+ _outParameters: {
164
+ type: "string[]",
165
+ defaultValue: [],
166
+ byValue: true,
167
+ visibility: "hidden"
168
+ }
169
+ },
170
+ aggregations: {
171
+ /**
172
+ * Container that is used and opened if the value help icon of the input field is pressed.
173
+ */
174
+ dialog: {
175
+ type: "sap.ui.mdc.valuehelp.IDialogContainer",
176
+ multiple: false
177
+ },
178
+ /**
179
+ * Container that is used and opened in typeahead
180
+ */
181
+ typeahead: {
182
+ type: "sap.ui.mdc.valuehelp.ITypeaheadContainer",
183
+ multiple: false
184
+ },
185
+
186
+ /**
187
+ * Sets the in parameters of a field help.
188
+ *
189
+ * If set, the value help reads the data of these entities in the model and uses it to filter in the value help.
190
+ *
191
+ * <b>Note:</b> In parameters are only used if the content of the value help supports it
192
+ */
193
+ inParameters: {
194
+ type: "sap.ui.mdc.field.InParameter",
195
+ group: "Data",
196
+ multiple: true
197
+ },
198
+
199
+ /**
200
+ * Sets the out parameters of a field help.
201
+ *
202
+ * If set, the fields sets the data of these entities in the model based to the selected values.
203
+ *
204
+ * <b>Note:</b> Out parameters are only used if the content of the value help supports it
205
+ */
206
+ outParameters: {
207
+ type: "sap.ui.mdc.field.OutParameter",
208
+ group: "Data",
209
+ multiple: true
210
+ }
211
+ },
212
+ events: {
213
+ /**
214
+ * This event is fired when a value is selected in the field help.
215
+ *
216
+ * <b>Note:</b> This event must only be handled by the control the <code>FieldHelp</code> element
217
+ * belongs to, not by the application.
218
+ */
219
+ select: {
220
+ parameters: {
221
+
222
+ /**
223
+ * The selected <code>conditions</code>
224
+ *
225
+ * <b>Note:</b> A condition has the structure of {@link sap.ui.mdc.condition.ConditionObject ConditionObject}.
226
+ */
227
+ conditions: { type: "object[]" },
228
+
229
+ /**
230
+ * If set, the selected <code>conditions</code> are added by the listening control, otherwise they replace the existing ones
231
+ */
232
+ add: { type: "boolean" },
233
+
234
+ /**
235
+ * Indicator if the field help is closed while selection
236
+ */
237
+ close: {type: "boolean"}
238
+ }
239
+ },
240
+
241
+ /**
242
+ * This event is fired when the <code>FieldHelp</code> element is disconnected from a control.
243
+ *
244
+ * <b>Note:</b> This event must only be handled by the control the <code>FieldHelp</code> element
245
+ * belongs to, not by the application.
246
+ */
247
+ disconnect: {
248
+ },
249
+
250
+ /**
251
+ * This event is fired after the field help has been closed.
252
+ */
253
+ closed: {},
254
+
255
+ /**
256
+ * This event is fired after the user navigated in the value help.
257
+ */
258
+ navigated: {
259
+ parameters: {
260
+ /**
261
+ * True if the focus should be set back to the field.
262
+ */
263
+ bLeaveFocus: { type: "boolean" },
264
+ /**
265
+ * Navigated condition.
266
+ *
267
+ * <b>Note:</b> A condition must have the structure of {@link sap.ui.mdc.condition.ConditionObject ConditionObject}.
268
+ */
269
+ condition: { type: "object" },
270
+ /**
271
+ * ID of the navigated item. (This is needed to set the corresponding aria-attribute)
272
+ */
273
+ itemId: { type: "string" }
274
+ }
275
+ },
276
+ /**
277
+ * This event is fired if the user wants to switch from typeahead to value help.
278
+ */
279
+ switchToValueHelp: {}
280
+ },
281
+ defaultProperty: "filterValue"
282
+ }
283
+ });
284
+
285
+ ValueHelp.prototype.init = function() {
286
+
287
+ Element.prototype.init.apply(this, arguments);
288
+
289
+ this._oObserver = new ManagedObjectObserver(_observeChanges.bind(this));
290
+
291
+ this._oObserver.observe(this, {
292
+ // properties: ["filterValue", "conditions"],
293
+ aggregations: ["inParameters", "outParameters", "typeahead", "dialog"]
294
+ });
295
+
296
+ this.setBindingContext(null); // don't inherit from parent as this could have a invalid BindingContent to read InParameters...
297
+
298
+ this._oConditions = {}; // if no FilterBar is used store Conditions for search and InParameters locally
299
+
300
+ };
301
+
302
+ ValueHelp.prototype.exit = function() {
303
+
304
+ if (this._oManagedObjectModel) {
305
+ this._oManagedObjectModel.destroy();
306
+ delete this._oManagedObjectModel;
307
+ }
308
+
309
+ };
310
+
311
+ ValueHelp.prototype.invalidate = function(oOrigin) {
312
+ // do not invalidate parent as this must not be the one who is the active parent.
313
+ // invalidation of rendered content must be done by Dialog or Popover.
314
+ return;
315
+ };
316
+
317
+ /**
318
+ * Connects the <code>ValueHelp</code> element to a control.
319
+ *
320
+ * If the <code>ValueHelp</code> element is used as an association to multiple controls, it has to know
321
+ * the currently active control to open and interact.
322
+ *
323
+ * If the <code>ValueHelp</code> element is connected to a control, the <code>disconnected</code> event is fired
324
+ * to inform the previously connected control.
325
+ *
326
+ * <b>Note:</b> This function must only be called by the control the <code>ValueHelp</code> element
327
+ * belongs to, not by the application.
328
+ *
329
+ * @param {sap.ui.core.Control} oControl Control to which the <code>FieldHelp</code> element is connected to
330
+ * @param {object} oConfig Configuration object that holds needed data of the connected control
331
+ * @returns {this} Reference to <code>this</code> in order to allow method chaining
332
+ * @private
333
+ * @ui5-restricted sap.ui.mdc.field.FieldBase
334
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
335
+ */
336
+ ValueHelp.prototype.connect = function(oControl, oConfig) {
337
+ if (this._oControl && this._oControl !== oControl) {
338
+ this.close();
339
+ this.setFilterValue("");
340
+ this.setConditions([]);
341
+ this.fireDisconnect();
342
+ }
343
+
344
+ this._oControl = oControl;
345
+ this.setProperty("_config", oConfig, true); // TODO: public property to be set by Control?
346
+
347
+ _updateBindingContext.call(this); //to get the right values for InParameters ect.
348
+
349
+ return this;
350
+ };
351
+
352
+ ValueHelp.prototype.getControl = function() {
353
+ return this._oControl;
354
+ };
355
+
356
+ ValueHelp.prototype.getDomRef = function() {
357
+
358
+ var oTypeahead = this.getTypeahead();
359
+ var oDialog = this.getDialog();
360
+
361
+ if (oTypeahead && oTypeahead.isOpen()) {
362
+ return oTypeahead.getDomRef();
363
+ } else if (oDialog && oDialog.isOpen()) {
364
+ return oDialog.getDomRef();
365
+ }
366
+
367
+ };
368
+
369
+ //TODO: define aria attribute object
370
+ /**
371
+ * Returns the aria attributes the field needs from the value help
372
+ *
373
+ * @param {int} iMaxConditions maximal conditions allowed (as FieldHelp might not be connected to a field)
374
+ * @returns {object} object with the aria-attibutes
375
+ * @private
376
+ * @ui5-restricted sap.ui.mdc.field.FieldBase
377
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
378
+ */
379
+ ValueHelp.prototype.getAriaAttributes = function(iMaxConditions) {
380
+
381
+ var oTypeahead = this.getTypeahead();
382
+ var oDialog = this.getDialog();
383
+
384
+ if (!oDialog && oTypeahead && oTypeahead.getUseAsValueHelp()) {
385
+ oDialog = oTypeahead;
386
+ }
387
+
388
+ var bTypeaheadOpen = oTypeahead && oTypeahead.isOpen();
389
+ var bDialogOpen = oDialog && oDialog.isOpen();
390
+ var oTypeaheadAttributes = oTypeahead && oTypeahead.getAriaAttributes(iMaxConditions);
391
+ var oDialogAttributes = oDialog && oDialog.getAriaAttributes(iMaxConditions);
392
+ var sContentId; // use from currently open context (only needed if open)
393
+ var sHasPopup; // use from Typeahead. If no Typeahead use from Dialog
394
+ var sRole; // TODO: check Input for only typeahead case
395
+ var sRoleDescription;
396
+
397
+ if (bTypeaheadOpen) {
398
+ sContentId = oTypeaheadAttributes.contentId;
399
+ } else if (bDialogOpen) {
400
+ sContentId = oDialogAttributes.contentId;
401
+ }
402
+
403
+ sHasPopup = (oTypeahead && oTypeaheadAttributes.ariaHasPopup) || (oDialog && oDialogAttributes.ariaHasPopup);
404
+ sRole = (oTypeahead && oTypeaheadAttributes.role) || (oDialog && oDialogAttributes.role);
405
+ sRoleDescription = (oTypeahead && oTypeaheadAttributes.roleDescription) || (oDialog && oDialogAttributes.roleDescription);
406
+
407
+ return {
408
+ contentId: sContentId,
409
+ ariaHasPopup: sHasPopup,
410
+ role: sRole,
411
+ roleDescription: sRoleDescription,
412
+ valueHelpEnabled: !!oDialog || !!oTypeahead && !!oTypeahead.getUseAsValueHelp()
413
+ };
414
+
415
+ };
416
+
417
+ // retrieve delegate based content modifications
418
+ ValueHelp.prototype._retrieveDelegateContent = function(oContainer) {
419
+ return this._retrievePromise("delegateContent--" + oContainer.getId(), function() {
420
+ var oDelegatePromise = this._getControlDelegatePromise();
421
+ return oDelegatePromise.then(function (oDelegateModule) {
422
+ return oDelegateModule.retrieveContent(this.getPayload(), oContainer); // TODO: wait until In/OutParameter bindings finished?
423
+ }.bind(this));
424
+ }.bind(this));
425
+ };
426
+
427
+ ValueHelp.prototype._getControlDelegatePromise = function(oContainer) {
428
+ return this._retrievePromise("delegate", this.initControlDelegate.bind(this));
429
+ };
430
+
431
+ /**
432
+ * Opens the value help for the control
433
+ * to which the <code>ValueHelp</code> element is connected.
434
+ *
435
+ * <b>Note:</b> This function must only be called by the control the <code>ValueHelp</code> element
436
+ * belongs to, not by the application.
437
+ *
438
+ * @param {boolean} bTypeahead Flag that determines whether value help is opened for type-ahead or for complex help
439
+ *
440
+ * @private
441
+ * @ui5-restricted sap.ui.mdc.field.FieldBase
442
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
443
+ */
444
+ ValueHelp.prototype.open = function(bTypeahead) {
445
+ var oContainer = bTypeahead ? this.getTypeahead() : _getValueHelpContainer.call(this);
446
+
447
+ if (oContainer && !oContainer.isOpen() && !oContainer.isOpening()) {
448
+ this._removePromise("delegateContent" + "--" + oContainer.getId());
449
+ oContainer.open(this._retrieveDelegateContent(oContainer, true));
450
+ }
451
+ };
452
+
453
+ function _handleRequestDelegateContent(oEvent) {
454
+ var oContainer = oEvent.getParameter("container");
455
+ this._removePromise("delegateContent" + "--" + oContainer.getId());
456
+ this._retrieveDelegateContent(oContainer);
457
+ }
458
+
459
+ function _handleRequestSwitchToDialog(oEvent) {
460
+ this.fireSwitchToValueHelp();
461
+ }
462
+
463
+ /**
464
+ * closes the value help.
465
+ *
466
+ * <b>Note:</b> This function must only be called by the control the <code>ValueHelp</code> element
467
+ * belongs to, not by the application.
468
+ *
469
+ * @private
470
+ * @ui5-restricted sap.ui.mdc.field.FieldBase
471
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
472
+ */
473
+ ValueHelp.prototype.close = function() {
474
+ var oTypeahead = this.getTypeahead();
475
+ var oDialog = this.getDialog();
476
+
477
+ if (oTypeahead && oTypeahead.isOpen()) {
478
+ oTypeahead.close();
479
+ }
480
+
481
+ if (oDialog && oDialog.isOpen()) {
482
+ oDialog.close();
483
+ }
484
+ };
485
+
486
+ /**
487
+ * Toggles the open state of the value help.
488
+ *
489
+ * <b>Note:</b> This function must only be called by the control the <code>ValueHelp</code> element
490
+ * belongs to, not by the application.
491
+ *
492
+ * @param {boolean} bTypeahead Flag that determines whether value help is opened for type-ahead or for complex help
493
+ *
494
+ * @private
495
+ * @ui5-restricted sap.ui.mdc.field.FieldBase
496
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
497
+ */
498
+ ValueHelp.prototype.toggleOpen = function(bTypeahead) {
499
+ var oTypeahead = this.getTypeahead();
500
+ var oDialog = this.getDialog();
501
+
502
+ if (!bTypeahead && !oDialog && oTypeahead && oTypeahead.getUseAsValueHelp()) {
503
+ oDialog = oTypeahead;
504
+ }
505
+
506
+ var bTypeaheadOpen = oTypeahead && oTypeahead.isOpen();
507
+ var bDialogOpen = oDialog && oDialog.isOpen();
508
+
509
+ if ((bTypeahead && bTypeaheadOpen) || (!bTypeahead && bDialogOpen)) {
510
+ this.close();
511
+ } else if ((bTypeahead && oTypeahead) || (!bTypeahead && oDialog)) {
512
+ this.open(bTypeahead);
513
+ }
514
+ };
515
+
516
+ /**
517
+ * Determines if the value help is open.
518
+ *
519
+ * <b>Note:</b> This function must only be called by the control the <code>ValueHelp</code> element
520
+ * belongs to, not by the application.
521
+ *
522
+ * @returns {boolean} true if open or opening
523
+ *
524
+ * @private
525
+ * @ui5-restricted sap.ui.mdc.field.FieldBase
526
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
527
+ */
528
+ ValueHelp.prototype.isOpen = function() {
529
+ var oTypeahead = this.getTypeahead();
530
+ var oDialog = this.getDialog();
531
+ return (oTypeahead && oTypeahead.isOpen()) || (oDialog && oDialog.isOpen());
532
+ };
533
+
534
+ /**
535
+ * Skips the opening of the value help if it is pending because of loading content.
536
+ *
537
+ * <b>Note:</b> This function must only be called by the control the <code>ValueHelp</code> element
538
+ * belongs to, not by the application.
539
+ *
540
+ * @private
541
+ * @ui5-restricted sap.ui.mdc.field.FieldBase
542
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
543
+ */
544
+ ValueHelp.prototype.skipOpening = function() { // ? Use close based logic instead?
545
+ this.close();
546
+ };
547
+
548
+ /**
549
+ * Calls initialization of the ValueHelp before the ValueHelp is really opened.
550
+ * This is called in Typeahead on first letter before the ValueHelp is opened with a delay. So the
551
+ * content can be determined in the delegate coding early.
552
+ *
553
+ * <b>Note:</b> This function must only be called by the control the <code>ValueHelp</code> element
554
+ * belongs to, not by the application.
555
+ *
556
+ * @param {boolean} bTypeahead Flag that determines whether value help is opened for suggestion or for complex help
557
+ *
558
+ * @private
559
+ * @ui5-restricted sap.ui.mdc.field.FieldBase
560
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
561
+ */
562
+ ValueHelp.prototype.initBeforeOpen = function(bTypeahead) { // ? naming, include as config in open?
563
+
564
+ };
565
+
566
+ /**
567
+ * Determines if the value help should be opened when something is typed into the field.
568
+ *
569
+ * Opening the value help must be triggered by the control the <code>ValueHelp</code> element
570
+ * belongs to.
571
+ *
572
+ * <b>Note:</b> This function must only be called by the control the <code>ValueHelp</code> element
573
+ * belongs to, not by the application.
574
+ *
575
+ * @returns {Promise<boolean>} if <code>true</code>, the field help should open by typing. The result might be returned asynchronously, so a Promise is used.
576
+ * @private
577
+ * @ui5-restricted sap.ui.mdc.field.FieldBase
578
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
579
+ */
580
+ ValueHelp.prototype.isTypeaheadSupported = function() { // always return promise ?
581
+
582
+ return Promise.resolve(!!this.getTypeahead()); // TODO: need to check for search supported or should TypeAhead not be added at all if search is not supported?
583
+
584
+ };
585
+
586
+ /**
587
+ * Determines if the value help should be opened when the user clicks into the connected control.
588
+ *
589
+ * Opening the value help must be triggered by the control the <code>ValueHelp</code> element
590
+ * belongs to.
591
+ *
592
+ * <b>Note:</b> This function must only be called by the control the <code>ValueHelp</code> element
593
+ * belongs to, not by the application.
594
+ *
595
+ * @returns {boolean} If <code>true</code>, the value help should open when user clicks into the connected field control
596
+ * @private
597
+ * @ui5-restricted sap.ui.mdc.field.FieldBase
598
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
599
+ */
600
+ ValueHelp.prototype.shouldOpenOnClick = function () { // was openByClick before, better naming?
601
+
602
+ var oContainer = _getValueHelpContainer.call(this);
603
+
604
+ if (oContainer) {
605
+ return oContainer.shouldOpenOnClick(); // TODO: needed async to load content
606
+ }
607
+
608
+ return false;
609
+ };
610
+
611
+ /**
612
+ * Determines if the focus is set in the value help or stays in the calling control.
613
+ *
614
+ * @returns {boolean} if true, focus goes to the value help, if false it stays in the calling control.
615
+ *
616
+ * @private
617
+ * @ui5-restricted sap.ui.mdc.field.FieldBase
618
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
619
+ */
620
+ ValueHelp.prototype.isFocusInHelp = function() { // find more elegant way?
621
+
622
+ var oDialog = _getValueHelpContainer.call(this);
623
+ return oDialog && oDialog.isFocusInHelp();
624
+
625
+ };
626
+
627
+ /**
628
+ * The focus visualization of the field help needs to be removed as the user starts typing into the field.
629
+ *
630
+ * @private
631
+ * @ui5-restricted sap.ui.mdc.field.FieldBase
632
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
633
+ */
634
+ ValueHelp.prototype.removeFocus = function() {
635
+ var oTypeahead = this.getTypeahead();
636
+ if (oTypeahead) {
637
+ // could be done sync. as it only occurs if open
638
+ oTypeahead.removeFocus();
639
+ }
640
+ };
641
+
642
+ /**
643
+ * Triggers navigation in the value help.
644
+ *
645
+ * As this could be asyncron as data might be loaded a promise is returned.
646
+ *
647
+ * <b>Note:</b> This function must only be called by the control the <code>ValueHelp</code> element
648
+ * belongs to, not by the application.
649
+ *
650
+ * @param {int} iStep Number of steps for navigation (e.g. 1 means next item, -1 means previous item)
651
+ *
652
+ * @private
653
+ * @ui5-restricted sap.ui.mdc.field.FieldBase
654
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
655
+ */
656
+ ValueHelp.prototype.navigate = function(iStep) { // pass through to container
657
+ var oTypeahead = this.getTypeahead();
658
+ if (oTypeahead) {
659
+ var _fnOnNavigatable = function () {
660
+ if (oTypeahead.shouldOpenOnNavigate() && !oTypeahead.isOpening() && !oTypeahead.isOpen()) {
661
+ return oTypeahead.open(true).then(function() {
662
+ oTypeahead.navigate(iStep);
663
+ });
664
+ }
665
+ return oTypeahead.navigate(iStep);
666
+ };
667
+ var oNavigatePromise = this._retrievePromise("navigate");
668
+ var oExistingPromise = oNavigatePromise && !oNavigatePromise.isSettled() && oNavigatePromise.getInternalPromise();
669
+ this._addPromise("navigate", oExistingPromise ? oExistingPromise.then(_fnOnNavigatable) : this._retrieveDelegateContent(oTypeahead).then(_fnOnNavigatable));
670
+ }
671
+ };
672
+
673
+ ValueHelp.prototype.getTextForKey = function (vKey, oInParameters, oOutParameters, oBindingContext, oConditionModel, sConditionModelName) {
674
+ return this.getItemForValue({
675
+ parsedValue: vKey,
676
+ value: vKey,
677
+ inParameters: oInParameters,
678
+ outParameters: oOutParameters,
679
+ bindingContext: oBindingContext,
680
+ conditionModel: oConditionModel,
681
+ conditionModelName: sConditionModelName,
682
+ checkKey: true,
683
+ exception: FormatException,
684
+ caseSensitive: true // case sensitive as used to get description for known key
685
+ });
686
+ };
687
+
688
+ ValueHelp.prototype.getKeyForText = function(sText, oInParameters) {
689
+ return this.getItemForValue({
690
+ value: sText,
691
+ inParameters: oInParameters,
692
+ checkDescription: true,
693
+ exception: ParseException,
694
+ caseSensitive: true // case sensitive as used to get description for known description
695
+ });
696
+ };
697
+
698
+ /**
699
+ * Determines the item (key and description) for a given value.
700
+ *
701
+ * The value help checks if there is an item with a key or description that fits this value.
702
+ *
703
+ * <b>Note:</b> This function must only be called by the control the <code>ValuedHelp</code> element
704
+ * belongs to, not by the application.
705
+ *
706
+ * @param {object} oConfig Configuration
707
+ * @param {any} oConfig.value Value as entered by user
708
+ * @param {any} [oConfig.parsedValue] Value parsed by type to fit the data type of the key
709
+ * @param {object} [oConfig.inParameters] In parameters for the key (as a key must not be unique.)
710
+ * @param {object} [oConfig.outParameters] Out parameters for the key (as a key must not be unique.)
711
+ * @param {sap.ui.model.Context} [oConfig.bindingContext] <code>BindingContext</code> of the checked field. Inside a table the <code>ValueHelp</code> element might be connected to a different row.
712
+ * @param {boolean} [oConfig.checkKeyFirst] If set, the value help checks first if the value fits a key // TODO: not longer needed?
713
+ * @param {boolean} oConfig.checkKey If set, the value help checks only if there is an item with the given key. This is set to <code>false</code> if the value cannot be a valid key because of type validation.
714
+ * @param {boolean} oConfig.checkDescription If set, the value help checks only if there is an item with the given description. This is set to <code>false</code> if only the key is used in the field.
715
+ * @param {sap.ui.mdc.condition.ConditionModel} [oConfig.conditionModel] <code>ConditionModel</code>, in case of <code>FilterField</code>
716
+ * @param {string} [oConfig.conditionModelName] Name of the <code>ConditionModel</code>, in case of <code>FilterField</code>
717
+ * @param {boolean} [oConfig.caseSensitive] If set, the check is done case sensitive
718
+ * @returns {Promise<sap.ui.mdc.field.FieldHelpItem>} Promise returning object containing description, key, in and out parameters.
719
+ * @throws {sap.ui.model.FormatException|sap.ui.model.ParseException} if entry is not found or not unique
720
+ *
721
+ * @private
722
+ * @ui5-restricted sap.ui.mdc.field.FieldBase, sap.ui.mdc.field.ConditionType
723
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
724
+ */
725
+ ValueHelp.prototype.getItemForValue = function(oConfig) {
726
+ // TODO: Discuss how we handle binding / typeahead changes ??
727
+ var oTypeahead = this.getTypeahead();
728
+ if (oTypeahead) {
729
+ //TODO: determine values from Inparameters from BindingContext (If not given from outside)
730
+ var aPromiseKey = ["getItemForValue", oConfig.parsedValue || oConfig.value, JSON.stringify(oConfig.oInParameters), oConfig.oBindingContext && oConfig.oBindingContext.getPath()];
731
+ var sPromisekey = aPromiseKey.join("_");
732
+ return this._retrievePromise(sPromisekey, function () {
733
+ return this._retrieveDelegateContent(oTypeahead).then(function() {
734
+ var aInBindings = _getParameterBinding.call(this, this.getInParameters(), oConfig.bindingContext, oConfig.conditionModel, oConfig.conditionModelName);
735
+ return _checkBindingsPending.call(this, aInBindings).then(function() {
736
+ oConfig.inParameters = _getParameterFilter.call(this, oConfig.inParameters, this.getInParameters(), aInBindings, oConfig.bindingContext);
737
+ oConfig.outParameters = null; // TODO: do we want to check for OutParameters if provided? (normally not needed)
738
+ oConfig.caseSensitive = oConfig.hasOwnProperty("caseSensitive") ? oConfig.caseSensitive : false; // If supported, search case insensitive
739
+
740
+ return oTypeahead.getItemForValue(oConfig).then(function(oItem) {
741
+ _cleanupParameterBinding.call(this, aInBindings);
742
+ if (oItem.inParameters) {
743
+ oItem.inParameters = _mapParametersToField.call(this, oItem.inParameters, this.getInParameters());
744
+ }
745
+ if (oItem.outParameters) {
746
+ oItem.outParameters = _mapParametersToField.call(this, oItem.outParameters, this.getOutParameters());
747
+ }
748
+ return oItem;
749
+ }.bind(this));
750
+ }.bind(this));
751
+ }.bind(this));
752
+ }.bind(this));
753
+ } else {
754
+ // to return always a Promise
755
+ return Promise.reject("No Typeahead"); // TODO message - no translation needed, could only occur on wrng configuration, not on user interaction
756
+ }
757
+ };
758
+
759
+ /**
760
+ * Defines if the value help can be used for input validation.
761
+ *
762
+ * @returns {boolean} True if value help can be used for input validation
763
+ *
764
+ * @private
765
+ * @ui5-restricted sap.ui.mdc.field.FieldBase
766
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
767
+ */
768
+ ValueHelp.prototype.isValidationSupported = function() { // isUsableForValidation also necessary?
769
+
770
+ var oTypeahead = this.getTypeahead();
771
+
772
+ return oTypeahead && oTypeahead.isValidationSupported();
773
+
774
+ };
775
+
776
+ /**
777
+ * Triggers some logic that must be executed in <code>ValueHelp</code> element if a <code>Change</code> event
778
+ * on the connected control is fired.
779
+ *
780
+ * This is done if the corresponding control value is changed (not during navigation).
781
+ *
782
+ * <b>Note:</b> This function must only be called by the control the <code>ValueHelp</code> element
783
+ * belongs to, not by the application.
784
+ *
785
+ * @private
786
+ * @ui5-restricted sap.ui.mdc.field.FieldBase
787
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
788
+ */
789
+ ValueHelp.prototype.onControlChange = function() {
790
+
791
+ if (this.bIsDestroyed) {
792
+ return; // if destroyed meanwhile, don't update
793
+ }
794
+ // apply out-parameters
795
+ var aOutParameters = this.getOutParameters();
796
+
797
+ // as BindingContext of Field might change (happens if fast typed and FieldHelp not opened) update if needed
798
+ _updateBindingContext.call(this);
799
+
800
+ // if OutParameters are bound and binding is pending, wait until finished
801
+ var aOutBindings = _getParameterBinding.call(this, aOutParameters); // do not provide BindingContext or ConditionModel, as only the current binding is used
802
+ _checkBindingsPending.call(this, aOutBindings).then(function() {
803
+ var aConditions = this.getConditions();
804
+ for (var j = 0; j < aOutParameters.length; j++) {
805
+ var oOutParameter = aOutParameters[j];
806
+ var vValue = oOutParameter.getValue();
807
+ var bUseConditions = oOutParameter.getUseConditions();
808
+ var bUpdate = true;
809
+ if (oOutParameter.getMode() === OutParameterMode.WhenEmpty) {
810
+ if (bUseConditions) {
811
+ bUpdate = !vValue || (Array.isArray(vValue) && vValue.length === 0);
812
+ } else {
813
+ bUpdate = !vValue;
814
+ }
815
+ }
816
+ if (bUpdate) {
817
+ var vNewValue;
818
+ var oNewCondition;
819
+ if (bUseConditions) {
820
+ if (!Array.isArray(vValue)) {
821
+ throw new Error("Value on OutParameter must be an array " + oOutParameter);
822
+ }
823
+ vNewValue = merge([], vValue);
824
+ } else {
825
+ vNewValue = vValue;
826
+ }
827
+ if (!oOutParameter.getHelpPath()) { // use fixed value
828
+ if (bUseConditions) {
829
+ oNewCondition = Condition.createCondition("EQ", [oOutParameter.getFixedValue()], undefined, undefined, ConditionValidated.Validated);
830
+ if (FilterOperatorUtil.indexOfCondition(oNewCondition, vNewValue) < 0) {
831
+ vNewValue.push(oNewCondition);
832
+ }
833
+ } else {
834
+ vNewValue = oOutParameter.getFixedValue();
835
+ }
836
+ } else {
837
+ for (var i = 0; i < aConditions.length; i++) {
838
+ var oCondition = aConditions[i];
839
+ if (oCondition.outParameters) {
840
+ for ( var sPath in oCondition.outParameters) {
841
+ if (oOutParameter.getFieldPath() === sPath) { // in Conditions fieldPath is used
842
+ if (bUseConditions) {
843
+ oNewCondition = Condition.createCondition("EQ", [oCondition.outParameters[sPath]], undefined, undefined, ConditionValidated.Validated); // as choosen from help -> validated
844
+
845
+ // TODO: handle in/out Parameters in ConditionModel (to let the condition know it's out-Parameters)
846
+ if (FilterOperatorUtil.indexOfCondition(oNewCondition, vNewValue) < 0) {
847
+ vNewValue.push(oNewCondition);
848
+ }
849
+ } else {
850
+ vNewValue = oCondition.outParameters[sPath];
851
+ }
852
+ }
853
+ }
854
+ }
855
+ }
856
+ }
857
+ if (bUseConditions) {
858
+ FilterOperatorUtil.checkConditionsEmpty(vNewValue); // to set isEmpty same as on directly selected in ValueHelp
859
+ }
860
+ oOutParameter.setValue(vNewValue);
861
+ }
862
+ }
863
+ }.bind(this));
864
+
865
+ };
866
+
867
+ /**
868
+ * Determines the icon for the value help.
869
+ *
870
+ * @returns {string} Name of the icon
871
+ *
872
+ * @private
873
+ * @ui5-restricted sap.ui.mdc.field.FieldBase
874
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
875
+ */
876
+ ValueHelp.prototype.getIcon = function() {
877
+
878
+ var oTypeahead = this.getTypeahead();
879
+ var oDialog = this.getDialog();
880
+
881
+ if (oDialog) {
882
+ return oDialog.getValueHelpIcon();
883
+ } else if (oTypeahead){
884
+ return oTypeahead.getValueHelpIcon();
885
+ }
886
+
887
+ };
888
+
889
+ // ValueHelp.prototype.getUIArea = function() { // Ask Frank, if better way available
890
+ //
891
+ // };
892
+
893
+ ValueHelp.prototype.getMaxConditions = function() { // ?
894
+ var oConfig = this.getProperty("_config");
895
+ return oConfig && oConfig.maxConditions;
896
+ };
897
+
898
+ ValueHelp.prototype.getDisplay = function() { // ? currently necessary to determine how to render the tokens in valuehelp
899
+
900
+ };
901
+
902
+ ValueHelp.prototype.getDataType = function() { // should only be of interest for content in the future, maybe provide such infos in an abstract way? (interface?)
903
+
904
+ };
905
+
906
+ /**
907
+ * If only typeahead is enabled the field should not show a valuehelp icon or open the valuehelp using F4.
908
+ *
909
+ * @returns {boolean} <code>true</code> if value help is enabled, <code>false</code> if only typeahead is enabled
910
+ * @private
911
+ * @ui5-restricted sap.ui.mdc.field.FieldBase
912
+ * @ui5-metamodel This method also will be described in the UI5 (legacy) designtime metamodel
913
+ */
914
+ ValueHelp.prototype.valueHelpEnabled = function() {
915
+
916
+ var oTypeahead = this.getTypeahead();
917
+ var oDialog = this.getDialog();
918
+
919
+ if (oDialog) {
920
+ return true;
921
+ } else {
922
+ return oTypeahead && oTypeahead.getUseAsValueHelp();
923
+ }
924
+
925
+ };
926
+
927
+ function _handleNavigated(oEvent) {
928
+
929
+ var oCondition = _mapConditionParametersToField.call(this, oEvent.getParameter("condition"));
930
+ this.fireNavigated({condition: oCondition, itemId: oEvent.getParameter("itemId"), leaveFocus: oEvent.getParameter("leaveFocus")});
931
+
932
+ }
933
+
934
+ function _handleSelect(oEvent) {
935
+
936
+ var bSingleSelect = this.getMaxConditions() === 1;
937
+
938
+ var sType = oEvent.getParameter("type");
939
+ var aEventConditions = oEvent.getParameter("conditions") || [];
940
+ var aNextConditions;
941
+
942
+ if (bSingleSelect) {
943
+ aEventConditions = aEventConditions.slice(0,1); // only use first condition of event
944
+ }
945
+
946
+ if (sType === SelectType.Set || sType === SelectType.Add) {
947
+ aNextConditions = sType === SelectType.Set || bSingleSelect ? [] : this.getConditions();
948
+
949
+ for (var i = 0; i < aEventConditions.length; i++) {
950
+ var oNewCondition = _mapConditionParametersToField.call(this, aEventConditions[i]);
951
+ //if (FilterOperatorUtil.indexOfCondition(oNewCondition, aNextConditions) === -1) {
952
+ aNextConditions.push(oNewCondition);
953
+ //}
954
+ }
955
+ } else if (sType === SelectType.Remove) {
956
+ aNextConditions = bSingleSelect ? [] : this.getConditions(); // in SingleSelect just remove existing condition
957
+ for (var j = 0; j < aEventConditions.length; j++) {
958
+ var oRemoveCondition = _mapConditionParametersToField.call(this, aEventConditions[j]);
959
+ var iIndex = FilterOperatorUtil.indexOfCondition(oRemoveCondition, aNextConditions);
960
+ if (iIndex >= 0) {
961
+ aNextConditions.splice(iIndex, 1);
962
+ }
963
+ }
964
+ }
965
+
966
+ if (aNextConditions) {
967
+ this.setProperty("conditions", aNextConditions, true); // TODO: update async to only update remove and add once
968
+ }
969
+ }
970
+
971
+ function _handleConfirm(oEvent) {
972
+ if (this.getProperty("_valid")) { // only confirm if valid
973
+ var bSingleSelect = this.getMaxConditions() === 1;
974
+ var bCloseParam = oEvent.getParameter("close");
975
+ var bCloseAfterConfirm = typeof bCloseParam !== 'undefined' ? bCloseParam : bSingleSelect;
976
+ var aConditions = this.getConditions();
977
+ var bAdd = !bSingleSelect && !oEvent.getSource().isMultiSelect();
978
+ if (bCloseAfterConfirm) {
979
+ this.close();
980
+ }
981
+ aConditions = Condition._removeEmptyConditions(aConditions);
982
+ aConditions = Condition._removeInitialFlags(aConditions);
983
+ FilterOperatorUtil.updateConditionsValues(aConditions); // to remove static text from static conditions
984
+ this.fireSelect({conditions: aConditions, add: bAdd, close: bCloseAfterConfirm});
985
+ }
986
+
987
+ }
988
+
989
+ function _handleCancel(oEvent) {
990
+
991
+ this.close();
992
+
993
+ }
994
+
995
+ function _handleOpened(oEvent) {
996
+
997
+ }
998
+
999
+ function _handleClosed(oEvent) {
1000
+ var oContainer = oEvent.getSource();
1001
+ this._removePromise("delegateContent--" + oContainer.getId());
1002
+ this._removePromise("navigate");
1003
+ this.fireClosed();
1004
+ }
1005
+
1006
+ function _observeChanges(oChanges) {
1007
+ if (["typeahead", "dialog"].indexOf(oChanges.name) !== -1) {
1008
+ var oContainer = oChanges.child;
1009
+
1010
+ var bAdded = oChanges.mutation === "insert";
1011
+ var fnEvent = bAdded ? oContainer.attachEvent.bind(oContainer) : oContainer.detachEvent.bind(oContainer);
1012
+
1013
+ fnEvent("select", _handleSelect, this);
1014
+ fnEvent("requestDelegateContent", _handleRequestDelegateContent, this);
1015
+ fnEvent("confirm", _handleConfirm, this);
1016
+ fnEvent("cancel", _handleCancel, this);
1017
+ fnEvent("opened", _handleOpened, this);
1018
+ fnEvent("closed", _handleClosed, this);
1019
+
1020
+ if (oContainer.attachRequestSwitchToDialog) {
1021
+ fnEvent("requestSwitchToDialog", _handleRequestSwitchToDialog, this);
1022
+ }
1023
+
1024
+ if (oContainer.attachNavigated) {
1025
+ fnEvent("navigated", _handleNavigated, this);
1026
+ }
1027
+
1028
+ if (bAdded) {
1029
+ if (!this._oManagedObjectModel) {
1030
+ this._oManagedObjectModel = new ManagedObjectModel(this);
1031
+ }
1032
+ oContainer.setModel(this._oManagedObjectModel, "$valueHelp");
1033
+ }
1034
+ }
1035
+
1036
+ if (oChanges.object == this) { // ValueHelp
1037
+ if (oChanges.name === "inParameters") {
1038
+ _inParametersChanged.call(this, oChanges.child, oChanges.mutation);
1039
+ }
1040
+
1041
+ if (oChanges.name === "outParameters") {
1042
+ _outParametersChanged.call(this, oChanges.child, oChanges.mutation);
1043
+ }
1044
+ } else if (oChanges.object.isA("sap.ui.mdc.field.OutParameter")){
1045
+ if (oChanges.name === "helpPath") {
1046
+ _outParameterPathChanged.call(this, oChanges.current, oChanges.old);
1047
+ }
1048
+ } else if (oChanges.object.isA("sap.ui.mdc.field.InParameter")){
1049
+ if (oChanges.name === "value") {
1050
+ _inParameterValueChanged.call(this, oChanges.object.getHelpPath(), oChanges.current, oChanges.object.getUseConditions(), oChanges.object.getInitialValueFilterEmpty());
1051
+ }
1052
+ if (oChanges.name === "helpPath") {
1053
+ _inParameterPathChanged.call(this, oChanges.current, oChanges.old, oChanges.object.getValue(), oChanges.object.getUseConditions(), oChanges.object.getInitialValueFilterEmpty());
1054
+ }
1055
+ }
1056
+
1057
+ }
1058
+
1059
+ function _inParametersChanged(oInParameter, sMutation) {
1060
+
1061
+ var sFilterPath = oInParameter.getHelpPath();
1062
+
1063
+ if (sMutation === "remove") {
1064
+ this._oObserver.unobserve(oInParameter);
1065
+ var oInConditions = this.getProperty("_inConditions");
1066
+ delete oInConditions[sFilterPath];
1067
+ this.setProperty("_inConditions", oInConditions, true);
1068
+ } else {
1069
+ this._oObserver.observe(oInParameter, {properties: ["value", "helpPath"]});
1070
+ _inParameterValueChanged.call(this, sFilterPath, oInParameter.getValue(), oInParameter.getUseConditions(), oInParameter.getInitialValueFilterEmpty());
1071
+ }
1072
+
1073
+ }
1074
+
1075
+ function _inParameterValueChanged(sFilterPath, vValue, bUseConditions, bInitialValueFilterEmpty) {
1076
+
1077
+ var oInConditions = this.getProperty("_inConditions");
1078
+ var oCondition;
1079
+
1080
+ oInConditions[sFilterPath] = [];
1081
+
1082
+ if (bUseConditions) {
1083
+ if (Array.isArray(vValue)) {
1084
+ for (var i = 0; i < vValue.length; i++) {
1085
+ oCondition = merge({}, vValue[i]);
1086
+ // change paths of in- and out-parameters
1087
+ if (oCondition.inParameters) {
1088
+ oCondition.inParameters = _mapParametersToHelp.call(this, oCondition.inParameters, this.getInParameters());
1089
+ }
1090
+ if (oCondition.outParameters) {
1091
+ oCondition.outParameters = _mapParametersToHelp.call(this, oCondition.outParameters, this.getOutParameters());
1092
+ }
1093
+
1094
+ oInConditions[sFilterPath].push(oCondition);
1095
+ }
1096
+ }
1097
+ } else {
1098
+ if (!vValue && bInitialValueFilterEmpty) {
1099
+ oCondition = Condition.createCondition("Empty", []);
1100
+ oCondition.isEmpty = false; // no explicit check needed
1101
+ } else {
1102
+ // TODO: way to provide description on InParameter
1103
+ // validated to let FilterField determine description if visible on FilterBar.
1104
+ // Also to show it as selected on table in FieldHelp of FilterField.
1105
+ oCondition = Condition.createItemCondition(vValue);
1106
+ oCondition.validated = ConditionValidated.Validated;
1107
+ }
1108
+ oInConditions[sFilterPath].push(oCondition);
1109
+ }
1110
+
1111
+ this.setProperty("_inConditions", oInConditions, true);
1112
+
1113
+ }
1114
+
1115
+ function _inParameterPathChanged(sFilterPath, sOldFilterPath, vValue, bUseConditions, bInitialValueFilterEmpty) {
1116
+
1117
+ var oInConditions = this.getProperty("_inConditions");
1118
+
1119
+ delete oInConditions[sOldFilterPath];
1120
+ this.setProperty("_inConditions", oInConditions, true);
1121
+
1122
+ _inParameterValueChanged.call(this, sFilterPath, vValue, bUseConditions, bInitialValueFilterEmpty);
1123
+
1124
+ }
1125
+
1126
+ function _outParametersChanged(oOutParameter, sMutation) {
1127
+
1128
+ var sFilterPath = oOutParameter.getHelpPath();
1129
+ var aOutParameters = this.getProperty("_outParameters");
1130
+ var iIndex = aOutParameters.indexOf(sFilterPath);
1131
+
1132
+ if (sMutation === "remove") {
1133
+ this._oObserver.unobserve(oOutParameter);
1134
+ if (iIndex > -1) {
1135
+ aOutParameters.splice(iIndex, 1);
1136
+ }
1137
+ } else {
1138
+ this._oObserver.observe(oOutParameter, {properties: ["helpPath"]});
1139
+ if (iIndex === -1) {
1140
+ aOutParameters.push(sFilterPath);
1141
+ }
1142
+ }
1143
+
1144
+ this.setProperty("_outParameters", aOutParameters, true);
1145
+
1146
+ }
1147
+
1148
+ function _outParameterPathChanged(sFilterPath, sOldFilterPath) {
1149
+
1150
+ var aOutParameters = this.getProperty("_outParameters");
1151
+ var iIndex = aOutParameters.indexOf(sOldFilterPath);
1152
+ if (iIndex > -1) {
1153
+ aOutParameters[iIndex] = sFilterPath;
1154
+ }
1155
+
1156
+ this.setProperty("_outParameters", aOutParameters, true);
1157
+
1158
+ }
1159
+
1160
+ function _mapParametersToHelp(oParameters, aParameters) {
1161
+
1162
+ var oHelpParameters;
1163
+
1164
+ if (aParameters.length > 0) {
1165
+ for (var sMyFieldPath in oParameters) {
1166
+ for (var i = 0; i < aParameters.length; i++) {
1167
+ var oParameter = aParameters[i];
1168
+ var sHelpPath = "conditions/" + oParameter.getHelpPath(); // if InParameter of InParameter it is part of the same FilterBar
1169
+ var sFieldPath = oParameter.getFieldPath();
1170
+ if (sFieldPath && (sFieldPath === sMyFieldPath || sFieldPath === "conditions/" + sMyFieldPath) && sHelpPath) { // support also old saved conditions without "conditions/" in name
1171
+ if (!oHelpParameters) {
1172
+ oHelpParameters = {};
1173
+ }
1174
+ oHelpParameters[sHelpPath] = oParameters[sMyFieldPath];
1175
+ }
1176
+ }
1177
+ }
1178
+ }
1179
+
1180
+ return oHelpParameters;
1181
+
1182
+ }
1183
+
1184
+ function _mapParametersToField(oParameters, aParameters) {
1185
+
1186
+ if (!oParameters || aParameters.length === 0) {
1187
+ return null; // should not happen
1188
+ }
1189
+
1190
+ var oFieldParameters = {};
1191
+
1192
+ for (var i = 0; i < aParameters.length; i++) {
1193
+ var oParameter = aParameters[i];
1194
+ var sHelpPath = oParameter.getHelpPath();
1195
+ var sFieldPath = oParameter.getFieldPath();
1196
+ if (sHelpPath && sFieldPath) {
1197
+ for (var sMyFieldPath in oParameters) {
1198
+ if ([sHelpPath,sFieldPath].indexOf(sMyFieldPath) >= 0) {
1199
+ oFieldParameters[sFieldPath] = oParameters[sMyFieldPath];
1200
+ break;
1201
+ }
1202
+ }
1203
+ } else if (!sHelpPath && sFieldPath && oParameter.getFixedValue) {
1204
+ // if helpPath is not set we expect a fix value for out-parameter
1205
+ oFieldParameters[sFieldPath] = oParameter.getFixedValue(); // TODO: do we want to add fixedValues to condition?
1206
+ }
1207
+ }
1208
+
1209
+ return oFieldParameters;
1210
+
1211
+ }
1212
+
1213
+ function _mapConditionParametersToField(oCondition) {
1214
+
1215
+ oCondition = merge({}, oCondition);
1216
+ if (oCondition.inParameters) {
1217
+ oCondition.inParameters = _mapParametersToField.call(this, oCondition.inParameters, this.getInParameters());
1218
+ }
1219
+ if (oCondition.outParameters) {
1220
+ oCondition.outParameters = _mapParametersToField.call(this, oCondition.outParameters, this.getOutParameters());
1221
+ }
1222
+ return oCondition;
1223
+
1224
+ }
1225
+
1226
+ function _updateBindingContext() {
1227
+
1228
+ var oBindingContext = this._oControl ? this._oControl.getBindingContext() : null; // if not connected use no BindingContext
1229
+ this.setBindingContext(oBindingContext);
1230
+
1231
+ // in FilterField case also set right ConditionModel
1232
+ var oConfig = this.getProperty("_config");
1233
+ if (oConfig && oConfig.conditionModel && this.getModel(oConfig.conditionModelName) !== oConfig.conditionModel) { // don't update propagated model
1234
+ this.setModel(oConfig.conditionModel, oConfig.conditionModelName);
1235
+ }
1236
+
1237
+ }
1238
+
1239
+ function _getParameterBinding(aParameters, oBindingContext, oConditionModel, sConditionModelName) {
1240
+
1241
+ var aBindings = [];
1242
+ var bBindingChanged = false;
1243
+ var oMyBindingContext;
1244
+
1245
+ if (oBindingContext) {
1246
+ oMyBindingContext = this.oBindingContexts[undefined]; // as getBindingContext returns propagated Context if own context don't fit to model
1247
+ if (oBindingContext && Context.hasChanged(oMyBindingContext, oBindingContext)) {
1248
+ bBindingChanged = true;
1249
+ }
1250
+ }
1251
+
1252
+ for (var i = 0; i < aParameters.length; i++) {
1253
+ var oParameter = aParameters[i];
1254
+ var oBinding = oParameter.getBinding("value");
1255
+
1256
+ if (oParameter.getUseConditions() && oConditionModel) {
1257
+ // if ConditionModel is used, check if Binding is OK and same ConditionModel is used
1258
+ var oMyConditionModel = this.getModel(sConditionModelName);
1259
+ if (oMyConditionModel !== oConditionModel) {
1260
+ // no or different ConditionModel -> create new binding on given ConditionModel
1261
+ oBinding = oConditionModel.bindProperty("/" + oParameter.getFieldPath());
1262
+ oBinding._bValueHelp = true; // to make cleanup easier
1263
+ aBindings.push(oBinding);
1264
+ }
1265
+ } else if (oBinding) {
1266
+ var sPath = oBinding.getPath();
1267
+ var oParameterBindingContext = oBinding.getContext();
1268
+
1269
+ if (bBindingChanged && oBinding.isRelative() && (oParameterBindingContext === oMyBindingContext || (!oParameterBindingContext && oMyBindingContext))) {
1270
+ // InParameter is bound and uses the same BindingContext like the FieldHelp or has no BindingContext right now.
1271
+ // If InParameter is bound to a different BindingContext just use this one.
1272
+ if (oBindingContext.getProperty(sPath) === undefined) {
1273
+ // if value is already known in BindingContext from other existing Binding, don't request again.
1274
+ var oModel = oBinding.getModel();
1275
+ oBinding = oModel.bindProperty(sPath, oBindingContext);
1276
+ oBinding._bValueHelp = true; // to make cleanup easier
1277
+ aBindings.push(oBinding);
1278
+ }
1279
+ } else if ((!oParameterBindingContext && oBinding.isRelative()) // we don't have a BindingContext but need one -> need to wait for one
1280
+ || (oParameterBindingContext && oParameterBindingContext.getProperty(sPath) === undefined) // the BindingContext has no data right now -> need to wait for update
1281
+ || oBinding.getValue() === undefined // the Binding has no data right now, need to wait for update
1282
+ || (oParameterBindingContext && !deepEqual(oParameter.validateProperty("value", oParameterBindingContext.getProperty(sPath)), oParameter.getValue()))) { // value not alreday set
1283
+ // Property not already known on BindingContext or not already updated in Parameter value
1284
+ // use validateProperty as null might be converted to undefined, if invalid value don't run into a check
1285
+ // use deepEqual as, depending on type, the value could be complex (same logic as in setProperty)
1286
+ aBindings.push(oBinding);
1287
+ }
1288
+ }
1289
+ }
1290
+
1291
+ return aBindings;
1292
+
1293
+ }
1294
+
1295
+ function _cleanupParameterBinding(aBindings) {
1296
+
1297
+ for (var i = 0; i < aBindings.length; i++) {
1298
+ if (aBindings[i]._bValueHelp) {
1299
+ aBindings[i].destroy();
1300
+ }
1301
+ }
1302
+
1303
+ }
1304
+
1305
+ function _checkBindingsPending(aBindings) {
1306
+
1307
+ var oDelegatePromise = this._getControlDelegatePromise();
1308
+ return oDelegatePromise.then(function (oDelegateModule) {
1309
+ if (aBindings.length === 0) {
1310
+ return null;
1311
+ }
1312
+
1313
+ return oDelegateModule.checkBindingsPending(this.getPayload(), aBindings);
1314
+ }.bind(this));
1315
+
1316
+ }
1317
+
1318
+ function _getParameterFilter(oParameters, aParameters, aBindings, oBindingContext) {
1319
+
1320
+ if (aParameters.length === 0) {
1321
+ return null;
1322
+ }
1323
+
1324
+ var oConditions = {};
1325
+ var oCondition;
1326
+ var oParameter;
1327
+ var sHelpPath;
1328
+ var sFieldPath;
1329
+ var i = 0;
1330
+
1331
+ if (oParameters) {
1332
+ // InParameters provided for value -> use it
1333
+ for (var sMyFieldPath in oParameters) {
1334
+ for (i = 0; i < aParameters.length; i++) {
1335
+ oParameter = aParameters[i];
1336
+ sHelpPath = oParameter.getHelpPath();
1337
+ sFieldPath = oParameter.getFieldPath();
1338
+ if (sFieldPath && sHelpPath && (sFieldPath === sMyFieldPath || sFieldPath === "conditions/" + sMyFieldPath)) { // support also old saved conditions without "conditions/" in name
1339
+ oConditions[sHelpPath] = [];
1340
+ oCondition = Condition.createItemCondition(oParameters[sMyFieldPath]);
1341
+ oCondition.validated = ConditionValidated.Validated;
1342
+ oConditions[sHelpPath].push(oCondition);
1343
+ }
1344
+ }
1345
+ }
1346
+ } else {
1347
+ // use current values of in/out-parameters
1348
+ // If Bindings are provided (from different BindingContext) use the value of this Binding
1349
+ var oMyBindingContext = this.getBindingContext();
1350
+ for (i = 0; i < aParameters.length; i++) {
1351
+ oParameter = aParameters[i];
1352
+ sHelpPath = oParameter.getHelpPath();
1353
+ if (sHelpPath) {
1354
+ var vValue = oParameter.getValue();
1355
+ var bUseConditions = oParameter.getUseConditions();
1356
+ var bInitialValueFilterEmpty = oParameter.getInitialValueFilterEmpty();
1357
+ var j = 0;
1358
+ if ((aBindings && aBindings.length > 0) || oBindingContext) {
1359
+ var oBinding = oParameter.getBinding("value");
1360
+ var bFound = false;
1361
+ if (oBinding || bUseConditions) {
1362
+ sFieldPath = oParameter.getFieldPath();
1363
+ for (j = 0; j < aBindings.length; j++) {
1364
+ if ((oBinding && oBinding.getPath() === aBindings[j].getPath()) ||
1365
+ (bUseConditions && aBindings[j].getPath() === "/" + sFieldPath)) {
1366
+ vValue = aBindings[j].getValue();
1367
+ bFound = true;
1368
+ break;
1369
+ }
1370
+ }
1371
+ if (!bFound && !bUseConditions && oBindingContext && oBinding && oBinding.isRelative() && (!oBinding.getContext() || (oBinding.getContext() !== oBindingContext && oBinding.getContext() === oMyBindingContext))) {
1372
+ // no new binding created and different BindingContext -> use propery from BindingConext (was already read before)
1373
+ vValue = oBindingContext.getProperty(oBinding.getPath());
1374
+ }
1375
+ }
1376
+ }
1377
+
1378
+ // create Filter statements here as here the data type of the Parameters can be determined
1379
+ // allow multiple values
1380
+ // ignore empty conditions for filtering
1381
+ oConditions[sHelpPath] = [];
1382
+ if (bUseConditions) { // just use conditions
1383
+ for (j = 0; j < vValue.length; j++) {
1384
+ oCondition = merge({}, vValue[j]);
1385
+ // change paths of in- and out-parameters
1386
+ if (oCondition.inParameters) {
1387
+ oCondition.inParameters = _mapParametersToHelp.call(this, oCondition.inParameters, this.getInParameters());
1388
+ }
1389
+ if (oCondition.outParameters) {
1390
+ oCondition.outParameters = _mapParametersToHelp.call(this, oCondition.outParameters, this.getOutParameters());
1391
+ }
1392
+ oConditions[sHelpPath].push(oCondition);
1393
+ }
1394
+ } else {
1395
+ if (!vValue && bInitialValueFilterEmpty) {
1396
+ oCondition = Condition.createCondition("Empty", []);
1397
+ oCondition.isEmpty = false; // no explicit check needed
1398
+ } else if (vValue) {
1399
+ oCondition = Condition.createItemCondition(vValue);
1400
+ oCondition.validated = ConditionValidated.Validated;
1401
+ }
1402
+ if (oCondition) {
1403
+ oConditions[sHelpPath].push(oCondition);
1404
+ }
1405
+ }
1406
+ oCondition = undefined;
1407
+ }
1408
+ }
1409
+ }
1410
+
1411
+ // return filters for filtering
1412
+ var oConditionTypes = _getTypesForConditions.call(this, oConditions);
1413
+ var oFilter = FilterConverter.createFilters(oConditions, oConditionTypes);
1414
+
1415
+ return oFilter;
1416
+
1417
+ }
1418
+
1419
+ function _getTypesForConditions(oConditions) {
1420
+
1421
+ var aInParameters = this.getInParameters();
1422
+ var oConditionTypes = {};
1423
+ var sFieldPath;
1424
+
1425
+ // collect condition Fieldpaths here
1426
+ for (sFieldPath in oConditions) {
1427
+ var oType;
1428
+ // try to find missing type from InParameter
1429
+ for (var i = 0; i < aInParameters.length; i++) {
1430
+ var oInParameter = aInParameters[i];
1431
+ if (oInParameter.getHelpPath() === sFieldPath) {
1432
+ oType = oInParameter.getDataType();
1433
+ break;
1434
+ }
1435
+ }
1436
+
1437
+ oConditionTypes[sFieldPath] = {type: oType};
1438
+ }
1439
+
1440
+ return oConditionTypes;
1441
+
1442
+ }
1443
+
1444
+ function _getValueHelpContainer() {
1445
+
1446
+ var oContainer = this.getDialog();
1447
+
1448
+ if (!oContainer) { // no Dialog -> check if Typeahead should be opened
1449
+ var oTypeahead = this.getTypeahead();
1450
+ if (oTypeahead && oTypeahead.getUseAsValueHelp()) {
1451
+ oContainer = oTypeahead;
1452
+ }
1453
+ }
1454
+
1455
+ return oContainer;
1456
+
1457
+ }
1458
+
1459
+ PromiseMixin.call(ValueHelp.prototype);
1460
+
1461
+
1462
+ return ValueHelp;
1463
+
1464
+ });
1465
+
1466
+
1467
+ /*
1468
+
1469
+ Valuehelp Interface:
1470
+ _getOperator
1471
+ _getControlForSuggestion
1472
+ getFieldPath
1473
+
1474
+ */