@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,504 @@
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
+ sap.ui.define([
8
+ "sap/ui/mdc/valuehelp/base/ListContent",
9
+ "sap/ui/mdc/util/loadModules",
10
+ "sap/ui/mdc/enum/ConditionValidated",
11
+ "sap/ui/model/FormatException",
12
+ "sap/ui/model/ParseException",
13
+ 'sap/ui/mdc/enum/SelectType'
14
+ ], function(
15
+ ListContent,
16
+ loadModules,
17
+ ConditionValidated,
18
+ FormatException,
19
+ ParseException,
20
+ SelectType
21
+ ) {
22
+ "use strict";
23
+
24
+ var FixedList = ListContent.extend("sap.ui.mdc.valuehelp.content.FixedList", /** @lends sap.ui.mdc.valuehelp.content.FixedList.prototype */
25
+ {
26
+ metadata: {
27
+ library: "sap.ui.mdc",
28
+ interfaces: [
29
+ "sap.ui.mdc.valuehelp.ITypeaheadContent",
30
+ "sap.ui.mdc.valuehelp.IDialogContent"
31
+ ],
32
+ properties: {
33
+ groupable: {
34
+ type: "boolean",
35
+ group: "Appearance",
36
+ defaultValue : false
37
+ },
38
+ /**
39
+ * If set, the items of the list are filtered based on <code>filterValue</code>.
40
+ *
41
+ * If a type-ahead behavior for the connected field is wanted, this property must be set to <code>true</code>.
42
+ * For small lists all values are meant to be shown, independent of the typing in the connected field.
43
+ * In this case this property must be set to <code>false</code>.
44
+ *
45
+ * If not set, the list opens if the user clicks into the connected field.
46
+ */
47
+ filterList: {
48
+ type: "boolean",
49
+ group: "Appearance",
50
+ defaultValue: true
51
+ }
52
+ },
53
+ aggregations: {
54
+ /**
55
+ * Items of the field help.
56
+ *
57
+ * The <code>key</code> of the items is not shown in the list, but is used as a value of the connected field.
58
+ *
59
+ * If the <code>additionalText</code> for all the items is not used, the column will not be displayed.
60
+ *
61
+ * <b>Note:</b> At the moment, icons are not supported.
62
+ *
63
+ */
64
+ items: {
65
+ type: "sap.ui.mdc.field.ListFieldHelpItem",
66
+ multiple: true,
67
+ singularName : "item"
68
+ }
69
+ },
70
+ defaultAggregation: "items",
71
+ events: {
72
+
73
+ }
74
+ }
75
+ });
76
+
77
+ FixedList.prototype.init = function() {
78
+
79
+ ListContent.prototype.init.apply(this, arguments);
80
+
81
+ this._oResourceBundle = sap.ui.getCore().getLibraryResourceBundle("sap.ui.mdc");
82
+
83
+ };
84
+
85
+ FixedList.prototype.exit = function() {
86
+
87
+ if (this._oManagedObjectModel) {
88
+ this._oManagedObjectModel.destroy();
89
+ delete this._oManagedObjectModel;
90
+ }
91
+
92
+ ListContent.prototype.exit.apply(this, arguments);
93
+ };
94
+
95
+ FixedList.prototype.getContent = function () {
96
+ return this._retrievePromise("content", function () {
97
+ return loadModules([
98
+ "sap/m/List",
99
+ "sap/m/DisplayListItem",
100
+ "sap/m/library",
101
+ "sap/ui/model/Filter",
102
+ "sap/ui/model/Sorter",
103
+ "sap/ui/model/base/ManagedObjectModel"
104
+ ]).then(function (aModules) {
105
+ var List = aModules[0];
106
+ var DisplayListItem = aModules[1];
107
+ var mLibrary = aModules[2];
108
+ var Filter = aModules[3];
109
+ var Sorter = aModules[4];
110
+ var ManagedObjectModel = aModules[5];
111
+
112
+ this._oManagedObjectModel = new ManagedObjectModel(this);
113
+
114
+ var oItemTemplate = new DisplayListItem(this.getId() + "-item", {
115
+ type: mLibrary.ListType.Active,
116
+ label: "{$help>text}",
117
+ value: "{$help>additionalText}",
118
+ valueTextDirection: "{$help>textDirection}"
119
+ }).addStyleClass("sapMComboBoxNonInteractiveItem"); // to add focus outline to selected items
120
+
121
+ var oFilter = new Filter("text", _suggestFilter.bind(this));
122
+
123
+ // add sorter only if supported
124
+ var oSorter;
125
+ if (this.getGroupable()) {
126
+ oSorter = new Sorter("groupKey", false, _suggestGrouping.bind(this));
127
+ }
128
+
129
+ var oList = new List(this.getId() + "-List", {
130
+ width: "100%",
131
+ showNoData: false,
132
+ mode: mLibrary.ListMode.SingleSelectMaster,
133
+ rememberSelections: false,
134
+ items: {path: "$help>/items", template: oItemTemplate, filters: oFilter, sorter: oSorter, templateShareable: false},
135
+ itemPress: _handleItemPress.bind(this) // as selected item can be pressed
136
+ }).addStyleClass("sapMComboBoxBaseList").addStyleClass("sapMComboBoxList");
137
+
138
+ oList.setModel(this._oManagedObjectModel, "$help");
139
+ // oList.bindElement({ path: "/", model: "$help" });
140
+ this.setAggregation("_displayContent", oList, true); // to have in control tree
141
+
142
+ return oList;
143
+ }.bind(this));
144
+ }.bind(this));
145
+ };
146
+
147
+ function _getList() {
148
+
149
+ return this.getAggregation("_displayContent");
150
+
151
+ }
152
+
153
+ function _handleItemPress(oEvent) {
154
+
155
+ var oItem = oEvent.getParameter("listItem");
156
+ var bSelected = oItem.getSelected();
157
+
158
+ if (bSelected) {
159
+ var oOriginalItem = _getOriginalItem.call(this, oItem);
160
+ var vKey = _getKey.call(this, oOriginalItem);
161
+ // this.fireRemoveConditions({conditions: this.get_conditions()});
162
+ _setConditions.call(this, vKey, oItem.getLabel());
163
+ // this.fireAddConditions({conditions: this.get_conditions()});
164
+ this.fireSelect({type: SelectType.Set, conditions: this.get_conditions()});
165
+ this.fireConfirm();
166
+ }
167
+
168
+ }
169
+
170
+ function _setConditions(vKey, sValue) {
171
+
172
+ var oCondition = this._createCondition(vKey, sValue);
173
+ this.setProperty("_conditions", [oCondition], true);
174
+
175
+ return oCondition;
176
+
177
+ }
178
+
179
+ function _suggestFilter(sText) {
180
+
181
+ var bFilterList = this.getFilterList();
182
+
183
+ return !bFilterList || _filterText.call(this, sText, this.get_filterValue());
184
+
185
+ }
186
+
187
+ function _filterText(sText, sFilterValue) {
188
+
189
+ return !sFilterValue || (typeof sFilterValue === "string" && (this.getCaseSensitive() ? sText.startsWith(sFilterValue) : sText.toLowerCase().startsWith(sFilterValue.toLowerCase())));
190
+
191
+ }
192
+
193
+ function _updateFilter() {
194
+
195
+ var oList = _getList.call(this);
196
+ if (oList) {
197
+ var oBinding = oList.getBinding("items");
198
+ oBinding.update();
199
+ oList.updateItems();
200
+ oList.invalidate();
201
+ _updateSelection.call(this); // to update selection
202
+ }
203
+
204
+ }
205
+
206
+ function _suggestGrouping(oContext) {
207
+
208
+ var vKey = oContext.getProperty('groupKey');
209
+ var sText = oContext.getProperty('groupText');
210
+ return {key: vKey, text: sText};
211
+
212
+ }
213
+
214
+ function _updateSelection() {
215
+
216
+ var oList = _getList.call(this);
217
+ if (oList) {
218
+ var aConditions = this.get_conditions();
219
+ var vSelectedKey;
220
+ var sFilterValue = this.get_filterValue();
221
+ var bUseFirstMatch = this.getUseFirstMatch();
222
+ var bFistFilterItemSelected = false;
223
+ // var oOperator = this._getOperator();
224
+
225
+ if (aConditions.length > 0 && (aConditions[0].validated === ConditionValidated.Validated || aConditions[0].operator === "EQ"/*oOperator.name*/)) {
226
+ vSelectedKey = aConditions[0].values[0];
227
+ }
228
+
229
+ var aItems = oList.getItems();
230
+ for (var i = 0; i < aItems.length; i++) {
231
+ var oItem = aItems[i];
232
+ if (oItem.isA("sap.m.DisplayListItem")) { // not for group headers
233
+ var oOriginalItem = _getOriginalItem.call(this, oItem);
234
+ if (aConditions.length > 0 && _getKey.call(this, oOriginalItem) === vSelectedKey) {
235
+ // conditions given -> use them to show selected items
236
+ oItem.setSelected(true);
237
+ } else if (aConditions.length === 0 && bUseFirstMatch && sFilterValue && !bFistFilterItemSelected && _filterText.call(this, oItem.getLabel(), sFilterValue)) {
238
+ // filter value used -> show first match as selected
239
+ oItem.setSelected(true);
240
+ bFistFilterItemSelected = true;
241
+ } else if (this.hasOwnProperty("_iNavigateIndex") && i === this._iNavigateIndex) { // TODO: better solution
242
+ // let navigated item be selected
243
+ oItem.setSelected(true);
244
+ } else {
245
+ oItem.setSelected(false);
246
+ }
247
+ }
248
+ }
249
+ }
250
+ }
251
+
252
+ // returns ListFieldHelp item for inner list item
253
+ function _getOriginalItem(oItem) {
254
+
255
+ var sPath = oItem.getBindingContextPath();
256
+ return this._oManagedObjectModel.getProperty(sPath);
257
+
258
+ }
259
+
260
+ function _getKey(oItem) {
261
+
262
+ // as key could have internally another type - use initial value of binding
263
+ // TODO: better logic?
264
+ var oBinding = oItem.getBinding("key");
265
+ if (oBinding) {
266
+ return oBinding.getInternalValue();
267
+ } else {
268
+ return oItem.getKey();
269
+ }
270
+
271
+ }
272
+
273
+ FixedList.prototype.getItemForValue = function (oConfig) {
274
+
275
+ return Promise.resolve().then(function() {
276
+ if (oConfig.value === null || oConfig.value === undefined) {
277
+ return null;
278
+ } else if (!oConfig.value && oConfig.checkDescription) {
279
+ return null; // no check for empty description
280
+ }
281
+
282
+ var aItems = this.getItems();
283
+ var oItem;
284
+ var i = 0;
285
+ var vKey;
286
+ var sText;
287
+
288
+ for (i = 0; i < aItems.length; i++) {
289
+ oItem = aItems[i];
290
+ vKey = _getKey.call(this, oItem);
291
+ sText = oItem.getText();
292
+ if ((oConfig.checkKey && vKey === oConfig.parsedValue) || (oConfig.checkDescription && (sText === oConfig.value || vKey == oConfig.value))) {
293
+ return {key: vKey, description: oItem.getText()};
294
+ }
295
+ }
296
+
297
+ if (oConfig.checkKey && oConfig.value === "") {
298
+ // empty key and no item with empty key
299
+ return null;
300
+ }
301
+
302
+ if (oConfig.checkDescription && this.getUseFirstMatch()) {
303
+ for (i = 0; i < aItems.length; i++) {
304
+ oItem = aItems[i];
305
+ sText = oItem.getText();
306
+ if (_filterText.call(this, sText, oConfig.value)) {
307
+ vKey = _getKey.call(this, oItem);
308
+ return {key: vKey, description: sText};
309
+ }
310
+ }
311
+ }
312
+
313
+ var sError = this._oResourceBundle.getText("valuehelp.VALUE_NOT_EXIST", [oConfig.value]);
314
+ if (oConfig.checkKey && !oConfig.checkDescription) {
315
+ throw new FormatException(sError);
316
+ } else {
317
+ throw new ParseException(sError);
318
+ }
319
+ }.bind(this));
320
+
321
+ };
322
+
323
+ FixedList.prototype.isValidationSupported = function(oConfig) {
324
+ return true;
325
+ };
326
+
327
+ FixedList.prototype._handleConditionsUpdate = function(oChanges) {
328
+ _updateSelection.call(this);
329
+ };
330
+
331
+ FixedList.prototype._handleFilterValueUpdate = function(oChanges) {
332
+ _updateFilter.call(this);
333
+ };
334
+
335
+ FixedList.prototype.removeFocus = function() {
336
+
337
+ var oList = _getList.call(this);
338
+ if (oList) {
339
+ oList.removeStyleClass("sapMListFocus");
340
+ }
341
+
342
+ };
343
+
344
+ FixedList.prototype.navigate = function(iStep) {
345
+
346
+ var oList = _getList.call(this);
347
+
348
+ if (!oList) {
349
+ return; // TODO: should not happen? Create List?
350
+ }
351
+
352
+ oList.addStyleClass("sapMListFocus"); // to show focus outline on navigated item
353
+
354
+ var oSelectedItem = oList.getSelectedItem();
355
+ var aItems = oList.getItems();
356
+ var iItems = aItems.length;
357
+ var iSelectedIndex = 0;
358
+ var bFilterList = this.getFilterList();
359
+ var sFilterValue = this.get_filterValue();
360
+ var bLeaveFocus = false;
361
+
362
+ if (!bFilterList && !oSelectedItem) {
363
+ // try to find item that matches Filter
364
+ var i = 0;
365
+ if (iStep >= 0) {
366
+ for (i = 0; i < aItems.length; i++) {
367
+ if (_filterText.call(this, aItems[i].getLabel(), sFilterValue)) {
368
+ iSelectedIndex = i;
369
+ break;
370
+ }
371
+ }
372
+ } else {
373
+ for (i = aItems.length - 1; i >= 0; i--) {
374
+ if (_filterText.call(this, aItems[i].getLabel(), sFilterValue)) {
375
+ iSelectedIndex = i;
376
+ break;
377
+ }
378
+ }
379
+ }
380
+ } else if (oSelectedItem) {
381
+ iSelectedIndex = oList.indexOfItem(oSelectedItem);
382
+ iSelectedIndex = iSelectedIndex + iStep;
383
+ } else if (iStep >= 0){
384
+ iSelectedIndex = iStep - 1;
385
+ } else {
386
+ iSelectedIndex = iItems + iStep;
387
+ }
388
+
389
+ var bSeachForNext;
390
+ if (iSelectedIndex < 0) {
391
+ iSelectedIndex = 0;
392
+ bSeachForNext = true;
393
+ bLeaveFocus = true;
394
+ } else if (iSelectedIndex >= iItems - 1) {
395
+ iSelectedIndex = iItems - 1;
396
+ bSeachForNext = false;
397
+ } else {
398
+ bSeachForNext = iStep >= 0;
399
+ }
400
+
401
+ while (aItems[iSelectedIndex] && aItems[iSelectedIndex].isA("sap.m.GroupHeaderListItem")) { // ignore group headers
402
+ if (bSeachForNext) {
403
+ iSelectedIndex++;
404
+ } else {
405
+ iSelectedIndex--;
406
+ }
407
+ }
408
+
409
+ var oItem = aItems[iSelectedIndex];
410
+ if (oItem) {
411
+ if (oItem !== oSelectedItem) {
412
+ var oOriginalItem = _getOriginalItem.call(this, oItem);
413
+ var vKey = _getKey.call(this, oOriginalItem);
414
+
415
+ if (this.getParent().isOpen()) {
416
+ oList.scrollToIndex(iSelectedIndex); // only possible if open
417
+ } else {
418
+ this._iNavigateIndex = iSelectedIndex; // TODO: better solution
419
+ }
420
+
421
+ oItem.setSelected(true);
422
+ var oCondition = _setConditions.call(this, vKey, oItem.getLabel());
423
+ this.fireNavigated({condition: oCondition, itemId: oItem.getId(), leaveFocus: false});
424
+ } else if (bLeaveFocus) {
425
+ this.fireNavigated({condition: undefined, itemId: undefined, leaveFocus: bLeaveFocus});
426
+ }
427
+ }
428
+
429
+ };
430
+
431
+ FixedList.prototype.onShow = function () { // TODO: name
432
+
433
+ ListContent.prototype.onShow.apply(this, arguments);
434
+
435
+ // scroll to selected item
436
+ var oList = _getList.call(this);
437
+
438
+ if (!oList) {
439
+ return; // TODO: should not happen? Create List?
440
+ }
441
+
442
+ var oSelectedItem = oList.getSelectedItem();
443
+ if (oSelectedItem) {
444
+ var iSelectedIndex = oList.indexOfItem(oSelectedItem);
445
+ oList.scrollToIndex(iSelectedIndex);
446
+ }
447
+
448
+ if (this.hasOwnProperty("_iNavigateIndex")) { // initialize after opening
449
+ delete this._iNavigateIndex;
450
+ }
451
+ };
452
+
453
+ FixedList.prototype.onHide = function () {
454
+
455
+ this.removeFocus();
456
+
457
+ };
458
+
459
+ FixedList.prototype.getValueHelpIcon = function() {
460
+
461
+ if (this.getUseAsValueHelp()) {
462
+ return "sap-icon://slim-arrow-down";
463
+ } else {
464
+ return null;
465
+ }
466
+
467
+ };
468
+
469
+ FixedList.prototype.getAriaAttributes = function(iMaxConditions) {
470
+
471
+ return { // return default values, but needs to be implemented by specific content
472
+ contentId: this.getId() + "-List", // as list might be created async, use fix ID
473
+ ariaHasPopup: "listbox",
474
+ roleDescription: null // no multi-selection
475
+ };
476
+
477
+ };
478
+
479
+ FixedList.prototype.shouldOpenOnClick = function() {
480
+
481
+ return !this.getFilterList(); // TODO: own property, maybe general at content?
482
+
483
+ };
484
+
485
+ FixedList.prototype.isFocusInHelp = function() {
486
+
487
+ return false; // focus should stay in field, even if opened as valueHelp
488
+
489
+ };
490
+
491
+ FixedList.prototype._isSingleSelect = function (oEvent) {
492
+
493
+ return true;
494
+
495
+ };
496
+
497
+ FixedList.prototype.shouldOpenOnNavigate = function() {
498
+
499
+ return !ListContent.prototype._isSingleSelect.apply(this);
500
+
501
+ };
502
+
503
+ return FixedList;
504
+ });