@openui5/sap.ui.mdc 1.94.0 → 1.95.0

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